omlish 0.0.0.dev209__py3-none-any.whl → 0.0.0.dev211__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.dev209'
2
- __revision__ = '314f6224b877d8afdb8708faee9e19b7c81cdd0f'
1
+ __version__ = '0.0.0.dev211'
2
+ __revision__ = '429bd6e544b5a0e15db5196c05605127719166d9'
3
3
 
4
4
 
5
5
  #
@@ -77,7 +77,7 @@ class Project(ProjectBase):
77
77
  ],
78
78
 
79
79
  'misc': [
80
- 'wrapt ~= 1.14',
80
+ 'wrapt ~= 1.17',
81
81
  ],
82
82
 
83
83
  'secrets': [
omlish/argparse/cli.py CHANGED
@@ -10,6 +10,7 @@ TODO:
10
10
  import argparse
11
11
  import dataclasses as dc
12
12
  import functools
13
+ import inspect
13
14
  import sys
14
15
  import typing as ta
15
16
 
@@ -280,8 +281,23 @@ class ArgparseCli:
280
281
 
281
282
  #
282
283
 
283
- async def async_cli_run(self) -> ta.Optional[int]:
284
+ async def async_cli_run(
285
+ self,
286
+ *,
287
+ force_async: bool = False,
288
+ ) -> ta.Optional[int]:
284
289
  if (fn := self.prepare_cli_run()) is None:
285
290
  return 0
286
291
 
287
- return await fn()
292
+ if force_async:
293
+ is_async = True
294
+ else:
295
+ tfn = fn
296
+ if isinstance(tfn, ArgparseCmd):
297
+ tfn = tfn.fn
298
+ is_async = inspect.iscoroutinefunction(tfn)
299
+
300
+ if is_async:
301
+ return await fn()
302
+ else:
303
+ return fn()
@@ -6,4 +6,11 @@ TODO:
6
6
  - blosc?
7
7
  - python-lzo?
8
8
  - zfp -> fp8?
9
+
10
+ Compression choice:
11
+ - lzma if-available minimal-space
12
+ - lz4 if-available read-heavy
13
+ - zstd if-available
14
+ - bz2 read-heavy (but no parallel decompress)
15
+ - gz
9
16
  """
omlish/lang/strings.py CHANGED
@@ -52,8 +52,13 @@ def replace_many(
52
52
  ##
53
53
 
54
54
 
55
- def camel_case(name: str) -> str:
56
- return ''.join(map(str.capitalize, name.split('_'))) # noqa
55
+ def camel_case(name: str, *, lower: bool = False) -> str:
56
+ if not name:
57
+ return ''
58
+ s = ''.join(map(str.capitalize, name.split('_'))) # noqa
59
+ if lower:
60
+ s = s[0].lower() + s[1:]
61
+ return s
57
62
 
58
63
 
59
64
  def snake_case(name: str) -> str:
@@ -61,6 +66,9 @@ def snake_case(name: str) -> str:
61
66
  return '_'.join([name[l:r].lower() for l, r in zip([None, *uppers], [*uppers, None])]).strip('_')
62
67
 
63
68
 
69
+ ##
70
+
71
+
64
72
  def is_dunder(name: str) -> bool:
65
73
  return (
66
74
  name[:2] == name[-2:] == '__' and
omlish/lite/strings.py CHANGED
@@ -4,7 +4,7 @@ import typing as ta
4
4
  ##
5
5
 
6
6
 
7
- def camel_case(name: str, lower: bool = False) -> str:
7
+ def camel_case(name: str, *, lower: bool = False) -> str:
8
8
  if not name:
9
9
  return ''
10
10
  s = ''.join(map(str.capitalize, name.split('_'))) # noqa
@@ -21,6 +21,27 @@ def snake_case(name: str) -> str:
21
21
  ##
22
22
 
23
23
 
24
+ def is_dunder(name: str) -> bool:
25
+ return (
26
+ name[:2] == name[-2:] == '__' and
27
+ name[2:3] != '_' and
28
+ name[-3:-2] != '_' and
29
+ len(name) > 4
30
+ )
31
+
32
+
33
+ def is_sunder(name: str) -> bool:
34
+ return (
35
+ name[0] == name[-1] == '_' and
36
+ name[1:2] != '_' and
37
+ name[-2:-1] != '_' and
38
+ len(name) > 2
39
+ )
40
+
41
+
42
+ ##
43
+
44
+
24
45
  def strip_with_newline(s: str) -> str:
25
46
  if not s:
26
47
  return ''
@@ -52,27 +73,6 @@ def split_keep_delimiter(s, d):
52
73
  ##
53
74
 
54
75
 
55
- def is_dunder(name: str) -> bool:
56
- return (
57
- name[:2] == name[-2:] == '__' and
58
- name[2:3] != '_' and
59
- name[-3:-2] != '_' and
60
- len(name) > 4
61
- )
62
-
63
-
64
- def is_sunder(name: str) -> bool:
65
- return (
66
- name[0] == name[-1] == '_' and
67
- name[1:2] != '_' and
68
- name[-2:-1] != '_' and
69
- len(name) > 2
70
- )
71
-
72
-
73
- ##
74
-
75
-
76
76
  def attr_repr(obj: ta.Any, *attrs: str) -> str:
77
77
  return f'{type(obj).__name__}({", ".join(f"{attr}={getattr(obj, attr)!r}" for attr in attrs)})'
78
78
 
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env python3
2
1
  import argparse
3
2
  import dataclasses as dc
4
3
  import sys
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: omlish
3
- Version: 0.0.0.dev209
3
+ Version: 0.0.0.dev211
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -32,7 +32,7 @@ Requires-Dist: pyyaml~=6.0; extra == "all"
32
32
  Requires-Dist: cbor2~=5.6; extra == "all"
33
33
  Requires-Dist: cloudpickle~=3.1; extra == "all"
34
34
  Requires-Dist: httpx[http2]~=0.28; extra == "all"
35
- Requires-Dist: wrapt~=1.14; extra == "all"
35
+ Requires-Dist: wrapt~=1.17; extra == "all"
36
36
  Requires-Dist: cryptography~=43.0; extra == "all"
37
37
  Requires-Dist: sqlalchemy[asyncio]~=2.0; extra == "all"
38
38
  Requires-Dist: pg8000~=1.31; extra == "all"
@@ -50,7 +50,7 @@ Requires-Dist: asttokens~=3.0; extra == "all"
50
50
  Requires-Dist: executing~=2.1; extra == "all"
51
51
  Requires-Dist: orjson~=3.10; extra == "all"
52
52
  Requires-Dist: pyyaml~=6.0; extra == "all"
53
- Requires-Dist: wrapt~=1.14; extra == "all"
53
+ Requires-Dist: wrapt~=1.17; extra == "all"
54
54
  Provides-Extra: async
55
55
  Requires-Dist: anyio~=4.8; extra == "async"
56
56
  Requires-Dist: sniffio~=1.3; extra == "async"
@@ -76,7 +76,7 @@ Requires-Dist: cloudpickle~=3.1; extra == "formats"
76
76
  Provides-Extra: http
77
77
  Requires-Dist: httpx[http2]~=0.28; extra == "http"
78
78
  Provides-Extra: misc
79
- Requires-Dist: wrapt~=1.14; extra == "misc"
79
+ Requires-Dist: wrapt~=1.17; extra == "misc"
80
80
  Provides-Extra: secrets
81
81
  Requires-Dist: cryptography~=43.0; extra == "secrets"
82
82
  Provides-Extra: sqlalchemy
@@ -99,4 +99,4 @@ Requires-Dist: asttokens~=3.0; extra == "plus"
99
99
  Requires-Dist: executing~=2.1; extra == "plus"
100
100
  Requires-Dist: orjson~=3.10; extra == "plus"
101
101
  Requires-Dist: pyyaml~=6.0; extra == "plus"
102
- Requires-Dist: wrapt~=1.14; extra == "plus"
102
+ Requires-Dist: wrapt~=1.17; extra == "plus"
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=dyIpveH7Z8OnQp2pTn6NVv7LCDXVrozJWAzbk8PBavg,7950
2
- omlish/__about__.py,sha256=l7B4fp3NAgnK7i0QN5U2wJtZ9gnavNAADXg1748jh7U,3409
2
+ omlish/__about__.py,sha256=M0cCQiz1nNSIVpsNpftgCI4sNi-sYqMT_ZA_wP4FTWY,3409
3
3
  omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
4
4
  omlish/c3.py,sha256=ubu7lHwss5V4UznbejAI0qXhXahrU01MysuHOZI9C4U,8116
5
5
  omlish/cached.py,sha256=UI-XTFBwA6YXWJJJeBn-WkwBkfzDjLBBaZf4nIJA9y0,510
@@ -83,7 +83,7 @@ omlish/antlr/_runtime/xpath/XPathLexer.py,sha256=WvGKQjQnu7pX5C4CFKtsCzba2B2W6ie
83
83
  omlish/antlr/_runtime/xpath/__init__.py,sha256=lMd_BbXYdlDhZQN_q0TKN978XW5G0pq618F0NaLkpFE,71
84
84
  omlish/argparse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
85
  omlish/argparse/all.py,sha256=2qhVgFTq3w_tJ_okEnw_D-2k4jlJD7EcM5hNEow6M2M,1030
86
- omlish/argparse/cli.py,sha256=Kjq3bzd_E2XwV0T7-cddDdrm68N4AWptTKdJty8vN8g,8217
86
+ omlish/argparse/cli.py,sha256=nMn4D2Oce2HNGGVuc_EtJuNSqoIfNdzWd_eKFBSfxEs,8586
87
87
  omlish/asyncs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  omlish/asyncs/all.py,sha256=uUz9ziKh4_QrgmdhKFMgq6j7mFbiZd3LiogguDCQsGI,587
89
89
  omlish/asyncs/anyio.py,sha256=gfpx-D8QGmUfhnQxHEaHXcAP8zSMQjcGw4COFTGNnHI,8021
@@ -329,7 +329,7 @@ omlish/io/abc.py,sha256=Cxs8KB1B_69rxpUYxI-MTsilAmNooJJn3w07DKqYKkE,1255
329
329
  omlish/io/buffers.py,sha256=qo1hCqTfKvlbSmddneporqCtW0rZJ_Mv2GrQTI1Hbk0,5636
330
330
  omlish/io/pyio.py,sha256=q4RBFVpBE5PYjnGPGT-_4pcZb7dFJmLJ4LtI8OoDRQY,95433
331
331
  omlish/io/trampoline.py,sha256=oUKTQg1F5xQS1431Kt7MbK-NZpX509ubcXU-s86xJr8,7171
332
- omlish/io/compress/__init__.py,sha256=qV-aDfPWykTMYcoQmE8THZ4KFDRzqwN3QPPNEJVarXY,86
332
+ omlish/io/compress/__init__.py,sha256=fJFPT4ONfqxmsA4jR6qbMt2woIyyEgnc_qOWK9o1kII,247
333
333
  omlish/io/compress/abc.py,sha256=P9YoQX8XYoq2UfBsinKLUuwwqV1ODUIJzjTraRWGF1M,3090
334
334
  omlish/io/compress/adapters.py,sha256=LJHhjwMHXstoLyX_q0QhGoBAcqyYGWfzhzQbGBXHzHY,6148
335
335
  omlish/io/compress/base.py,sha256=zwPnicyrEY-zersxdhxGHXxn02ycl8ew2uZXEecJea4,615
@@ -373,7 +373,7 @@ omlish/lang/maybes.py,sha256=1RN7chX_x2XvgUwryZRz0W7hAX-be3eEFcFub5vvf6M,3417
373
373
  omlish/lang/objects.py,sha256=LOC3JvX1g5hPxJ7Sv2TK9kNkAo9c8J-Jw2NmClR_rkA,4576
374
374
  omlish/lang/resolving.py,sha256=OuN2mDTPNyBUbcrswtvFKtj4xgH4H4WglgqSKv3MTy0,1606
375
375
  omlish/lang/resources.py,sha256=N64KeVE-rYMxqBBRp91qzgVqpOVR2uX7k1WlS_bo5hM,2681
376
- omlish/lang/strings.py,sha256=BsciSYnckD4vGtC6kmtnugR9IN6CIHdcjO4nZu-pSAw,3898
376
+ omlish/lang/strings.py,sha256=qnKLDEkp6zrrjq3ClzY1qubi1I2Vjf8HZfSlSCbmvi8,4019
377
377
  omlish/lang/sys.py,sha256=UoZz_PJYVKLQAKqYxxn-LHz1okK_38I__maZgnXMcxU,406
378
378
  omlish/lang/timeouts.py,sha256=vECdWYhc_IZgcal1Ng1Y42wf2FV3KAx-i8As-MgGHIQ,1186
379
379
  omlish/lang/typing.py,sha256=Zdad9Zv0sa-hIaUXPrzPidT7sDVpRcussAI7D-j-I1c,3296
@@ -406,7 +406,7 @@ omlish/lite/reflect.py,sha256=pzOY2PPuHH0omdtglkN6DheXDrGopdL3PtTJnejyLFU,2189
406
406
  omlish/lite/resources.py,sha256=YNSmX1Ohck1aoWRs55a-o5ChVbFJIQhtbqE-XwF55Oc,326
407
407
  omlish/lite/runtime.py,sha256=XQo408zxTdJdppUZqOWHyeUR50VlCpNIExNGHz4U6O4,459
408
408
  omlish/lite/secrets.py,sha256=3Mz3V2jf__XU9qNHcH56sBSw95L3U2UPL24bjvobG0c,816
409
- omlish/lite/strings.py,sha256=nGWaOi9LzTjkc5kPN2IqsVN8PUw8m_2yllTGRUQU5PI,1983
409
+ omlish/lite/strings.py,sha256=QGxT1Yh4oI8ycsfeobxnjEhvDob_GiAKLeIhZwo1j24,1986
410
410
  omlish/lite/types.py,sha256=fP5EMyBdEp2LmDxcHjUDtwAMdR06ISr9lKOL7smWfHM,140
411
411
  omlish/lite/typing.py,sha256=U3-JaEnkDSYxK4tsu_MzUn3RP6qALBe5FXQXpD-licE,1090
412
412
  omlish/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -494,7 +494,7 @@ omlish/specs/jmespath/LICENSE,sha256=IH-ZZlZkS8XMkf_ubNVD1aYHQ2l_wd0tmHtXrCcYpRU
494
494
  omlish/specs/jmespath/__init__.py,sha256=9tsrquw1kXe1KAhTP3WeL0GlGBiTguQVxsC-lUYTWP4,2087
495
495
  omlish/specs/jmespath/__main__.py,sha256=wIXm6bs08etNG_GZlN2rBkADPb0rKfL2HSkm8spnpxw,200
496
496
  omlish/specs/jmespath/ast.py,sha256=XhcUGodHIdsY3-hVZEfpeW6LBehRjLbxVFXkMfZhRdk,5386
497
- omlish/specs/jmespath/cli.py,sha256=RYVTFVEwIFFZ8jYOsvaadzyFmweZxpENQfCe79iMa5U,2205
497
+ omlish/specs/jmespath/cli.py,sha256=3KZwgbPXjJF_yd8H40f0vCNTNkcYLGbV7OQjp1etOdg,2182
498
498
  omlish/specs/jmespath/exceptions.py,sha256=Co1HiUBPFNwFgZY3FV_ayuZoSgZIAmDcImImxauYNxc,4435
499
499
  omlish/specs/jmespath/functions.py,sha256=lE_MlW5rDQirDCE9HtcAG-17kuHhH36RaPaQfk97xDY,22595
500
500
  omlish/specs/jmespath/lexer.py,sha256=hlPGCXPzGhd9ySj-z2cGTbyC9z3e0Io78IMYJZSEwNk,12647
@@ -609,9 +609,9 @@ omlish/text/indent.py,sha256=YjtJEBYWuk8--b9JU_T6q4yxV85_TR7VEVr5ViRCFwk,1336
609
609
  omlish/text/minja.py,sha256=jZC-fp3Xuhx48ppqsf2Sf1pHbC0t8XBB7UpUUoOk2Qw,5751
610
610
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
611
611
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
612
- omlish-0.0.0.dev209.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
613
- omlish-0.0.0.dev209.dist-info/METADATA,sha256=FjfbdnxVwRrgkC_Q2RzHSOYVJU_zpvpdro5xBvOxTPk,4264
614
- omlish-0.0.0.dev209.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
615
- omlish-0.0.0.dev209.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
616
- omlish-0.0.0.dev209.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
617
- omlish-0.0.0.dev209.dist-info/RECORD,,
612
+ omlish-0.0.0.dev211.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
613
+ omlish-0.0.0.dev211.dist-info/METADATA,sha256=5eXBkL9XUJsMuIZofsOEhTgJU-bOtX_KH188PXyq2aw,4264
614
+ omlish-0.0.0.dev211.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
615
+ omlish-0.0.0.dev211.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
616
+ omlish-0.0.0.dev211.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
617
+ omlish-0.0.0.dev211.dist-info/RECORD,,