peek-python 1.8.7__tar.gz → 1.8.7.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-1.8.7 → peek_python-1.8.7.post0}/PKG-INFO +4 -4
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/README.md +3 -3
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek/peek.py +18 -15
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek_python.egg-info/PKG-INFO +4 -4
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/pyproject.toml +1 -1
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/license.txt +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek/__init__.py +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek_python.egg-info/requires.txt +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/setup.cfg +0 -0
- {peek_python-1.8.7 → peek_python-1.8.7.post0}/tests/test_peek.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.8.7
|
|
3
|
+
Version: 1.8.7.post0
|
|
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/peek
|
|
@@ -669,7 +669,7 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
|
|
|
669
669
|
>
|
|
670
670
|
> The color and color_value attributes are only applied when using stdout as output.
|
|
671
671
|
>
|
|
672
|
-
> Colors can be ignored completely by using `peek.output = "stdout_nocolor
|
|
672
|
+
> Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
|
|
673
673
|
|
|
674
674
|
## compact / c
|
|
675
675
|
This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
|
|
@@ -1351,7 +1351,7 @@ It is not possible to use peek:
|
|
|
1351
1351
|
|
|
1352
1352
|
The changelog can be found here:
|
|
1353
1353
|
|
|
1354
|
-
* https://github.com/salabim/peek/main/changelog.md or
|
|
1354
|
+
* https://github.com/salabim/peek/blob/main/changelog.md or
|
|
1355
1355
|
* https://salabim.org/peek/changelog
|
|
1356
1356
|
|
|
1357
1357
|
|
|
@@ -1393,7 +1393,7 @@ suppress f-strings at left hand optional no
|
|
|
1393
1393
|
indentation 4 blanks (overridable) dependent on length of prefix
|
|
1394
1394
|
forking and cloning yes no
|
|
1395
1395
|
test script pytest unittest
|
|
1396
|
-
colorize ***)
|
|
1396
|
+
colorize ***) yes, off by default yes, on by default
|
|
1397
1397
|
-------------------------------------------------------------------------------------------
|
|
1398
1398
|
*) under Python <= 3.7, dicts are always sorted (regardless of the sort_dicts attribute
|
|
1399
1399
|
**) under Python <= 3.7, numbers are never underscored (regardless of the underscore_numnbers attribute
|
|
@@ -649,7 +649,7 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
|
|
|
649
649
|
>
|
|
650
650
|
> The color and color_value attributes are only applied when using stdout as output.
|
|
651
651
|
>
|
|
652
|
-
> Colors can be ignored completely by using `peek.output = "stdout_nocolor
|
|
652
|
+
> Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
|
|
653
653
|
|
|
654
654
|
## compact / c
|
|
655
655
|
This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
|
|
@@ -1331,7 +1331,7 @@ It is not possible to use peek:
|
|
|
1331
1331
|
|
|
1332
1332
|
The changelog can be found here:
|
|
1333
1333
|
|
|
1334
|
-
* https://github.com/salabim/peek/main/changelog.md or
|
|
1334
|
+
* https://github.com/salabim/peek/blob/main/changelog.md or
|
|
1335
1335
|
* https://salabim.org/peek/changelog
|
|
1336
1336
|
|
|
1337
1337
|
|
|
@@ -1373,7 +1373,7 @@ suppress f-strings at left hand optional no
|
|
|
1373
1373
|
indentation 4 blanks (overridable) dependent on length of prefix
|
|
1374
1374
|
forking and cloning yes no
|
|
1375
1375
|
test script pytest unittest
|
|
1376
|
-
colorize ***)
|
|
1376
|
+
colorize ***) yes, off by default yes, on by default
|
|
1377
1377
|
-------------------------------------------------------------------------------------------
|
|
1378
1378
|
*) under Python <= 3.7, dicts are always sorted (regardless of the sort_dicts attribute
|
|
1379
1379
|
**) under Python <= 3.7, numbers are never underscored (regardless of the underscore_numnbers attribute
|
|
@@ -99,6 +99,8 @@ def check_validity(item, value, message=""):
|
|
|
99
99
|
return
|
|
100
100
|
|
|
101
101
|
if item in ("color", "color_value"):
|
|
102
|
+
if item == "color_value" and value == "":
|
|
103
|
+
return
|
|
102
104
|
if isinstance(value, str) and value.lower() in colors:
|
|
103
105
|
return
|
|
104
106
|
|
|
@@ -205,6 +207,7 @@ class show_level:
|
|
|
205
207
|
_show_level = self.saved_show_level
|
|
206
208
|
_show_level_expression = self.saved_show_level_expression
|
|
207
209
|
|
|
210
|
+
|
|
208
211
|
class show_color:
|
|
209
212
|
def __new__(cls, spec=None):
|
|
210
213
|
if spec is None:
|
|
@@ -215,11 +218,11 @@ class show_color:
|
|
|
215
218
|
global _show_color
|
|
216
219
|
global _show_color_expression
|
|
217
220
|
|
|
218
|
-
if not isinstance(spec,str):
|
|
221
|
+
if not isinstance(spec, str):
|
|
219
222
|
raise TypeError(f"spec should be a string not {type(spec)}")
|
|
220
223
|
self.saved_show_color = _show_color
|
|
221
224
|
self.saved_show_color_expression = _show_color_expression
|
|
222
|
-
_show_color=spec
|
|
225
|
+
_show_color = spec
|
|
223
226
|
if spec.lower().startswith("not"):
|
|
224
227
|
_show_color_expression = f"color.lower() not in {repr(spec.lower()[3:])}"
|
|
225
228
|
else:
|
|
@@ -231,10 +234,11 @@ class show_color:
|
|
|
231
234
|
def __exit__(self, exc_type, exc_value, exc_tb):
|
|
232
235
|
global _show_color
|
|
233
236
|
global _show_color_expression
|
|
234
|
-
print("exit",self.saved_show_color)
|
|
237
|
+
print("exit", self.saved_show_color)
|
|
235
238
|
_show_color = self.saved_show_color
|
|
236
239
|
_show_color_expression = self.saved_show_color_expression
|
|
237
240
|
|
|
241
|
+
|
|
238
242
|
def peek_pformat(obj, width, compact, indent, depth, sort_dicts, underscore_numbers):
|
|
239
243
|
return pprint.pformat(obj, width=width, compact=compact, indent=indent, depth=depth, sort_dicts=sort_dicts, underscore_numbers=underscore_numbers).replace(
|
|
240
244
|
"\\n", "\n"
|
|
@@ -271,6 +275,7 @@ _show_level_expression = "True"
|
|
|
271
275
|
_show_color = "-"
|
|
272
276
|
_show_color_expression = "True"
|
|
273
277
|
|
|
278
|
+
|
|
274
279
|
def fix_perf_counter(val): # for tests
|
|
275
280
|
global _fixed_perf_counter
|
|
276
281
|
_fixed_perf_counter = val
|
|
@@ -332,7 +337,7 @@ def set_defaults():
|
|
|
332
337
|
default.values_only_for_fstrings = False
|
|
333
338
|
default.return_none = False
|
|
334
339
|
default.color = "-"
|
|
335
|
-
default.color_value = "
|
|
340
|
+
default.color_value = ""
|
|
336
341
|
default.level = 0
|
|
337
342
|
default.enforce_line_length = False
|
|
338
343
|
default.one_line_per_pairenforce_line_length = False
|
|
@@ -485,7 +490,7 @@ class _Peek:
|
|
|
485
490
|
self._attributes[item] = value
|
|
486
491
|
|
|
487
492
|
def do_show(self):
|
|
488
|
-
return eval(_show_level_expression, dict(level=self.level)) and eval(_show_color_expression, dict(color=self.color))and self.enabled
|
|
493
|
+
return eval(_show_level_expression, dict(level=self.level)) and eval(_show_color_expression, dict(color=self.color)) and self.enabled
|
|
489
494
|
|
|
490
495
|
def assign(self, shortcuts, source, func):
|
|
491
496
|
for key, value in shortcuts.items():
|
|
@@ -509,15 +514,14 @@ class _Peek:
|
|
|
509
514
|
def fork(self, **kwargs):
|
|
510
515
|
kwargs["_parent"] = self
|
|
511
516
|
return _Peek(**kwargs)
|
|
512
|
-
|
|
517
|
+
|
|
513
518
|
def to_clipboard(self, value, confirm=True):
|
|
514
519
|
if Pythonista:
|
|
515
520
|
clipboard.set(str(value))
|
|
516
521
|
else:
|
|
517
522
|
pyperclip.copy(str(value))
|
|
518
523
|
if confirm:
|
|
519
|
-
print(f
|
|
520
|
-
|
|
524
|
+
print(f"copied to clipboard: {value}")
|
|
521
525
|
|
|
522
526
|
def __call__(self, *args, **kwargs):
|
|
523
527
|
prefix = kwargs.pop("prefix", nv)
|
|
@@ -548,7 +552,7 @@ class _Peek:
|
|
|
548
552
|
level = kwargs.pop("level", nv)
|
|
549
553
|
enforce_line_length = kwargs.pop("enforce_line_length", nv)
|
|
550
554
|
delta = kwargs.pop("delta", nv)
|
|
551
|
-
to_clipboard=kwargs.pop("to_clipboard", nv)
|
|
555
|
+
to_clipboard = kwargs.pop("to_clipboard", nv)
|
|
552
556
|
as_str = kwargs.pop("as_str", nv)
|
|
553
557
|
provided = kwargs.pop("provided", nv)
|
|
554
558
|
pr = kwargs.pop("pr", nv)
|
|
@@ -557,7 +561,7 @@ class _Peek:
|
|
|
557
561
|
raise TypeError("can't use both pr and provided")
|
|
558
562
|
|
|
559
563
|
as_str = False if as_str is nv else bool(as_str)
|
|
560
|
-
to_clipboard=False if to_clipboard is nv else bool(to_clipboard)
|
|
564
|
+
to_clipboard = False if to_clipboard is nv else bool(to_clipboard)
|
|
561
565
|
provided = True if provided is nv else bool(provided)
|
|
562
566
|
|
|
563
567
|
this = self.fork()
|
|
@@ -806,7 +810,7 @@ class _Peek:
|
|
|
806
810
|
return out + "\n"
|
|
807
811
|
else:
|
|
808
812
|
return ""
|
|
809
|
-
peek.to_clipboard(pairs[0].right if "pairs" in locals() else
|
|
813
|
+
peek.to_clipboard(pairs[0].right if "pairs" in locals() else "", confirm=False)
|
|
810
814
|
this.do_output(out)
|
|
811
815
|
|
|
812
816
|
return return_args(args, this.return_none)
|
|
@@ -937,10 +941,9 @@ class _Peek:
|
|
|
937
941
|
return (self.prefix() if callable(self.prefix) else self.prefix) + context
|
|
938
942
|
|
|
939
943
|
def add_color_value(self, s):
|
|
940
|
-
|
|
941
944
|
if self.output != "stdout" or self.as_str:
|
|
942
945
|
return s
|
|
943
|
-
if self.color_value.lower() not in (self.color.lower(),"
|
|
946
|
+
if self.color_value.lower() not in (self.color.lower(), ""):
|
|
944
947
|
return colors[self.color_value.lower()] + s + colors[self.color.lower()]
|
|
945
948
|
else:
|
|
946
949
|
return s
|
|
@@ -954,7 +957,7 @@ class _Peek:
|
|
|
954
957
|
elif self.output == "stderr":
|
|
955
958
|
print(s, file=sys.stderr)
|
|
956
959
|
elif self.output == "stdout":
|
|
957
|
-
if self.color!="-" or self.color_value!="-":
|
|
960
|
+
if self.color != "-" or self.color_value != "-":
|
|
958
961
|
s = colors[self.color.lower()] + s + colors["-"]
|
|
959
962
|
if Pythonista:
|
|
960
963
|
while s:
|
|
@@ -975,7 +978,7 @@ class _Peek:
|
|
|
975
978
|
print(s)
|
|
976
979
|
else:
|
|
977
980
|
print(s)
|
|
978
|
-
elif self.output=="stdout_nocolor":
|
|
981
|
+
elif self.output == "stdout_nocolor":
|
|
979
982
|
print(s)
|
|
980
983
|
elif self.output == "logging.debug":
|
|
981
984
|
logging.debug(s)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.8.7
|
|
3
|
+
Version: 1.8.7.post0
|
|
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/peek
|
|
@@ -669,7 +669,7 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
|
|
|
669
669
|
>
|
|
670
670
|
> The color and color_value attributes are only applied when using stdout as output.
|
|
671
671
|
>
|
|
672
|
-
> Colors can be ignored completely by using `peek.output = "stdout_nocolor
|
|
672
|
+
> Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
|
|
673
673
|
|
|
674
674
|
## compact / c
|
|
675
675
|
This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
|
|
@@ -1351,7 +1351,7 @@ It is not possible to use peek:
|
|
|
1351
1351
|
|
|
1352
1352
|
The changelog can be found here:
|
|
1353
1353
|
|
|
1354
|
-
* https://github.com/salabim/peek/main/changelog.md or
|
|
1354
|
+
* https://github.com/salabim/peek/blob/main/changelog.md or
|
|
1355
1355
|
* https://salabim.org/peek/changelog
|
|
1356
1356
|
|
|
1357
1357
|
|
|
@@ -1393,7 +1393,7 @@ suppress f-strings at left hand optional no
|
|
|
1393
1393
|
indentation 4 blanks (overridable) dependent on length of prefix
|
|
1394
1394
|
forking and cloning yes no
|
|
1395
1395
|
test script pytest unittest
|
|
1396
|
-
colorize ***)
|
|
1396
|
+
colorize ***) yes, off by default yes, on by default
|
|
1397
1397
|
-------------------------------------------------------------------------------------------
|
|
1398
1398
|
*) under Python <= 3.7, dicts are always sorted (regardless of the sort_dicts attribute
|
|
1399
1399
|
**) under Python <= 3.7, numbers are never underscored (regardless of the underscore_numnbers attribute
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|