peek-python 26.1.1__tar.gz → 26.1.1.post0__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-26.1.1 → peek_python-26.1.1.post0}/PKG-INFO +1 -1
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek/peek.py +11 -16
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek_python.egg-info/PKG-INFO +1 -1
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/pyproject.toml +1 -1
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/tests/test_peek.py +1 -1
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/README.md +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek/__init__.py +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek_python.egg-info/requires.txt +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-26.1.1 → peek_python-26.1.1.post0}/setup.cfg +0 -0
|
@@ -304,7 +304,7 @@ class _Peek:
|
|
|
304
304
|
s = s[1:]
|
|
305
305
|
print(cached + end, end="", file=file)
|
|
306
306
|
|
|
307
|
-
def return_args(self,args):
|
|
307
|
+
def return_args(self, args):
|
|
308
308
|
if self.return_none:
|
|
309
309
|
return None
|
|
310
310
|
if len(args) == 0:
|
|
@@ -362,17 +362,12 @@ class _Peek:
|
|
|
362
362
|
self._attributes.update(_Peek.spec_to_attributes(**{item: value}))
|
|
363
363
|
|
|
364
364
|
def __repr__(self):
|
|
365
|
-
pairs = [
|
|
366
|
-
|
|
367
|
-
]
|
|
368
|
-
return "peek.new(" + ", ".join(pairs) + ")"
|
|
365
|
+
pairs = [f"{name}={getattr(self, 'delta1') if name == 'delta' else getattr(self, name)!r}" for name in _Peek.name_default if name != "serialize"]
|
|
366
|
+
return f"peek.new({', '.join(pairs)})"
|
|
369
367
|
|
|
370
368
|
def __str__(self):
|
|
371
|
-
pairs = [
|
|
372
|
-
|
|
373
|
-
]
|
|
374
|
-
|
|
375
|
-
return "peek with attributes:\n " + "\n ".join(pairs) + ")"
|
|
369
|
+
pairs = [f"{name}={getattr(self, 'delta1') if name == 'delta' else getattr(self, name)!r}" for name in _Peek.name_default if name != "serialize"]
|
|
370
|
+
return f"peek with attributes:\n {'\n '.join(pairs)}"
|
|
376
371
|
|
|
377
372
|
def fix_perf_counter(self, val): # for tests
|
|
378
373
|
_Peek._fixed_perf_counter = val
|
|
@@ -396,9 +391,9 @@ class _Peek:
|
|
|
396
391
|
def add_to_pairs(pairs, left, right):
|
|
397
392
|
if right is locals or right is globals or right is vars:
|
|
398
393
|
frame = inspect.currentframe().f_back
|
|
399
|
-
peek_filename=frame.f_code.co_filename
|
|
400
|
-
while frame is not None and frame.f_code.co_filename==peek_filename:
|
|
401
|
-
frame=frame.f_back
|
|
394
|
+
peek_filename = frame.f_code.co_filename
|
|
395
|
+
while frame is not None and frame.f_code.co_filename == peek_filename:
|
|
396
|
+
frame = frame.f_back
|
|
402
397
|
for name, value in {locals: frame.f_locals, globals: frame.f_globals, vars: frame.f_locals}[right].items():
|
|
403
398
|
if not (isinstance(value, _PeekModule) or name.startswith("__")):
|
|
404
399
|
pairs.append(Pair(left=f"{name}{this.equals_separator}", right=value))
|
|
@@ -408,7 +403,7 @@ class _Peek:
|
|
|
408
403
|
this = self.fork(**kwargs)
|
|
409
404
|
if not this.do_show():
|
|
410
405
|
if this.as_timer:
|
|
411
|
-
this._real_decorator=lambda x:x
|
|
406
|
+
this._real_decorator = lambda x: x
|
|
412
407
|
return _Timer(this)
|
|
413
408
|
else:
|
|
414
409
|
if as_str:
|
|
@@ -465,7 +460,7 @@ class _Peek:
|
|
|
465
460
|
if (filename.startswith("<") and filename.endswith(">")) or (main_file_resolved is None) or (filename_resolved == main_file_resolved):
|
|
466
461
|
filename_name = ""
|
|
467
462
|
else:
|
|
468
|
-
filename_name = "[
|
|
463
|
+
filename_name = f"[{os.path.basename(filename)}]"
|
|
469
464
|
|
|
470
465
|
frame_info = inspect.getframeinfo(call_frame, context=1)
|
|
471
466
|
if frame_info.code_context is None:
|
|
@@ -638,7 +633,7 @@ class _Peek:
|
|
|
638
633
|
this.do_output(out)
|
|
639
634
|
|
|
640
635
|
return this.return_args(args)
|
|
641
|
-
|
|
636
|
+
|
|
642
637
|
def timer(self, *args, **kwargs):
|
|
643
638
|
return self(*args, **kwargs | dict(as_timer=True))
|
|
644
639
|
|
|
@@ -192,7 +192,7 @@ def test_repr_and_str(capsys):
|
|
|
192
192
|
print(str(peek))
|
|
193
193
|
out, err = capsys.readouterr()
|
|
194
194
|
assert out.startswith("peek with attributes:")
|
|
195
|
-
assert out.endswith("
|
|
195
|
+
assert out.endswith("\n")
|
|
196
196
|
|
|
197
197
|
print(repr(peek))
|
|
198
198
|
out, err = capsys.readouterr()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|