omlish 0.0.0.dev312__py3-none-any.whl → 0.0.0.dev314__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.
- omlish/__about__.py +2 -2
- omlish/collections/hasheq.py +2 -0
- omlish/collections/sorted/skiplist.py +1 -0
- omlish/lang/__init__.py +3 -1
- omlish/lang/cached/function.py +1 -0
- omlish/lang/functions.py +20 -6
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/RECORD +12 -12
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/WHEEL +1 -1
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/licenses/LICENSE +0 -0
- {omlish-0.0.0.dev312.dist-info → omlish-0.0.0.dev314.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
omlish/collections/hasheq.py
CHANGED
@@ -57,6 +57,7 @@ class SkipList(SortedCollection[T]):
|
|
57
57
|
comparator = SortedCollection.default_comparator
|
58
58
|
self._compare = comparator
|
59
59
|
self._max_height = max_height
|
60
|
+
|
60
61
|
self._head = SkipList._Node(None, self._max_height)
|
61
62
|
self._height = 1
|
62
63
|
self._head.next = [None] * self._max_height
|
omlish/lang/__init__.py
CHANGED
@@ -160,6 +160,7 @@ from .functions import ( # noqa
|
|
160
160
|
as_async,
|
161
161
|
call_with,
|
162
162
|
coalesce,
|
163
|
+
cond_kw,
|
163
164
|
constant,
|
164
165
|
finally_,
|
165
166
|
identity,
|
@@ -171,6 +172,7 @@ from .functions import ( # noqa
|
|
171
172
|
maybe_call,
|
172
173
|
new_function,
|
173
174
|
new_function_kwargs,
|
175
|
+
nullary_constant,
|
174
176
|
opt_coalesce,
|
175
177
|
opt_fn,
|
176
178
|
opt_kw,
|
@@ -178,7 +180,7 @@ from .functions import ( # noqa
|
|
178
180
|
raise_,
|
179
181
|
raising,
|
180
182
|
recurse,
|
181
|
-
|
183
|
+
truthy_kw,
|
182
184
|
try_,
|
183
185
|
void,
|
184
186
|
)
|
omlish/lang/cached/function.py
CHANGED
@@ -7,6 +7,7 @@ TODO:
|
|
7
7
|
- also just riic
|
8
8
|
- !! reconcile A().f() with A.f(A())
|
9
9
|
- unbound descriptor *should* still hit instance cache
|
10
|
+
- significant_kwargs_order=False - stdlib has significant kwarg order
|
10
11
|
- integrate / expose with collections.cache
|
11
12
|
- weakrefs (selectable by arg)
|
12
13
|
- more rigorous descriptor pickling
|
omlish/lang/functions.py
CHANGED
@@ -26,6 +26,7 @@ def call_with(fn: ta.Any, *args: ta.Any, **kwargs: ta.Any) -> ta.Callable[[T], T
|
|
26
26
|
def inner(obj):
|
27
27
|
fn(obj, *args, **kwargs)
|
28
28
|
return obj
|
29
|
+
|
29
30
|
return inner
|
30
31
|
|
31
32
|
|
@@ -55,6 +56,7 @@ def raise_(o: BaseException) -> ta.NoReturn:
|
|
55
56
|
def raising(o: BaseException) -> ta.Callable[..., ta.NoReturn]:
|
56
57
|
def inner(*args, **kwargs):
|
57
58
|
raise o
|
59
|
+
|
58
60
|
return inner
|
59
61
|
|
60
62
|
|
@@ -97,6 +99,7 @@ def opt_fn(fn: ta.Callable[[F], T]) -> ta.Callable[[F | None], T | None]:
|
|
97
99
|
return fn(v)
|
98
100
|
else:
|
99
101
|
return None
|
102
|
+
|
100
103
|
return inner
|
101
104
|
|
102
105
|
|
@@ -115,7 +118,7 @@ class constant(_constant[T]): # noqa
|
|
115
118
|
return self._obj
|
116
119
|
|
117
120
|
|
118
|
-
class
|
121
|
+
class nullary_constant(_constant[T]): # noqa
|
119
122
|
def __call__(self) -> T:
|
120
123
|
return self._obj
|
121
124
|
|
@@ -165,6 +168,7 @@ def as_async(fn: ta.Callable[P, T]) -> ta.Callable[P, ta.Awaitable[T]]:
|
|
165
168
|
@functools.wraps(fn)
|
166
169
|
async def inner(*args, **kwargs):
|
167
170
|
return fn(*args, **kwargs)
|
171
|
+
|
168
172
|
return inner
|
169
173
|
|
170
174
|
|
@@ -180,19 +184,20 @@ def periodically(
|
|
180
184
|
initial: ta.Any = _MISSING,
|
181
185
|
*,
|
182
186
|
include_runtime: bool = False,
|
187
|
+
clock: ta.Callable[[], float] = time.monotonic,
|
183
188
|
) -> CallableT:
|
184
|
-
nxt =
|
189
|
+
nxt = clock() + interval_s
|
185
190
|
ret = initial
|
186
191
|
|
187
192
|
@functools.wraps(fn)
|
188
193
|
def inner(*args, **kwargs):
|
189
194
|
nonlocal nxt, ret
|
190
|
-
if
|
195
|
+
if clock() >= nxt or ret is _MISSING:
|
191
196
|
if include_runtime:
|
192
|
-
nxt =
|
197
|
+
nxt = clock() + interval_s
|
193
198
|
ret = fn(*args, **kwargs)
|
194
199
|
if not include_runtime:
|
195
|
-
nxt =
|
200
|
+
nxt = clock() + interval_s
|
196
201
|
return ret
|
197
202
|
|
198
203
|
return inner # type: ignore
|
@@ -208,6 +213,7 @@ class Args:
|
|
208
213
|
|
209
214
|
def __init__(self, *args: ta.Any, **kwargs: ta.Any) -> None:
|
210
215
|
super().__init__()
|
216
|
+
|
211
217
|
self.args = args
|
212
218
|
self.kwargs = kwargs
|
213
219
|
|
@@ -248,10 +254,18 @@ def opt_coalesce(*vs: T | None) -> T | None:
|
|
248
254
|
##
|
249
255
|
|
250
256
|
|
251
|
-
def
|
257
|
+
def cond_kw(cond: ta.Callable[[T], bool], **kwargs: T) -> dict[str, T]:
|
258
|
+
return {k: v for k, v in kwargs.items() if cond(v)}
|
259
|
+
|
260
|
+
|
261
|
+
def opt_kw(**kwargs: T | None) -> dict[str, T]:
|
252
262
|
return {k: v for k, v in kwargs.items() if v is not None}
|
253
263
|
|
254
264
|
|
265
|
+
def truthy_kw(**kwargs: T) -> dict[str, T]:
|
266
|
+
return {k: v for k, v in kwargs.items() if v}
|
267
|
+
|
268
|
+
|
255
269
|
##
|
256
270
|
|
257
271
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
omlish/.manifests.json,sha256=orgsRvtpHu8tdhaCvlP9v3P495OJopYYiHKjK68WtWg,8587
|
2
|
-
omlish/__about__.py,sha256=
|
2
|
+
omlish/__about__.py,sha256=KdW3YR5-xk4PrgPu9drjg1QCLSwN66eeNnfbVgzpF-c,3478
|
3
3
|
omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
|
4
4
|
omlish/c3.py,sha256=rer-TPOFDU6fYq_AWio_AmA-ckZ8JDY5shIzQ_yXfzA,8414
|
5
5
|
omlish/cached.py,sha256=MLap_p0rdGoDIMVhXVHm1tsbcWobJF0OanoodV03Ju8,542
|
@@ -81,7 +81,7 @@ omlish/collections/abc.py,sha256=ikTJlJ5dhXjU6tlNsI0Wm0_7GaIEpe3mftpvdGY_nc8,262
|
|
81
81
|
omlish/collections/coerce.py,sha256=tAls15v_7p5bUN33R7Zbko87KW5toWHl9fRialCqyNY,7030
|
82
82
|
omlish/collections/errors.py,sha256=shcS-NCnEUudF8qC_SmO2TQyjivKlS4TDjaz_faqQ0c,44
|
83
83
|
omlish/collections/frozen.py,sha256=LMbAHYDENIQk1hvjCTvpnx66m1TalrHa4CSn8n_tsXQ,4142
|
84
|
-
omlish/collections/hasheq.py,sha256=
|
84
|
+
omlish/collections/hasheq.py,sha256=uHypfZlHhicQPvx9OOlpT9MSLwfc_mFil-WaxF9dTOo,3732
|
85
85
|
omlish/collections/identity.py,sha256=xtoczgBPYzr6r2lJS-eti2kEnN8rVDvNGDCG3TA6vRo,3405
|
86
86
|
omlish/collections/mappings.py,sha256=iXb7oq1rCQak0KgzblgrzWCJLrkfJAYHFvl9lprOVUI,2804
|
87
87
|
omlish/collections/ordered.py,sha256=7zTbrAt12rf6i33XHkQERKar258fJacaw_WbtGEBgWo,2338
|
@@ -104,7 +104,7 @@ omlish/collections/persistent/persistent.py,sha256=boBSZ9yEhVfnxxxv1LrCBzWYfHCa_
|
|
104
104
|
omlish/collections/persistent/treap.py,sha256=o7vhnn8kHde_Plk0sojlJZkkKwp8hpj2IekhcvbYqHs,7739
|
105
105
|
omlish/collections/persistent/treapmap.py,sha256=BdqZC6WvwJ0iF0rMgdoRie6PxqrApE2PKQ3j-hFLOR4,6311
|
106
106
|
omlish/collections/sorted/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
|
-
omlish/collections/sorted/skiplist.py,sha256=
|
107
|
+
omlish/collections/sorted/skiplist.py,sha256=bcTO1hZvV5EnYxBZ3YBhdewXP_2aCTZra7tJ0pA7jjo,6194
|
108
108
|
omlish/collections/sorted/sorted.py,sha256=Y_-7bA8hXG1KXEx5sS_EoLiH-Ru6ERJEsjHIcJ-8-IA,3968
|
109
109
|
omlish/concurrent/__init__.py,sha256=9p-s8MvBEYDqHIoYU3OYoe-Nni22QdkW7nhZGEukJTM,197
|
110
110
|
omlish/concurrent/executors.py,sha256=mF-rjJWzNFxwB1-_H7rHuwoImpl4FtNM6W3wcqM3NEE,1291
|
@@ -402,7 +402,7 @@ omlish/iterators/iterators.py,sha256=RxW35yQ5ed8vBQ22IqpDXFx-i5JiLQdp7-pkMZXhJJ8
|
|
402
402
|
omlish/iterators/recipes.py,sha256=wOwOZg-zWG9Zc3wcAxJFSe2rtavVBYwZOfG09qYEx_4,472
|
403
403
|
omlish/iterators/tools.py,sha256=c4hArZEVV8y9_dFfmRwakusv1cWJLT4MkTkGRjnGN5U,2556
|
404
404
|
omlish/iterators/unique.py,sha256=Nw0pSaNEcHAkve0ugfLPvJcirDOn9ECyC5wIL8JlJKI,1395
|
405
|
-
omlish/lang/__init__.py,sha256=
|
405
|
+
omlish/lang/__init__.py,sha256=7T9vv39wNkm9jb0LOpzQ1eMxtoMbltMCU554FqTZ4eY,5908
|
406
406
|
omlish/lang/attrs.py,sha256=i7euRF81uNF8QDmUVXSK_BtqLGshaMi4VVdUnMjiMwg,5050
|
407
407
|
omlish/lang/casing.py,sha256=cFUlbDdXLhwnWwcYx4qnM5c4zGX7hIRUfcjiZbxUD28,4636
|
408
408
|
omlish/lang/clsdct.py,sha256=HAGIvBSbCefzRjXriwYSBLO7QHKRv2UsE78jixOb-fA,1828
|
@@ -412,7 +412,7 @@ omlish/lang/contextmanagers.py,sha256=pN8X4ZCagqU9_xWumi8gZPdMIWlInA-_zQrkl7o5VP
|
|
412
412
|
omlish/lang/datetimes.py,sha256=mrTtA67JYpfQwSlzdPcBtvm6dAyYM_dXNnlxFwFQH0M,228
|
413
413
|
omlish/lang/descriptors.py,sha256=zBtgO9LjdSTGHNUgiIqswh78WOVoGH6KzS0NbgB1Wls,6572
|
414
414
|
omlish/lang/enums.py,sha256=F9tflHfaAoV2MpyuhZzpfX9-H55M3zNa9hCszsngEo8,111
|
415
|
-
omlish/lang/functions.py,sha256=
|
415
|
+
omlish/lang/functions.py,sha256=75JhKRNhe2iDeqN7yCdLTw_q5k1VFpdphypqb4yy2I0,6298
|
416
416
|
omlish/lang/generators.py,sha256=yd3ebG2LlA3XQImP8rplt6tSToXwMxhlGRGCkdJ87ME,5230
|
417
417
|
omlish/lang/imports.py,sha256=y9W9Y-d_cQ35QCLuSIPoa6vnEqSErFCz8b-34IH128U,10552
|
418
418
|
omlish/lang/iterables.py,sha256=StoGp9yaP3njdLKHoWYcEevO3eE8SHEPYl5_avZob24,2149
|
@@ -427,7 +427,7 @@ omlish/lang/strings.py,sha256=kJmRFd1D36xXcjd9MdB12BCwF_-MVhNr-TpWj7hMi_4,4252
|
|
427
427
|
omlish/lang/sys.py,sha256=b4qOPiJZQru_mbb04FNfOjYWUxlV2becZOoc-yya_rQ,411
|
428
428
|
omlish/lang/typing.py,sha256=Zdad9Zv0sa-hIaUXPrzPidT7sDVpRcussAI7D-j-I1c,3296
|
429
429
|
omlish/lang/cached/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
430
|
-
omlish/lang/cached/function.py,sha256=
|
430
|
+
omlish/lang/cached/function.py,sha256=gXrU4DYO952lCJpNDuSTVb83f0tVjVnaG3BY2Sqab0k,9712
|
431
431
|
omlish/lang/cached/property.py,sha256=WHYyg4-6EA86TcNMfbXTjVhjEZPc0kngt9hfY3WN5w8,2768
|
432
432
|
omlish/lang/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
433
433
|
omlish/lang/classes/abstract.py,sha256=n4rDlDraUKxPF0GtOWEFZ6mEzEDmP7Z8LSI6Jww_thw,3715
|
@@ -854,9 +854,9 @@ omlish/typedvalues/holder.py,sha256=ZTnHiw-K38ciOBLEdwgrltr7Xp8jjEs_0Lp69DH-G-o,
|
|
854
854
|
omlish/typedvalues/marshal.py,sha256=hWHRLcrGav7lvXJDtb9bNI0ickl4SKPQ6F4BbTpqw3A,4219
|
855
855
|
omlish/typedvalues/reflect.py,sha256=Ih1YgU-srUjsvBn_P7C66f73_VCvcwqE3ffeBnZBgt4,674
|
856
856
|
omlish/typedvalues/values.py,sha256=ym46I-q2QJ_6l4UlERqv3yj87R-kp8nCKMRph0xQ3UA,1307
|
857
|
-
omlish-0.0.0.
|
858
|
-
omlish-0.0.0.
|
859
|
-
omlish-0.0.0.
|
860
|
-
omlish-0.0.0.
|
861
|
-
omlish-0.0.0.
|
862
|
-
omlish-0.0.0.
|
857
|
+
omlish-0.0.0.dev314.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
858
|
+
omlish-0.0.0.dev314.dist-info/METADATA,sha256=H6zdgadrYc1EUQZ205dMIBmPuvZtkXHKEvVAu1kyHYY,4416
|
859
|
+
omlish-0.0.0.dev314.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
860
|
+
omlish-0.0.0.dev314.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
|
861
|
+
omlish-0.0.0.dev314.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
|
862
|
+
omlish-0.0.0.dev314.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|