ominfra 0.0.0.dev181__py3-none-any.whl → 0.0.0.dev183__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -143,6 +143,7 @@ SocketHandlerFactory = ta.Callable[[SocketAddress, ta.BinaryIO, ta.BinaryIO], 'S
143
143
 
144
144
  # ../configs.py
145
145
  ConfigMapping = ta.Mapping[str, ta.Any]
146
+ IniConfigSectionSettingsMap = ta.Mapping[str, ta.Mapping[str, ta.Union[str, ta.Sequence[str]]]] # ta.TypeAlias
146
147
 
147
148
  # ../../omlish/http/handlers.py
148
149
  HttpHandler = ta.Callable[['HttpHandlerRequest'], 'HttpHandlerResponse'] # ta.TypeAlias
@@ -5371,6 +5372,17 @@ def register_type_obj_marshaler(ty: type, om: ObjMarshaler) -> None:
5371
5372
  _REGISTERED_OBJ_MARSHALERS_BY_TYPE[ty] = om
5372
5373
 
5373
5374
 
5375
+ def register_single_field_type_obj_marshaler(fld, ty=None):
5376
+ def inner(ty): # noqa
5377
+ register_type_obj_marshaler(ty, SingleFieldObjMarshaler(ty, fld))
5378
+ return ty
5379
+
5380
+ if ty is not None:
5381
+ return inner(ty)
5382
+ else:
5383
+ return inner
5384
+
5385
+
5374
5386
  ##
5375
5387
 
5376
5388
 
@@ -5839,6 +5851,9 @@ class SocketHandler(abc.ABC):
5839
5851
  # ../../configs.py
5840
5852
 
5841
5853
 
5854
+ ##
5855
+
5856
+
5842
5857
  def parse_config_file(
5843
5858
  name: str,
5844
5859
  f: ta.TextIO,
@@ -5882,6 +5897,9 @@ def read_config_file(
5882
5897
  return msh.unmarshal_obj(config_dct, cls)
5883
5898
 
5884
5899
 
5900
+ ##
5901
+
5902
+
5885
5903
  def build_config_named_children(
5886
5904
  o: ta.Union[
5887
5905
  ta.Sequence[ConfigMapping],
@@ -5920,6 +5938,30 @@ def build_config_named_children(
5920
5938
  return lst
5921
5939
 
5922
5940
 
5941
+ ##
5942
+
5943
+
5944
+ def render_ini_config(
5945
+ settings_by_section: IniConfigSectionSettingsMap,
5946
+ ) -> str:
5947
+ out = io.StringIO()
5948
+
5949
+ for i, (section, settings) in enumerate(settings_by_section.items()):
5950
+ if i:
5951
+ out.write('\n')
5952
+
5953
+ out.write(f'[{section}]\n')
5954
+
5955
+ for k, v in settings.items():
5956
+ if isinstance(v, str):
5957
+ out.write(f'{k}={v}\n')
5958
+ else:
5959
+ for vv in v:
5960
+ out.write(f'{k}={vv}\n')
5961
+
5962
+ return out.getvalue()
5963
+
5964
+
5923
5965
  ########################################
5924
5966
  # ../pipes.py
5925
5967
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev181
3
+ Version: 0.0.0.dev183
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.dev181
16
- Requires-Dist: omlish==0.0.0.dev181
15
+ Requires-Dist: omdev==0.0.0.dev183
16
+ Requires-Dist: omlish==0.0.0.dev183
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -2,10 +2,9 @@ ominfra/.manifests.json,sha256=8KREXxMAlsilZOktXPYru1ND3V5hFI22vnrp6hT3bio,589
2
2
  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
- ominfra/configs.py,sha256=gY49bZgAQU1IP3lfLbJxOlEuQcL1tlX3TjyJd-XYHt4,2413
5
+ ominfra/configs.py,sha256=UrwZrzsnU4E305OoFH_eAcyI8e82LQZ2yhy8WnuAUGM,3055
6
6
  ominfra/pyremote.py,sha256=HLfAZl3Xw5CpxLS5PS380zqCyE7n3vKVksIYT2Fbdc8,15197
7
7
  ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
8
- ominfra/systemd.py,sha256=sepFytuiRjoWHJbiFH8Ti9zm1gvWBaUXNyvSRiVLi-k,419
9
8
  ominfra/threadworkers.py,sha256=oX4ubZn7h932saXpRIJu2MNhBExgGGMuGhdXarZxLJw,4948
10
9
  ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
10
  ominfra/clouds/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -45,25 +44,30 @@ ominfra/manage/commands/ping.py,sha256=DVZFzL1Z_f-Bq53vxMrL3xOi0iK_nMonJE4KvQf9w
45
44
  ominfra/manage/commands/subprocess.py,sha256=yHGMbAI-xKe_9BUs5IZ3Yav8qRE-I9aGnBtTwW15Pnw,2440
46
45
  ominfra/manage/commands/types.py,sha256=XFZPeqeIBAaIIQF3pdPbGxLlb-LCrz6WtlDWO2q_vz0,210
47
46
  ominfra/manage/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- ominfra/manage/deploy/apps.py,sha256=LeZ2iX2YHviOAnvgut7Oz15301eJoYYCpmD3ffoIagA,4742
47
+ ominfra/manage/deploy/apps.py,sha256=d0OwAVqLyr-_lrsmaeTH69G4b6vIm6ESvmWqKjA-Xn0,4750
49
48
  ominfra/manage/deploy/commands.py,sha256=U74HYQ4nhvH7znAKyXGOmZfdnll2gMWxKWVW4GzxG-0,830
50
- ominfra/manage/deploy/conf.py,sha256=fNfFlIb-bB3KAzaYZcjrbqaqKSiSq0Lpk0mIF6WgXiw,5410
51
49
  ominfra/manage/deploy/config.py,sha256=kPpl8TRisz295cM4oj-RHA6oh5jdcJ_N9pVpkl_doO8,114
52
50
  ominfra/manage/deploy/deploy.py,sha256=vyBTbBm51HhRE-MQNvxEt39F8uOYsB4ToqZ3zmVkpqU,819
53
51
  ominfra/manage/deploy/driver.py,sha256=kSriXFC8L_EpOcHFGxNZDBGyxV_fZAAF95y-czisnwE,1352
54
52
  ominfra/manage/deploy/git.py,sha256=g4wzUuSu9HwWSDhdVX-7BvA2htMwtWbRcHaoDy-xOJ4,3960
55
- ominfra/manage/deploy/inject.py,sha256=eTQC8Kyk8S8ogTJqti2lTwD2j7ha5qQG6KxqeIpLoxU,3610
53
+ ominfra/manage/deploy/inject.py,sha256=8Y1wUEnWCFh9a7YEzHi1GaPfK18c6wP6eVVkKKheScw,3378
54
+ ominfra/manage/deploy/inject_.py,sha256=LR7gEkVx2ldUoQZsGvIcm1Y4QXCVDnLIAdc3LHhQiD4,392
56
55
  ominfra/manage/deploy/interp.py,sha256=_5fuHrY5ZA0eGbnNcOqAhAMSWI1UNvbm0l29eDjE5fI,1037
57
- ominfra/manage/deploy/specs.py,sha256=usi5AmTlv8OGFcwhVHnu8Qrz1Criu5QP6_ScNMi9ehM,3748
58
- ominfra/manage/deploy/tags.py,sha256=NVEJhHKMwoDuCFd8lInH_jIe99FQILBX3wrulh3GiDg,5166
56
+ ominfra/manage/deploy/specs.py,sha256=-WSVpRwiwgXVUh4HVdFUYxadxbLz1WX1ARmQXvmbLlw,2445
57
+ ominfra/manage/deploy/tags.py,sha256=3BU0OtHQJ1Vk9B_U7Q3Cq1rbVgxcXrFki24WU0nPX1M,5106
59
58
  ominfra/manage/deploy/tmp.py,sha256=FqXoVpIpVe8-KWNu7kXt37A4jKdK_y7h_YFvtrUoOG8,729
60
59
  ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2I,112
61
60
  ominfra/manage/deploy/venvs.py,sha256=1Ic3yKap9bTduqHorz1MpmSiQPh9x-vxhLLxgpVpRdc,1592
61
+ ominfra/manage/deploy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
+ ominfra/manage/deploy/conf/inject.py,sha256=xHZQr7oaJCxaKgpJ0H-hgiQNGt4QsskhT3f5v7xrFwE,451
63
+ ominfra/manage/deploy/conf/manager.py,sha256=29txtcAeRNUqK2MD1V5Q-82EoeExdkkV4fRvPnc8GTs,6226
64
+ ominfra/manage/deploy/conf/specs.py,sha256=r9Tf6i0TPVOTuoS__F5Yz1v14Btfqtb1nvUdgEaNeBU,2030
62
65
  ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
66
  ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
64
67
  ominfra/manage/deploy/paths/manager.py,sha256=Dnl8euyZQYDGwDzkMvgPAwOssseducr5kP6T0qzVXQk,929
65
68
  ominfra/manage/deploy/paths/owners.py,sha256=sgCdKOFve8XZOtoTjrFrOrJd_MhZOGXo4yFJAFGRQ_s,1229
66
69
  ominfra/manage/deploy/paths/paths.py,sha256=i7g8YdYOh4M_jgJXtafTbFkRhlu469cfGxAJAuB3fVY,5531
70
+ ominfra/manage/deploy/paths/specs.py,sha256=0cXJI7xjevv4qco3qn4jAs9i5pGyupJ3CFAyJh8y1z0,244
67
71
  ominfra/manage/deploy/paths/types.py,sha256=TGgtSASmdyuZ2maZnvahfA0QxPLWlHBtpDeIEoEDGxk,112
68
72
  ominfra/manage/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
73
  ominfra/manage/remote/_main.py,sha256=p5KoiS2WMw6QAqlDl_Zun-JybmCsy8awIfpBMLBjGMY,4356
@@ -87,9 +91,9 @@ ominfra/manage/targets/connection.py,sha256=rVI1YJxFClcF-sdttqWyIz9_XjPI01GUdwxY
87
91
  ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhhMcE,1561
88
92
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
89
93
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
90
- ominfra/scripts/journald2aws.py,sha256=yEnBAd0Q_3lBkVoTvlJ_uCcUxz7Ckn2qoSWZVhMihvQ,157696
91
- ominfra/scripts/manage.py,sha256=08HgDZP0pTo_3Ms0SZR4Yfh5vQKyyJ092pnwUrlrLnA,327646
92
- ominfra/scripts/supervisor.py,sha256=aEngsVXbK7DNEtILJ_eMMlUu113kfT2uFJ-bdbcPTro,281984
94
+ ominfra/scripts/journald2aws.py,sha256=-XlQ9s2yKZpOQqTQhvEb44q-cYX317mobkjlyCyfUro,158588
95
+ ominfra/scripts/manage.py,sha256=ZH8YdqXxnFdcGb6uCcXotg2wbke0MnniRquPwy3aAPg,330216
96
+ ominfra/scripts/supervisor.py,sha256=WpK_AR5LwmvxLfCyjylMV4_Ud2iNZ6k9QBUxiseSmqY,282876
93
97
  ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
94
98
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
95
99
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
@@ -131,9 +135,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
131
135
  ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
132
136
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
137
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
134
- ominfra-0.0.0.dev181.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
135
- ominfra-0.0.0.dev181.dist-info/METADATA,sha256=JqSra-VNBdQN15a56pBzYgMmXZ3VoycCS4wHIERO7u4,731
136
- ominfra-0.0.0.dev181.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
137
- ominfra-0.0.0.dev181.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
138
- ominfra-0.0.0.dev181.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
139
- ominfra-0.0.0.dev181.dist-info/RECORD,,
138
+ ominfra-0.0.0.dev183.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
139
+ ominfra-0.0.0.dev183.dist-info/METADATA,sha256=l8qBEvlOq5XDXAxp-x6qac9jPhZ2gkyHXMR8mIVnVS0,731
140
+ ominfra-0.0.0.dev183.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
141
+ ominfra-0.0.0.dev183.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
142
+ ominfra-0.0.0.dev183.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
143
+ ominfra-0.0.0.dev183.dist-info/RECORD,,
ominfra/systemd.py DELETED
@@ -1,18 +0,0 @@
1
- # @omlish-lite
2
- import io
3
- import typing as ta
4
-
5
-
6
- def render_systemd_unit(settings_by_section: ta.Mapping[str, ta.Mapping[str, str]]) -> str:
7
- out = io.StringIO()
8
-
9
- for i, (section, settings) in enumerate(settings_by_section.items()):
10
- if i:
11
- out.write('\n')
12
-
13
- out.write(f'[{section}]\n')
14
-
15
- for k, v in settings.items():
16
- out.write(f'{k}={v}\n')
17
-
18
- return out.getvalue()