ominfra 0.0.0.dev223__py3-none-any.whl → 0.0.0.dev224__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.
@@ -4495,6 +4495,25 @@ class SubprocessRun:
4495
4495
  capture_output: ta.Optional[bool] = None
4496
4496
  kwargs: ta.Optional[ta.Mapping[str, ta.Any]] = None
4497
4497
 
4498
+ @classmethod
4499
+ def of(
4500
+ cls,
4501
+ *cmd: str,
4502
+ input: ta.Any = None, # noqa
4503
+ timeout: ta.Optional[float] = None,
4504
+ check: bool = False,
4505
+ capture_output: ta.Optional[bool] = None,
4506
+ **kwargs: ta.Any,
4507
+ ) -> 'SubprocessRun':
4508
+ return cls(
4509
+ cmd=cmd,
4510
+ input=input,
4511
+ timeout=timeout,
4512
+ check=check,
4513
+ capture_output=capture_output,
4514
+ kwargs=kwargs,
4515
+ )
4516
+
4498
4517
 
4499
4518
  @dc.dataclass(frozen=True)
4500
4519
  class SubprocessRunOutput(ta.Generic[T]):
ominfra/scripts/manage.py CHANGED
@@ -8432,6 +8432,25 @@ class SubprocessRun:
8432
8432
  capture_output: ta.Optional[bool] = None
8433
8433
  kwargs: ta.Optional[ta.Mapping[str, ta.Any]] = None
8434
8434
 
8435
+ @classmethod
8436
+ def of(
8437
+ cls,
8438
+ *cmd: str,
8439
+ input: ta.Any = None, # noqa
8440
+ timeout: ta.Optional[float] = None,
8441
+ check: bool = False,
8442
+ capture_output: ta.Optional[bool] = None,
8443
+ **kwargs: ta.Any,
8444
+ ) -> 'SubprocessRun':
8445
+ return cls(
8446
+ cmd=cmd,
8447
+ input=input,
8448
+ timeout=timeout,
8449
+ check=check,
8450
+ capture_output=capture_output,
8451
+ kwargs=kwargs,
8452
+ )
8453
+
8435
8454
 
8436
8455
  @dc.dataclass(frozen=True)
8437
8456
  class SubprocessRunOutput(ta.Generic[T]):
@@ -6908,11 +6908,14 @@ class HttpHandler_(abc.ABC): # noqa
6908
6908
  raise NotImplementedError
6909
6909
 
6910
6910
 
6911
+ ##
6912
+
6913
+
6911
6914
  @dc.dataclass(frozen=True)
6912
6915
  class LoggingHttpHandler(HttpHandler_):
6913
6916
  handler: HttpHandler
6914
6917
  log: logging.Logger
6915
- level: int = logging.INFO
6918
+ level: int = logging.DEBUG
6916
6919
 
6917
6920
  def __call__(self, req: HttpHandlerRequest) -> HttpHandlerResponse:
6918
6921
  self.log.log(self.level, '%r', req)
@@ -6921,6 +6924,54 @@ class LoggingHttpHandler(HttpHandler_):
6921
6924
  return resp
6922
6925
 
6923
6926
 
6927
+ ##
6928
+
6929
+
6930
+ @dc.dataclass(frozen=True)
6931
+ class BytesResponseHttpHandler(HttpHandler_):
6932
+ data: bytes
6933
+
6934
+ status: ta.Union[http.HTTPStatus, int] = 200
6935
+ content_type: ta.Optional[str] = 'application/octet-stream'
6936
+ headers: ta.Optional[ta.Mapping[str, str]] = None
6937
+ close_connection: bool = True
6938
+
6939
+ def __call__(self, req: HttpHandlerRequest) -> HttpHandlerResponse:
6940
+ return HttpHandlerResponse(
6941
+ status=self.status,
6942
+ headers={
6943
+ **({'Content-Type': self.content_type} if self.content_type else {}),
6944
+ 'Content-Length': str(len(self.data)),
6945
+ **(self.headers or {}),
6946
+ },
6947
+ data=self.data,
6948
+ close_connection=self.close_connection,
6949
+ )
6950
+
6951
+
6952
+ @dc.dataclass(frozen=True)
6953
+ class StringResponseHttpHandler(HttpHandler_):
6954
+ data: str
6955
+
6956
+ status: ta.Union[http.HTTPStatus, int] = 200
6957
+ content_type: ta.Optional[str] = 'text/plain; charset=utf-8'
6958
+ headers: ta.Optional[ta.Mapping[str, str]] = None
6959
+ close_connection: bool = True
6960
+
6961
+ def __call__(self, req: HttpHandlerRequest) -> HttpHandlerResponse:
6962
+ data = self.data.encode('utf-8')
6963
+ return HttpHandlerResponse(
6964
+ status=self.status,
6965
+ headers={
6966
+ **({'Content-Type': self.content_type} if self.content_type else {}),
6967
+ 'Content-Length': str(len(data)),
6968
+ **(self.headers or {}),
6969
+ },
6970
+ data=data,
6971
+ close_connection=self.close_connection,
6972
+ )
6973
+
6974
+
6924
6975
  ########################################
6925
6976
  # ../../../omlish/lite/configs.py
6926
6977
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ominfra
3
- Version: 0.0.0.dev223
3
+ Version: 0.0.0.dev224
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.dev223
16
- Requires-Dist: omlish==0.0.0.dev223
15
+ Requires-Dist: omdev==0.0.0.dev224
16
+ Requires-Dist: omlish==0.0.0.dev224
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -112,9 +112,9 @@ ominfra/manage/targets/connection.py,sha256=rVI1YJxFClcF-sdttqWyIz9_XjPI01GUdwxY
112
112
  ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhhMcE,1561
113
113
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
114
114
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
- ominfra/scripts/journald2aws.py,sha256=JciUBLUqkdYUH-QEe5p1rN3m1Rva33FCzB5or3P9UCk,174157
116
- ominfra/scripts/manage.py,sha256=ugFO2yEgd5r9F1YvqaTqoFA5fZr_6kxJkyBQhXBYE80,365322
117
- ominfra/scripts/supervisor.py,sha256=lGMR_wVYDvdStvQXt-48BSs1L0k09vLtLWY3pGXt_vw,297684
115
+ ominfra/scripts/journald2aws.py,sha256=RzHOaeG2Pjoo3KVNdj-5HFZrGDNTXaHEu71UqPHA9KM,174660
116
+ ominfra/scripts/manage.py,sha256=IrlDAT-VvIPWa030ZtWvVR6xea8nuQiMK8XqmxZTmNs,365825
117
+ ominfra/scripts/supervisor.py,sha256=Bd6uUGc3-6xq9VVvmXfOR4mM22-jaR8-ba0Ib5iBVs8,299210
118
118
  ominfra/supervisor/LICENSE.txt,sha256=ZrHY15PVR98y26Yg6iQfa-SXnUaYTDhrUsPVcEO5OKM,1874
119
119
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
120
120
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
@@ -156,9 +156,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
156
156
  ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
157
157
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
158
  ominfra/tools/listresources.py,sha256=BxFoxtyF2aVEcW67ZD9QujoBkJBtvIxGmKqXvLwnEHo,6180
159
- ominfra-0.0.0.dev223.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
160
- ominfra-0.0.0.dev223.dist-info/METADATA,sha256=kp6iE8u8sk6dRbinaC51rSoPjSrwW2TiX-Q_JYDtBDw,731
161
- ominfra-0.0.0.dev223.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
162
- ominfra-0.0.0.dev223.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
163
- ominfra-0.0.0.dev223.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
164
- ominfra-0.0.0.dev223.dist-info/RECORD,,
159
+ ominfra-0.0.0.dev224.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
160
+ ominfra-0.0.0.dev224.dist-info/METADATA,sha256=0AC0qHfJ_AOl0R7bQPEr76-2LIxnn23jkLdKdnSyltQ,731
161
+ ominfra-0.0.0.dev224.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
162
+ ominfra-0.0.0.dev224.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
163
+ ominfra-0.0.0.dev224.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
164
+ ominfra-0.0.0.dev224.dist-info/RECORD,,