ominfra 0.0.0.dev141__py3-none-any.whl → 0.0.0.dev142__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ominfra/manage/commands/subprocess.py +18 -17
- ominfra/manage/main.py +25 -63
- ominfra/manage/protocol.py +45 -0
- ominfra/manage/spawning.py +4 -8
- ominfra/pyremote.py +13 -11
- ominfra/scripts/journald2aws.py +123 -86
- ominfra/scripts/manage.py +219 -176
- ominfra/scripts/supervisor.py +110 -86
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/RECORD +14 -13
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev141.dist-info → ominfra-0.0.0.dev142.dist-info}/top_level.txt +0 -0
ominfra/scripts/supervisor.py
CHANGED
@@ -4954,120 +4954,144 @@ _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES: ta.Dict[ta.Any, type] = {
|
|
4954
4954
|
}
|
4955
4955
|
|
4956
4956
|
|
4957
|
-
|
4958
|
-
ty: ta.Any,
|
4959
|
-
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
4960
|
-
*,
|
4961
|
-
nonstrict_dataclasses: bool = False,
|
4962
|
-
) -> ObjMarshaler:
|
4963
|
-
if isinstance(ty, type):
|
4964
|
-
if abc.ABC in ty.__bases__:
|
4965
|
-
return PolymorphicObjMarshaler.of([ # type: ignore
|
4966
|
-
PolymorphicObjMarshaler.Impl(
|
4967
|
-
ity,
|
4968
|
-
ity.__qualname__,
|
4969
|
-
rec(ity),
|
4970
|
-
)
|
4971
|
-
for ity in deep_subclasses(ty)
|
4972
|
-
if abc.ABC not in ity.__bases__
|
4973
|
-
])
|
4974
|
-
|
4975
|
-
if issubclass(ty, enum.Enum):
|
4976
|
-
return EnumObjMarshaler(ty)
|
4957
|
+
##
|
4977
4958
|
|
4978
|
-
if dc.is_dataclass(ty):
|
4979
|
-
return DataclassObjMarshaler(
|
4980
|
-
ty,
|
4981
|
-
{f.name: rec(f.type) for f in dc.fields(ty)},
|
4982
|
-
nonstrict=nonstrict_dataclasses,
|
4983
|
-
)
|
4984
4959
|
|
4985
|
-
|
4986
|
-
|
4987
|
-
|
4988
|
-
|
4989
|
-
|
4990
|
-
|
4991
|
-
|
4992
|
-
|
4993
|
-
|
4994
|
-
try:
|
4995
|
-
st = _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES[ta.get_origin(ty)]
|
4996
|
-
except KeyError:
|
4997
|
-
pass
|
4998
|
-
else:
|
4999
|
-
[e] = ta.get_args(ty)
|
5000
|
-
return IterableObjMarshaler(st, rec(e))
|
4960
|
+
class ObjMarshalerManager:
|
4961
|
+
def __init__(
|
4962
|
+
self,
|
4963
|
+
*,
|
4964
|
+
default_obj_marshalers: ta.Dict[ta.Any, ObjMarshaler] = _DEFAULT_OBJ_MARSHALERS, # noqa
|
4965
|
+
generic_mapping_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_MAPPING_TYPES, # noqa
|
4966
|
+
generic_iterable_types: ta.Dict[ta.Any, type] = _OBJ_MARSHALER_GENERIC_ITERABLE_TYPES, # noqa
|
4967
|
+
) -> None:
|
4968
|
+
super().__init__()
|
5001
4969
|
|
5002
|
-
|
5003
|
-
|
4970
|
+
self._obj_marshalers = dict(default_obj_marshalers)
|
4971
|
+
self._generic_mapping_types = generic_mapping_types
|
4972
|
+
self._generic_iterable_types = generic_iterable_types
|
5004
4973
|
|
5005
|
-
|
4974
|
+
self._lock = threading.RLock()
|
4975
|
+
self._marshalers: ta.Dict[ta.Any, ObjMarshaler] = dict(_DEFAULT_OBJ_MARSHALERS)
|
4976
|
+
self._proxies: ta.Dict[ta.Any, ProxyObjMarshaler] = {}
|
5006
4977
|
|
4978
|
+
#
|
5007
4979
|
|
5008
|
-
|
4980
|
+
def make_obj_marshaler(
|
4981
|
+
self,
|
4982
|
+
ty: ta.Any,
|
4983
|
+
rec: ta.Callable[[ta.Any], ObjMarshaler],
|
4984
|
+
*,
|
4985
|
+
nonstrict_dataclasses: bool = False,
|
4986
|
+
) -> ObjMarshaler:
|
4987
|
+
if isinstance(ty, type):
|
4988
|
+
if abc.ABC in ty.__bases__:
|
4989
|
+
return PolymorphicObjMarshaler.of([ # type: ignore
|
4990
|
+
PolymorphicObjMarshaler.Impl(
|
4991
|
+
ity,
|
4992
|
+
ity.__qualname__,
|
4993
|
+
rec(ity),
|
4994
|
+
)
|
4995
|
+
for ity in deep_subclasses(ty)
|
4996
|
+
if abc.ABC not in ity.__bases__
|
4997
|
+
])
|
4998
|
+
|
4999
|
+
if issubclass(ty, enum.Enum):
|
5000
|
+
return EnumObjMarshaler(ty)
|
5001
|
+
|
5002
|
+
if dc.is_dataclass(ty):
|
5003
|
+
return DataclassObjMarshaler(
|
5004
|
+
ty,
|
5005
|
+
{f.name: rec(f.type) for f in dc.fields(ty)},
|
5006
|
+
nonstrict=nonstrict_dataclasses,
|
5007
|
+
)
|
5009
5008
|
|
5009
|
+
if is_generic_alias(ty):
|
5010
|
+
try:
|
5011
|
+
mt = self._generic_mapping_types[ta.get_origin(ty)]
|
5012
|
+
except KeyError:
|
5013
|
+
pass
|
5014
|
+
else:
|
5015
|
+
k, v = ta.get_args(ty)
|
5016
|
+
return MappingObjMarshaler(mt, rec(k), rec(v))
|
5010
5017
|
|
5011
|
-
|
5018
|
+
try:
|
5019
|
+
st = self._generic_iterable_types[ta.get_origin(ty)]
|
5020
|
+
except KeyError:
|
5021
|
+
pass
|
5022
|
+
else:
|
5023
|
+
[e] = ta.get_args(ty)
|
5024
|
+
return IterableObjMarshaler(st, rec(e))
|
5012
5025
|
|
5013
|
-
|
5026
|
+
if is_union_alias(ty):
|
5027
|
+
return OptionalObjMarshaler(rec(get_optional_alias_arg(ty)))
|
5014
5028
|
|
5015
|
-
|
5029
|
+
raise TypeError(ty)
|
5016
5030
|
|
5031
|
+
#
|
5017
5032
|
|
5018
|
-
def register_opj_marshaler(ty: ta.Any, m: ObjMarshaler) -> None:
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5033
|
+
def register_opj_marshaler(self, ty: ta.Any, m: ObjMarshaler) -> None:
|
5034
|
+
with self._lock:
|
5035
|
+
if ty in self._obj_marshalers:
|
5036
|
+
raise KeyError(ty)
|
5037
|
+
self._obj_marshalers[ty] = m
|
5023
5038
|
|
5039
|
+
def get_obj_marshaler(
|
5040
|
+
self,
|
5041
|
+
ty: ta.Any,
|
5042
|
+
*,
|
5043
|
+
no_cache: bool = False,
|
5044
|
+
**kwargs: ta.Any,
|
5045
|
+
) -> ObjMarshaler:
|
5046
|
+
with self._lock:
|
5047
|
+
if not no_cache:
|
5048
|
+
try:
|
5049
|
+
return self._obj_marshalers[ty]
|
5050
|
+
except KeyError:
|
5051
|
+
pass
|
5024
5052
|
|
5025
|
-
def get_obj_marshaler(
|
5026
|
-
ty: ta.Any,
|
5027
|
-
*,
|
5028
|
-
no_cache: bool = False,
|
5029
|
-
**kwargs: ta.Any,
|
5030
|
-
) -> ObjMarshaler:
|
5031
|
-
with _OBJ_MARSHALERS_LOCK:
|
5032
|
-
if not no_cache:
|
5033
5053
|
try:
|
5034
|
-
return
|
5054
|
+
return self._proxies[ty]
|
5035
5055
|
except KeyError:
|
5036
5056
|
pass
|
5037
5057
|
|
5038
|
-
|
5039
|
-
|
5040
|
-
|
5041
|
-
|
5058
|
+
rec = functools.partial(
|
5059
|
+
self.get_obj_marshaler,
|
5060
|
+
no_cache=no_cache,
|
5061
|
+
**kwargs,
|
5062
|
+
)
|
5042
5063
|
|
5043
|
-
|
5044
|
-
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5064
|
+
p = ProxyObjMarshaler()
|
5065
|
+
self._proxies[ty] = p
|
5066
|
+
try:
|
5067
|
+
m = self.make_obj_marshaler(ty, rec, **kwargs)
|
5068
|
+
finally:
|
5069
|
+
del self._proxies[ty]
|
5070
|
+
p.m = m
|
5048
5071
|
|
5049
|
-
|
5050
|
-
|
5051
|
-
|
5052
|
-
|
5053
|
-
|
5054
|
-
|
5055
|
-
|
5072
|
+
if not no_cache:
|
5073
|
+
self._obj_marshalers[ty] = m
|
5074
|
+
return m
|
5075
|
+
|
5076
|
+
#
|
5077
|
+
|
5078
|
+
def marshal_obj(self, o: ta.Any, ty: ta.Any = None) -> ta.Any:
|
5079
|
+
return self.get_obj_marshaler(ty if ty is not None else type(o)).marshal(o)
|
5056
5080
|
|
5057
|
-
|
5058
|
-
|
5059
|
-
return m
|
5081
|
+
def unmarshal_obj(self, o: ta.Any, ty: ta.Union[ta.Type[T], ta.Any]) -> T:
|
5082
|
+
return self.get_obj_marshaler(ty).unmarshal(o)
|
5060
5083
|
|
5061
5084
|
|
5062
5085
|
##
|
5063
5086
|
|
5064
5087
|
|
5065
|
-
|
5066
|
-
return get_obj_marshaler(ty if ty is not None else type(o)).marshal(o)
|
5088
|
+
OBJ_MARSHALER_MANAGER = ObjMarshalerManager()
|
5067
5089
|
|
5090
|
+
register_opj_marshaler = OBJ_MARSHALER_MANAGER.register_opj_marshaler
|
5091
|
+
get_obj_marshaler = OBJ_MARSHALER_MANAGER.get_obj_marshaler
|
5068
5092
|
|
5069
|
-
|
5070
|
-
|
5093
|
+
marshal_obj = OBJ_MARSHALER_MANAGER.marshal_obj
|
5094
|
+
unmarshal_obj = OBJ_MARSHALER_MANAGER.unmarshal_obj
|
5071
5095
|
|
5072
5096
|
|
5073
5097
|
########################################
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev142
|
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.
|
16
|
-
Requires-Dist: omlish==0.0.0.
|
15
|
+
Requires-Dist: omdev==0.0.0.dev142
|
16
|
+
Requires-Dist: omlish==0.0.0.dev142
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -3,7 +3,7 @@ ominfra/__about__.py,sha256=6i1AoruFYQCd-PyhhbDQDWY2d1tiQu9nkwWr-fXAqfY,705
|
|
3
3
|
ominfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
ominfra/cmds.py,sha256=E0AfnvEmnKntXWvmLW5L05_NeDpBET1VBXn7vV6EwBQ,2083
|
5
5
|
ominfra/configs.py,sha256=8aU1Qmbr-qjaE2iP3gAbA2SWJYMPZ-uGK007L01PoOI,1727
|
6
|
-
ominfra/pyremote.py,sha256=
|
6
|
+
ominfra/pyremote.py,sha256=FkxGXrgeszcYQK-lhp3B1bvDIShW-vTkYVcx0yz_Evs,13150
|
7
7
|
ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
|
8
8
|
ominfra/threadworkers.py,sha256=oX4ubZn7h932saXpRIJu2MNhBExgGGMuGhdXarZxLJw,4948
|
9
9
|
ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -28,16 +28,17 @@ ominfra/journald/genmessages.py,sha256=rLTS-K2v7otNOtTz4RoOEVYCm0fQuuBzf47e0T61t
|
|
28
28
|
ominfra/journald/messages.py,sha256=Wr7TjWMOySc0WnKwp_-idR8RfeKlbyJQ_KkELr0VB70,2192
|
29
29
|
ominfra/journald/tailer.py,sha256=5abcFMfgi7fnY9ZEQe2ZVobaJxjQkeu6d9Kagw33a1w,33525
|
30
30
|
ominfra/manage/__init__.py,sha256=YqHcYMfmo04OoVNYc6Ykc1I8WaJot44skwhm9DcnmXE,166
|
31
|
-
ominfra/manage/main.py,sha256=
|
31
|
+
ominfra/manage/main.py,sha256=31ZjdEGTo3v4H5CLe1ksNlZiEvXZ26utN3wabupvdDk,3193
|
32
32
|
ominfra/manage/payload.py,sha256=NPuQtMGe1q3kDjG5cgOFmd6M9ITyKRc4IyMRY9PHzRI,818
|
33
|
-
ominfra/manage/
|
33
|
+
ominfra/manage/protocol.py,sha256=NPxXxLX-jP-MKcSR3Sz3sMcFRVO2AdtL1gxRtHYXZIw,1171
|
34
|
+
ominfra/manage/spawning.py,sha256=r16vSlUiWRUevSHMkBNBVDOZnB7qdu0k0K4jY3oHPu4,2626
|
34
35
|
ominfra/manage/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
36
|
ominfra/manage/commands/base.py,sha256=nXvqvMYeiuya0hcLnVjQNX3jUdIQN6Brt_UGIQBfNvs,559
|
36
|
-
ominfra/manage/commands/subprocess.py,sha256=
|
37
|
+
ominfra/manage/commands/subprocess.py,sha256=3JaOt56uPqW3jYRtpBpHk5zm3ZzOXzCK-feyDBkq8P4,2198
|
37
38
|
ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
|
-
ominfra/scripts/journald2aws.py,sha256=
|
39
|
-
ominfra/scripts/manage.py,sha256=
|
40
|
-
ominfra/scripts/supervisor.py,sha256=
|
39
|
+
ominfra/scripts/journald2aws.py,sha256=W5mjSE-zeT6DV4oCALur1i8za7XnThh0jLleDxNtKJc,133341
|
40
|
+
ominfra/scripts/manage.py,sha256=wsWkxzFg24hD-Pn9F-fosPw5sa5i7kEPBoeCVOqXBLU,48622
|
41
|
+
ominfra/scripts/supervisor.py,sha256=EVSJ5q7pSQ9vIBZsFyHT2p_RndRb8JMpTfAJ-pY6WNU,247313
|
41
42
|
ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
|
42
43
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
43
44
|
ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
|
@@ -79,9 +80,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
|
79
80
|
ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
|
80
81
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
81
82
|
ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
|
82
|
-
ominfra-0.0.0.
|
83
|
-
ominfra-0.0.0.
|
84
|
-
ominfra-0.0.0.
|
85
|
-
ominfra-0.0.0.
|
86
|
-
ominfra-0.0.0.
|
87
|
-
ominfra-0.0.0.
|
83
|
+
ominfra-0.0.0.dev142.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
84
|
+
ominfra-0.0.0.dev142.dist-info/METADATA,sha256=a7T1XgtIZR-J7arZa-JEIS-v3QHwFaq6t_l-Kuq6eb4,731
|
85
|
+
ominfra-0.0.0.dev142.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
86
|
+
ominfra-0.0.0.dev142.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
87
|
+
ominfra-0.0.0.dev142.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
88
|
+
ominfra-0.0.0.dev142.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|