bluer-options 5.159.1__py3-none-any.whl → 5.164.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 CHANGED
@@ -6,7 +6,7 @@ ICON = "🌀"
6
6
 
7
7
  DESCRIPTION = f"{ICON} Options for Bash."
8
8
 
9
- VERSION = "5.159.1"
9
+ VERSION = "5.164.1"
10
10
 
11
11
  REPO_NAME = "bluer-options"
12
12
 
@@ -4,5 +4,6 @@ from bluer_options.logger.config import (
4
4
  get_logger,
5
5
  log_dict,
6
6
  log_list,
7
+ log_list_as_str,
7
8
  log_long_text,
8
9
  )
@@ -87,6 +87,23 @@ def log_dict(
87
87
  break
88
88
 
89
89
 
90
+ def log_list_as_str(
91
+ title: str,
92
+ list_of_items: list,
93
+ item_name_plural: str = "item(s)",
94
+ max_count: int = 5,
95
+ ) -> str:
96
+ return "{} {} {}: {}".format(
97
+ title,
98
+ len(list_of_items),
99
+ item_name_plural,
100
+ ", ".join(
101
+ list_of_items[:max_count]
102
+ + (["..."] if len(list_of_items) > max_count else [])
103
+ ),
104
+ )
105
+
106
+
90
107
  def log_list(
91
108
  logger: Logger,
92
109
  title: str,
@@ -98,14 +115,11 @@ def log_list(
98
115
  ):
99
116
  if not itemize:
100
117
  logger.info(
101
- "{} {} {}: {}".format(
102
- title,
103
- len(list_of_items),
104
- item_name_plural,
105
- ", ".join(
106
- list_of_items[:max_count]
107
- + (["..."] if len(list_of_items) > max_count else [])
108
- ),
118
+ log_list_as_str(
119
+ title=title,
120
+ list_of_items=list_of_items,
121
+ item_name_plural=item_name_plural,
122
+ max_count=max_count,
109
123
  )
110
124
  )
111
125
  return
bluer_options/timer.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import time
2
+
2
3
  from bluer_options import string
4
+ from bluer_options.logger import logger
3
5
 
4
6
 
5
7
  class Timer:
@@ -7,6 +9,7 @@ class Timer:
7
9
  self,
8
10
  period: int,
9
11
  name: str,
12
+ log: bool = False,
10
13
  ):
11
14
  self.count = 0
12
15
  self.hot = False
@@ -15,6 +18,18 @@ class Timer:
15
18
  self.name = name
16
19
  self.start_time = time.time()
17
20
 
21
+ if log:
22
+ logger.info(
23
+ "{}: {} every {}.".format(
24
+ self.__class__.__name__,
25
+ name,
26
+ string.pretty_duration(
27
+ period,
28
+ include_ms=True,
29
+ ),
30
+ )
31
+ )
32
+
18
33
  def reset(self):
19
34
  self.hot = False
20
35
  self.last_hot = time.time()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluer_options
3
- Version: 5.159.1
3
+ Version: 5.164.1
4
4
  Summary: 🌀 Options for Bash.
5
5
  Home-page: https://github.com/kamangir/bluer-options
6
6
  Author: Arash Abadpour (Kamangir)
@@ -1,8 +1,8 @@
1
- bluer_options/__init__.py,sha256=SdXpVkgp4fvV7FWketrahyXnNhcuPCGYcIfqWlgLvIA,288
1
+ bluer_options/__init__.py,sha256=ycZcPPYI3RRRJJjlqpKIyhe5I33QkfN4w6gud4REJIg,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/elapsed_timer.py,sha256=46e-g-bjC7J4hGOGKD12R90ficXzFYn84xlLX6l34I8,545
5
- bluer_options/timer.py,sha256=LJDIsZgnX0EbeChjsgnfVEIJ7Jv4H4HGTX2NGGDsomQ,2074
5
+ bluer_options/timer.py,sha256=UPmsfCjbEWpcjXgMpYemXieheMJH_UpuemhVGsKYVoE,2470
6
6
  bluer_options/urls.py,sha256=paHaYlLMQOI46-EYNch5ohu9Q09BMkF2vvJy1QufrVI,19
7
7
  bluer_options/.bash/alias.sh,sha256=8-t6sTIy3YjyMkFLArRc45U1lNBWWmG0dIhYuN3-wRo,890
8
8
  bluer_options/.bash/assert.sh,sha256=3QvFWBS0-fyodXR7ZWIx5rCtQilrlV3r5zXQ8AZmsFg,1677
@@ -51,8 +51,8 @@ bluer_options/host/__main__.py,sha256=A0Z-sAG9lVpQx9ULzroAINPw2sZyzouUvwrYU_8QtS
51
51
  bluer_options/host/functions.py,sha256=SZnEaPp1dvQuWi8K_skwI3wQXr7PKtwUBI1qJ2RqoIM,4036
52
52
  bluer_options/list/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  bluer_options/list/__main__.py,sha256=er69iqdooU9Hb-7Vl6CAUMgQmZApSq_BTDnLT4xCjWI,3646
54
- bluer_options/logger/__init__.py,sha256=RBE9wNeOlBcbQFCYjJEbTMvCmY-aqKdZ-uNRJYTBzP4,137
55
- bluer_options/logger/config.py,sha256=4wzy55DpBcTBC7d8krhwd1ZKeBfrdZ6koc3lup14EvI,3198
54
+ bluer_options/logger/__init__.py,sha256=2k9853tBtpTx00sBQwI_YTyacYpN6WK6obK4IWMvz7s,158
55
+ bluer_options/logger/config.py,sha256=fBsZb1sTLf_iVR_Cq7Xpiyka4cp0OV-Ps2GFrdz_g9U,3475
56
56
  bluer_options/options/__init__.py,sha256=q0Ymi9oCBwgN0g7NVeYh4XgiICOtH8W8Wuaa52NH-rw,50
57
57
  bluer_options/options/__main__.py,sha256=wnCzX2dxIgrjZ6qoDnE_YBE6xzJO5ME5u-gCPmb02cw,1479
58
58
  bluer_options/options/classes.py,sha256=dcfGd34y6vDYvj-v-Bb5uOyy79mwV0s98czYFJ9hB9U,2211
@@ -63,8 +63,8 @@ bluer_options/string/functions.py,sha256=cvP4_b0CUk3xXWLTpqy17NOw8ldiiUx3GLpggap
63
63
  bluer_options/terminal/__init__.py,sha256=kyNhbC5NVCuqrUhbbTeAOTW1ZO7MRRbi0RtXGBFKtJc,73
64
64
  bluer_options/terminal/__main__.py,sha256=3o465bp44c2f1KHDn4j664hpbvu8wKOwQ2c1OPoa6Xc,902
65
65
  bluer_options/terminal/functions.py,sha256=A23uHLeU4JIctmecOFk_KhIfOeHu-WMjnSzBj2KiF3U,1947
66
- bluer_options-5.159.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
67
- bluer_options-5.159.1.dist-info/METADATA,sha256=HLPAenU4cfCZDD7hZbEHC2gVCqnR6rjPj-jNsiD5lKU,4951
68
- bluer_options-5.159.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
- bluer_options-5.159.1.dist-info/top_level.txt,sha256=yw9slt8n3R7IiYmf83OtHtB8Z-EgP9UwyQTk1EGiAJU,14
70
- bluer_options-5.159.1.dist-info/RECORD,,
66
+ bluer_options-5.164.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
67
+ bluer_options-5.164.1.dist-info/METADATA,sha256=2AVvCqM6ipI-5YWMgwMBuLaSsTmQaV-V9w8q4CFMytE,4951
68
+ bluer_options-5.164.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
+ bluer_options-5.164.1.dist-info/top_level.txt,sha256=yw9slt8n3R7IiYmf83OtHtB8Z-EgP9UwyQTk1EGiAJU,14
70
+ bluer_options-5.164.1.dist-info/RECORD,,