ominfra 0.0.0.dev172__py3-none-any.whl → 0.0.0.dev174__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -2259,6 +2259,9 @@ Maybe._empty = tuple.__new__(_Maybe, ()) # noqa
2259
2259
  # ../../../omlish/lite/reflect.py
2260
2260
 
2261
2261
 
2262
+ ##
2263
+
2264
+
2262
2265
  _GENERIC_ALIAS_TYPES = (
2263
2266
  ta._GenericAlias, # type: ignore # noqa
2264
2267
  *([ta._SpecialGenericAlias] if hasattr(ta, '_SpecialGenericAlias') else []), # noqa
@@ -2276,6 +2279,9 @@ is_union_alias = functools.partial(is_generic_alias, origin=ta.Union)
2276
2279
  is_callable_alias = functools.partial(is_generic_alias, origin=ta.Callable)
2277
2280
 
2278
2281
 
2282
+ ##
2283
+
2284
+
2279
2285
  def is_optional_alias(spec: ta.Any) -> bool:
2280
2286
  return (
2281
2287
  isinstance(spec, _GENERIC_ALIAS_TYPES) and # noqa
@@ -2290,6 +2296,9 @@ def get_optional_alias_arg(spec: ta.Any) -> ta.Any:
2290
2296
  return it
2291
2297
 
2292
2298
 
2299
+ ##
2300
+
2301
+
2293
2302
  def is_new_type(spec: ta.Any) -> bool:
2294
2303
  if isinstance(ta.NewType, type):
2295
2304
  return isinstance(spec, ta.NewType)
@@ -2302,6 +2311,26 @@ def get_new_type_supertype(spec: ta.Any) -> ta.Any:
2302
2311
  return spec.__supertype__
2303
2312
 
2304
2313
 
2314
+ ##
2315
+
2316
+
2317
+ def is_literal_type(spec: ta.Any) -> bool:
2318
+ if hasattr(ta, '_LiteralGenericAlias'):
2319
+ return isinstance(spec, ta._LiteralGenericAlias) # noqa
2320
+ else:
2321
+ return (
2322
+ isinstance(spec, ta._GenericAlias) and # type: ignore # noqa
2323
+ spec.__origin__ is ta.Literal
2324
+ )
2325
+
2326
+
2327
+ def get_literal_type_args(spec: ta.Any) -> ta.Iterable[ta.Any]:
2328
+ return spec.__args__
2329
+
2330
+
2331
+ ##
2332
+
2333
+
2305
2334
  def deep_subclasses(cls: ta.Type[T]) -> ta.Iterator[ta.Type[T]]:
2306
2335
  seen = set()
2307
2336
  todo = list(reversed(cls.__subclasses__()))
@@ -4991,6 +5020,18 @@ class OptionalObjMarshaler(ObjMarshaler):
4991
5020
  return self.item.unmarshal(o, ctx)
4992
5021
 
4993
5022
 
5023
+ @dc.dataclass(frozen=True)
5024
+ class LiteralObjMarshaler(ObjMarshaler):
5025
+ item: ObjMarshaler
5026
+ vs: frozenset
5027
+
5028
+ def marshal(self, o: ta.Any, ctx: 'ObjMarshalContext') -> ta.Any:
5029
+ return self.item.marshal(check.in_(o, self.vs), ctx)
5030
+
5031
+ def unmarshal(self, o: ta.Any, ctx: 'ObjMarshalContext') -> ta.Any:
5032
+ return check.in_(self.item.unmarshal(o, ctx), self.vs)
5033
+
5034
+
4994
5035
  @dc.dataclass(frozen=True)
4995
5036
  class MappingObjMarshaler(ObjMarshaler):
4996
5037
  ty: type
@@ -5202,6 +5243,11 @@ class ObjMarshalerManager:
5202
5243
  if is_new_type(ty):
5203
5244
  return rec(get_new_type_supertype(ty))
5204
5245
 
5246
+ if is_literal_type(ty):
5247
+ lvs = frozenset(get_literal_type_args(ty))
5248
+ lty = check.single(set(map(type, lvs)))
5249
+ return LiteralObjMarshaler(rec(lty), lvs)
5250
+
5205
5251
  if is_generic_alias(ty):
5206
5252
  try:
5207
5253
  mt = self._generic_mapping_types[ta.get_origin(ty)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev172
3
+ Version: 0.0.0.dev174
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.dev172
16
- Requires-Dist: omlish==0.0.0.dev172
15
+ Requires-Dist: omdev==0.0.0.dev174
16
+ Requires-Dist: omlish==0.0.0.dev174
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -44,23 +44,25 @@ ominfra/manage/commands/ping.py,sha256=DVZFzL1Z_f-Bq53vxMrL3xOi0iK_nMonJE4KvQf9w
44
44
  ominfra/manage/commands/subprocess.py,sha256=yHGMbAI-xKe_9BUs5IZ3Yav8qRE-I9aGnBtTwW15Pnw,2440
45
45
  ominfra/manage/commands/types.py,sha256=XFZPeqeIBAaIIQF3pdPbGxLlb-LCrz6WtlDWO2q_vz0,210
46
46
  ominfra/manage/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- ominfra/manage/deploy/apps.py,sha256=O8iLGeldK48SQp8JkWSBEA93X5o-EuR9-f15wDj-1Bc,5567
47
+ ominfra/manage/deploy/apps.py,sha256=4qcUi7Zxd2Sgfb8ZQSbjiMv1ppkHpJ37zJJMeDs6_xo,4738
48
48
  ominfra/manage/deploy/commands.py,sha256=fKFKhFwqIqC_PsgA-W66qIJ5S32xRgBBaRt3lbPX5Zg,763
49
- ominfra/manage/deploy/conf.py,sha256=AvIZFNuURpS0mKZazr36oBMKi4kJDeTlt74JZmDrpcA,5227
49
+ ominfra/manage/deploy/conf.py,sha256=C2eLMuB2BVi7RM-7aPvZvlZbAgQVDunDD0AehJ11Kog,5511
50
50
  ominfra/manage/deploy/config.py,sha256=aR6ubMEWqkTI55XtcG1Cczn6YhCVN6eSL8DT5EHQJN0,166
51
- ominfra/manage/deploy/deploy.py,sha256=APg8Pbni48ycw83JdsWZRlc1utVDCWlj4q8RCEDXPDg,564
51
+ ominfra/manage/deploy/deploy.py,sha256=zEcuwH7Sj3Z5Wb5U9RDqEG8CHaOZVhGpPBBTGGER2j4,1672
52
52
  ominfra/manage/deploy/git.py,sha256=cfTCx1qD-FQPFkbYW28tkU8nVxQbnfnWxpuJuGQHtBw,3753
53
53
  ominfra/manage/deploy/inject.py,sha256=kzGl2N2jhijUw4-PYUK1LNG8_MJD7BMgCbi6nDViMWg,1965
54
54
  ominfra/manage/deploy/interp.py,sha256=OKkenH8YKEW_mEDR6X7_ZLxK9a1Ox6KHSwFPTHT6OzA,1029
55
- ominfra/manage/deploy/specs.py,sha256=3VenKZyX_PmAFcqmvNQqRO-EaMuvFwWWaVF8Y_X9fHU,2865
55
+ ominfra/manage/deploy/specs.py,sha256=13QLTShAyt-tT0i85Cf_L6GsPZvVKnYShk2EMrLBdj8,3726
56
+ ominfra/manage/deploy/tags.py,sha256=f2gTcV9aOGv5A6-6ZESHzeQ47TcLTkaEXe60_JyvqQo,4977
56
57
  ominfra/manage/deploy/tmp.py,sha256=dFJuqGfSf5otCxSaCI01a5UOSaArMlU4MzzYcyr74-s,1237
57
- ominfra/manage/deploy/types.py,sha256=HzOTDmj9HcHWA_X1GGiwYZ98CGG7X_hdAGMvit_a_n4,829
58
+ ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2I,112
58
59
  ominfra/manage/deploy/venvs.py,sha256=1co8l3eSxl2WccrF-XOTqeltoMccRH63o69NblV3yok,1366
59
60
  ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
61
  ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
61
62
  ominfra/manage/deploy/paths/manager.py,sha256=gxr_CsjLmjxXx8w3J8ookJk9OGltCpyBFYBnxXaw5lg,1050
62
63
  ominfra/manage/deploy/paths/owners.py,sha256=GmLy0E70C8CF3eYIdkAhBtYaZXW4QWmSzvgts5l1i_4,1379
63
- ominfra/manage/deploy/paths/paths.py,sha256=gluJ0I-OPfig0YbjlqE1Tepv48oKIIv6lN6kcQLtUg0,6076
64
+ ominfra/manage/deploy/paths/paths.py,sha256=_zFXTeiACLkC9i289rQlqkPg_U8nHWWpuShW29-STSs,5541
65
+ ominfra/manage/deploy/paths/types.py,sha256=TGgtSASmdyuZ2maZnvahfA0QxPLWlHBtpDeIEoEDGxk,112
64
66
  ominfra/manage/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
67
  ominfra/manage/remote/_main.py,sha256=p5KoiS2WMw6QAqlDl_Zun-JybmCsy8awIfpBMLBjGMY,4356
66
68
  ominfra/manage/remote/channel.py,sha256=36xR9Ti9ZA8TUBtxmY0u7_3Lv7E6wzQTxlZl7gLR5GE,2224
@@ -83,9 +85,9 @@ ominfra/manage/targets/connection.py,sha256=rVI1YJxFClcF-sdttqWyIz9_XjPI01GUdwxY
83
85
  ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhhMcE,1561
84
86
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
85
87
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
- ominfra/scripts/journald2aws.py,sha256=OjbemVx-zyCBuWZVgTky66n2-MfyyS7ups4A9hsvHfA,155684
87
- ominfra/scripts/manage.py,sha256=-S9NuQJfhPDNMZ65E17gA3FW5VET1k7hVfD6IsnxqpY,309598
88
- ominfra/scripts/supervisor.py,sha256=viYrsafRW5fLN2KUS1MtxCOm9CO4iOgIu60cmN3joSg,274450
88
+ ominfra/scripts/journald2aws.py,sha256=fbs8jZCsnwi5vF8Bg892wu3rscHCHeLQlvsDs6oAZBs,156681
89
+ ominfra/scripts/manage.py,sha256=jzClDt2zLKySdtAvo1vvis8bJaYVY44KB_jZ6ePY4ho,316667
90
+ ominfra/scripts/supervisor.py,sha256=CD8o9RktPyB3L8nMBa6rabWE0tZlti6dmzoEEKRPWvY,275447
89
91
  ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
90
92
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
91
93
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
@@ -127,9 +129,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
127
129
  ominfra/tailscale/cli.py,sha256=h6akQJMl0KuWLHS7Ur6WcBZ2JwF0DJQhsPTnFBdGyNk,3571
128
130
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
131
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
130
- ominfra-0.0.0.dev172.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
131
- ominfra-0.0.0.dev172.dist-info/METADATA,sha256=Dblof9p8CJUrUXZQUd-D90DdAC6wURRm9I5pSZ-v3N4,731
132
- ominfra-0.0.0.dev172.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
133
- ominfra-0.0.0.dev172.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
134
- ominfra-0.0.0.dev172.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
135
- ominfra-0.0.0.dev172.dist-info/RECORD,,
132
+ ominfra-0.0.0.dev174.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
133
+ ominfra-0.0.0.dev174.dist-info/METADATA,sha256=qeVp2nf876Zeu0NurT7Qldb4EuRYsIuTY9jAFc51DXo,731
134
+ ominfra-0.0.0.dev174.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
135
+ ominfra-0.0.0.dev174.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
136
+ ominfra-0.0.0.dev174.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
137
+ ominfra-0.0.0.dev174.dist-info/RECORD,,