peek-python 1.8.0__tar.gz → 1.8.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.8.0 → peek_python-1.8.1}/PKG-INFO +30 -7
- {peek_python-1.8.0 → peek_python-1.8.1}/README.md +28 -6
- {peek_python-1.8.0 → peek_python-1.8.1}/peek/peek.py +12 -2
- {peek_python-1.8.0 → peek_python-1.8.1}/peek_python.egg-info/PKG-INFO +30 -7
- {peek_python-1.8.0 → peek_python-1.8.1}/peek_python.egg-info/requires.txt +1 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/pyproject.toml +2 -2
- {peek_python-1.8.0 → peek_python-1.8.1}/license.txt +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/peek/__init__.py +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/setup.cfg +0 -0
- {peek_python-1.8.0 → peek_python-1.8.1}/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.
|
|
3
|
+
Version: 1.8.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
|
|
@@ -16,6 +16,7 @@ Requires-Dist: six
|
|
|
16
16
|
Requires-Dist: executing
|
|
17
17
|
Requires-Dist: asttokens
|
|
18
18
|
Requires-Dist: tomli
|
|
19
|
+
Requires-Dist: pyperclip
|
|
19
20
|
|
|
20
21
|
<img src="https://www.salabim.org/peek/peek_logo1.png">
|
|
21
22
|
|
|
@@ -49,6 +50,8 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
49
50
|
|
|
50
51
|
* [Using level to control peek output](#Using-level-to-control-peek-output)
|
|
51
52
|
|
|
53
|
+
* [Copying to the clipboard](#Copying-to-the-clipboard)
|
|
54
|
+
|
|
52
55
|
* [Speeding up disabled peek](#speeding-up-disabled-peek)
|
|
53
56
|
|
|
54
57
|
* [Using peek as a substitute for `assert`](#using-peek-as-a-substitute-for-assert)
|
|
@@ -91,7 +94,7 @@ pip install peek-python --upgrade
|
|
|
91
94
|
|
|
92
95
|
Alternatively, peek.py can be just copied into you current work directory from GitHub (https://github.com/salabim/peek).
|
|
93
96
|
|
|
94
|
-
Note that peek requires the `asttokens`, `colorama`, `executing`. `six
|
|
97
|
+
Note that peek requires the `asttokens`, `colorama`, `executing`. `six`, tomli and pyperclip` modules, all of which will be automatically installed.
|
|
95
98
|
|
|
96
99
|
# Importing peek
|
|
97
100
|
|
|
@@ -1054,14 +1057,15 @@ This will print only 1.
|
|
|
1054
1057
|
|
|
1055
1058
|
The most easy form for `peek.show_level` is just a simple value as argument, like `peek.show.level(2)`, which will make only level 2 peeks to work.
|
|
1056
1059
|
|
|
1057
|
-
`peek.show_level` can have a number (
|
|
1060
|
+
`peek.show_level` can have a number (usually 1) of arguments.
|
|
1058
1061
|
|
|
1059
|
-
|
|
1060
|
-
- <from>-<to>
|
|
1062
|
+
Each parameter may be:
|
|
1061
1063
|
|
|
1062
|
-
|
|
1064
|
+
* a float value or
|
|
1063
1065
|
|
|
1064
|
-
|
|
1066
|
+
- a string with the format *from* - *to*
|
|
1067
|
+
, where both *from* and *to* are optional. If *from* is omitted, -1E30 is assumed. If *to* is omitted, 1E30 is assumed.
|
|
1068
|
+
Negative values have to be parenthesized.
|
|
1065
1069
|
|
|
1066
1070
|
Examples:
|
|
1067
1071
|
|
|
@@ -1094,7 +1098,26 @@ Examples:
|
|
|
1094
1098
|
|
|
1095
1099
|
This will print one line with`1` only.
|
|
1096
1100
|
|
|
1101
|
+
# Copying to the clipboard
|
|
1102
|
+
It is possible to copy a value to the clipbaord with the method `to_clipboard` which accepts a value to be copied to the clipboard.
|
|
1103
|
+
So,
|
|
1104
|
+
|
|
1105
|
+
```
|
|
1106
|
+
part1 = 1234
|
|
1107
|
+
peek.to_clipboard(part1)
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
will copy `1234` to the clipboard and write `copied to clipboard: 1234` to the console.
|
|
1111
|
+
If the confirmation message is not wanted, just add confirm=False, like
|
|
1112
|
+
|
|
1113
|
+
```
|
|
1114
|
+
peek.to_clipboard(part1, confirm=False)
|
|
1115
|
+
```
|
|
1116
|
+
|
|
1117
|
+
Implementation detail: this functionality uses pyperclip, apart from under Pythonista, whre the
|
|
1118
|
+
builtin clipboard module is used.
|
|
1097
1119
|
|
|
1120
|
+
This functionality is particularly useful for entering an answer of an *Advent of Code* solution to the site.
|
|
1098
1121
|
|
|
1099
1122
|
# Interpreting the line number information
|
|
1100
1123
|
|
|
@@ -30,6 +30,8 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
30
30
|
|
|
31
31
|
* [Using level to control peek output](#Using-level-to-control-peek-output)
|
|
32
32
|
|
|
33
|
+
* [Copying to the clipboard](#Copying-to-the-clipboard)
|
|
34
|
+
|
|
33
35
|
* [Speeding up disabled peek](#speeding-up-disabled-peek)
|
|
34
36
|
|
|
35
37
|
* [Using peek as a substitute for `assert`](#using-peek-as-a-substitute-for-assert)
|
|
@@ -72,7 +74,7 @@ pip install peek-python --upgrade
|
|
|
72
74
|
|
|
73
75
|
Alternatively, peek.py can be just copied into you current work directory from GitHub (https://github.com/salabim/peek).
|
|
74
76
|
|
|
75
|
-
Note that peek requires the `asttokens`, `colorama`, `executing`. `six
|
|
77
|
+
Note that peek requires the `asttokens`, `colorama`, `executing`. `six`, tomli and pyperclip` modules, all of which will be automatically installed.
|
|
76
78
|
|
|
77
79
|
# Importing peek
|
|
78
80
|
|
|
@@ -1035,14 +1037,15 @@ This will print only 1.
|
|
|
1035
1037
|
|
|
1036
1038
|
The most easy form for `peek.show_level` is just a simple value as argument, like `peek.show.level(2)`, which will make only level 2 peeks to work.
|
|
1037
1039
|
|
|
1038
|
-
`peek.show_level` can have a number (
|
|
1040
|
+
`peek.show_level` can have a number (usually 1) of arguments.
|
|
1039
1041
|
|
|
1040
|
-
|
|
1041
|
-
- <from>-<to>
|
|
1042
|
+
Each parameter may be:
|
|
1042
1043
|
|
|
1043
|
-
|
|
1044
|
+
* a float value or
|
|
1044
1045
|
|
|
1045
|
-
|
|
1046
|
+
- a string with the format *from* - *to*
|
|
1047
|
+
, where both *from* and *to* are optional. If *from* is omitted, -1E30 is assumed. If *to* is omitted, 1E30 is assumed.
|
|
1048
|
+
Negative values have to be parenthesized.
|
|
1046
1049
|
|
|
1047
1050
|
Examples:
|
|
1048
1051
|
|
|
@@ -1075,7 +1078,26 @@ Examples:
|
|
|
1075
1078
|
|
|
1076
1079
|
This will print one line with`1` only.
|
|
1077
1080
|
|
|
1081
|
+
# Copying to the clipboard
|
|
1082
|
+
It is possible to copy a value to the clipbaord with the method `to_clipboard` which accepts a value to be copied to the clipboard.
|
|
1083
|
+
So,
|
|
1084
|
+
|
|
1085
|
+
```
|
|
1086
|
+
part1 = 1234
|
|
1087
|
+
peek.to_clipboard(part1)
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
will copy `1234` to the clipboard and write `copied to clipboard: 1234` to the console.
|
|
1091
|
+
If the confirmation message is not wanted, just add confirm=False, like
|
|
1092
|
+
|
|
1093
|
+
```
|
|
1094
|
+
peek.to_clipboard(part1, confirm=False)
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
Implementation detail: this functionality uses pyperclip, apart from under Pythonista, whre the
|
|
1098
|
+
builtin clipboard module is used.
|
|
1078
1099
|
|
|
1100
|
+
This functionality is particularly useful for entering an answer of an *Advent of Code* solution to the site.
|
|
1079
1101
|
|
|
1080
1102
|
# Interpreting the line number information
|
|
1081
1103
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# | .__/ \___| \___||_|\_\
|
|
5
5
|
# |_| like print, but easy.
|
|
6
6
|
|
|
7
|
-
__version__ = "1.8.
|
|
7
|
+
__version__ = "1.8.1"
|
|
8
8
|
|
|
9
9
|
"""
|
|
10
10
|
See https://github.com/salabim/peek for details
|
|
@@ -40,8 +40,10 @@ from pathlib import Path
|
|
|
40
40
|
Pythonista = sys.platform == "ios"
|
|
41
41
|
if Pythonista:
|
|
42
42
|
import console
|
|
43
|
+
import clipboard
|
|
43
44
|
else:
|
|
44
45
|
import colorama
|
|
46
|
+
import pyperclip
|
|
45
47
|
|
|
46
48
|
try:
|
|
47
49
|
import tomlib
|
|
@@ -479,6 +481,15 @@ class _Peek:
|
|
|
479
481
|
def fork(self, **kwargs):
|
|
480
482
|
kwargs["_parent"] = self
|
|
481
483
|
return _Peek(**kwargs)
|
|
484
|
+
|
|
485
|
+
def to_clipboard(self, value, confirm=True):
|
|
486
|
+
if Pythonista:
|
|
487
|
+
clipboard.set(str(value))
|
|
488
|
+
else:
|
|
489
|
+
pyperclip.copy(str(value))
|
|
490
|
+
if confirm:
|
|
491
|
+
print(f'copied to clipboard: {value}')
|
|
492
|
+
|
|
482
493
|
|
|
483
494
|
def __call__(self, *args, **kwargs):
|
|
484
495
|
prefix = kwargs.pop("prefix", nv)
|
|
@@ -941,7 +952,6 @@ class _Peek:
|
|
|
941
952
|
logging.critical(s)
|
|
942
953
|
elif self.output in ("", "null"):
|
|
943
954
|
pass
|
|
944
|
-
|
|
945
955
|
elif isinstance(self.output, str):
|
|
946
956
|
with open(self.output, "a+", encoding="utf-8") as f:
|
|
947
957
|
print(s, file=f)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.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
|
|
@@ -16,6 +16,7 @@ Requires-Dist: six
|
|
|
16
16
|
Requires-Dist: executing
|
|
17
17
|
Requires-Dist: asttokens
|
|
18
18
|
Requires-Dist: tomli
|
|
19
|
+
Requires-Dist: pyperclip
|
|
19
20
|
|
|
20
21
|
<img src="https://www.salabim.org/peek/peek_logo1.png">
|
|
21
22
|
|
|
@@ -49,6 +50,8 @@ And on top of that, you get some basic benchmarking functionality.
|
|
|
49
50
|
|
|
50
51
|
* [Using level to control peek output](#Using-level-to-control-peek-output)
|
|
51
52
|
|
|
53
|
+
* [Copying to the clipboard](#Copying-to-the-clipboard)
|
|
54
|
+
|
|
52
55
|
* [Speeding up disabled peek](#speeding-up-disabled-peek)
|
|
53
56
|
|
|
54
57
|
* [Using peek as a substitute for `assert`](#using-peek-as-a-substitute-for-assert)
|
|
@@ -91,7 +94,7 @@ pip install peek-python --upgrade
|
|
|
91
94
|
|
|
92
95
|
Alternatively, peek.py can be just copied into you current work directory from GitHub (https://github.com/salabim/peek).
|
|
93
96
|
|
|
94
|
-
Note that peek requires the `asttokens`, `colorama`, `executing`. `six
|
|
97
|
+
Note that peek requires the `asttokens`, `colorama`, `executing`. `six`, tomli and pyperclip` modules, all of which will be automatically installed.
|
|
95
98
|
|
|
96
99
|
# Importing peek
|
|
97
100
|
|
|
@@ -1054,14 +1057,15 @@ This will print only 1.
|
|
|
1054
1057
|
|
|
1055
1058
|
The most easy form for `peek.show_level` is just a simple value as argument, like `peek.show.level(2)`, which will make only level 2 peeks to work.
|
|
1056
1059
|
|
|
1057
|
-
`peek.show_level` can have a number (
|
|
1060
|
+
`peek.show_level` can have a number (usually 1) of arguments.
|
|
1058
1061
|
|
|
1059
|
-
|
|
1060
|
-
- <from>-<to>
|
|
1062
|
+
Each parameter may be:
|
|
1061
1063
|
|
|
1062
|
-
|
|
1064
|
+
* a float value or
|
|
1063
1065
|
|
|
1064
|
-
|
|
1066
|
+
- a string with the format *from* - *to*
|
|
1067
|
+
, where both *from* and *to* are optional. If *from* is omitted, -1E30 is assumed. If *to* is omitted, 1E30 is assumed.
|
|
1068
|
+
Negative values have to be parenthesized.
|
|
1065
1069
|
|
|
1066
1070
|
Examples:
|
|
1067
1071
|
|
|
@@ -1094,7 +1098,26 @@ Examples:
|
|
|
1094
1098
|
|
|
1095
1099
|
This will print one line with`1` only.
|
|
1096
1100
|
|
|
1101
|
+
# Copying to the clipboard
|
|
1102
|
+
It is possible to copy a value to the clipbaord with the method `to_clipboard` which accepts a value to be copied to the clipboard.
|
|
1103
|
+
So,
|
|
1104
|
+
|
|
1105
|
+
```
|
|
1106
|
+
part1 = 1234
|
|
1107
|
+
peek.to_clipboard(part1)
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
will copy `1234` to the clipboard and write `copied to clipboard: 1234` to the console.
|
|
1111
|
+
If the confirmation message is not wanted, just add confirm=False, like
|
|
1112
|
+
|
|
1113
|
+
```
|
|
1114
|
+
peek.to_clipboard(part1, confirm=False)
|
|
1115
|
+
```
|
|
1116
|
+
|
|
1117
|
+
Implementation detail: this functionality uses pyperclip, apart from under Pythonista, whre the
|
|
1118
|
+
builtin clipboard module is used.
|
|
1097
1119
|
|
|
1120
|
+
This functionality is particularly useful for entering an answer of an *Advent of Code* solution to the site.
|
|
1098
1121
|
|
|
1099
1122
|
# Interpreting the line number information
|
|
1100
1123
|
|
|
@@ -8,10 +8,10 @@ authors = [
|
|
|
8
8
|
{name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com"}
|
|
9
9
|
]
|
|
10
10
|
description = "peek - debugging and benchmarking made easy"
|
|
11
|
-
version = "1.8.
|
|
11
|
+
version = "1.8.1"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.6"
|
|
14
|
-
dependencies = ["colorama","six","executing","asttokens","tomli"]
|
|
14
|
+
dependencies = ["colorama","six","executing","asttokens","tomli","pyperclip"]
|
|
15
15
|
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 5 - Production/Stable",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|