omlish 0.0.0.dev254__py3-none-any.whl → 0.0.0.dev255__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.dev254'
2
- __revision__ = '94661b567698b6ba0b73d7f8d8ca9d0cecd3e99a'
1
+ __version__ = '0.0.0.dev255'
2
+ __revision__ = '68bcce87dfef9de1ab636cae14e4cbf5d71889cd'
3
3
 
4
4
 
5
5
  #
omlish/dispatch/impls.py CHANGED
@@ -5,7 +5,6 @@ TODO:
5
5
  - multidispatch? never solved..
6
6
  - just generic on tuple[A0, A1, ...]
7
7
  """
8
- import contextlib
9
8
  import typing as ta
10
9
  import weakref
11
10
 
@@ -24,8 +23,10 @@ _IMPL_FUNC_CLS_SET_CACHE: ta.MutableMapping[ta.Callable, frozenset[type]] = weak
24
23
 
25
24
 
26
25
  def get_impl_func_cls_set(func: ta.Callable) -> frozenset[type]:
27
- with contextlib.suppress(KeyError):
26
+ try:
28
27
  return _IMPL_FUNC_CLS_SET_CACHE[func]
28
+ except KeyError:
29
+ pass
29
30
 
30
31
  ann = getattr(func, '__annotations__', {})
31
32
  if not ann:
omlish/os/filemodes.py CHANGED
@@ -24,7 +24,7 @@ class FileMode:
24
24
 
25
25
  https://en.cppreference.com/w/cpp/io/c/fopen
26
26
 
27
- "r" read Open a file for reading read from start return NULL and set error
27
+ "r" read Open a file for reading read from start return NULL and set error
28
28
  "w" write Create a file for writing destroy contents create new
29
29
  "a" append Append to a file write to end create new
30
30
  "r+" read extended Open a file for read/write read from start return NULL and set error
@@ -100,11 +100,14 @@ sortItem
100
100
  ;
101
101
 
102
102
  relation
103
- : relation AS? ident #aliasedRelation
104
- | left=relation ty=joinType? JOIN right=relation (ON cond=booleanExpr)? #joinRelation
105
- | '(' select ')' #selectRelation
106
- | '(' relation ')' #parenRelation
107
- | qualifiedName #tableRelation
103
+ : relation AS? ident #aliasedRelation
104
+ | left=relation
105
+ ty=joinType?
106
+ JOIN right=relation
107
+ (ON cond=booleanExpr)? #joinRelation
108
+ | '(' select ')' #selectRelation
109
+ | '(' relation ')' #parenRelation
110
+ | qualifiedName #tableRelation
108
111
  ;
109
112
 
110
113
  groupBy
omlish/text/parts.py CHANGED
@@ -72,40 +72,47 @@ class Meta(DataPart):
72
72
 
73
73
 
74
74
  class PartTransform:
75
+ def __call__(self, part: Part | None) -> Part:
76
+ return self._transform(part)
77
+
75
78
  @dispatch.method
76
- def __call__(self, part: Part) -> Part:
79
+ def _transform(self, part: Part | None) -> Part:
77
80
  raise TypeError(part)
78
81
 
79
- @__call__.register
80
- def __call__str(self, part: str) -> Part:
82
+ @_transform.register
83
+ def _transform_none(self, part: None) -> Part:
84
+ return []
85
+
86
+ @_transform.register
87
+ def _transform_str(self, part: str) -> Part:
81
88
  return part
82
89
 
83
- @__call__.register
84
- def __call__sequence(self, part: collections.abc.Sequence) -> Part:
90
+ @_transform.register
91
+ def _transform_sequence(self, part: collections.abc.Sequence) -> Part:
85
92
  return [self(c) for c in part]
86
93
 
87
- @__call__.register
88
- def __call__wrap(self, part: Wrap) -> Part:
94
+ @_transform.register
95
+ def _transform_wrap(self, part: Wrap) -> Part:
89
96
  return Wrap(self(part.part), part.wrapper)
90
97
 
91
- @__call__.register
92
- def __call__list(self, part: List) -> Part:
98
+ @_transform.register
99
+ def _transform_list(self, part: List) -> Part:
93
100
  return List([self(c) for c in part.parts], part.delimiter, part.trailer)
94
101
 
95
- @__call__.register
96
- def __call__concat(self, part: Concat) -> Part:
102
+ @_transform.register
103
+ def _transform_concat(self, part: Concat) -> Part:
97
104
  return Concat([self(c) for c in part.parts])
98
105
 
99
- @__call__.register
100
- def __call__block(self, part: Block) -> Part:
106
+ @_transform.register
107
+ def _transform_block(self, part: Block) -> Part:
101
108
  return Block([self(c) for c in part.parts])
102
109
 
103
- @__call__.register
104
- def __call__section(self, part: Section) -> Part:
110
+ @_transform.register
111
+ def _transform_section(self, part: Section) -> Part:
105
112
  return Section([self(c) for c in part.parts])
106
113
 
107
- @__call__.register
108
- def __call__meta(self, part: Meta) -> Meta:
114
+ @_transform.register
115
+ def _transform_meta(self, part: Meta) -> Meta:
109
116
  return part
110
117
 
111
118
 
@@ -113,8 +120,8 @@ class PartTransform:
113
120
 
114
121
 
115
122
  class RemoveMetas(PartTransform):
116
- @PartTransform.__call__.register
117
- def __call__meta(self, part: Meta) -> Part:
123
+ @PartTransform._transform.register # noqa
124
+ def _transform_meta(self, part: Meta) -> Part:
118
125
  return []
119
126
 
120
127
 
@@ -137,27 +144,27 @@ def _drop_empties(it: ta.Iterable[T]) -> list[T]:
137
144
 
138
145
 
139
146
  class CompactPart(PartTransform):
140
- @PartTransform.__call__.register
141
- def __call__sequence(self, part: collections.abc.Sequence) -> Part:
147
+ @PartTransform._transform.register # noqa
148
+ def _transform_sequence(self, part: collections.abc.Sequence) -> Part:
142
149
  return _drop_empties(self(c) for c in part)
143
150
 
144
- @PartTransform.__call__.register
145
- def __call__list(self, part: List) -> Part:
151
+ @PartTransform._transform.register # noqa
152
+ def _transform_list(self, part: List) -> Part:
146
153
  parts = _drop_empties(self(c) for c in part.parts)
147
154
  return List(parts, part.delimiter, part.trailer) if parts else []
148
155
 
149
- @PartTransform.__call__.register
150
- def __call__concat(self, part: Concat) -> Part:
156
+ @PartTransform._transform.register # noqa
157
+ def _transform_concat(self, part: Concat) -> Part:
151
158
  parts = _drop_empties(self(c) for c in part.parts)
152
159
  return Concat(parts) if parts else []
153
160
 
154
- @PartTransform.__call__.register
155
- def __call__block(self, part: Block) -> Part:
161
+ @PartTransform._transform.register # noqa
162
+ def _transform_block(self, part: Block) -> Part:
156
163
  parts = _drop_empties(self(c) for c in part.parts)
157
164
  return Block(parts) if parts else []
158
165
 
159
- @PartTransform.__call__.register
160
- def __call__section(self, part: Section) -> Part:
166
+ @PartTransform._transform.register # noqa
167
+ def _transform_section(self, part: Section) -> Part:
161
168
  parts = _drop_empties(self(c) for c in part.parts)
162
169
  return Section(parts) if parts else []
163
170
 
@@ -204,29 +211,36 @@ class PartRenderer:
204
211
  self._blank_lines += n
205
212
  self._has_indented = False
206
213
 
214
+ def __call__(self, part: Part | None) -> None:
215
+ return self._render(part)
216
+
207
217
  @dispatch.method
208
- def __call__(self, part: Part) -> None:
218
+ def _render(self, part: Part | None) -> None:
209
219
  raise TypeError(part)
210
220
 
211
- @__call__.register
212
- def __call__str(self, part: str) -> None:
221
+ @_render.register
222
+ def _render_none(self, part: None) -> None:
223
+ pass
224
+
225
+ @_render.register
226
+ def _render_str(self, part: str) -> None:
213
227
  self._write(part)
214
228
 
215
- @__call__.register
216
- def __call__sequence(self, part: collections.abc.Sequence) -> None:
229
+ @_render.register
230
+ def _render_sequence(self, part: collections.abc.Sequence) -> None:
217
231
  for i, c in enumerate(part):
218
232
  if i:
219
233
  self._write(' ')
220
234
  self(c)
221
235
 
222
- @__call__.register
223
- def __call__wrap(self, part: Wrap) -> None:
236
+ @_render.register
237
+ def _render_wrap(self, part: Wrap) -> None:
224
238
  self._write(part.wrapper[0])
225
239
  self(part.part)
226
240
  self._write(part.wrapper[1])
227
241
 
228
- @__call__.register
229
- def __call__list(self, part: List) -> None:
242
+ @_render.register
243
+ def _render_list(self, part: List) -> None:
230
244
  for i, c in enumerate(part.parts):
231
245
  if i:
232
246
  self._write(part.delimiter + ' ')
@@ -234,19 +248,19 @@ class PartRenderer:
234
248
  if part.trailer:
235
249
  self._write(part.delimiter)
236
250
 
237
- @__call__.register
238
- def __call__concat(self, part: Concat) -> None:
251
+ @_render.register
252
+ def _render_concat(self, part: Concat) -> None:
239
253
  for c in part.parts:
240
254
  self(c)
241
255
 
242
- @__call__.register
243
- def __call__block(self, part: Block) -> None:
256
+ @_render.register
257
+ def _render_block(self, part: Block) -> None:
244
258
  for c in part.parts:
245
259
  self(c)
246
260
  self._write_newline()
247
261
 
248
- @__call__.register
249
- def __call__section(self, part: Section) -> None:
262
+ @_render.register
263
+ def _render_section(self, part: Section) -> None:
250
264
  self._indents += 1
251
265
  try:
252
266
  for c in part.parts:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: omlish
3
- Version: 0.0.0.dev254
3
+ Version: 0.0.0.dev255
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=_UAdSthc_ThPG20zNClzsObtbtg1SgdxuKoWfomaXRw,3380
2
+ omlish/__about__.py,sha256=RWHoA3srEenVlQkvR7jq1Ub8ehSFGPwTcfcQOXal8Rk,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
@@ -238,7 +238,7 @@ omlish/dispatch/_dispatch2.py,sha256=70k1tKKvuhxtAu6v4skECfHKIKVWrmlt7G_JKLUsKEs
238
238
  omlish/dispatch/_dispatch3.py,sha256=9Zjd7bINAC3keiaBdssc4v5dY0-8OI6XooV2DR9U7Z0,2818
239
239
  omlish/dispatch/dispatch.py,sha256=KA5l49AiGLRjp4J7RDJW9RiDp9WUD1ewR1AOPEF8g38,3062
240
240
  omlish/dispatch/functions.py,sha256=8Qvj62XKn9SKfiqoVQdBD3wVRE4JUWpZDqs0oouuDIw,1519
241
- omlish/dispatch/impls.py,sha256=0t1N3EZUHi-V3kzgOVUezE7ghevZt1G3r0eo2q_do7c,2151
241
+ omlish/dispatch/impls.py,sha256=JP67zSvDWG4XFOmKPrhWHxRV9WnyAPAsjQHvbmEJh4c,2136
242
242
  omlish/dispatch/methods.py,sha256=dr8xQo-zVRckIo_V2Wp8Reqor3NE6APuzomUfsSBGdk,5498
243
243
  omlish/docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
244
244
  omlish/docker/all.py,sha256=xXRgJgLGPwAtr7bDMJ_Dp9jTfOwfGvohNhc6LsoELJc,514
@@ -532,7 +532,7 @@ omlish/os/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
532
532
  omlish/os/atomics.py,sha256=KhWNeh4mzU3M-TF0v8uR6hUqMfZJW42MeyIK9Jl6R0k,5246
533
533
  omlish/os/deathsig.py,sha256=hk9Yq2kyDdI-cI7OQH7mOfpRbOKzY_TfPKEqgrjVYbA,641
534
534
  omlish/os/fcntl.py,sha256=riQf9iEEEIC28lJp8ud06MU56w2XJHJ9nBFtck_hdhc,1501
535
- omlish/os/filemodes.py,sha256=eVT60kokup40-N31r2acHJ2ip3d9HmqY8jCGIsKpKqc,4576
535
+ omlish/os/filemodes.py,sha256=ZIk6XpPw2oyoytSsuVmBXQ6fvMDHzctNEDIA2uHTBC4,4575
536
536
  omlish/os/files.py,sha256=WJ_42vsZIZukQURN3TTccp-n74ZNhbux_ps3TLbHj18,1106
537
537
  omlish/os/forkhooks.py,sha256=yjodOvs90ClXskv5oBIJbHn0Y7dzajLmZmOpRMKbyxM,5656
538
538
  omlish/os/journald.py,sha256=2nI8Res1poXkbLc31--MPUlzYMESnCcPUkIxDOCjZW0,3903
@@ -670,7 +670,7 @@ omlish/sql/api/errors.py,sha256=YtC2gz5DqRTT3uCJniUOufVH1GEnFIc5ElkYLK3BHwM,230
670
670
  omlish/sql/api/funcs.py,sha256=-H6V-o9JPSHFXsxdHtutB4mP2LwJfCzlLbRrPHunmB4,990
671
671
  omlish/sql/api/queries.py,sha256=IgB8_sDe40-mKE-ByTmZ4GVOCdLLJDzJGJCevMd8R5s,1207
672
672
  omlish/sql/api/rows.py,sha256=MEK9LNYEe8vLEJXQJD63MpnSOiE22cawJL-dUWQD6sU,1246
673
- omlish/sql/parsing/Minisql.g4,sha256=DlriPFcnGT4QYG7O7VH2EmDVJQZq5zewoQ-tpXsSbIY,4748
673
+ omlish/sql/parsing/Minisql.g4,sha256=Jw8xT-8UI6ySHAgStyCg5QX9NTCinvTenLJReWiZIJU,4578
674
674
  omlish/sql/parsing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
675
675
  omlish/sql/parsing/parsing.py,sha256=hYIZdEKik4q22aEHHOX6lCpMa1jvgUk2aC1Llx10NMI,3343
676
676
  omlish/sql/parsing/_antlr/MinisqlLexer.py,sha256=f4WzRrwqM7tW6sNn01035hRWPZL7xtuvba9EMR06j2E,17611
@@ -754,11 +754,11 @@ omlish/text/indent.py,sha256=YjtJEBYWuk8--b9JU_T6q4yxV85_TR7VEVr5ViRCFwk,1336
754
754
  omlish/text/linecache.py,sha256=hRYlEhD63ZfA6_ZOTkQIcnON-3W56QMAhcG3vEJqj9M,1858
755
755
  omlish/text/mangle.py,sha256=kfzFLfvepH-chl1P89_mdc5vC4FSqyPA2aVtgzuB8IY,1133
756
756
  omlish/text/minja.py,sha256=jZC-fp3Xuhx48ppqsf2Sf1pHbC0t8XBB7UpUUoOk2Qw,5751
757
- omlish/text/parts.py,sha256=JkNZpyR2tv2CNcTaWJJhpQ9E4F0yPR8P_YfDbZfMtwQ,6182
757
+ omlish/text/parts.py,sha256=Q9NvoyEGQKIWgiPD4D_Qc66cWAuyEKE033dT9m7c3Wk,6662
758
758
  omlish/text/random.py,sha256=jNWpqiaKjKyTdMXC-pWAsSC10AAP-cmRRPVhm59ZWLk,194
759
- omlish-0.0.0.dev254.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
760
- omlish-0.0.0.dev254.dist-info/METADATA,sha256=-Mvy0_hjjJoMNilZrvKn9X-FWgQvLcItEjlbdvLO2vE,4176
761
- omlish-0.0.0.dev254.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
762
- omlish-0.0.0.dev254.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
763
- omlish-0.0.0.dev254.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
764
- omlish-0.0.0.dev254.dist-info/RECORD,,
759
+ omlish-0.0.0.dev255.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
760
+ omlish-0.0.0.dev255.dist-info/METADATA,sha256=OYcI4_aud4-SKLb5y1OiYRjgrj-QkyxBctM6FPPe9aQ,4176
761
+ omlish-0.0.0.dev255.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
762
+ omlish-0.0.0.dev255.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
763
+ omlish-0.0.0.dev255.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
764
+ omlish-0.0.0.dev255.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (76.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5