adding test case, error color handling

This commit is contained in:
yunminjin2 2020-12-05 01:46:24 +09:00
parent 1b21c47b90
commit 7f9337a412
5 changed files with 166 additions and 15 deletions

View file

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N806" />
<option value="N803" />
<option value="N802" />
</list>
</option>
</inspection_tool>
</profile>
</component>

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

137
.idea/workspace.xml generated
View file

@ -3,13 +3,87 @@
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:feature" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:pulls" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:pulls" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:1038886542" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:upstream" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:upstream" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:feature" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:upstream" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:pulls" type="e8cecc67:BranchNodeDescriptor" />
</path>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:upstream" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:pulls" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:1038886542" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="a6ce10d4-c4cf-4d3e-a399-1dd8833312f0" name="Default Changelist" comment="" />
<list default="true" id="a6ce10d4-c4cf-4d3e-a399-1dd8833312f0" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test1.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pysnooper/tracer.py" beforeDir="false" afterPath="$PROJECT_DIR$/pysnooper/tracer.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -20,10 +94,33 @@
<option name="showMembers" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="settings.editor.selected.configurable" value="build.tools" />
</component>
<component name="RunManager">
<component name="RunManager" selected="Python.test1">
<configuration name="test1" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\Minje\AppData\Local\Programs\Python\Python38-32\python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test1.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="test_chinese" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -47,6 +144,7 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.test1" />
<item itemvalue="Python.test_chinese" />
</list>
</recent_temporary>
@ -62,30 +160,45 @@
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="WindowStateProjectService">
<state x="734" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1607092665434">
<state x="734" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1607098112387">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="734" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1607092665434" />
<state width="2539" height="205" key="GridCell.Tab.0.bottom" timestamp="1607097787642">
<state x="734" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1607098112387" />
<state width="2539" height="264" key="GridCell.Tab.0.bottom" timestamp="1607100041819">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state width="2539" height="205" key="GridCell.Tab.0.bottom/0.0.2560.1040@0.0.2560.1040" timestamp="1607097787642" />
<state width="2539" height="205" key="GridCell.Tab.0.center" timestamp="1607097787642">
<state width="2539" height="264" key="GridCell.Tab.0.bottom/0.0.2560.1040@0.0.2560.1040" timestamp="1607100041819" />
<state width="2539" height="264" key="GridCell.Tab.0.center" timestamp="1607100041818">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state width="2539" height="205" key="GridCell.Tab.0.center/0.0.2560.1040@0.0.2560.1040" timestamp="1607097787642" />
<state width="2539" height="205" key="GridCell.Tab.0.left" timestamp="1607097787641">
<state width="2539" height="264" key="GridCell.Tab.0.center/0.0.2560.1040@0.0.2560.1040" timestamp="1607100041818" />
<state width="2539" height="264" key="GridCell.Tab.0.left" timestamp="1607100041818">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state width="2539" height="205" key="GridCell.Tab.0.left/0.0.2560.1040@0.0.2560.1040" timestamp="1607097787641" />
<state width="2539" height="205" key="GridCell.Tab.0.right" timestamp="1607097787642">
<state width="2539" height="264" key="GridCell.Tab.0.left/0.0.2560.1040@0.0.2560.1040" timestamp="1607100041818" />
<state width="2539" height="264" key="GridCell.Tab.0.right" timestamp="1607100041818">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state width="2539" height="205" key="GridCell.Tab.0.right/0.0.2560.1040@0.0.2560.1040" timestamp="1607097787642" />
<state width="2539" height="264" key="GridCell.Tab.0.right/0.0.2560.1040@0.0.2560.1040" timestamp="1607100041818" />
<state x="781" y="164" key="SettingsEditor" timestamp="1607094631533">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="781" y="164" key="SettingsEditor/0.0.2560.1040@0.0.2560.1040" timestamp="1607094631533" />
<state x="1095" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1607097873691">
<screen x="0" y="0" width="2560" height="1040" />
</state>
<state x="1095" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2560.1040@0.0.2560.1040" timestamp="1607097873691" />
</component>
</project>

View file

@ -429,7 +429,7 @@ class Tracer:
str = '{indent}{newish_string}{name} = {value_repr}'.format(**locals())
idx = str.find(":")
if ("Start" in str):
self.write('\033[33m' + str[0:idx + 3] + '\033[34m' + str[idx + 3:] + '\033[0m')
self.write('\033[95m' + str[0:idx + 3] + '\033[34m' + str[idx + 3:] + '\033[0m')
else:
self.write('\033[33m' + str[0:idx + 8] + '\033[34m' + str[idx + 8:] + '\033[0m')
elif old_local_reprs[name] != value_repr:
@ -498,14 +498,14 @@ class Tracer:
self.max_variable_length,
self.normalize,
)
self.write('\033[95m' + '{indent}Return value:.. {name} = {return_value_repr}'.
self.write('\033[95m' + '{indent}Return value:... {return_value_repr}'.
format(**locals()) + '\033[0m')
if event == 'exception':
exception = '\n'.join(traceback.format_exception_only(*arg[:2])).strip()
if self.max_variable_length:
exception = utils.truncate(exception, self.max_variable_length)
self.write('{indent}Exception:..... {exception}'.
self.write('\033[31m' + '{indent}Exception:..... {exception}'.
format(**locals()))
return self.trace

18
test1.py Normal file
View file

@ -0,0 +1,18 @@
import pysnooper
@pysnooper.snoop()
def bubble(number):
a = [5, 0, 2, 3, 6, 9, 1, 7, 4]
if number == 1:
for i in range(0,11):
for j in range(i, 9):
if(a[j] < a[i]):
temp = a[i]
a[i] = a[j]
a[j] = temp
return a
else:
return [0]
print(bubble(0))