omlish 0.0.0.dev201__py3-none-any.whl → 0.0.0.dev202__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.dev201'
2
- __revision__ = '77be9dbd97d16b54293dbf9f3803e3fa882ecc5f'
1
+ __version__ = '0.0.0.dev202'
2
+ __revision__ = '3da244e2a7f1e04753682c9f4ddc813289a82a42'
3
3
 
4
4
 
5
5
  #
omlish/formats/props.py CHANGED
@@ -306,8 +306,7 @@ class Properties(collections.abc.MutableMapping):
306
306
  if self._metadoc and self._prev_key:
307
307
  prev_metadata = self._metadata.setdefault(self._prev_key, {})
308
308
  prev_metadata.setdefault('_doc', '')
309
- if docstr.startswith(' '):
310
- docstr = docstr[1:]
309
+ docstr = docstr.removeprefix(' ')
311
310
  prev_metadata['_doc'] += docstr + '\n'
312
311
  return
313
312
 
omlish/lang/__init__.py CHANGED
@@ -189,7 +189,8 @@ from .resolving import ( # noqa
189
189
  )
190
190
 
191
191
  from .resources import ( # noqa
192
- RelativeResource,
192
+ ReadableResource,
193
+ get_package_resources,
193
194
  get_relative_resources,
194
195
  )
195
196
 
omlish/lang/resources.py CHANGED
@@ -6,7 +6,7 @@ import typing as ta
6
6
 
7
7
 
8
8
  @dc.dataclass(frozen=True)
9
- class RelativeResource:
9
+ class ReadableResource:
10
10
  name: str
11
11
  is_file: bool
12
12
  read_bytes: ta.Callable[[], bytes]
@@ -15,13 +15,26 @@ class RelativeResource:
15
15
  return self.read_bytes().decode(encoding)
16
16
 
17
17
 
18
+ def get_package_resources(anchor: str) -> ta.Mapping[str, ReadableResource]:
19
+ lst: list[ReadableResource] = []
20
+
21
+ for pf in importlib.resources.files(anchor).iterdir():
22
+ lst.append(ReadableResource(
23
+ name=pf.name,
24
+ is_file=pf.is_file(),
25
+ read_bytes=pf.read_bytes if pf.is_file() else None, # type: ignore
26
+ ))
27
+
28
+ return {r.name: r for r in lst}
29
+
30
+
18
31
  def get_relative_resources(
19
32
  path: str = '',
20
33
  *,
21
34
  globals: ta.Mapping[str, ta.Any] | None = None, # noqa
22
35
  package: str | None = None,
23
36
  file: str | None = None,
24
- ) -> ta.Mapping[str, RelativeResource]:
37
+ ) -> ta.Mapping[str, ReadableResource]:
25
38
  if globals is not None:
26
39
  if not package:
27
40
  package = globals.get('__package__')
@@ -45,7 +58,7 @@ def get_relative_resources(
45
58
 
46
59
  #
47
60
 
48
- lst: list[RelativeResource] = []
61
+ lst: list[ReadableResource] = []
49
62
 
50
63
  if package:
51
64
  pkg_parts = package.split('.')
@@ -53,7 +66,7 @@ def get_relative_resources(
53
66
  pkg_parts = pkg_parts[:-num_up]
54
67
  anchor = '.'.join([*pkg_parts, *path_parts])
55
68
  for pf in importlib.resources.files(anchor).iterdir():
56
- lst.append(RelativeResource(
69
+ lst.append(ReadableResource(
57
70
  name=pf.name,
58
71
  is_file=pf.is_file(),
59
72
  read_bytes=pf.read_bytes if pf.is_file() else None, # type: ignore
@@ -73,7 +86,7 @@ def get_relative_resources(
73
86
 
74
87
  for ff in os.listdir(dst_dir):
75
88
  ff = os.path.join(dst_dir, ff)
76
- lst.append(RelativeResource(
89
+ lst.append(ReadableResource(
77
90
  name=os.path.basename(ff),
78
91
  is_file=os.path.isfile(ff),
79
92
  read_bytes=functools.partial(_read_file, ff),
omlish/sql/abc.py CHANGED
@@ -1,3 +1,6 @@
1
+ """
2
+ https://peps.python.org/pep-0249/
3
+ """
1
4
  import typing as ta
2
5
 
3
6
 
@@ -14,6 +17,16 @@ DbapiColumnDescription: ta.TypeAlias = tuple[
14
17
  ]
15
18
 
16
19
 
20
+ class DbapiColumnDescription_(ta.NamedTuple): # noqa
21
+ name: str
22
+ type_code: DbapiTypeCode
23
+ display_size: int | None
24
+ internal_size: int | None
25
+ precision: int | None
26
+ scale: int | None
27
+ null_ok: bool | None
28
+
29
+
17
30
  class DbapiConnection(ta.Protocol):
18
31
  def close(self) -> object: ...
19
32
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: omlish
3
- Version: 0.0.0.dev201
3
+ Version: 0.0.0.dev202
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=dyIpveH7Z8OnQp2pTn6NVv7LCDXVrozJWAzbk8PBavg,7950
2
- omlish/__about__.py,sha256=nozjeM6WZjCDpl0YL18Qfh8ve_0Ihl-hf7OLBlfHY70,3409
2
+ omlish/__about__.py,sha256=TkrqZrE-0H4UPhtpzOoT1oElyBJWd2jFOEJucdouLTY,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
@@ -226,7 +226,7 @@ omlish/formats/codecs.py,sha256=ip4TLOyWAaUyEJmrIOzuLMtjRdgaMEsC6JeAlcCVi28,1657
226
226
  omlish/formats/dotenv.py,sha256=qoDG4Ayu7B-8LjBBhcmNiLZW0_9LgCi3Ri2aPo9DEQ8,19314
227
227
  omlish/formats/json5.py,sha256=odpZIShlUpv19aACWe58SoMPcv0AHKIa6zSMjlKgaMI,515
228
228
  omlish/formats/pickle.py,sha256=jdp4E9WH9qVPBE3sSqbqDtUo18RbTSIiSpSzJ-IEVZw,529
229
- omlish/formats/props.py,sha256=cek3JLFLIrpE76gvs8rs_B8yF4SpY8ooDH8apWsquwE,18953
229
+ omlish/formats/props.py,sha256=auCv-Jx79KGlWfyG1-Qo0ou-Ex0W_mF3r_lDFdsVkWI,18920
230
230
  omlish/formats/repr.py,sha256=kYrNs4o-ji8nOdp6u_L3aMgBMWN1ZAZJSAWgQQfStSQ,414
231
231
  omlish/formats/xml.py,sha256=ggiOwSERt4d9XmZwLZiDIh5qnFJS4jdmow9m9_9USps,1491
232
232
  omlish/formats/yaml.py,sha256=ffOwGnLA6chdiFyaS7X0TBMGmHG9AoGudzKVWfQ1UOs,7389
@@ -357,7 +357,7 @@ omlish/iterators/iterators.py,sha256=ghI4dO6WPyyFOLTIIMaHQ_IOy2xXaFpGPqveZ5YGIBU
357
357
  omlish/iterators/recipes.py,sha256=53mkexitMhkwXQZbL6DrhpT0WePQ_56uXd5Jaw3DfzI,467
358
358
  omlish/iterators/tools.py,sha256=SvXyyQJh7aceLYhRl6pQB-rfSaXw5IMIWukeEeOZt-0,2492
359
359
  omlish/iterators/unique.py,sha256=0jAX3kwzVfRNhe0Tmh7kVP_Q2WBIn8POo_O-rgFV0rQ,1390
360
- omlish/lang/__init__.py,sha256=GqZ3exAAK7iphRf8e4d3CvAz7EptvmEOmCkmN06uYvQ,3986
360
+ omlish/lang/__init__.py,sha256=091aYd1gRii-ulxI9QAMjZBPLcl-kfL-XU82kLMR0qU,4013
361
361
  omlish/lang/cached.py,sha256=92TvRZQ6sWlm7dNn4hgl7aWKbX0J1XUEo3DRjBpgVQk,7834
362
362
  omlish/lang/clsdct.py,sha256=AjtIWLlx2E6D5rC97zQ3Lwq2SOMkbg08pdO_AxpzEHI,1744
363
363
  omlish/lang/cmp.py,sha256=5vbzWWbqdzDmNKAGL19z6ZfUKe5Ci49e-Oegf9f4BsE,1346
@@ -372,7 +372,7 @@ omlish/lang/iterables.py,sha256=HOjcxOwyI5bBApDLsxRAGGhTTmw7fdZl2kEckxRVl-0,1994
372
372
  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
- omlish/lang/resources.py,sha256=yywDWhh0tsgw24l7mHYv49ll4oZS8Kc8MSCa8f4UbbI,2280
375
+ omlish/lang/resources.py,sha256=N64KeVE-rYMxqBBRp91qzgVqpOVR2uX7k1WlS_bo5hM,2681
376
376
  omlish/lang/strings.py,sha256=BsciSYnckD4vGtC6kmtnugR9IN6CIHdcjO4nZu-pSAw,3898
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
@@ -531,7 +531,7 @@ omlish/specs/openapi/__init__.py,sha256=zilQhafjvteRDF_TUIRgF293dBC6g-TJChmUb6T9
531
531
  omlish/specs/openapi/marshal.py,sha256=Z-E2Knm04C81N8AA8cibCVSl2ImhSpHZVc7yAhmPx88,2135
532
532
  omlish/specs/openapi/openapi.py,sha256=y4h04jeB7ORJSVrcy7apaBdpwLjIyscv1Ub5SderH2c,12682
533
533
  omlish/sql/__init__.py,sha256=TpZLsEJKJzvJ0eMzuV8hwOJJbkxBCV1RZPUMLAVB6io,173
534
- omlish/sql/abc.py,sha256=kiOitW_ZhTXrJanJ582wD7o9K69v6HXqDPkxuHEAxrc,1606
534
+ omlish/sql/abc.py,sha256=NfbcIlEvdEu6vn0TolhfYb2SO5uzUmY0kARCbg6uVAU,1879
535
535
  omlish/sql/dbapi.py,sha256=5ghJH-HexsmDlYdWlhf00nCGQX2IC98_gxIxMkucOas,3195
536
536
  omlish/sql/dbs.py,sha256=lpdFmm2vTwLoBiVYGj9yPsVcTEYYNCxlYZZpjfChzkY,1870
537
537
  omlish/sql/params.py,sha256=Z4VPet6GhNqD1T_MXSWSHkdy3cpUEhST-OplC4B_fYI,4433
@@ -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.dev201.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
613
- omlish-0.0.0.dev201.dist-info/METADATA,sha256=_xm1Dh4zcl8xwhcC7IQ83_lZs18KGg7gufxEsCbfPHA,4264
614
- omlish-0.0.0.dev201.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
615
- omlish-0.0.0.dev201.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
616
- omlish-0.0.0.dev201.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
617
- omlish-0.0.0.dev201.dist-info/RECORD,,
612
+ omlish-0.0.0.dev202.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
613
+ omlish-0.0.0.dev202.dist-info/METADATA,sha256=XEiYKss22Lx_Cerj_g1QURXuSPir4iCoi-tiPex6nik,4264
614
+ omlish-0.0.0.dev202.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
615
+ omlish-0.0.0.dev202.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
616
+ omlish-0.0.0.dev202.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
617
+ omlish-0.0.0.dev202.dist-info/RECORD,,