mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
dd
This commit is contained in:
parent
f465d2d025
commit
1b21c47b90
3 changed files with 70 additions and 10 deletions
59
.idea/workspace.xml
generated
59
.idea/workspace.xml
generated
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="a6ce10d4-c4cf-4d3e-a399-1dd8833312f0" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
|
@ -14,9 +17,39 @@
|
|||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
<option name="showMembers" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="build.tools" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="test_chinese" 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$/tests/test_chinese.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>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.test_chinese" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
|
|
@ -29,4 +62,30 @@
|
|||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="734" y="175" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1607092665434">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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 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" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -325,7 +325,7 @@ class Tracer:
|
|||
elapsed_time_string = pycompat.timedelta_format(duration)
|
||||
indent = ' ' * 4 * (thread_global.depth + 1)
|
||||
self.write(
|
||||
'\033[33m'+'{indent}Elapsed time: {elapsed_time_string}'+'\033[0m'.format(**locals())
|
||||
'\033[33m' + '{indent}Elapsed time: {elapsed_time_string}' + '\033[0m'.format(**locals())
|
||||
)
|
||||
# #
|
||||
### Finished writing elapsed time. ####################################
|
||||
|
|
@ -426,16 +426,16 @@ class Tracer:
|
|||
|
||||
for name, value_repr in local_reprs.items():
|
||||
if name not in old_local_reprs:
|
||||
str = '{indent}{newish_string}{name} = {value_repr}'.format( **locals())
|
||||
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')
|
||||
if ("Start" in str):
|
||||
self.write('\033[33m' + 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')
|
||||
self.write('\033[33m' + str[0:idx + 8] + '\033[34m' + str[idx + 8:] + '\033[0m')
|
||||
elif old_local_reprs[name] != value_repr:
|
||||
str = '{indent}Modified var:.. {name} = {value_repr}'.format(**locals())
|
||||
idx = str.find("..")
|
||||
self.write('\033[33m' + str[0:idx+2] + '\033[34m' + str[idx+2:] + '\033[0m')
|
||||
self.write('\033[33m' + str[0:idx + 2] + '\033[34m' + str[idx + 2:] + '\033[0m')
|
||||
|
||||
# #
|
||||
### Finished newish and modified variables. ###########################
|
||||
|
|
@ -455,7 +455,7 @@ class Tracer:
|
|||
|
||||
if candidate_source_line.lstrip().startswith('def'):
|
||||
# Found the def line!
|
||||
# Save line_no and sorce line
|
||||
# Save line_no and source line
|
||||
line_no = candidate_line_no
|
||||
source_line = candidate_source_line
|
||||
break
|
||||
|
|
@ -483,7 +483,7 @@ class Tracer:
|
|||
idx = str.find(" ")
|
||||
|
||||
for s in str.split():
|
||||
if(s.isdigit()): num = s
|
||||
if s.isdigit(): num = s
|
||||
numidx = str.find(" " + num + " ")
|
||||
self.write('\033[30m' + str[:idx] + '\033[32m' + str[idx:numidx] + '\033[36m' + str[numidx:] + '\033[0m')
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ class Tracer:
|
|||
self.max_variable_length,
|
||||
self.normalize,
|
||||
)
|
||||
self.write('\033[95m' + '{indent}Return value:.. {return_value_repr}'.
|
||||
self.write('\033[95m' + '{indent}Return value:.. {name} = {return_value_repr}'.
|
||||
format(**locals()) + '\033[0m')
|
||||
|
||||
if event == 'exception':
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import itertools
|
||||
import abc
|
||||
|
||||
try:
|
||||
from collections.abc import Mapping, Sequence
|
||||
except ImportError:
|
||||
|
|
@ -47,7 +48,7 @@ class BaseVariable(pycompat.ABC):
|
|||
|
||||
def __eq__(self, other):
|
||||
return (isinstance(other, BaseVariable) and
|
||||
self._fingerprint == other._fingerprint)
|
||||
self._fingerprint == other._fingerprint)
|
||||
|
||||
|
||||
class CommonVariable(BaseVariable):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue