omlish 0.0.0.dev89__py3-none-any.whl → 0.0.0.dev91__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev89'
2
- __revision__ = '0d88588896911954e58df3f8fcc4b10f17ac59d1'
1
+ __version__ = '0.0.0.dev91'
2
+ __revision__ = '7808e640fab965d3bc4cacf93e74cd5115bb0ba2'
3
3
 
4
4
 
5
5
  #
@@ -10,7 +10,7 @@ class ProjectBase:
10
10
  authors = [{'name': 'wrmsr'}]
11
11
  urls = {'source': 'https://github.com/wrmsr/omlish'}
12
12
  license = {'text': 'BSD-3-Clause'}
13
- requires_python = '~=3.12'
13
+ requires_python = '>=3.12'
14
14
 
15
15
  version = __version__
16
16
 
omlish/lite/strings.py CHANGED
@@ -1,6 +1,9 @@
1
1
  import typing as ta
2
2
 
3
3
 
4
+ ##
5
+
6
+
4
7
  def camel_case(name: str, lower: bool = False) -> str:
5
8
  if not name:
6
9
  return ''
@@ -15,6 +18,9 @@ def snake_case(name: str) -> str:
15
18
  return '_'.join([name[l:r].lower() for l, r in zip([None, *uppers], [*uppers, None])]).strip('_')
16
19
 
17
20
 
21
+ ##
22
+
23
+
18
24
  def is_dunder(name: str) -> bool:
19
25
  return (
20
26
  name[:2] == name[-2:] == '__' and
@@ -33,5 +39,26 @@ def is_sunder(name: str) -> bool:
33
39
  )
34
40
 
35
41
 
42
+ ##
43
+
44
+
36
45
  def attr_repr(obj: ta.Any, *attrs: str) -> str:
37
46
  return f'{type(obj).__name__}({", ".join(f"{attr}={getattr(obj, attr)!r}" for attr in attrs)})'
47
+
48
+
49
+ ##
50
+
51
+
52
+ FORMAT_NUM_BYTES_SUFFIXES: ta.Sequence[str] = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']
53
+
54
+
55
+ def format_num_bytes(num_bytes: int) -> str:
56
+ for i, suffix in enumerate(FORMAT_NUM_BYTES_SUFFIXES):
57
+ value = num_bytes / 1024 ** i
58
+ if num_bytes < 1024 ** (i + 1):
59
+ if value.is_integer():
60
+ return f'{int(value)}{suffix}'
61
+ else:
62
+ return f'{value:.2f}{suffix}'
63
+
64
+ return f'{num_bytes / 1024 ** (len(FORMAT_NUM_BYTES_SUFFIXES) - 1):.2f}{FORMAT_NUM_BYTES_SUFFIXES[-1]}'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omlish
3
- Version: 0.0.0.dev89
3
+ Version: 0.0.0.dev91
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -10,7 +10,7 @@ Classifier: Development Status :: 2 - Pre-Alpha
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
- Requires-Python: ~=3.12
13
+ Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
15
  Provides-Extra: all
16
16
  Requires-Dist: anyio ~=4.6 ; extra == 'all'
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=hTFp9tvE72BxKloIq1s1SS0LRQlIsvMtO69Sbc47rKg,1704
2
- omlish/__about__.py,sha256=Q9mDryV_qCQEGDjiz3WA4lC9VWXTq11Nhm_Gz3REKoY,3345
2
+ omlish/__about__.py,sha256=EckAHH33DGXCoHJ44J_pr62vPfHFpm1Wf8zbW22UFjk,3345
3
3
  omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  omlish/argparse.py,sha256=Dc73G8lyoQBLvXhMYUbzQUh4SJu_OTvKUXjSUxq_ang,7499
5
5
  omlish/c3.py,sha256=4vogWgwPb8TbNS2KkZxpoWbwjj7MuHG2lQG-hdtkvjI,8062
@@ -300,7 +300,7 @@ omlish/lite/pidfile.py,sha256=ymcr6JhEt33caZMsay_auQI0Ok-OTc6qpn49Zena5KQ,1723
300
300
  omlish/lite/reflect.py,sha256=9QYJwdINraq1JNMEgvoqeSlVvRRgOXpxAkpgX8EgRXc,1307
301
301
  omlish/lite/runtime.py,sha256=VUhmNQvwf8QzkWSKj4Q0ReieJA_PzHaJNRBivfTseow,452
302
302
  omlish/lite/secrets.py,sha256=3Mz3V2jf__XU9qNHcH56sBSw95L3U2UPL24bjvobG0c,816
303
- omlish/lite/strings.py,sha256=GFkkp-q6sgO06EACyp33oiyCQQKAbpGMnVMFHZE5KP8,955
303
+ omlish/lite/strings.py,sha256=QURcE4-1pKVW8eT_5VCJpXaHDWR2dW2pYOChTJnZDiQ,1504
304
304
  omlish/lite/subprocesses.py,sha256=KuGV3ImehMjCUK0JoV3pUtG_7o5wei1lRDn9HxzByAg,3063
305
305
  omlish/logs/__init__.py,sha256=FbOyAW-lGH8gyBlSVArwljdYAU6RnwZLI5LwAfuNnrk,438
306
306
  omlish/logs/_abc.py,sha256=UgrCUQVUi_PvT3p1CEkb3P74CFrFcZq2AFby3GEUv9M,5974
@@ -457,9 +457,9 @@ omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
457
457
  omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
458
458
  omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
459
459
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
460
- omlish-0.0.0.dev89.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
461
- omlish-0.0.0.dev89.dist-info/METADATA,sha256=E-REh5OdeGYQIyX_OlzG4PETzDPS54hW-foOupBbXFc,3987
462
- omlish-0.0.0.dev89.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
463
- omlish-0.0.0.dev89.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
464
- omlish-0.0.0.dev89.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
465
- omlish-0.0.0.dev89.dist-info/RECORD,,
460
+ omlish-0.0.0.dev91.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
461
+ omlish-0.0.0.dev91.dist-info/METADATA,sha256=yb1WOSQkmSh7bpQAggim4LpkjXrjiGeEUGh7sePAjWw,3987
462
+ omlish-0.0.0.dev91.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
463
+ omlish-0.0.0.dev91.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
464
+ omlish-0.0.0.dev91.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
465
+ omlish-0.0.0.dev91.dist-info/RECORD,,