mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
Merge branch 'master' into Minje
This commit is contained in:
commit
8c1f16c329
11 changed files with 92 additions and 9 deletions
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../:\Users\Jinsuby\Desktop\PySnooper-8\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
8
.idea/PySnooper-8.iml
generated
Normal file
8
.idea/PySnooper-8.iml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
28
.idea/deployment.xml
generated
Normal file
28
.idea/deployment.xml
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
||||
<serverData>
|
||||
<paths name="115.145.188.69">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="115.145.190.194">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
<paths name="jinsuby@115.145.190.194:22 password">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
4
.idea/misc.xml
generated
Normal file
4
.idea/misc.xml
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (py37)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/PySnooper-8.iml" filepath="$PROJECT_DIR$/.idea/PySnooper-8.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal 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>
|
||||
2
LEEJINSUB_to_do_list.txt
Normal file
2
LEEJINSUB_to_do_list.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
LEEJINSUB will be rewrite this list.
|
||||
- add the comments
|
||||
14
example.py
Normal file
14
example.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import pysnooper
|
||||
|
||||
@pysnooper.snoop()
|
||||
def number_to_bits(number):
|
||||
if number:
|
||||
bits = []
|
||||
while number:
|
||||
number, remainder = divmod(number, 2)
|
||||
bits.insert(0,remainder)
|
||||
return bits
|
||||
else:
|
||||
return [0]
|
||||
|
||||
number_to_bits(6)
|
||||
|
|
@ -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[95m' + 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. ###########################
|
||||
|
|
@ -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:.. {return_value_repr}'.
|
||||
format(**locals()) + '\033[0m')
|
||||
|
||||
if event == 'exception':
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ def bar():
|
|||
str(1)
|
||||
raise
|
||||
|
||||
|
||||
@pysnooper.snoop(depth=3)
|
||||
def main():
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue