omlish 0.0.0.dev364__py3-none-any.whl → 0.0.0.dev365__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.

Potentially problematic release.


This version of omlish might be problematic. Click here for more details.

omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev364'
2
- __revision__ = 'efbc21858b1c3354b55f4666e435a1bd79b1a23a'
1
+ __version__ = '0.0.0.dev365'
2
+ __revision__ = 'b4c28dd8f673c9f03dee99119cd46e8afb3a89f5'
3
3
 
4
4
 
5
5
  #
@@ -60,7 +60,7 @@ class Project(ProjectBase):
60
60
  ],
61
61
 
62
62
  'formats': [
63
- 'orjson ~= 3.10',
63
+ 'orjson ~= 3.11',
64
64
  'ujson ~= 5.10',
65
65
 
66
66
  'pyyaml ~= 6.0',
omlish/metadata.py CHANGED
@@ -91,7 +91,15 @@ def append_object_metadata(obj: T, *mds: ObjectMetadata) -> T:
91
91
  return obj
92
92
 
93
93
 
94
- def get_object_metadata(obj: ta.Any, *, strict: bool = False) -> ta.Sequence[ObjectMetadata]:
94
+ _type = type
95
+
96
+
97
+ def get_object_metadata(
98
+ obj: ta.Any,
99
+ *,
100
+ strict: bool = False,
101
+ type: ta.Type | tuple[ta.Type, ...] | None = None, # noqa
102
+ ) -> ta.Sequence[ObjectMetadata]:
95
103
  try:
96
104
  tgt = _unwrap_object_metadata_target(obj)
97
105
  except ObjectMetadataTargetTypeError:
@@ -104,7 +112,12 @@ def get_object_metadata(obj: ta.Any, *, strict: bool = False) -> ta.Sequence[Obj
104
112
  except AttributeError:
105
113
  return ()
106
114
 
107
- return dct.get(_OBJECT_METADATA_ATTR, ())
115
+ ret = dct.get(_OBJECT_METADATA_ATTR, ())
116
+
117
+ if type is not None:
118
+ ret = [o for o in ret if isinstance(o, type)]
119
+
120
+ return ret
108
121
 
109
122
 
110
123
  ##
omlish/os/paths.py CHANGED
@@ -7,6 +7,31 @@ import typing as ta
7
7
  ##
8
8
 
9
9
 
10
+ @ta.overload
11
+ def path_dirname(p: str, n: int = 1) -> str:
12
+ ...
13
+
14
+
15
+ @ta.overload
16
+ def path_dirname(p: bytes, n: int = 1) -> bytes:
17
+ ...
18
+
19
+
20
+ def path_dirname(p, n=1):
21
+ if isinstance(p, bytes):
22
+ sep: ta.Any = b'/'
23
+ else:
24
+ sep = '/'
25
+ p = os.fspath(p)
26
+ i = -1
27
+ for _ in range(n):
28
+ i = p.rindex(sep, 0, i)
29
+ head = p[:i + 1]
30
+ if head and head != sep * len(head):
31
+ head = head.rstrip(sep)
32
+ return head
33
+
34
+
10
35
  def abs_real_path(p: str) -> str:
11
36
  return os.path.abspath(os.path.realpath(p))
12
37
 
omlish/term/confirm.py CHANGED
@@ -15,6 +15,9 @@ def confirm_action(
15
15
  stdin = sys.stdin
16
16
  if not stdin.isatty():
17
17
  raise OSError(f'stdin {stdin!r} is not a tty')
18
+ # FIXME: we want to make sure we only run on a tty, but we als want input()'s readline goodies..
19
+ if stdin is not sys.stdin:
20
+ raise RuntimeError('Unsupported stdin')
18
21
 
19
22
  if stdout is None:
20
23
  stdout = sys.stdout
@@ -37,4 +40,4 @@ def confirm_action(
37
40
  elif c == 'n':
38
41
  return False
39
42
  else:
40
- print("Please enter 'y' for yes or 'n' for no.")
43
+ print("Please enter 'y' for yes or 'n' for no.", file=stdout)
omlish/text/templating.py CHANGED
@@ -23,6 +23,10 @@ else:
23
23
 
24
24
 
25
25
  class Templater(lang.Abstract):
26
+ """
27
+ This is named a 'templatER', not 'template', because it probably refers to a bigger thing itself called a
28
+ 'template' (like a `jinja2.Template`).
29
+ """
26
30
  @dc.dataclass(frozen=True)
27
31
  class Context:
28
32
  env: ta.Mapping[str, ta.Any] | None = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omlish
3
- Version: 0.0.0.dev364
3
+ Version: 0.0.0.dev365
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -25,7 +25,7 @@ Requires-Dist: brotli~=1.1; extra == "all"
25
25
  Requires-Dist: asttokens~=3.0; extra == "all"
26
26
  Requires-Dist: executing~=2.2; extra == "all"
27
27
  Requires-Dist: psutil~=7.0; extra == "all"
28
- Requires-Dist: orjson~=3.10; extra == "all"
28
+ Requires-Dist: orjson~=3.11; extra == "all"
29
29
  Requires-Dist: ujson~=5.10; extra == "all"
30
30
  Requires-Dist: pyyaml~=6.0; extra == "all"
31
31
  Requires-Dist: cbor2~=5.6; extra == "all"
@@ -49,7 +49,7 @@ Requires-Dist: anyio~=4.9; extra == "all"
49
49
  Requires-Dist: sniffio~=1.3; extra == "all"
50
50
  Requires-Dist: asttokens~=3.0; extra == "all"
51
51
  Requires-Dist: executing~=2.2; extra == "all"
52
- Requires-Dist: orjson~=3.10; extra == "all"
52
+ Requires-Dist: orjson~=3.11; extra == "all"
53
53
  Requires-Dist: pyyaml~=6.0; extra == "all"
54
54
  Requires-Dist: wrapt~=1.17; extra == "all"
55
55
  Provides-Extra: async
@@ -68,7 +68,7 @@ Requires-Dist: asttokens~=3.0; extra == "diag"
68
68
  Requires-Dist: executing~=2.2; extra == "diag"
69
69
  Requires-Dist: psutil~=7.0; extra == "diag"
70
70
  Provides-Extra: formats
71
- Requires-Dist: orjson~=3.10; extra == "formats"
71
+ Requires-Dist: orjson~=3.11; extra == "formats"
72
72
  Requires-Dist: ujson~=5.10; extra == "formats"
73
73
  Requires-Dist: pyyaml~=6.0; extra == "formats"
74
74
  Requires-Dist: cbor2~=5.6; extra == "formats"
@@ -100,7 +100,7 @@ Requires-Dist: anyio~=4.9; extra == "plus"
100
100
  Requires-Dist: sniffio~=1.3; extra == "plus"
101
101
  Requires-Dist: asttokens~=3.0; extra == "plus"
102
102
  Requires-Dist: executing~=2.2; extra == "plus"
103
- Requires-Dist: orjson~=3.10; extra == "plus"
103
+ Requires-Dist: orjson~=3.11; extra == "plus"
104
104
  Requires-Dist: pyyaml~=6.0; extra == "plus"
105
105
  Requires-Dist: wrapt~=1.17; extra == "plus"
106
106
  Dynamic: license-file
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=aT8yZ-Zh-9wfHl5Ym5ouiWC1i0cy7Q7RlhzavB6VLPI,8587
2
- omlish/__about__.py,sha256=jPad_LyUf2h4QZmz7cjzDxV8N2Q7ba3FdRz1o5SXyK0,3478
2
+ omlish/__about__.py,sha256=yal4M4IqqPRxe1zOQ3JquQPYH2qkVC_vQZaBVdeABYs,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
@@ -8,7 +8,7 @@ omlish/datetimes.py,sha256=7dh4aiVRWXWECH3JLF8kkRbgJ1qyGlAlQVp1vCXdTBE,2168
8
8
  omlish/defs.py,sha256=-4UuZoJUUNO_bZ6eSSdhR4CK4NKN2Wwr1FfUvfTF--8,4918
9
9
  omlish/dynamic.py,sha256=zy0oO70_Vlh5dW8Nwav_O9bhIzQ6L16UgSuKR6y43VU,6526
10
10
  omlish/libc.py,sha256=mNY2FWZ2BjSucOx5TEW8IP_B5n84tVZWuVPL3Z3sUH8,15644
11
- omlish/metadata.py,sha256=-noAyXT-7wV0SXul6wV1fPe7EYKxluuuYh1VmM39IPk,3593
11
+ omlish/metadata.py,sha256=l_GGk0g_GkxltQYNDr-P9TTtvIggkdFtnfIffYtaieQ,3797
12
12
  omlish/runmodule.py,sha256=vQ9VZN_c3sQX9rj036dW9lXuMWTjGOfWnwDcWTSWnn0,705
13
13
  omlish/shlex.py,sha256=rlbgHWxjwpkCBRphOPqSIN_KD6qWJMLldNJUILulKT0,253
14
14
  omlish/sync.py,sha256=-2gVJZFl8hvp7jvrnX8GcZVOecqAym6AcyK1QtMR9Ic,2979
@@ -559,7 +559,7 @@ omlish/os/forkhooks.py,sha256=sLrDCOletKcuiKTKIstksmvYw8GNg5e5yHUGuJ0dEeo,5678
559
559
  omlish/os/journald.py,sha256=Ysm-lyjBfTvRA9PZtkdNxeFNNuSdLwoCXnBgePeRu3Y,3909
560
560
  omlish/os/linux.py,sha256=CfnYR1vJooo74OfeiSB6EaB1KN5SLz9x3b1KXtJIRQ4,18949
561
561
  omlish/os/mangle.py,sha256=1Z_gYNiRiHn7wAA8tGEumra3lD4r9Isn581Ml2auJZI,531
562
- omlish/os/paths.py,sha256=Eok1nx4H3SjO86EroTKRl1upA1VNjgvlwYbR5pGpSO4,855
562
+ omlish/os/paths.py,sha256=lnO2JJWo8rWgmrmNUiRuGyXVWdmfalDsGmH0UsyRsHA,1304
563
563
  omlish/os/signals.py,sha256=k2nSiuefwzjRkqxBf2gZX2QDANDpHHB1Xfsvv49nQHc,358
564
564
  omlish/os/sizes.py,sha256=ohGartgu_us6Eo6qT2pz5MvLeHfMes1Fxq8om_z0cak,157
565
565
  omlish/os/temp.py,sha256=TkiBU89aq0vHHaMKFNEFsKV6F_wTPZJCdnmwvGygD0Q,1209
@@ -742,7 +742,7 @@ omlish/subprocesses/wrap.py,sha256=AhGV8rsnaVUMQCFYKkrjj35fs3O-VJLZC1hZ14dz3C8,7
742
742
  omlish/term/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
743
743
  omlish/term/codes.py,sha256=fDRhUYzCzllcvCfMMgEroJaQoxqFsfTivpYdVmnwcCE,6390
744
744
  omlish/term/coloring.py,sha256=MCFYV_JTvEObTCJE12wfalW8OFFQB_KIFBKDtfES6Nk,2559
745
- omlish/term/confirm.py,sha256=5aqZnfy60K9CBSfXDsD-zA84HJm5fBWb_Y1T1x8gRnw,918
745
+ omlish/term/confirm.py,sha256=M3DAyyPO2yREhSXOAWF-KQcLTHRRZCVsg2nrIKT8kHI,1111
746
746
  omlish/term/progressbar.py,sha256=em2o2emwbfmJIB-EHljQBCkwHd-Zw8Zydl3n73IYvX0,3678
747
747
  omlish/term/vt100/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
748
748
  omlish/term/vt100/c.py,sha256=93HARU6Dd1rVF-n8cAyXqkEqleYLcofuLgSUNd6-GbU,3537
@@ -791,7 +791,7 @@ omlish/text/mangle.py,sha256=k7mYavVgxJ2ENV2wfjw3c9u3hqH5NeVpjoxYbyaYC0Y,2796
791
791
  omlish/text/minja.py,sha256=eyOA_zUCzyqaBfiPX-hV2xdK9_cqlDEhbVTkZUTZgQo,7521
792
792
  omlish/text/parts.py,sha256=MpiCUyfpcL4PLb2Etj8V7Yj4qofhy0xVwBrIL6RfNdg,6646
793
793
  omlish/text/random.py,sha256=8feS5JE_tSjYlMl-lp0j93kCfzBae9AM2cXlRLebXMA,199
794
- omlish/text/templating.py,sha256=4dw0EGEPze6AtI6767PVvwnU3Vn9nyl6NI-ieqY7wQ0,3041
794
+ omlish/text/templating.py,sha256=dUPLXMFFzI2Ep5OhX13z4QXtnhzgNqOmyLkgF5MlFsg,3210
795
795
  omlish/text/antlr/__init__.py,sha256=88bMl_28cfSKslgOkMGYXqALgsHz3KC4LFvAVtzj7k8,89
796
796
  omlish/text/antlr/delimit.py,sha256=wvpZ-FlVoGwRjBALKT1in9cIriIwvyFqmHxgliNJEi8,3472
797
797
  omlish/text/antlr/dot.py,sha256=-WHO-xDSv-Ir00TZ4sVIwunKYtZkRveaQ4m5FKj_bRs,962
@@ -872,9 +872,9 @@ omlish/typedvalues/marshal.py,sha256=AtBz7Jq-BfW8vwM7HSxSpR85JAXmxK2T0xDblmm1HI0
872
872
  omlish/typedvalues/of_.py,sha256=UXkxSj504WI2UrFlqdZJbu2hyDwBhL7XVrc2qdR02GQ,1309
873
873
  omlish/typedvalues/reflect.py,sha256=PAvKW6T4cW7u--iX80w3HWwZUS3SmIZ2_lQjT65uAyk,1026
874
874
  omlish/typedvalues/values.py,sha256=ym46I-q2QJ_6l4UlERqv3yj87R-kp8nCKMRph0xQ3UA,1307
875
- omlish-0.0.0.dev364.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
876
- omlish-0.0.0.dev364.dist-info/METADATA,sha256=ZOYVCoR87JVc1QxFTVZMhgI4L5a_nQN_HgZiDLraDY4,4416
877
- omlish-0.0.0.dev364.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
878
- omlish-0.0.0.dev364.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
879
- omlish-0.0.0.dev364.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
880
- omlish-0.0.0.dev364.dist-info/RECORD,,
875
+ omlish-0.0.0.dev365.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
876
+ omlish-0.0.0.dev365.dist-info/METADATA,sha256=Iqpr1GKfPFRx-BkzrXQ705YfawXtfqbtyuiCHFm9lxQ,4416
877
+ omlish-0.0.0.dev365.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
878
+ omlish-0.0.0.dev365.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
879
+ omlish-0.0.0.dev365.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
880
+ omlish-0.0.0.dev365.dist-info/RECORD,,