peek-python 1.5.0__tar.gz → 1.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {peek_python-1.5.0 → peek_python-1.5.1}/PKG-INFO +5 -2
- {peek_python-1.5.0 → peek_python-1.5.1}/README.md +4 -1
- {peek_python-1.5.0 → peek_python-1.5.1}/peek/peek.py +9 -7
- {peek_python-1.5.0 → peek_python-1.5.1}/peek_python.egg-info/PKG-INFO +5 -2
- {peek_python-1.5.0 → peek_python-1.5.1}/pyproject.toml +1 -1
- {peek_python-1.5.0 → peek_python-1.5.1}/tests/test_peek.py +10 -12
- {peek_python-1.5.0 → peek_python-1.5.1}/license.txt +0 -0
- {peek_python-1.5.0 → peek_python-1.5.1}/peek/__init__.py +0 -0
- {peek_python-1.5.0 → peek_python-1.5.1}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-1.5.0 → peek_python-1.5.1}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-1.5.0 → peek_python-1.5.1}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-1.5.0 → peek_python-1.5.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.1
|
|
4
4
|
Summary: peek - debugging and benchmarking made easy
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/ycecream
|
|
@@ -100,6 +100,9 @@ import peek
|
|
|
100
100
|
from peek import peek
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
Note that after this, `peek` is automatically a builtin and can thus be used in any module without
|
|
104
|
+
importing it there.
|
|
105
|
+
|
|
103
106
|
# Inspect variables and expressions
|
|
104
107
|
|
|
105
108
|
Have you ever printed variables or expressions to debug your program? If you've
|
|
@@ -1155,7 +1158,7 @@ Although not important for using the package, here are some implementation detai
|
|
|
1155
1158
|
The changelog can be found here:
|
|
1156
1159
|
|
|
1157
1160
|
* https://github.com/salabim/peek/main/changelog.md or
|
|
1158
|
-
* https://salabim.org/peek/changelog
|
|
1161
|
+
* https://salabim.org/peek/changelog
|
|
1159
1162
|
|
|
1160
1163
|
|
|
1161
1164
|
# Acknowledgement
|
|
@@ -86,6 +86,9 @@ import peek
|
|
|
86
86
|
from peek import peek
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
Note that after this, `peek` is automatically a builtin and can thus be used in any module without
|
|
90
|
+
importing it there.
|
|
91
|
+
|
|
89
92
|
# Inspect variables and expressions
|
|
90
93
|
|
|
91
94
|
Have you ever printed variables or expressions to debug your program? If you've
|
|
@@ -1141,7 +1144,7 @@ Although not important for using the package, here are some implementation detai
|
|
|
1141
1144
|
The changelog can be found here:
|
|
1142
1145
|
|
|
1143
1146
|
* https://github.com/salabim/peek/main/changelog.md or
|
|
1144
|
-
* https://salabim.org/peek/changelog
|
|
1147
|
+
* https://salabim.org/peek/changelog
|
|
1145
1148
|
|
|
1146
1149
|
|
|
1147
1150
|
# Acknowledgement
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# | .__/ \___| \___||_|\_\
|
|
5
5
|
# |_| like print, but easy.
|
|
6
6
|
|
|
7
|
-
__version__ = "1.5.
|
|
7
|
+
__version__ = "1.5.1"
|
|
8
8
|
|
|
9
9
|
"""
|
|
10
10
|
See https://github.com/salabim/peek for details
|
|
@@ -130,6 +130,7 @@ import traceback
|
|
|
130
130
|
import executing
|
|
131
131
|
import types
|
|
132
132
|
import pprint
|
|
133
|
+
import builtins
|
|
133
134
|
|
|
134
135
|
nv = object()
|
|
135
136
|
|
|
@@ -423,7 +424,6 @@ class _Peek:
|
|
|
423
424
|
provided = kwargs.pop("provided", nv)
|
|
424
425
|
pr = kwargs.pop("pr", nv)
|
|
425
426
|
|
|
426
|
-
|
|
427
427
|
if pr is not nv and provided is not nv:
|
|
428
428
|
raise TypeError("can't use both pr and provided")
|
|
429
429
|
|
|
@@ -479,8 +479,8 @@ class _Peek:
|
|
|
479
479
|
code = codes[filename]
|
|
480
480
|
frame_info = inspect.getframeinfo(call_frame, context=1)
|
|
481
481
|
|
|
482
|
-
parent_function = frame_info.function
|
|
483
|
-
parent_function = Source.executing(call_frame).code_qualname()
|
|
482
|
+
# parent_function = frame_info.function
|
|
483
|
+
parent_function = Source.executing(call_frame).code_qualname() # changed in version 1.3.10 to include class name
|
|
484
484
|
parent_function = parent_function.replace(".<locals>.", ".")
|
|
485
485
|
if parent_function == "<module>" or str(this.show_line_number) in ("n", "no parent"):
|
|
486
486
|
parent_function = ""
|
|
@@ -495,7 +495,7 @@ class _Peek:
|
|
|
495
495
|
this_line_prev = code[line_number - 2].strip()
|
|
496
496
|
else:
|
|
497
497
|
this_line_prev = ""
|
|
498
|
-
if len(args)==0 and (this_line.startswith("@") or this_line_prev.startswith("@")):
|
|
498
|
+
if len(args) == 0 and (this_line.startswith("@") or this_line_prev.startswith("@")):
|
|
499
499
|
if as_str:
|
|
500
500
|
raise TypeError("as_str may not be True when peek used as decorator")
|
|
501
501
|
|
|
@@ -539,7 +539,6 @@ class _Peek:
|
|
|
539
539
|
|
|
540
540
|
return wrapper
|
|
541
541
|
|
|
542
|
-
|
|
543
542
|
return real_decorator
|
|
544
543
|
|
|
545
544
|
if filename in ("<stdin>", "<string>"):
|
|
@@ -555,7 +554,7 @@ class _Peek:
|
|
|
555
554
|
line_number=line_number, filename_name=filename_name, parent_function=parent_function
|
|
556
555
|
)
|
|
557
556
|
|
|
558
|
-
if len(args)==0 and (this_line.startswith("with ") or this_line.startswith("with\t")):
|
|
557
|
+
if len(args) == 0 and (this_line.startswith("with ") or this_line.startswith("with\t")):
|
|
559
558
|
if as_str:
|
|
560
559
|
raise TypeError("as_str may not be True when y used as context manager")
|
|
561
560
|
if args:
|
|
@@ -869,9 +868,11 @@ set_defaults()
|
|
|
869
868
|
default_pre_json = copy.copy(default)
|
|
870
869
|
apply_json()
|
|
871
870
|
peek = _Peek()
|
|
871
|
+
builtins.peek = peek
|
|
872
872
|
p = peek.fork()
|
|
873
873
|
|
|
874
874
|
|
|
875
|
+
|
|
875
876
|
class PeekModule(types.ModuleType):
|
|
876
877
|
def __call__(self, *args, **kwargs):
|
|
877
878
|
return peek(*args, **kwargs)
|
|
@@ -882,5 +883,6 @@ class PeekModule(types.ModuleType):
|
|
|
882
883
|
def __getattr__(self, item):
|
|
883
884
|
return getattr(peek, item)
|
|
884
885
|
|
|
886
|
+
|
|
885
887
|
if __name__ != "__main__":
|
|
886
888
|
sys.modules["peek"].__class__ = PeekModule
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.1
|
|
4
4
|
Summary: peek - debugging and benchmarking made easy
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/ycecream
|
|
@@ -100,6 +100,9 @@ import peek
|
|
|
100
100
|
from peek import peek
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
Note that after this, `peek` is automatically a builtin and can thus be used in any module without
|
|
104
|
+
importing it there.
|
|
105
|
+
|
|
103
106
|
# Inspect variables and expressions
|
|
104
107
|
|
|
105
108
|
Have you ever printed variables or expressions to debug your program? If you've
|
|
@@ -1155,7 +1158,7 @@ Although not important for using the package, here are some implementation detai
|
|
|
1155
1158
|
The changelog can be found here:
|
|
1156
1159
|
|
|
1157
1160
|
* https://github.com/salabim/peek/main/changelog.md or
|
|
1158
|
-
* https://salabim.org/peek/changelog
|
|
1161
|
+
* https://salabim.org/peek/changelog
|
|
1159
1162
|
|
|
1160
1163
|
|
|
1161
1164
|
# Acknowledgement
|
|
@@ -876,7 +876,6 @@ def test_check_output(capsys):
|
|
|
876
876
|
print(
|
|
877
877
|
"""\
|
|
878
878
|
def check_output():
|
|
879
|
-
import peek
|
|
880
879
|
import x2
|
|
881
880
|
|
|
882
881
|
peek.configure(show_line_number=True, show_exit= False)
|
|
@@ -922,7 +921,6 @@ def check_output():
|
|
|
922
921
|
with open(str(x2_file), "w") as f:
|
|
923
922
|
print(
|
|
924
923
|
"""\
|
|
925
|
-
import peek
|
|
926
924
|
|
|
927
925
|
def test():
|
|
928
926
|
@peek()
|
|
@@ -945,17 +943,17 @@ def test():
|
|
|
945
943
|
assert (
|
|
946
944
|
out
|
|
947
945
|
== """\
|
|
948
|
-
#
|
|
949
|
-
#
|
|
950
|
-
#
|
|
946
|
+
#4[x2.py] in test() ==> called myself(6)
|
|
947
|
+
#5[x2.py] in test.myself() ==> x=6
|
|
948
|
+
#9[x2.py] in test() ==> enter
|
|
949
|
+
#6[x1.py] in check_output() ==> 1
|
|
951
950
|
#7[x1.py] in check_output() ==> 1
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
#
|
|
957
|
-
#
|
|
958
|
-
#33[x1.py] in check_output() ==> called x()
|
|
951
|
+
==>#10[x1.py] in check_output() ==> enter
|
|
952
|
+
#11[x1.py] in check_output()
|
|
953
|
+
==>#13[x1.py] in check_output() ==> enter
|
|
954
|
+
#20[x1.py] in check_output()
|
|
955
|
+
#23[x1.py] in check_output() ==> called x(2)
|
|
956
|
+
#32[x1.py] in check_output() ==> called x()
|
|
959
957
|
"""
|
|
960
958
|
)
|
|
961
959
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|