bluer-options 5.170.1__py3-none-any.whl → 5.175.1__py3-none-any.whl
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.
Potentially problematic release.
This version of bluer-options might be problematic. Click here for more details.
- bluer_options/__init__.py +1 -1
- bluer_options/logger/__main__.py +32 -0
- bluer_options/logger/watch.py +19 -0
- bluer_options/timing/classes.py +11 -1
- {bluer_options-5.170.1.dist-info → bluer_options-5.175.1.dist-info}/METADATA +1 -1
- {bluer_options-5.170.1.dist-info → bluer_options-5.175.1.dist-info}/RECORD +9 -7
- {bluer_options-5.170.1.dist-info → bluer_options-5.175.1.dist-info}/WHEEL +0 -0
- {bluer_options-5.170.1.dist-info → bluer_options-5.175.1.dist-info}/licenses/LICENSE +0 -0
- {bluer_options-5.170.1.dist-info → bluer_options-5.175.1.dist-info}/top_level.txt +0 -0
bluer_options/__init__.py
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
|
|
3
|
+
from blueness import module
|
|
4
|
+
from blueness.argparse.generic import sys_exit
|
|
5
|
+
|
|
6
|
+
from bluer_options import NAME
|
|
7
|
+
from bluer_options.logger.watch import watch
|
|
8
|
+
from bluer_options.logger import logger
|
|
9
|
+
|
|
10
|
+
NAME = module.name(__file__, NAME)
|
|
11
|
+
|
|
12
|
+
parser = argparse.ArgumentParser(NAME)
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"task",
|
|
15
|
+
type=str,
|
|
16
|
+
help="watch",
|
|
17
|
+
)
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--seconds",
|
|
20
|
+
type=int,
|
|
21
|
+
default=1,
|
|
22
|
+
help="in seconds.",
|
|
23
|
+
)
|
|
24
|
+
args = parser.parse_args()
|
|
25
|
+
|
|
26
|
+
success = False
|
|
27
|
+
if args.task == "watch":
|
|
28
|
+
success = watch(seconds=args.seconds)
|
|
29
|
+
else:
|
|
30
|
+
success = None
|
|
31
|
+
|
|
32
|
+
sys_exit(logger, NAME, args.task, success)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
from bluer_options.env import bluer_ai_log_filename
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def watch(seconds: int = 1) -> bool:
|
|
7
|
+
try:
|
|
8
|
+
with open(bluer_ai_log_filename, "r") as f:
|
|
9
|
+
f.seek(0, 2) # jump to end of file
|
|
10
|
+
while True:
|
|
11
|
+
line = f.readline()
|
|
12
|
+
if not line:
|
|
13
|
+
time.sleep(seconds)
|
|
14
|
+
continue
|
|
15
|
+
print(line, end="")
|
|
16
|
+
except KeyboardInterrupt:
|
|
17
|
+
print("\n^C received.")
|
|
18
|
+
|
|
19
|
+
return True
|
bluer_options/timing/classes.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import time
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import List, Dict
|
|
3
3
|
from collections import defaultdict
|
|
4
4
|
from functools import wraps
|
|
5
5
|
|
|
@@ -9,6 +9,12 @@ from bluer_options.logger.config import log_list
|
|
|
9
9
|
from bluer_options.timing.elapsed_timer import ElapsedTimer
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def recursive_to_dict(d):
|
|
13
|
+
if isinstance(d, (defaultdict, dict)):
|
|
14
|
+
d = {k: recursive_to_dict(v) for k, v in d.items()}
|
|
15
|
+
return d
|
|
16
|
+
|
|
17
|
+
|
|
12
18
|
class Timing:
|
|
13
19
|
def __init__(self):
|
|
14
20
|
self._active = {}
|
|
@@ -30,6 +36,10 @@ class Timing:
|
|
|
30
36
|
|
|
31
37
|
return elapsed
|
|
32
38
|
|
|
39
|
+
@property
|
|
40
|
+
def as_dict(self) -> Dict:
|
|
41
|
+
return recursive_to_dict(self.stats)
|
|
42
|
+
|
|
33
43
|
def as_list(self, **kwgrs) -> List[str]:
|
|
34
44
|
lines = []
|
|
35
45
|
# sort items by total time (descending)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
bluer_options/__init__.py,sha256=
|
|
1
|
+
bluer_options/__init__.py,sha256=aDCJFUDVdq3MwloKECDq-_nrNs8t5Ew3DjcawqN13c4,288
|
|
2
2
|
bluer_options/__main__.py,sha256=-6ce9W1uXkle4YtEYlSUMWxSmsur3dRDA4_MvNNhEVg,236
|
|
3
3
|
bluer_options/config.env,sha256=2AG3xuWiMqaNmlCNDWQOJ_AssKk7KXhn0XDIkHWNQ2Q,30
|
|
4
4
|
bluer_options/timer.py,sha256=UPmsfCjbEWpcjXgMpYemXieheMJH_UpuemhVGsKYVoE,2470
|
|
@@ -51,7 +51,9 @@ bluer_options/host/functions.py,sha256=SZnEaPp1dvQuWi8K_skwI3wQXr7PKtwUBI1qJ2Rqo
|
|
|
51
51
|
bluer_options/list/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
52
|
bluer_options/list/__main__.py,sha256=er69iqdooU9Hb-7Vl6CAUMgQmZApSq_BTDnLT4xCjWI,3646
|
|
53
53
|
bluer_options/logger/__init__.py,sha256=2k9853tBtpTx00sBQwI_YTyacYpN6WK6obK4IWMvz7s,158
|
|
54
|
+
bluer_options/logger/__main__.py,sha256=YetPs-lCkHDrmMgFB7pVs9icIqT5aFVA2nU0bgFN7_w,625
|
|
54
55
|
bluer_options/logger/config.py,sha256=fBsZb1sTLf_iVR_Cq7Xpiyka4cp0OV-Ps2GFrdz_g9U,3475
|
|
56
|
+
bluer_options/logger/watch.py,sha256=4FJjbstlsAl3EF_2vx9Dshe4EmGrkR-VAQXZOmGV6jc,486
|
|
55
57
|
bluer_options/options/__init__.py,sha256=q0Ymi9oCBwgN0g7NVeYh4XgiICOtH8W8Wuaa52NH-rw,50
|
|
56
58
|
bluer_options/options/__main__.py,sha256=wnCzX2dxIgrjZ6qoDnE_YBE6xzJO5ME5u-gCPmb02cw,1479
|
|
57
59
|
bluer_options/options/classes.py,sha256=dcfGd34y6vDYvj-v-Bb5uOyy79mwV0s98czYFJ9hB9U,2211
|
|
@@ -63,10 +65,10 @@ bluer_options/terminal/__init__.py,sha256=kyNhbC5NVCuqrUhbbTeAOTW1ZO7MRRbi0RtXGB
|
|
|
63
65
|
bluer_options/terminal/__main__.py,sha256=3o465bp44c2f1KHDn4j664hpbvu8wKOwQ2c1OPoa6Xc,902
|
|
64
66
|
bluer_options/terminal/functions.py,sha256=A23uHLeU4JIctmecOFk_KhIfOeHu-WMjnSzBj2KiF3U,1947
|
|
65
67
|
bluer_options/timing/__init__.py,sha256=CCIJKvRVdimLdk46WOc_C-t8HHTVFPdGxQTFCFrN5zc,127
|
|
66
|
-
bluer_options/timing/classes.py,sha256=
|
|
68
|
+
bluer_options/timing/classes.py,sha256=28q4Yw6T-SOer8pNXx1eLhnSvkTWX9WaF6ZLjXAUzu8,3639
|
|
67
69
|
bluer_options/timing/elapsed_timer.py,sha256=ecM11nzXnoDL_k6p41YPH28-OLnYreg_CgPQlbv4mjI,897
|
|
68
|
-
bluer_options-5.
|
|
69
|
-
bluer_options-5.
|
|
70
|
-
bluer_options-5.
|
|
71
|
-
bluer_options-5.
|
|
72
|
-
bluer_options-5.
|
|
70
|
+
bluer_options-5.175.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
|
|
71
|
+
bluer_options-5.175.1.dist-info/METADATA,sha256=fvAGNzoVnxgTNAmp-L9IxiYQPKCyPOyegZwnwvtx1zc,4951
|
|
72
|
+
bluer_options-5.175.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
73
|
+
bluer_options-5.175.1.dist-info/top_level.txt,sha256=yw9slt8n3R7IiYmf83OtHtB8Z-EgP9UwyQTk1EGiAJU,14
|
|
74
|
+
bluer_options-5.175.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|