diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..5933d59 --- /dev/null +++ b/.idea/.gitignore @@ -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/ diff --git a/.idea/PySnooper-8.iml b/.idea/PySnooper-8.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/PySnooper-8.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..d1048be --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..84fe515 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..bf6a407 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LEEJINSUB_to_do_list.txt b/LEEJINSUB_to_do_list.txt new file mode 100644 index 0000000..4235b57 --- /dev/null +++ b/LEEJINSUB_to_do_list.txt @@ -0,0 +1,2 @@ +LEEJINSUB will be rewrite this list. +- add the comments \ No newline at end of file diff --git a/example.py b/example.py new file mode 100644 index 0000000..9b64ee5 --- /dev/null +++ b/example.py @@ -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) \ No newline at end of file diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index 13582b6..a977dab 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -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': diff --git a/tests/samples/exception.py b/tests/samples/exception.py index 5455929..800c9e2 100644 --- a/tests/samples/exception.py +++ b/tests/samples/exception.py @@ -10,7 +10,6 @@ def bar(): str(1) raise - @pysnooper.snoop(depth=3) def main(): try: