ominfra 0.0.0.dev121__py3-none-any.whl → 0.0.0.dev122__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.
@@ -66,6 +66,7 @@ import subprocess
66
66
  import sys
67
67
  import textwrap
68
68
  import threading
69
+ import types
69
70
  import typing as ta
70
71
  import uuid
71
72
  import weakref # noqa
@@ -255,6 +256,14 @@ def get_optional_alias_arg(spec: ta.Any) -> ta.Any:
255
256
  return it
256
257
 
257
258
 
259
+ def is_new_type(spec: ta.Any) -> bool:
260
+ if isinstance(ta.NewType, type):
261
+ return isinstance(spec, ta.NewType)
262
+ else:
263
+ # Before https://github.com/python/cpython/commit/c2f33dfc83ab270412bf243fb21f724037effa1a
264
+ return isinstance(spec, types.FunctionType) and spec.__code__ is ta.NewType.__code__.co_consts[1] # type: ignore # noqa
265
+
266
+
258
267
  def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
259
268
  seen = set()
260
269
  todo = list(reversed(cls.__subclasses__()))
@@ -24,6 +24,7 @@ import subprocess
24
24
  import sys
25
25
  import textwrap
26
26
  import threading
27
+ import types
27
28
  import typing as ta
28
29
  import uuid
29
30
  import weakref # noqa
@@ -338,6 +339,14 @@ def get_optional_alias_arg(spec: ta.Any) -> ta.Any:
338
339
  return it
339
340
 
340
341
 
342
+ def is_new_type(spec: ta.Any) -> bool:
343
+ if isinstance(ta.NewType, type):
344
+ return isinstance(spec, ta.NewType)
345
+ else:
346
+ # Before https://github.com/python/cpython/commit/c2f33dfc83ab270412bf243fb21f724037effa1a
347
+ return isinstance(spec, types.FunctionType) and spec.__code__ is ta.NewType.__code__.co_consts[1] # type: ignore # noqa
348
+
349
+
341
350
  def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
342
351
  seen = set()
343
352
  todo = list(reversed(cls.__subclasses__()))
@@ -1102,6 +1102,14 @@ def get_optional_alias_arg(spec: ta.Any) -> ta.Any:
1102
1102
  return it
1103
1103
 
1104
1104
 
1105
+ def is_new_type(spec: ta.Any) -> bool:
1106
+ if isinstance(ta.NewType, type):
1107
+ return isinstance(spec, ta.NewType)
1108
+ else:
1109
+ # Before https://github.com/python/cpython/commit/c2f33dfc83ab270412bf243fb21f724037effa1a
1110
+ return isinstance(spec, types.FunctionType) and spec.__code__ is ta.NewType.__code__.co_consts[1] # type: ignore # noqa
1111
+
1112
+
1105
1113
  def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
1106
1114
  seen = set()
1107
1115
  todo = list(reversed(cls.__subclasses__()))
@@ -1511,6 +1511,14 @@ def get_optional_alias_arg(spec: ta.Any) -> ta.Any:
1511
1511
  return it
1512
1512
 
1513
1513
 
1514
+ def is_new_type(spec: ta.Any) -> bool:
1515
+ if isinstance(ta.NewType, type):
1516
+ return isinstance(spec, ta.NewType)
1517
+ else:
1518
+ # Before https://github.com/python/cpython/commit/c2f33dfc83ab270412bf243fb21f724037effa1a
1519
+ return isinstance(spec, types.FunctionType) and spec.__code__ is ta.NewType.__code__.co_consts[1] # type: ignore # noqa
1520
+
1521
+
1514
1522
  def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
1515
1523
  seen = set()
1516
1524
  todo = list(reversed(cls.__subclasses__()))
@@ -1687,7 +1695,7 @@ def as_injector_key(o: ta.Any) -> InjectorKey:
1687
1695
  raise TypeError(o)
1688
1696
  if isinstance(o, InjectorKey):
1689
1697
  return o
1690
- if isinstance(o, (type, ta.NewType)):
1698
+ if isinstance(o, type) or is_new_type(o):
1691
1699
  return InjectorKey(o)
1692
1700
  raise TypeError(o)
1693
1701
 
@@ -1803,6 +1811,7 @@ class _InjectorBindings(InjectorBindings):
1803
1811
  def as_injector_bindings(*args: InjectorBindingOrBindings) -> InjectorBindings:
1804
1812
  bs: ta.List[InjectorBinding] = []
1805
1813
  ps: ta.List[InjectorBindings] = []
1814
+
1806
1815
  for a in args:
1807
1816
  if isinstance(a, InjectorBindings):
1808
1817
  ps.append(a)
@@ -1810,6 +1819,7 @@ def as_injector_bindings(*args: InjectorBindingOrBindings) -> InjectorBindings:
1810
1819
  bs.append(a)
1811
1820
  else:
1812
1821
  raise TypeError(a)
