omlish 0.0.0.dev100__py3-none-any.whl → 0.0.0.dev102__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omlish/__about__.py +2 -2
- omlish/collections/__init__.py +26 -7
- omlish/collections/cache/__init__.py +19 -11
- omlish/lang/__init__.py +1 -0
- omlish/lang/imports.py +84 -0
- omlish/term.py +7 -2
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/RECORD +12 -12
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/WHEEL +0 -0
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev100.dist-info → omlish-0.0.0.dev102.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
omlish/collections/__init__.py
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# ruff: noqa: I001
|
2
|
+
import typing as _ta
|
3
|
+
|
4
|
+
from .. import lang as _lang
|
5
|
+
|
6
|
+
|
1
7
|
from .coerce import ( # noqa
|
2
8
|
abs_set,
|
3
9
|
abs_set_of,
|
@@ -74,10 +80,16 @@ from .persistent import ( # noqa
|
|
74
80
|
PersistentMap,
|
75
81
|
)
|
76
82
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
83
|
+
if _ta.TYPE_CHECKING:
|
84
|
+
from .skiplist import ( # noqa
|
85
|
+
SkipList,
|
86
|
+
SkipListDict,
|
87
|
+
)
|
88
|
+
else:
|
89
|
+
_lang.proxy_init(globals(), '.skiplist', [
|
90
|
+
'SkipList',
|
91
|
+
'SkipListDict',
|
92
|
+
])
|
81
93
|
|
82
94
|
from .sorted import ( # noqa
|
83
95
|
SortedCollection,
|
@@ -86,9 +98,16 @@ from .sorted import ( # noqa
|
|
86
98
|
SortedMutableMapping,
|
87
99
|
)
|
88
100
|
|
89
|
-
|
90
|
-
|
91
|
-
|
101
|
+
if _ta.TYPE_CHECKING:
|
102
|
+
from .treapmap import ( # noqa
|
103
|
+
TreapMap,
|
104
|
+
new_treap_map,
|
105
|
+
)
|
106
|
+
else:
|
107
|
+
_lang.proxy_init(globals(), '.treapmap', [
|
108
|
+
'TreapMap',
|
109
|
+
'new_treap_map',
|
110
|
+
])
|
92
111
|
|
93
112
|
from .unmodifiable import ( # noqa
|
94
113
|
Unmodifiable,
|
@@ -1,11 +1,19 @@
|
|
1
|
-
from .descriptor import
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
from .impl import
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
from .descriptor import ( # noqa
|
2
|
+
Ignore,
|
3
|
+
Scope,
|
4
|
+
cache,
|
5
|
+
ignore,
|
6
|
+
)
|
7
|
+
|
8
|
+
from .impl import ( # noqa
|
9
|
+
LFU,
|
10
|
+
LRI,
|
11
|
+
LRU,
|
12
|
+
new_cache,
|
13
|
+
)
|
14
|
+
|
15
|
+
from .types import ( # noqa
|
16
|
+
Cache,
|
17
|
+
Eviction,
|
18
|
+
OverweightError,
|
19
|
+
)
|
omlish/lang/__init__.py
CHANGED
omlish/lang/imports.py
CHANGED
@@ -237,3 +237,87 @@ def _trigger_conditional_imports(package: str) -> None:
|
|
237
237
|
_REGISTERED_CONDITIONAL_IMPORTS[package] = None
|
238
238
|
for tn in tns:
|
239
239
|
__import__(tn)
|
240
|
+
|
241
|
+
|
242
|
+
##
|
243
|
+
|
244
|
+
|
245
|
+
class NamePackage(ta.NamedTuple):
|
246
|
+
name: str
|
247
|
+
package: str
|
248
|
+
|
249
|
+
|
250
|
+
class _ProxyInit:
|
251
|
+
def __init__(
|
252
|
+
self,
|
253
|
+
name_package: NamePackage,
|
254
|
+
*,
|
255
|
+
globals: ta.MutableMapping[str, ta.Any] | None = None, # noqa
|
256
|
+
update_globals: bool = False,
|
257
|
+
) -> None:
|
258
|
+
super().__init__()
|
259
|
+
|
260
|
+
self._name_package = name_package
|
261
|
+
self._globals = globals
|
262
|
+
self._update_globals = update_globals
|
263
|
+
|
264
|
+
self._pkgs_by_attr: dict[str, str] = {}
|
265
|
+
self._mods_by_pkgs: dict[str, ta.Any] = {}
|
266
|
+
|
267
|
+
@property
|
268
|
+
def name_package(self) -> NamePackage:
|
269
|
+
return self._name_package
|
270
|
+
|
271
|
+
def add(self, package: str, attrs: ta.Iterable[str]) -> None:
|
272
|
+
if isinstance(attrs, str):
|
273
|
+
raise TypeError(attrs)
|
274
|
+
for attr in attrs:
|
275
|
+
self._pkgs_by_attr[attr] = package
|
276
|
+
|
277
|
+
def get(self, attr: str) -> ta.Any:
|
278
|
+
try:
|
279
|
+
pkg = self._pkgs_by_attr[attr]
|
280
|
+
except KeyError:
|
281
|
+
raise AttributeError(attr) # noqa
|
282
|
+
|
283
|
+
try:
|
284
|
+
mod = self._mods_by_pkgs[pkg]
|
285
|
+
except KeyError:
|
286
|
+
mod = importlib.import_module(pkg, package=self.name_package.package)
|
287
|
+
|
288
|
+
val = getattr(mod, attr)
|
289
|
+
|
290
|
+
if self._update_globals and self._globals is not None:
|
291
|
+
self._globals[attr] = val
|
292
|
+
|
293
|
+
return val
|
294
|
+
|
295
|
+
|
296
|
+
def proxy_init(
|
297
|
+
globals: ta.MutableMapping[str, ta.Any], # noqa
|
298
|
+
package: str,
|
299
|
+
attrs: ta.Iterable[str],
|
300
|
+
) -> None:
|
301
|
+
if isinstance(attrs, str):
|
302
|
+
raise TypeError(attrs)
|
303
|
+
|
304
|
+
init_name_package = NamePackage(
|
305
|
+
globals['__name__'],
|
306
|
+
globals['__package__'],
|
307
|
+
)
|
308
|
+
|
309
|
+
pi: _ProxyInit
|
310
|
+
try:
|
311
|
+
pi = globals['__proxy_init__']
|
312
|
+
except KeyError:
|
313
|
+
pi = _ProxyInit(
|
314
|
+
init_name_package,
|
315
|
+
globals=globals,
|
316
|
+
)
|
317
|
+
globals['__proxy_init__'] = pi
|
318
|
+
globals['__getattr__'] = pi.get
|
319
|
+
else:
|
320
|
+
if pi.name_package != init_name_package:
|
321
|
+
raise Exception(f'Wrong init name: {pi.name_package=} != {init_name_package=}')
|
322
|
+
|
323
|
+
pi.add(package, attrs)
|
omlish/term.py
CHANGED
@@ -320,9 +320,13 @@ def progress_bar(
|
|
320
320
|
*,
|
321
321
|
no_tty_check: bool = False,
|
322
322
|
total: int | None = None,
|
323
|
+
out: ta.TextIO | None = None,
|
323
324
|
**kwargs: ta.Any,
|
324
325
|
) -> ta.Generator[T, None, None]:
|
325
|
-
if
|
326
|
+
if out is None:
|
327
|
+
out = sys.stdout
|
328
|
+
|
329
|
+
if not no_tty_check and not out.isatty():
|
326
330
|
yield from seq
|
327
331
|
return
|
328
332
|
|
@@ -332,6 +336,7 @@ def progress_bar(
|
|
332
336
|
|
333
337
|
pb = ProgressBar(
|
334
338
|
total=total,
|
339
|
+
out=out,
|
335
340
|
**kwargs,
|
336
341
|
)
|
337
342
|
|
@@ -340,7 +345,7 @@ def progress_bar(
|
|
340
345
|
yield item
|
341
346
|
|
342
347
|
pb.print(complete=True)
|
343
|
-
|
348
|
+
out.write('\n')
|
344
349
|
|
345
350
|
|
346
351
|
##
|
@@ -1,5 +1,5 @@
|
|
1
1
|
omlish/.manifests.json,sha256=hTFp9tvE72BxKloIq1s1SS0LRQlIsvMtO69Sbc47rKg,1704
|
2
|
-
omlish/__about__.py,sha256=
|
2
|
+
omlish/__about__.py,sha256=pBJkbHIJJzAOlkMivUCm04lP4HEtJB4MsycgG36bN4s,3352
|
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
|
@@ -18,7 +18,7 @@ omlish/multiprocessing.py,sha256=QZT4C7I-uThCAjaEY3xgUYb-5GagUlnE4etN01LDyU4,518
|
|
18
18
|
omlish/os.py,sha256=5nJ-a9JKSMoaZVZ1eOa5BAbfL7o7CF7ue_PyJwufnwY,1460
|
19
19
|
omlish/runmodule.py,sha256=PWvuAaJ9wQQn6bx9ftEL3_d04DyotNn8dR_twm2pgw0,700
|
20
20
|
omlish/sync.py,sha256=AqwIfIuCMVHLwlJUa7dmaSjfA4sM5AYPCD5-nsz3XVQ,1516
|
21
|
-
omlish/term.py,sha256=
|
21
|
+
omlish/term.py,sha256=BXJSE9gfM461bh4z_gysx0oavZSafqcQs5ayZK-kTUo,9284
|
22
22
|
omlish/antlr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
23
|
omlish/antlr/_runtime/BufferedTokenStream.py,sha256=1Rnhm62MZCWSuQeRs7lRUbdtdyo7Gyg8r4gAETjv-cE,10793
|
24
24
|
omlish/antlr/_runtime/CommonTokenFactory.py,sha256=QrSSTH0gYhOpPeOHqrs6-2g1PGcgYvjhR6J6pynKLOc,2147
|
@@ -94,7 +94,7 @@ omlish/bootstrap/harness.py,sha256=VW8YP-yENGyXIuJ8GL_xintArF13nafwpz-iAghPt34,1
|
|
94
94
|
omlish/bootstrap/main.py,sha256=yZhOHDDlj4xB5a89dRdT8z58FsqqnpoBg1-tvY2CJe4,5903
|
95
95
|
omlish/bootstrap/marshal.py,sha256=ZxdAeMNd2qXRZ1HUK89HmEhz8tqlS9OduW34QBscKw0,516
|
96
96
|
omlish/bootstrap/sys.py,sha256=iLHUNIuIPv-k-Mc6aHj5sSET78olCVt7t0HquFDO4iQ,8762
|
97
|
-
omlish/collections/__init__.py,sha256=
|
97
|
+
omlish/collections/__init__.py,sha256=qIznS1cnXBxQsZk871DDWOnQfxk_u1PZ_VuIWxqPuxw,2134
|
98
98
|
omlish/collections/_abc.py,sha256=sP7BpTVhx6s6C59mTFeosBi4rHOWC6tbFBYbxdZmvh0,2365
|
99
99
|
omlish/collections/_io_abc.py,sha256=Cxs8KB1B_69rxpUYxI-MTsilAmNooJJn3w07DKqYKkE,1255
|
100
100
|
omlish/collections/coerce.py,sha256=o11AMrUiyoadd8WkdqeKPIpXf2xd0LyylzNCyJivCLU,7036
|
@@ -112,7 +112,7 @@ omlish/collections/treap.py,sha256=A09ZPacGyJlyRB-Wi4TNj3tE0w-RpFNliPgpDaa6Vwg,7
|
|
112
112
|
omlish/collections/treapmap.py,sha256=TxOM-ZRF5PK2xe5wRIhESNt7DGh9b_MeZfE7HLkCOs4,5804
|
113
113
|
omlish/collections/unmodifiable.py,sha256=QmUEi9IBXqiM_KGgH2rqg15VmkHJo1MZ6kwq2twEMho,4750
|
114
114
|
omlish/collections/utils.py,sha256=9o9STwzAn5YjZRZ9ns1kuo7NgLXLaoVPFu6AJd-3JT8,4336
|
115
|
-
omlish/collections/cache/__init__.py,sha256=
|
115
|
+
omlish/collections/cache/__init__.py,sha256=D1gO71VcwxFTZP9gAc9isHfg_TEdalwhsJcgGLvS9hg,233
|
116
116
|
omlish/collections/cache/descriptor.py,sha256=t-1Gh4DTABDuNmeDJlpoW4LV3gi_uSlBd9ZfBINfYCM,5023
|
117
117
|
omlish/collections/cache/impl.py,sha256=nQox5kChhns9h2a5gnX-ayQGBQJ5-B1aZkLQ2Aej19g,15137
|
118
118
|
omlish/collections/cache/types.py,sha256=yNjwd6CGyTJQdxN2CQxFqqBAlcs1Z7vvNV-aU1K7p8E,685
|
@@ -257,7 +257,7 @@ omlish/inject/impl/privates.py,sha256=alpCYyk5VJ9lJknbRH2nLVNFYVvFhkj-VC1Vco3zCF
|
|
257
257
|
omlish/inject/impl/providers.py,sha256=QnwhsujJFIHC0JTgd2Wlo1kP53i3CWTrj1nKU2DNxwg,2375
|
258
258
|
omlish/inject/impl/proxy.py,sha256=1ko0VaKqzu9UG8bIldp9xtUrAVUOFTKWKTjOCqIGr4s,1636
|
259
259
|
omlish/inject/impl/scopes.py,sha256=ASfULXgP_ETlsAqFJfrZmyEaZt64Zr8tNn5ScA-EoXk,5900
|
260
|
-
omlish/lang/__init__.py,sha256=
|
260
|
+
omlish/lang/__init__.py,sha256=1BTfyRGPq8ahztMT3xP34EcN2zV3bInCqc1XrUygZh8,3704
|
261
261
|
omlish/lang/cached.py,sha256=92TvRZQ6sWlm7dNn4hgl7aWKbX0J1XUEo3DRjBpgVQk,7834
|
262
262
|
omlish/lang/clsdct.py,sha256=AjtIWLlx2E6D5rC97zQ3Lwq2SOMkbg08pdO_AxpzEHI,1744
|
263
263
|
omlish/lang/cmp.py,sha256=5vbzWWbqdzDmNKAGL19z6ZfUKe5Ci49e-Oegf9f4BsE,1346
|
@@ -266,7 +266,7 @@ omlish/lang/datetimes.py,sha256=ehI_DhQRM-bDxAavnp470XcekbbXc4Gdw9y1KpHDJT0,223
|
|
266
266
|
omlish/lang/descriptors.py,sha256=RRBbkMgTzg82fFFE4D0muqobpM-ZZaOta6yB1lpX3s8,6617
|
267
267
|
omlish/lang/exceptions.py,sha256=qJBo3NU1mOWWm-NhQUHCY5feYXR3arZVyEHinLsmRH4,47
|
268
268
|
omlish/lang/functions.py,sha256=kkPfcdocg-OmyN7skIqrFxNvqAv89Zc_kXKYAN8vw8g,3895
|
269
|
-
omlish/lang/imports.py,sha256=
|
269
|
+
omlish/lang/imports.py,sha256=zxhoDw4d9F0GcKZGFAe1kU8AiTvGoWLVsqU2uggi_Rk,8729
|
270
270
|
omlish/lang/iterables.py,sha256=xRwktm6i2RHSb_ELfAXdjITIfE69qDyMEzgeZqvQXiU,2386
|
271
271
|
omlish/lang/maybes.py,sha256=NYHZDjqDtwPMheDrj2VtUVujxRPf8Qpgk4ZlZCTvBZc,3492
|
272
272
|
omlish/lang/objects.py,sha256=LOC3JvX1g5hPxJ7Sv2TK9kNkAo9c8J-Jw2NmClR_rkA,4576
|
@@ -458,9 +458,9 @@ omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
|
|
458
458
|
omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
|
459
459
|
omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
|
460
460
|
omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
|
461
|
-
omlish-0.0.0.
|
462
|
-
omlish-0.0.0.
|
463
|
-
omlish-0.0.0.
|
464
|
-
omlish-0.0.0.
|
465
|
-
omlish-0.0.0.
|
466
|
-
omlish-0.0.0.
|
461
|
+
omlish-0.0.0.dev102.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
462
|
+
omlish-0.0.0.dev102.dist-info/METADATA,sha256=rMtcXpbFBE9hmWF4JaCACQPrjmk1VOMvJcugXSjtbOw,4000
|
463
|
+
omlish-0.0.0.dev102.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
464
|
+
omlish-0.0.0.dev102.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
|
465
|
+
omlish-0.0.0.dev102.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
466
|
+
omlish-0.0.0.dev102.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|