peek-python 25.0.0__tar.gz → 25.0.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-25.0.0 → peek_python-25.0.1}/PKG-INFO +40 -4
- {peek_python-25.0.0 → peek_python-25.0.1}/README.md +39 -3
- {peek_python-25.0.0 → peek_python-25.0.1}/peek/peek.py +22 -1
- {peek_python-25.0.0 → peek_python-25.0.1}/peek_python.egg-info/PKG-INFO +40 -4
- {peek_python-25.0.0 → peek_python-25.0.1}/pyproject.toml +1 -1
- {peek_python-25.0.0 → peek_python-25.0.1}/license.txt +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/peek/__init__.py +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/peek_python.egg-info/requires.txt +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/setup.cfg +0 -0
- {peek_python-25.0.0 → peek_python-25.0.1}/tests/test_peek.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 25.0.
|
|
3
|
+
Version: 25.0.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/peek
|
|
@@ -50,11 +50,11 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
50
50
|
|
|
51
51
|
* [Disabling peek's output](#disabling-peeks-output)
|
|
52
52
|
|
|
53
|
-
* [Using level to control peek output](#
|
|
53
|
+
* [Using level to control peek output](#using-level-to-control-peek-output)
|
|
54
54
|
|
|
55
|
-
* [Using color to control peek output](#
|
|
55
|
+
* [Using color to control peek output](#using-color-to-control-peek-output)
|
|
56
56
|
|
|
57
|
-
* [Copying to the clipboard](#
|
|
57
|
+
* [Copying to the clipboard](#copying-to-the-clipboard)
|
|
58
58
|
|
|
59
59
|
* [Interpreting the line number information](#interpreting-the-line-number-information)
|
|
60
60
|
|
|
@@ -346,6 +346,7 @@ enabled - True
|
|
|
346
346
|
end - "\n"
|
|
347
347
|
equals_separator - "="
|
|
348
348
|
filter f ""
|
|
349
|
+
format fmt ""
|
|
349
350
|
indent - 1
|
|
350
351
|
level lvl 0
|
|
351
352
|
line_length ll 80
|
|
@@ -905,7 +906,42 @@ This will print:
|
|
|
905
906
|
>
|
|
906
907
|
> This setting does not influence how strings are displayed within other data structures, like dicts and lists.
|
|
907
908
|
|
|
909
|
+
## format / fmt
|
|
910
|
+
With the format attribute, it is possible to apply a format specifier to each of the values to be printed, like
|
|
911
|
+
```
|
|
912
|
+
test_float = 1.3
|
|
913
|
+
peek(test_float, format="06.3f")
|
|
914
|
+
```
|
|
915
|
+
This will print
|
|
916
|
+
```
|
|
917
|
+
test_float=01.300
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
The format should be like the Python format specifiers, with or without the `:` prefix, like `"6.3f"`, `">10"`, `"06d"`, `:6.3d`.
|
|
921
|
+
It is also possible to use the `!` format specifier: `"!r"`, `"!r:>10"`.
|
|
922
|
+
|
|
923
|
+
If format is the null string (`""`) (the default), this functionality is skipped completely.
|
|
924
|
+
|
|
925
|
+
It is also possible to use a list (or tuple) of format specifiers, which are tried in succession. If they all fail, the 'normal' serializer will be used.
|
|
926
|
+
|
|
927
|
+
```
|
|
928
|
+
test_float = 1.3
|
|
929
|
+
test_integer=10
|
|
930
|
+
test_string = "test"
|
|
931
|
+
test_dict=dict(one=1, two=2)
|
|
932
|
+
peek(test_float, test_integer, test_string, test_dict, format=["04d", "06.3f", ">10"])
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
will result in
|
|
936
|
+
|
|
937
|
+
```
|
|
938
|
+
test_float=01.300, test_integer=0010, test_string= test, test_dict={'one': 1, 'two': 2}
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
Of course, format may be put in a peek.toml file.
|
|
942
|
+
|
|
908
943
|
## values_only / vo
|
|
944
|
+
|
|
909
945
|
If False (the default), both the left-hand side (if possible) and the
|
|
910
946
|
value will be printed. If True, the left hand side will be suppressed:
|
|
911
947
|
|
|
@@ -30,11 +30,11 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
30
30
|
|
|
31
31
|
* [Disabling peek's output](#disabling-peeks-output)
|
|
32
32
|
|
|
33
|
-
* [Using level to control peek output](#
|
|
33
|
+
* [Using level to control peek output](#using-level-to-control-peek-output)
|
|
34
34
|
|
|
35
|
-
* [Using color to control peek output](#
|
|
35
|
+
* [Using color to control peek output](#using-color-to-control-peek-output)
|
|
36
36
|
|
|
37
|
-
* [Copying to the clipboard](#
|
|
37
|
+
* [Copying to the clipboard](#copying-to-the-clipboard)
|
|
38
38
|
|
|
39
39
|
* [Interpreting the line number information](#interpreting-the-line-number-information)
|
|
40
40
|
|
|
@@ -326,6 +326,7 @@ enabled - True
|
|
|
326
326
|
end - "\n"
|
|
327
327
|
equals_separator - "="
|
|
328
328
|
filter f ""
|
|
329
|
+
format fmt ""
|
|
329
330
|
indent - 1
|
|
330
331
|
level lvl 0
|
|
331
332
|
line_length ll 80
|
|
@@ -885,7 +886,42 @@ This will print:
|
|
|
885
886
|
>
|
|
886
887
|
> This setting does not influence how strings are displayed within other data structures, like dicts and lists.
|
|
887
888
|
|
|
889
|
+
## format / fmt
|
|
890
|
+
With the format attribute, it is possible to apply a format specifier to each of the values to be printed, like
|
|
891
|
+
```
|
|
892
|
+
test_float = 1.3
|
|
893
|
+
peek(test_float, format="06.3f")
|
|
894
|
+
```
|
|
895
|
+
This will print
|
|
896
|
+
```
|
|
897
|
+
test_float=01.300
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
The format should be like the Python format specifiers, with or without the `:` prefix, like `"6.3f"`, `">10"`, `"06d"`, `:6.3d`.
|
|
901
|
+
It is also possible to use the `!` format specifier: `"!r"`, `"!r:>10"`.
|
|
902
|
+
|
|
903
|
+
If format is the null string (`""`) (the default), this functionality is skipped completely.
|
|
904
|
+
|
|
905
|
+
It is also possible to use a list (or tuple) of format specifiers, which are tried in succession. If they all fail, the 'normal' serializer will be used.
|
|
906
|
+
|
|
907
|
+
```
|
|
908
|
+
test_float = 1.3
|
|
909
|
+
test_integer=10
|
|
910
|
+
test_string = "test"
|
|
911
|
+
test_dict=dict(one=1, two=2)
|
|
912
|
+
peek(test_float, test_integer, test_string, test_dict, format=["04d", "06.3f", ">10"])
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
will result in
|
|
916
|
+
|
|
917
|
+
```
|
|
918
|
+
test_float=01.300, test_integer=0010, test_string= test, test_dict={'one': 1, 'two': 2}
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
Of course, format may be put in a peek.toml file.
|
|
922
|
+
|
|
888
923
|
## values_only / vo
|
|
924
|
+
|
|
889
925
|
If False (the default), both the left-hand side (if possible) and the
|
|
890
926
|
value will be printed. If True, the left hand side will be suppressed:
|
|
891
927
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# | .__/ \___| \___||_|\_\
|
|
5
5
|
# |_| like print, but easy.
|
|
6
6
|
|
|
7
|
-
__version__ = "25.0.
|
|
7
|
+
__version__ = "25.0.1"
|
|
8
8
|
|
|
9
9
|
"""
|
|
10
10
|
See https://github.com/salabim/peek for details
|
|
@@ -65,6 +65,7 @@ class _Peek:
|
|
|
65
65
|
("end", "", "\n"),
|
|
66
66
|
("equals_separator", "", "="),
|
|
67
67
|
("filter", "f", ""),
|
|
68
|
+
("format", "fmt", ""),
|
|
68
69
|
("indent", "", 1),
|
|
69
70
|
("level", "lvl", 0),
|
|
70
71
|
("line_length", "ll", 80),
|
|
@@ -180,6 +181,15 @@ class _Peek:
|
|
|
180
181
|
if value > 0:
|
|
181
182
|
return
|
|
182
183
|
|
|
184
|
+
elif name == "format":
|
|
185
|
+
if isinstance(value, str):
|
|
186
|
+
return
|
|
187
|
+
try:
|
|
188
|
+
if all(isinstance(sub_format, str) for sub_format in value):
|
|
189
|
+
return
|
|
190
|
+
except TypeError:
|
|
191
|
+
...
|
|
192
|
+
|
|
183
193
|
elif name == "filter":
|
|
184
194
|
if value.strip() == "":
|
|
185
195
|
return
|
|
@@ -701,6 +711,17 @@ class _Peek:
|
|
|
701
711
|
return ""
|
|
702
712
|
|
|
703
713
|
def serialize_kwargs(self, obj, width):
|
|
714
|
+
if self.format:
|
|
715
|
+
if isinstance(self.format, str):
|
|
716
|
+
iterator=iter([self.format])
|
|
717
|
+
else:
|
|
718
|
+
iterator=iter(self.format)
|
|
719
|
+
for sub_format in iterator:
|
|
720
|
+
format_string = "{" + sub_format + "}" if sub_format.startswith(":") or sub_format.startswith("!") else "{:" + sub_format + "}"
|
|
721
|
+
try:
|
|
722
|
+
return format_string.format(obj)
|
|
723
|
+
except Exception:
|
|
724
|
+
...
|
|
704
725
|
if isinstance(obj, str):
|
|
705
726
|
if not self.quote_string:
|
|
706
727
|
return str(self.add_color_value(obj))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 25.0.
|
|
3
|
+
Version: 25.0.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/peek
|
|
@@ -50,11 +50,11 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
50
50
|
|
|
51
51
|
* [Disabling peek's output](#disabling-peeks-output)
|
|
52
52
|
|
|
53
|
-
* [Using level to control peek output](#
|
|
53
|
+
* [Using level to control peek output](#using-level-to-control-peek-output)
|
|
54
54
|
|
|
55
|
-
* [Using color to control peek output](#
|
|
55
|
+
* [Using color to control peek output](#using-color-to-control-peek-output)
|
|
56
56
|
|
|
57
|
-
* [Copying to the clipboard](#
|
|
57
|
+
* [Copying to the clipboard](#copying-to-the-clipboard)
|
|
58
58
|
|
|
59
59
|
* [Interpreting the line number information](#interpreting-the-line-number-information)
|
|
60
60
|
|
|
@@ -346,6 +346,7 @@ enabled - True
|
|
|
346
346
|
end - "\n"
|
|
347
347
|
equals_separator - "="
|
|
348
348
|
filter f ""
|
|
349
|
+
format fmt ""
|
|
349
350
|
indent - 1
|
|
350
351
|
level lvl 0
|
|
351
352
|
line_length ll 80
|
|
@@ -905,7 +906,42 @@ This will print:
|
|
|
905
906
|
>
|
|
906
907
|
> This setting does not influence how strings are displayed within other data structures, like dicts and lists.
|
|
907
908
|
|
|
909
|
+
## format / fmt
|
|
910
|
+
With the format attribute, it is possible to apply a format specifier to each of the values to be printed, like
|
|
911
|
+
```
|
|
912
|
+
test_float = 1.3
|
|
913
|
+
peek(test_float, format="06.3f")
|
|
914
|
+
```
|
|
915
|
+
This will print
|
|
916
|
+
```
|
|
917
|
+
test_float=01.300
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
The format should be like the Python format specifiers, with or without the `:` prefix, like `"6.3f"`, `">10"`, `"06d"`, `:6.3d`.
|
|
921
|
+
It is also possible to use the `!` format specifier: `"!r"`, `"!r:>10"`.
|
|
922
|
+
|
|
923
|
+
If format is the null string (`""`) (the default), this functionality is skipped completely.
|
|
924
|
+
|
|
925
|
+
It is also possible to use a list (or tuple) of format specifiers, which are tried in succession. If they all fail, the 'normal' serializer will be used.
|
|
926
|
+
|
|
927
|
+
```
|
|
928
|
+
test_float = 1.3
|
|
929
|
+
test_integer=10
|
|
930
|
+
test_string = "test"
|
|
931
|
+
test_dict=dict(one=1, two=2)
|
|
932
|
+
peek(test_float, test_integer, test_string, test_dict, format=["04d", "06.3f", ">10"])
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
will result in
|
|
936
|
+
|
|
937
|
+
```
|
|
938
|
+
test_float=01.300, test_integer=0010, test_string= test, test_dict={'one': 1, 'two': 2}
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
Of course, format may be put in a peek.toml file.
|
|
942
|
+
|
|
908
943
|
## values_only / vo
|
|
944
|
+
|
|
909
945
|
If False (the default), both the left-hand side (if possible) and the
|
|
910
946
|
value will be printed. If True, the left hand side will be suppressed:
|
|
911
947
|
|
|
@@ -10,7 +10,7 @@ authors = [
|
|
|
10
10
|
{ name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
|
|
11
11
|
]
|
|
12
12
|
description = "peek - debugging and benchmarking made easy"
|
|
13
|
-
version = "25.0.
|
|
13
|
+
version = "25.0.1"
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.6"
|
|
16
16
|
dependencies = [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|