omlish 0.0.0.dev260__py3-none-any.whl → 0.0.0.dev261__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 CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev260'
2
- __revision__ = 'a6928086771a585741f218a766bca18cea32e734'
1
+ __version__ = '0.0.0.dev261'
2
+ __revision__ = '3c82002e38d6309590759b67148331f48f2b7149'
3
3
 
4
4
 
5
5
  #
@@ -30,6 +30,9 @@ class Once:
30
30
  return True
31
31
 
32
32
 
33
+ ##
34
+
35
+
33
36
  class Lazy(ta.Generic[T]):
34
37
  def __init__(self) -> None:
35
38
  super().__init__()
@@ -4,6 +4,9 @@ import asyncio
4
4
  import typing as ta
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  class AsyncioBytesChannelTransport(asyncio.Transport):
8
11
  def __init__(self, reader: asyncio.StreamReader) -> None:
9
12
  super().__init__()
@@ -7,6 +7,9 @@ from ...lite.timeouts import Timeout
7
7
  from ...lite.timeouts import TimeoutLike
8
8
 
9
9
 
10
+ ##
11
+
12
+
10
13
  async def asyncio_wait_until_can_connect(
11
14
  host: ta.Any = None,
12
15
  port: ta.Any = None,
@@ -4,6 +4,9 @@ import asyncio
4
4
  import typing as ta
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  ASYNCIO_DEFAULT_BUFFER_LIMIT = 2 ** 16
8
11
 
9
12
 
@@ -10,6 +10,9 @@ from ...lite.timeouts import TimeoutLike
10
10
  AwaitableT = ta.TypeVar('AwaitableT', bound=ta.Awaitable)
11
11
 
12
12
 
13
+ ##
14
+
15
+
13
16
  def asyncio_maybe_timeout(
14
17
  fut: AwaitableT,
15
18
  timeout: ta.Optional[TimeoutLike] = None,
@@ -17,6 +17,9 @@ else:
17
17
  trio_asyncio = lang.proxy_import('trio_asyncio')
18
18
 
19
19
 
20
+ ##
21
+
22
+
20
23
  def check_trio_asyncio() -> None:
21
24
  if trio_asyncio.current_loop.get() is None:
22
25
  raise RuntimeError('trio_asyncio loop not running')
@@ -10,6 +10,9 @@ K = ta.TypeVar('K')
10
10
  V = ta.TypeVar('V')
11
11
 
12
12
 
13
+ ##
14
+
15
+
13
16
  class SkipList(SortedCollection[T]):
14
17
  """https://gist.github.com/icejoywoo/3bf0c54983a725fa3917"""
15
18
 
@@ -59,6 +62,8 @@ class SkipList(SortedCollection[T]):
59
62
  self._head.next = [None] * self._max_height
60
63
  self._length = 0
61
64
 
65
+ #
66
+
62
67
  def __len__(self) -> int:
63
68
  return self._length
64
69
 
@@ -68,6 +73,8 @@ class SkipList(SortedCollection[T]):
68
73
  def __contains__(self, value: T) -> bool: # type: ignore
69
74
  return self.find(value) is not None
70
75
 
76
+ #
77
+
71
78
  def _random_level(self) -> int:
72
79
  result = 1
73
80
  while random.uniform(0, 1) < 0.5 and result < self._max_height:
@@ -108,6 +115,8 @@ class SkipList(SortedCollection[T]):
108
115
  self._length += 1
109
116
  return True
110
117
 
118
+ #
119
+
111
120
  def _find(self, value: T) -> _Node | None:
112
121
  if value is None:
113
122
  raise TypeError(value)
@@ -128,6 +137,8 @@ class SkipList(SortedCollection[T]):
128
137
  return None
129
138
  return node.value # type: ignore
130
139
 
140
+ #
141
+
131
142
  def remove(self, value: T) -> bool:
132
143
  if value is None:
133
144
  raise TypeError(value)
@@ -157,6 +168,8 @@ class SkipList(SortedCollection[T]):
157
168
  self._length -= 1
158
169
  return True
159
170
 
171
+ #
172
+
160
173
  def iter(self, base: T | None = None) -> ta.Iterable[T]:
161
174
  if base is not None:
162
175
  cur = self._find(base)
@@ -187,6 +200,9 @@ class SkipList(SortedCollection[T]):
187
200
  cur = cur.prev # type: ignore
188
201
 
189
202
 
203
+ ##
204
+
205
+
190
206
  class SkipListDict(SortedListDict[K, V]):
191
207
  def __init__(self, *args, **kwargs) -> None:
192
208
  super().__init__(SkipList(comparator=SortedListDict._item_comparator), *args, **kwargs) # noqa
@@ -174,14 +174,12 @@ def field_init(
174
174
 
175
175
  value: str | None = None
176
176
  if f.default_factory is not MISSING:
177
+ locals[default_name] = f.default_factory
177
178
  if f.init:
178
- locals[default_name] = f.default_factory
179
179
  lines.append(f'if {f.name} is __dataclass_HAS_DEFAULT_FACTORY__: {f.name} = {default_name}()')
180
- value = f.name
181
180
  else:
182
- locals[default_name] = f.default_factory
183
181
  lines.append(f'{f.name} = {default_name}()')
184
- value = f.name
182
+ value = f.name
185
183
 
186
184
  elif f.init:
187
185
  if f.default is MISSING:
omlish/diag/asts.py CHANGED
@@ -15,6 +15,9 @@ else:
15
15
  executing = lang.proxy_import('executing')
16
16
 
17
17
 
18
+ ##
19
+
20
+
18
21
  class ArgsRenderer:
19
22
  """
20
23
  TODO:
@@ -50,7 +53,7 @@ class ArgsRenderer:
50
53
 
51
54
  def _get_indented_text(
52
55
  self,
53
- src: executing.Source,
56
+ src: 'executing.Source',
54
57
  node: ast.AST,
55
58
  ) -> str:
56
59
  result = src.asttokens().get_text(node)
omlish/lang/clsdct.py CHANGED
@@ -4,6 +4,9 @@ import types
4
4
  import typing as ta
5
5
 
6
6
 
7
+ ##
8
+
9
+
7
10
  _CLS_DCT_ATTR_SETS = [
8
11
  {
9
12
  '__module__',
@@ -35,8 +38,17 @@ def get_caller_cls_dct(offset: int = 0) -> ta.MutableMapping[str, ta.Any]:
35
38
  return cls_dct
36
39
 
37
40
 
41
+ ##
42
+
43
+
38
44
  class ClassDctFn:
39
- def __init__(self, fn: ta.Callable, offset: int | None = None, *, wrap=True) -> None:
45
+ def __init__(
46
+ self,
47
+ fn: ta.Callable,
48
+ offset: int | None = None,
49
+ *,
50
+ wrap: bool = True,
51
+ ) -> None:
40
52
  super().__init__()
41
53
 
42
54
  self._fn = fn
omlish/metadata.py CHANGED
@@ -7,6 +7,7 @@ TODO:
7
7
  - unwrap instances of objects to their types?
8
8
  - merge mro?
9
9
  - are these better left up to callers? too usecase-specific to favor either way?
10
+ - cls_dct_fn?
10
11
  """
11
12
  import threading
12
13
  import types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omlish
3
- Version: 0.0.0.dev260
3
+ Version: 0.0.0.dev261
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=x26AIwDzScUvnX-p4xlq6Zc5QYrAo0Vmgf1qHc1KL_M,8253
2
- omlish/__about__.py,sha256=TYkbJu3PdyieNOUbdum9MiWF15ojfJww_QglLmLSmD8,3380
2
+ omlish/__about__.py,sha256=ZHsfTvh2tqA6F3h9CJiRPE2DyXkN-QqoPblX54bfc2A,3380
3
3
  omlish/__init__.py,sha256=SsyiITTuK0v74XpKV8dqNaCmjOlan1JZKrHQv5rWKPA,253
4
4
  omlish/c3.py,sha256=ubu7lHwss5V4UznbejAI0qXhXahrU01MysuHOZI9C4U,8116
5
5
  omlish/cached.py,sha256=MLap_p0rdGoDIMVhXVHm1tsbcWobJF0OanoodV03Ju8,542
@@ -8,7 +8,7 @@ omlish/datetimes.py,sha256=HajeM1kBvwlTa-uR1TTZHmZ3zTPnnUr1uGGQhiO1XQ0,2152
8
8
  omlish/defs.py,sha256=9uUjJuVIbCBL3g14fyzAp-9gH935MFofvlfOGwcBIaM,4913
9
9
  omlish/dynamic.py,sha256=xQ8LlOt_fUPApg-yz7-gNq8JdVgTqJ0_R6vhJq2WbpI,6522
10
10
  omlish/libc.py,sha256=8K4c66YV1ziJerl5poAAYCmsV-VSsHkT3EHhPW04ufg,15639
11
- omlish/metadata.py,sha256=q8UG-fpcXhEF7BZnhVikIE_IHyud9-8YT8iv646zU2s,3589
11
+ omlish/metadata.py,sha256=HvZ6ItMpEmnE-X2d5Q6J17sBiG_qOyWB8DJrS9RFZpY,3604
12
12
  omlish/runmodule.py,sha256=PWvuAaJ9wQQn6bx9ftEL3_d04DyotNn8dR_twm2pgw0,700
13
13
  omlish/shlex.py,sha256=bsW2XUD8GiMTUTDefJejZ5AyqT1pTgWMPD0BMoF02jE,248
14
14
  omlish/sync.py,sha256=-2gVJZFl8hvp7jvrnX8GcZVOecqAym6AcyK1QtMR9Ic,2979
@@ -96,23 +96,23 @@ omlish/asyncs/buffers.py,sha256=ip9oDRT-XbBDpeAa72osv-TtZXxdF_ggW4lHkGKxCwE,1418
96
96
  omlish/asyncs/flavors.py,sha256=1mNxGNRVmjUHzA13K5ht8vdJv4CLEmzYTQ6BZXr1520,4866
97
97
  omlish/asyncs/sync.py,sha256=qfK8zRMQ0B_huC-6CsMG8vhKB0ktw7Ttq0NnySdWPwQ,2039
98
98
  omlish/asyncs/trio.py,sha256=fmZ5b_lKdVV8NQ3euCUutWgnkqTFzSnOjvJSA_jvmrE,367
99
- omlish/asyncs/trio_asyncio.py,sha256=oqdOHy0slj9PjVxaDf3gJkq9AAgg7wYZbB469jOftVw,1327
99
+ omlish/asyncs/trio_asyncio.py,sha256=b6H5H32pB79Uz5xvWEmuhXTJgTAeKFHBHzocv_Rpt5A,1332
100
100
  omlish/asyncs/utils.py,sha256=1QQMQ1WJBG86QLu4hQZRBFeUg-AypCVhlB8-niHHE4s,400
101
101
  omlish/asyncs/anyio/__init__.py,sha256=AkwRD3XFWmEzBeHV-eAzwpA4F04bl7xyyapigrxMR8g,1747
102
102
  omlish/asyncs/anyio/backends.py,sha256=jJIymWoiedaEJJm82gvKiJ41EWLQZ-bcyNHpbDpKKi4,1584
103
103
  omlish/asyncs/anyio/futures.py,sha256=Nm1gLerZEnHk-rlsmr0UfK168IWIK6zA8EebZFtoY_E,2052
104
104
  omlish/asyncs/anyio/signals.py,sha256=ySSut5prdnoy0-5Ws5V1M4cC2ON_vY550vU10d2NHk8,893
105
105
  omlish/asyncs/anyio/streams.py,sha256=gNRAcHR0L8OtNioqKFbq0Z_apYAWKHFipZ2MUBp8Vg0,2228
106
- omlish/asyncs/anyio/sync.py,sha256=maggE0mH-TxmefX3vfa27DuDEaE5-yQKn84Mj3mOSVU,1569
106
+ omlish/asyncs/anyio/sync.py,sha256=ZmSNhSsEkPwlXThrpefhtVTxw4GJ9F0P-yKyo5vbbSk,1574
107
107
  omlish/asyncs/anyio/utils.py,sha256=X2Rz1DGrCJ0zkt1O5cHoMRaYKTPndBj6dzLhb09mVtE,1672
108
108
  omlish/asyncs/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
109
  omlish/asyncs/asyncio/all.py,sha256=EksCHjRQKobiGrxuDW72IaH53WJMs7rdj_ZDBI3iKcg,315
110
110
  omlish/asyncs/asyncio/asyncio.py,sha256=mDjYNm1cylUhQ8slWXwdPoXasuWfafjzu78GHt2Mdig,2437
111
- omlish/asyncs/asyncio/channels.py,sha256=ZbmsEmdK1fV96liHdcVpRqA2dAMkXJt4Q3rFAg3YOIw,1074
112
- omlish/asyncs/asyncio/sockets.py,sha256=Ni5O80fNAccSMAGrlSkZ923Nawxi3FHoXrKj4nr0xlU,1266
113
- omlish/asyncs/asyncio/streams.py,sha256=Uc9PCWSfBqrK2kdVtfjjQU1eaYTWYmZm8QISDj2xiuw,1004
111
+ omlish/asyncs/asyncio/channels.py,sha256=X3S951YTjTRDguMSQRlfu74mPuWkNd2ZEUWboLY58-M,1079
112
+ omlish/asyncs/asyncio/sockets.py,sha256=oZAPeC545MGeSpVj_uQfy-BbzXsXHesjCkJSiuqKmAI,1271
113
+ omlish/asyncs/asyncio/streams.py,sha256=J_d1hgX4Mx9SfyW4DjOzh91PqzZmjOtiIB95ytF8Ygw,1009
114
114
  omlish/asyncs/asyncio/subprocesses.py,sha256=f30-wi-3n9R5dftm4CMrzp23EEa4GX283bORixm1_UU,6931
115
- omlish/asyncs/asyncio/timeouts.py,sha256=hokhi7jZSAtBv0ME3qL1cO5eshNA9ViEH7BLafNCBpQ,454
115
+ omlish/asyncs/asyncio/timeouts.py,sha256=LwFx93KSrefBobQoK4-yH5B6M-pbd7NdNksNzLBfLgQ,459
116
116
  omlish/asyncs/bluelet/LICENSE,sha256=VHf3oPQihOHnWyIR8LcXX0dpONa1lgyJnjWC2qVuRR0,559
117
117
  omlish/asyncs/bluelet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
118
  omlish/asyncs/bluelet/all.py,sha256=aUV6PwnR8DqnEBS9wsZuPW_UtP6G9M8_KY-mmxZeVG0,1516
@@ -165,7 +165,7 @@ omlish/collections/persistent/persistent.py,sha256=KG471s0bhhReQrjlmX0xaN9HeAIcr
165
165
  omlish/collections/persistent/treap.py,sha256=A09ZPacGyJlyRB-Wi4TNj3tE0w-RpFNliPgpDaa6Vwg,7719
166
166
  omlish/collections/persistent/treapmap.py,sha256=TxOM-ZRF5PK2xe5wRIhESNt7DGh9b_MeZfE7HLkCOs4,5804
167
167
  omlish/collections/sorted/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
168
- omlish/collections/sorted/skiplist.py,sha256=eU_cYQVnT-EZxv_dN9PYQZdOP0km5usEcOQRiJKL7Rw,5986
168
+ omlish/collections/sorted/skiplist.py,sha256=tybcD8OslDBCc86Z1qKb4GRkbhMY26qorPzPIeqFmKk,6031
169
169
  omlish/collections/sorted/sorted.py,sha256=euHJan3FqTYSCJGsVcYYRV-yhAAQ5_htnjymnNoVHRE,3319
170
170
  omlish/concurrent/__init__.py,sha256=9p-s8MvBEYDqHIoYU3OYoe-Nni22QdkW7nhZGEukJTM,197
171
171
  omlish/concurrent/executors.py,sha256=mF-rjJWzNFxwB1-_H7rHuwoImpl4FtNM6W3wcqM3NEE,1291
@@ -205,7 +205,7 @@ omlish/dataclasses/impl/as_.py,sha256=CD-t7hkC1EP2F_jvZKIA_cVoDuwZ-Ln_xC4fJumPYX
205
205
  omlish/dataclasses/impl/copy.py,sha256=Tn8_n6Vohs-w4otbGdubBEvhd3TsSTaM3EfNGdS2LYo,591
206
206
  omlish/dataclasses/impl/descriptors.py,sha256=jSYNkKdy2rKddGpQqRwNuhw-ggpcvp_SWHpLwIWPOzc,2474
207
207
  omlish/dataclasses/impl/exceptions.py,sha256=-vqxZmfXVflymVuiM553XTlJProse5HEMktTpfdPCIY,1275
208
- omlish/dataclasses/impl/fields.py,sha256=8p7Uzvr0C4yBR0NqHzkq--OY2HXFQlGsb1HC3K17-7k,6985
208
+ omlish/dataclasses/impl/fields.py,sha256=jM2Rvu6DQOfRUrZBMOeJMda-CT5JKXQvJKzoIU_LFxc,6897
209
209
  omlish/dataclasses/impl/frozen.py,sha256=x87DSM8FIMZ3c_BIUE8NooCkExFjPsabeqIueEP5qKs,2988
210
210
  omlish/dataclasses/impl/hashing.py,sha256=0Gr6XIRkKy4pr-mdHblIlQCy3mBxycjMqJk3oZDw43s,3215
211
211
  omlish/dataclasses/impl/init.py,sha256=drt_-697uw2xp0FGj9AYlMbiuSfYRNV3-8JxTPzkP_w,6415
@@ -224,7 +224,7 @@ omlish/dataclasses/impl/simple.py,sha256=tr1WkNuUZ3upyrLBea6RV5Jb_2YsBxisSrGPN_X
224
224
  omlish/dataclasses/impl/slots.py,sha256=qXRLbtFWUs_2UV1fFUdv53_6fBLKJ_8McjNiP9YQlGM,5264
225
225
  omlish/dataclasses/impl/utils.py,sha256=aER2iL3UAtgS1BdLuEvTr9Tr2wC28wk1kiOeO-jIymw,6138
226
226
  omlish/diag/__init__.py,sha256=4S8v0myJM4Zld6_FV6cPe_nSv0aJb6kXftEit0HkiGE,1141
227
- omlish/diag/asts.py,sha256=BveUUNUcaAm4Hg55f4ZxGSI313E4L8cCZ5XjHpEkKVI,3325
227
+ omlish/diag/asts.py,sha256=MWh9XAG3m9L10FIJCyoNT2aU4Eft6tun_x9K0riq6Dk,3332
228
228
  omlish/diag/debug.py,sha256=ClED7kKXeVMyKrjGIxcq14kXk9kvUJfytBQwK9y7c4Q,1637
229
229
  omlish/diag/lslocks.py,sha256=fWI3SZwgEkhipVfSqvzVzREJRShcDYmlYByHBT0LToc,1744
230
230
  omlish/diag/lsof.py,sha256=DnowqvKYah-WCuBHS3DAcZCvlsWJdM9kYNFq97UZDDA,9127
@@ -410,7 +410,7 @@ omlish/iterators/tools.py,sha256=Pi4ybXytUXVZ3xwK89xpPImQfYYId9p1vIFQvVqVLqA,255
410
410
  omlish/iterators/unique.py,sha256=0jAX3kwzVfRNhe0Tmh7kVP_Q2WBIn8POo_O-rgFV0rQ,1390
411
411
  omlish/lang/__init__.py,sha256=H-kPgztXCiOneAvYeC1YxN8nMQu_gYBY2hwy8-dxHvs,5064
412
412
  omlish/lang/attrs.py,sha256=fofCKN0X8TMu1yGqHpLpNLih9r9HWl3D3Vn3b6O791w,3891
413
- omlish/lang/clsdct.py,sha256=sJYadm-fwzti-gsi98knR5qQUxriBmOqQE_qz3RopNk,1743
413
+ omlish/lang/clsdct.py,sha256=HAGIvBSbCefzRjXriwYSBLO7QHKRv2UsE78jixOb-fA,1828
414
414
  omlish/lang/collections.py,sha256=aGi0j6VzVe2nz4l357Y4RD5_XNl8OJbmM5qM6BclrrY,1895
415
415
  omlish/lang/comparison.py,sha256=5vbzWWbqdzDmNKAGL19z6ZfUKe5Ci49e-Oegf9f4BsE,1346
416
416
  omlish/lang/contextmanagers.py,sha256=UPH6daYwSP9cH5AfSVsJyEHk1UURMGhVPM5ZRhp_Hvw,7576
@@ -768,9 +768,9 @@ omlish/text/parts.py,sha256=Q9NvoyEGQKIWgiPD4D_Qc66cWAuyEKE033dT9m7c3Wk,6662
768
768
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
769
769
  omlish/text/go/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
770
770
  omlish/text/go/quoting.py,sha256=N9EYdnFdEX_A8fOviH-1w4jwV3XOQ7VU2WsoUNubYVY,9137
771
- omlish-0.0.0.dev260.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
772
- omlish-0.0.0.dev260.dist-info/METADATA,sha256=2zWJ8R0gGrP9bm0OLlyCdul5gKb0ImQJ6zBgB5Tw7x8,4198
773
- omlish-0.0.0.dev260.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
774
- omlish-0.0.0.dev260.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
775
- omlish-0.0.0.dev260.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
776
- omlish-0.0.0.dev260.dist-info/RECORD,,
771
+ omlish-0.0.0.dev261.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
772
+ omlish-0.0.0.dev261.dist-info/METADATA,sha256=O7gGUkhbgsi0XRUcwynTYxv1lgYqSKk6-UQI4Y9hCkQ,4198
773
+ omlish-0.0.0.dev261.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
774
+ omlish-0.0.0.dev261.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
775
+ omlish-0.0.0.dev261.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
776
+ omlish-0.0.0.dev261.dist-info/RECORD,,