1822
+
1813
1823
  return _InjectorBindings(
1814
1824
  bs or None,
1815
1825
  ps or None,
@@ -1831,10 +1841,12 @@ class OverridesInjectorBindings(InjectorBindings):
1831
1841
 
1832
1842
  def injector_override(p: InjectorBindings, *args: InjectorBindingOrBindings) -> InjectorBindings:
1833
1843
  m: ta.Dict[InjectorKey, InjectorBinding] = {}
1844
+
1834
1845
  for b in as_injector_bindings(*args).bindings():
1835
1846
  if b.key in m:
1836
1847
  raise DuplicateInjectorKeyError(b.key)
1837
1848
  m[b.key] = b
1849
+
1838
1850
  return OverridesInjectorBindings(p, m)
1839
1851
 
1840
1852
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev121
3
+ Version: 0.0.0.dev122
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
12
12
  Classifier: Operating System :: POSIX
13
13
  Requires-Python: >=3.12
14
14
  License-File: LICENSE
15
- Requires-Dist: omdev ==0.0.0.dev121
16
- Requires-Dist: omlish ==0.0.0.dev121
15
+ Requires-Dist: omdev ==0.0.0.dev122
16
+ Requires-Dist: omlish ==0.0.0.dev122
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko ~=3.5 ; extra == 'all'
19
19
  Requires-Dist: asyncssh ~=2.18 ; extra == 'all'
@@ -22,7 +22,7 @@ ominfra/clouds/aws/journald2aws/poster.py,sha256=hz1XuctW8GtLmfjhRvCFY6py52D4BzX
22
22
  ominfra/clouds/gcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  ominfra/clouds/gcp/auth.py,sha256=3PyfRJNgajjMqJFem3SKui0CqGeHEsZlvbRhuxFcZG8,1348
24
24
  ominfra/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- ominfra/deploy/_executor.py,sha256=7-A5aScQKhkvh1RgMHBYhccIXECaSHEf0Cv0tqIE_DY,34215
25
+ ominfra/deploy/_executor.py,sha256=46QRoTcnPzhu7RvIL9m7zfx4_AwysA4XdZ1LvABCcHA,34589
26
26
  ominfra/deploy/configs.py,sha256=qi0kwT7G2NH7dXLOQic-u6R3yeadup_QtvrjwWIggbM,435
27
27
  ominfra/deploy/remote.py,sha256=6ACmpXU1uBdyGs3Xsp97ktKFq30cJlzN9LRWNUWlGY4,2144
28
28
  ominfra/deploy/executor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -56,12 +56,12 @@ ominfra/journald/tailer.py,sha256=5abcFMfgi7fnY9ZEQe2ZVobaJxjQkeu6d9Kagw33a1w,33
56
56
  ominfra/manage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  ominfra/manage/manage.py,sha256=BttL8LFEknHZE_h2Pt5dAqbfUkv6qy43WI0raXBZ1a8,151
58
58
  ominfra/pyremote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
- ominfra/pyremote/_runcommands.py,sha256=g-e_vL1if4ls-GokLpUdAlwLQFTEwtJwsc31Vgb1uw8,28051
59
+ ominfra/pyremote/_runcommands.py,sha256=SGMQpN5-LDM99yNYR7lvjdkkJ_jVinSfmxm9mU34hjc,28425
60
60
  ominfra/pyremote/bootstrap.py,sha256=RvMO3YGaN1E4sgUi1JEtiPak8cjvqtc_vRCq1yqbeZg,3370
61
61
  ominfra/pyremote/runcommands.py,sha256=bviS0_TDIoZVAe4h-_iavbvJtVSFu8lnk7fQ5iasCWE,1571
62
62
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
- ominfra/scripts/journald2aws.py,sha256=PAhsys4Ya_FERZ6fcYWJDqTNB2PNfE-dpZwaq4tw2nI,128130
64
- ominfra/scripts/supervisor.py,sha256=zk8oHSBar7wCW890NBELECAZxQ5oYhRjHvqhYnSxBmM,172749
63
+ ominfra/scripts/journald2aws.py,sha256=G56Fx-fHv3p2brOObTwdX7ORA2blhslFfooG2LQL6h4,128491
64
+ ominfra/scripts/supervisor.py,sha256=Vv4x7BER3xAZ-ORNM-5SB1HsSJvu-eSYfcgx3kx5Vfo,173118
65
65
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
66
66
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
67
67
  ominfra/supervisor/compat.py,sha256=mutfnQbSCDaE7TSuQArOcFdfGVw4uEE_E04rIhs1IqU,5312
@@ -82,9 +82,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
82
82
  ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
83
83
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
84
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
85
- ominfra-0.0.0.dev121.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
86
- ominfra-0.0.0.dev121.dist-info/METADATA,sha256=SBtjNf2M-A5Y1F8QRg2785aRubDRD_ff15vrWTLA90E,742
87
- ominfra-0.0.0.dev121.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
88
- ominfra-0.0.0.dev121.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
89
- ominfra-0.0.0.dev121.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
90
- ominfra-0.0.0.dev121.dist-info/RECORD,,
85
+ ominfra-0.0.0.dev122.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
86
+ ominfra-0.0.0.dev122.dist-info/METADATA,sha256=deSke0MO3j-CHNhTN8uGgI-3374_P5fgfqJgo4GRVMU,742
87
+ ominfra-0.0.0.dev122.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
88
+ ominfra-0.0.0.dev122.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
89
+ ominfra-0.0.0.dev122.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
90
+ ominfra-0.0.0.dev122.dist-info/RECORD,,