peek-python 26.1.0__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.0 → peek_python-26.1.1.post0}/PKG-INFO +11 -20
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/README.md +10 -19
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek/peek.py +14 -18
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek_python.egg-info/PKG-INFO +11 -20
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/pyproject.toml +1 -1
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/tests/test_peek.py +2 -2
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek/__init__.py +0 -0
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek_python.egg-info/requires.txt +0 -0
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-26.1.0 → peek_python-26.1.1.post0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 26.1.
|
|
3
|
+
Version: 26.1.1.post0
|
|
4
4
|
Summary: peek - like print, but easy
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/peek
|
|
@@ -763,7 +763,7 @@ list(range(i, i + 10)) for i in range(10, 100, 10)]=
|
|
|
763
763
|
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49],
|
|
764
764
|
[abbreviated]
|
|
765
765
|
```
|
|
766
|
-
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings
|
|
766
|
+
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings Lite.
|
|
767
767
|
|
|
768
768
|
### color / col /c and color_value / colv / c
|
|
769
769
|
The color attribute is used to specify the color of the output.
|
|
@@ -792,7 +792,7 @@ will result in:
|
|
|
792
792
|
|
|
793
793
|
<img src="https://www.salabim.org/peek/peek_picture3.png" width=30%>
|
|
794
794
|
|
|
795
|
-
Alternatively, the color/
|
|
795
|
+
Alternatively, the color / color_value attribute can be specified as an integer, where
|
|
796
796
|
- 0 - (reset)
|
|
797
797
|
- 1 white
|
|
798
798
|
- 2 black
|
|
@@ -804,7 +804,7 @@ Alternatively, the color/Color_value attribute can be specified as an integer, w
|
|
|
804
804
|
- 8 cyan (tealblue)
|
|
805
805
|
|
|
806
806
|
Note that the color number corresponds to the number of letters in the name (apart from white and black).
|
|
807
|
-
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=
|
|
807
|
+
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=123)=` in red and `123` in dark_green.
|
|
808
808
|
|
|
809
809
|
Of course, color and color_value may be specified in a peek.toml file, to make all peek output in a specified color.
|
|
810
810
|
|
|
@@ -1418,7 +1418,7 @@ peek.to_clipboard(part1, confirm=False)
|
|
|
1418
1418
|
#### General
|
|
1419
1419
|
|
|
1420
1420
|
Implementation detail: the clipboard functionality uses pyperclip, apart from under Pythonista, where the builtin clipboard module is used.
|
|
1421
|
-
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do
|
|
1421
|
+
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do so.
|
|
1422
1422
|
|
|
1423
1423
|
```
|
|
1424
1424
|
pip install pyperclip
|
|
@@ -1552,8 +1552,6 @@ There are several ways to obtain a new instance of peek:
|
|
|
1552
1552
|
|
|
1553
1553
|
With this a new peek object is created with the same attributes as the object it is created ('the parent') from. Note that the attributes are not propagated from the parent, in this case.
|
|
1554
1554
|
|
|
1555
|
-
* with `peek.timer()` used as a context manager or decorator
|
|
1556
|
-
|
|
1557
1555
|
In either case, attributes can be added to override the default ones.
|
|
1558
1556
|
|
|
1559
1557
|
#### Example
|
|
@@ -1569,22 +1567,15 @@ peek.equals_separator = " == " # this affects only the forked objects
|
|
|
1569
1567
|
peek_with_line_number(hello)
|
|
1570
1568
|
peek_with_new_prefix(hello)
|
|
1571
1569
|
peek_with_new_prefix_and_time(hello)
|
|
1572
|
-
with peek(prefix="peek_cm ") as peek_cm:
|
|
1573
|
-
peek_cm(hello)
|
|
1574
|
-
peek(hello)
|
|
1575
1570
|
```
|
|
1576
1571
|
prints something like
|
|
1577
1572
|
```
|
|
1578
|
-
#
|
|
1579
|
-
==> hello=
|
|
1580
|
-
==> @
|
|
1581
|
-
#
|
|
1582
|
-
==> hello=
|
|
1583
|
-
==> @
|
|
1584
|
-
peek_cm enter
|
|
1585
|
-
peek_cm hello == 'world'
|
|
1586
|
-
hello == 'world'
|
|
1587
|
-
peek_cm exit in 0.001843 seconds
|
|
1573
|
+
#12 ==> hello=world
|
|
1574
|
+
==> hello=world
|
|
1575
|
+
==> @ 12:40:42.106329 ==> hello=world
|
|
1576
|
+
#16 ==> hello == world
|
|
1577
|
+
==> hello=world
|
|
1578
|
+
==> @ 12:40:42.109258 ==> hello=world
|
|
1588
1579
|
```
|
|
1589
1580
|
|
|
1590
1581
|
### ignore_toml
|
|
@@ -746,7 +746,7 @@ list(range(i, i + 10)) for i in range(10, 100, 10)]=
|
|
|
746
746
|
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49],
|
|
747
747
|
[abbreviated]
|
|
748
748
|
```
|
|
749
|
-
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings
|
|
749
|
+
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings Lite.
|
|
750
750
|
|
|
751
751
|
### color / col /c and color_value / colv / c
|
|
752
752
|
The color attribute is used to specify the color of the output.
|
|
@@ -775,7 +775,7 @@ will result in:
|
|
|
775
775
|
|
|
776
776
|
<img src="https://www.salabim.org/peek/peek_picture3.png" width=30%>
|
|
777
777
|
|
|
778
|
-
Alternatively, the color/
|
|
778
|
+
Alternatively, the color / color_value attribute can be specified as an integer, where
|
|
779
779
|
- 0 - (reset)
|
|
780
780
|
- 1 white
|
|
781
781
|
- 2 black
|
|
@@ -787,7 +787,7 @@ Alternatively, the color/Color_value attribute can be specified as an integer, w
|
|
|
787
787
|
- 8 cyan (tealblue)
|
|
788
788
|
|
|
789
789
|
Note that the color number corresponds to the number of letters in the name (apart from white and black).
|
|
790
|
-
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=
|
|
790
|
+
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=123)=` in red and `123` in dark_green.
|
|
791
791
|
|
|
792
792
|
Of course, color and color_value may be specified in a peek.toml file, to make all peek output in a specified color.
|
|
793
793
|
|
|
@@ -1401,7 +1401,7 @@ peek.to_clipboard(part1, confirm=False)
|
|
|
1401
1401
|
#### General
|
|
1402
1402
|
|
|
1403
1403
|
Implementation detail: the clipboard functionality uses pyperclip, apart from under Pythonista, where the builtin clipboard module is used.
|
|
1404
|
-
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do
|
|
1404
|
+
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do so.
|
|
1405
1405
|
|
|
1406
1406
|
```
|
|
1407
1407
|
pip install pyperclip
|
|
@@ -1535,8 +1535,6 @@ There are several ways to obtain a new instance of peek:
|
|
|
1535
1535
|
|
|
1536
1536
|
With this a new peek object is created with the same attributes as the object it is created ('the parent') from. Note that the attributes are not propagated from the parent, in this case.
|
|
1537
1537
|
|
|
1538
|
-
* with `peek.timer()` used as a context manager or decorator
|
|
1539
|
-
|
|
1540
1538
|
In either case, attributes can be added to override the default ones.
|
|
1541
1539
|
|
|
1542
1540
|
#### Example
|
|
@@ -1552,22 +1550,15 @@ peek.equals_separator = " == " # this affects only the forked objects
|
|
|
1552
1550
|
peek_with_line_number(hello)
|
|
1553
1551
|
peek_with_new_prefix(hello)
|
|
1554
1552
|
peek_with_new_prefix_and_time(hello)
|
|
1555
|
-
with peek(prefix="peek_cm ") as peek_cm:
|
|
1556
|
-
peek_cm(hello)
|
|
1557
|
-
peek(hello)
|
|
1558
1553
|
```
|
|
1559
1554
|
prints something like
|
|
1560
1555
|
```
|
|
1561
|
-
#
|
|
1562
|
-
==> hello=
|
|
1563
|
-
==> @
|
|
1564
|
-
#
|
|
1565
|
-
==> hello=
|
|
1566
|
-
==> @
|
|
1567
|
-
peek_cm enter
|
|
1568
|
-
peek_cm hello == 'world'
|
|
1569
|
-
hello == 'world'
|
|
1570
|
-
peek_cm exit in 0.001843 seconds
|
|
1556
|
+
#12 ==> hello=world
|
|
1557
|
+
==> hello=world
|
|
1558
|
+
==> @ 12:40:42.106329 ==> hello=world
|
|
1559
|
+
#16 ==> hello == world
|
|
1560
|
+
==> hello=world
|
|
1561
|
+
==> @ 12:40:42.109258 ==> hello=world
|
|
1571
1562
|
```
|
|
1572
1563
|
|
|
1573
1564
|
### ignore_toml
|
|
@@ -33,7 +33,7 @@ import pprint
|
|
|
33
33
|
import builtins
|
|
34
34
|
import shutil
|
|
35
35
|
|
|
36
|
-
__version__ = "26.1.
|
|
36
|
+
__version__ = "26.1.1"
|
|
37
37
|
|
|
38
38
|
from pathlib import Path
|
|
39
39
|
|
|
@@ -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
|
|
@@ -392,11 +387,12 @@ class _Peek:
|
|
|
392
387
|
kwargs["print_like"] = True
|
|
393
388
|
return self(*args, as_str=as_str, **kwargs)
|
|
394
389
|
|
|
395
|
-
def __call__(self, *args, as_str=False,
|
|
390
|
+
def __call__(self, *args, as_str=False, **kwargs):
|
|
396
391
|
def add_to_pairs(pairs, left, right):
|
|
397
392
|
if right is locals or right is globals or right is vars:
|
|
398
|
-
frame = inspect.currentframe().f_back
|
|
399
|
-
|
|
393
|
+
frame = inspect.currentframe().f_back
|
|
394
|
+
peek_filename = frame.f_code.co_filename
|
|
395
|
+
while frame is not None and frame.f_code.co_filename == peek_filename:
|
|
400
396
|
frame = frame.f_back
|
|
401
397
|
for name, value in {locals: frame.f_locals, globals: frame.f_globals, vars: frame.f_locals}[right].items():
|
|
402
398
|
if not (isinstance(value, _PeekModule) or name.startswith("__")):
|
|
@@ -407,7 +403,7 @@ class _Peek:
|
|
|
407
403
|
this = self.fork(**kwargs)
|
|
408
404
|
if not this.do_show():
|
|
409
405
|
if this.as_timer:
|
|
410
|
-
this._real_decorator=lambda x:x
|
|
406
|
+
this._real_decorator = lambda x: x
|
|
411
407
|
return _Timer(this)
|
|
412
408
|
else:
|
|
413
409
|
if as_str:
|
|
@@ -464,7 +460,7 @@ class _Peek:
|
|
|
464
460
|
if (filename.startswith("<") and filename.endswith(">")) or (main_file_resolved is None) or (filename_resolved == main_file_resolved):
|
|
465
461
|
filename_name = ""
|
|
466
462
|
else:
|
|
467
|
-
filename_name = "[
|
|
463
|
+
filename_name = f"[{os.path.basename(filename)}]"
|
|
468
464
|
|
|
469
465
|
frame_info = inspect.getframeinfo(call_frame, context=1)
|
|
470
466
|
if frame_info.code_context is None:
|
|
@@ -637,7 +633,7 @@ class _Peek:
|
|
|
637
633
|
this.do_output(out)
|
|
638
634
|
|
|
639
635
|
return this.return_args(args)
|
|
640
|
-
|
|
636
|
+
|
|
641
637
|
def timer(self, *args, **kwargs):
|
|
642
638
|
return self(*args, **kwargs | dict(as_timer=True))
|
|
643
639
|
|
|
@@ -854,7 +850,7 @@ class _Timer:
|
|
|
854
850
|
|
|
855
851
|
class _PeekModule(types.ModuleType):
|
|
856
852
|
def __call__(self, *args, **kwargs):
|
|
857
|
-
return peek(*args, **kwargs
|
|
853
|
+
return peek(*args, **kwargs)
|
|
858
854
|
|
|
859
855
|
def __setattr__(self, item, value):
|
|
860
856
|
setattr(peek, item, value)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 26.1.
|
|
3
|
+
Version: 26.1.1.post0
|
|
4
4
|
Summary: peek - like print, but easy
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/peek
|
|
@@ -763,7 +763,7 @@ list(range(i, i + 10)) for i in range(10, 100, 10)]=
|
|
|
763
763
|
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49],
|
|
764
764
|
[abbreviated]
|
|
765
765
|
```
|
|
766
|
-
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings
|
|
766
|
+
This feature can be useful on platforms, where printing many lines is time consuming, like on xlwings Lite.
|
|
767
767
|
|
|
768
768
|
### color / col /c and color_value / colv / c
|
|
769
769
|
The color attribute is used to specify the color of the output.
|
|
@@ -792,7 +792,7 @@ will result in:
|
|
|
792
792
|
|
|
793
793
|
<img src="https://www.salabim.org/peek/peek_picture3.png" width=30%>
|
|
794
794
|
|
|
795
|
-
Alternatively, the color/
|
|
795
|
+
Alternatively, the color / color_value attribute can be specified as an integer, where
|
|
796
796
|
- 0 - (reset)
|
|
797
797
|
- 1 white
|
|
798
798
|
- 2 black
|
|
@@ -804,7 +804,7 @@ Alternatively, the color/Color_value attribute can be specified as an integer, w
|
|
|
804
804
|
- 8 cyan (tealblue)
|
|
805
805
|
|
|
806
806
|
Note that the color number corresponds to the number of letters in the name (apart from white and black).
|
|
807
|
-
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=
|
|
807
|
+
A negative color/color_value number represents the dark version, e.g. `peek((a:=123), c=3, cv=-5)` will print `(a:=123)=` in red and `123` in dark_green.
|
|
808
808
|
|
|
809
809
|
Of course, color and color_value may be specified in a peek.toml file, to make all peek output in a specified color.
|
|
810
810
|
|
|
@@ -1418,7 +1418,7 @@ peek.to_clipboard(part1, confirm=False)
|
|
|
1418
1418
|
#### General
|
|
1419
1419
|
|
|
1420
1420
|
Implementation detail: the clipboard functionality uses pyperclip, apart from under Pythonista, where the builtin clipboard module is used.
|
|
1421
|
-
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do
|
|
1421
|
+
The pyperclip module is not installed automatically when peek-python is installed. So, it might be necessary to do so.
|
|
1422
1422
|
|
|
1423
1423
|
```
|
|
1424
1424
|
pip install pyperclip
|
|
@@ -1552,8 +1552,6 @@ There are several ways to obtain a new instance of peek:
|
|
|
1552
1552
|
|
|
1553
1553
|
With this a new peek object is created with the same attributes as the object it is created ('the parent') from. Note that the attributes are not propagated from the parent, in this case.
|
|
1554
1554
|
|
|
1555
|
-
* with `peek.timer()` used as a context manager or decorator
|
|
1556
|
-
|
|
1557
1555
|
In either case, attributes can be added to override the default ones.
|
|
1558
1556
|
|
|
1559
1557
|
#### Example
|
|
@@ -1569,22 +1567,15 @@ peek.equals_separator = " == " # this affects only the forked objects
|
|
|
1569
1567
|
peek_with_line_number(hello)
|
|
1570
1568
|
peek_with_new_prefix(hello)
|
|
1571
1569
|
peek_with_new_prefix_and_time(hello)
|
|
1572
|
-
with peek(prefix="peek_cm ") as peek_cm:
|
|
1573
|
-
peek_cm(hello)
|
|
1574
|
-
peek(hello)
|
|
1575
1570
|
```
|
|
1576
1571
|
prints something like
|
|
1577
1572
|
```
|
|
1578
|
-
#
|
|
1579
|
-
==> hello=
|
|
1580
|
-
==> @
|
|
1581
|
-
#
|
|
1582
|
-
==> hello=
|
|
1583
|
-
==> @
|
|
1584
|
-
peek_cm enter
|
|
1585
|
-
peek_cm hello == 'world'
|
|
1586
|
-
hello == 'world'
|
|
1587
|
-
peek_cm exit in 0.001843 seconds
|
|
1573
|
+
#12 ==> hello=world
|
|
1574
|
+
==> hello=world
|
|
1575
|
+
==> @ 12:40:42.106329 ==> hello=world
|
|
1576
|
+
#16 ==> hello == world
|
|
1577
|
+
==> hello=world
|
|
1578
|
+
==> @ 12:40:42.109258 ==> hello=world
|
|
1588
1579
|
```
|
|
1589
1580
|
|
|
1590
1581
|
### ignore_toml
|
|
@@ -12,7 +12,7 @@ import os, sys # three lines to use the local package and chdir
|
|
|
12
12
|
os.chdir(os.path.dirname(__file__))
|
|
13
13
|
sys.path.insert(0, os.path.dirname(__file__) + "/../")
|
|
14
14
|
|
|
15
|
-
import peek
|
|
15
|
+
from peek import peek
|
|
16
16
|
|
|
17
17
|
peek = peek.new(ignore_toml=True)
|
|
18
18
|
|
|
@@ -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
|