omserv 0.0.0.dev188__py3-none-any.whl → 0.0.0.dev190__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omserv/nginx/build.py +4 -0
- omserv/nginx/configs.py +26 -36
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/METADATA +2 -2
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/RECORD +12 -12
- /omserv/{node → nodes}/__init__.py +0 -0
- /omserv/{node → nodes}/models.py +0 -0
- /omserv/{node → nodes}/registry.py +0 -0
- /omserv/{node → nodes}/sql.py +0 -0
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/LICENSE +0 -0
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/WHEEL +0 -0
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/entry_points.txt +0 -0
- {omserv-0.0.0.dev188.dist-info → omserv-0.0.0.dev190.dist-info}/top_level.txt +0 -0
omserv/nginx/build.py
CHANGED
omserv/nginx/configs.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# ruff: noqa: UP006 UP007
|
2
|
+
# @omlish-lite
|
1
3
|
"""
|
2
4
|
TODO:
|
3
5
|
- omnibus/jmespath
|
@@ -8,46 +10,46 @@ https://nginx.org/en/docs/example.html
|
|
8
10
|
|
9
11
|
https://github.com/yandex/gixy
|
10
12
|
"""
|
13
|
+
import collections.abc
|
11
14
|
import dataclasses as dc
|
12
15
|
import typing as ta
|
13
16
|
|
14
|
-
from omlish import check
|
15
|
-
from omlish import lang
|
17
|
+
from omlish.lite.check import check
|
16
18
|
from omlish.text.indent import IndentWriter
|
17
19
|
|
18
20
|
|
19
21
|
@dc.dataclass()
|
20
|
-
class
|
21
|
-
lst:
|
22
|
+
class NginxConfigItems:
|
23
|
+
lst: ta.List['NginxConfigItem']
|
22
24
|
|
23
25
|
@classmethod
|
24
|
-
def of(cls, obj: ta.Any) -> '
|
25
|
-
if isinstance(obj,
|
26
|
+
def of(cls, obj: ta.Any) -> 'NginxConfigItems':
|
27
|
+
if isinstance(obj, NginxConfigItems):
|
26
28
|
return obj
|
27
|
-
return cls([
|
29
|
+
return cls([NginxConfigItem.of(e) for e in check.isinstance(obj, list)])
|
28
30
|
|
29
31
|
|
30
32
|
@dc.dataclass()
|
31
|
-
class
|
33
|
+
class NginxConfigItem:
|
32
34
|
name: str
|
33
|
-
args:
|
34
|
-
block:
|
35
|
+
args: ta.Optional[ta.List[str]] = None
|
36
|
+
block: ta.Optional[NginxConfigItems] = None
|
35
37
|
|
36
38
|
@classmethod
|
37
|
-
def of(cls, obj: ta.Any) -> '
|
38
|
-
if isinstance(obj,
|
39
|
+
def of(cls, obj: ta.Any) -> 'NginxConfigItem':
|
40
|
+
if isinstance(obj, NginxConfigItem):
|
39
41
|
return obj
|
40
|
-
args = check.isinstance(obj,
|
42
|
+
args = check.isinstance(check.not_isinstance(obj, str), collections.abc.Sequence)
|
41
43
|
name, args = check.isinstance(args[0], str), args[1:]
|
42
44
|
if args and not isinstance(args[-1], str):
|
43
|
-
block, args =
|
45
|
+
block, args = NginxConfigItems.of(args[-1]), args[:-1]
|
44
46
|
else:
|
45
47
|
block = None
|
46
|
-
return
|
48
|
+
return NginxConfigItem(name, [check.isinstance(e, str) for e in args], block=block)
|
47
49
|
|
48
50
|
|
49
|
-
def
|
50
|
-
if isinstance(obj,
|
51
|
+
def render_nginx_config(wr: IndentWriter, obj: ta.Any) -> None:
|
52
|
+
if isinstance(obj, NginxConfigItem):
|
51
53
|
wr.write(obj.name)
|
52
54
|
for e in obj.args or ():
|
53
55
|
wr.write(' ')
|
@@ -55,32 +57,20 @@ def render(wr: IndentWriter, obj: ta.Any) -> None:
|
|
55
57
|
if obj.block:
|
56
58
|
wr.write(' {\n')
|
57
59
|
with wr.indent():
|
58
|
-
|
60
|
+
render_nginx_config(wr, obj.block)
|
59
61
|
wr.write('}\n')
|
60
62
|
else:
|
61
63
|
wr.write(';\n')
|
62
64
|
|
63
|
-
elif isinstance(obj,
|
65
|
+
elif isinstance(obj, NginxConfigItems):
|
64
66
|
for e2 in obj.lst:
|
65
|
-
|
67
|
+
render_nginx_config(wr, e2)
|
66
68
|
|
67
69
|
else:
|
68
70
|
raise TypeError(obj)
|
69
71
|
|
70
72
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
('events', [
|
76
|
-
('worker_connections', '2000'),
|
77
|
-
]),
|
78
|
-
])
|
79
|
-
|
80
|
-
wr = IndentWriter()
|
81
|
-
render(wr, conf)
|
82
|
-
print(wr.getvalue())
|
83
|
-
|
84
|
-
|
85
|
-
if __name__ == '__main__':
|
86
|
-
_main()
|
73
|
+
def render_nginx_config_str(obj: ta.Any) -> str:
|
74
|
+
iw = IndentWriter()
|
75
|
+
render_nginx_config(iw, obj)
|
76
|
+
return iw.getvalue()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omserv
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev190
|
4
4
|
Summary: omserv
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ 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: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev190
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: h11~=0.14; extra == "all"
|
18
18
|
Requires-Dist: h2~=4.1; extra == "all"
|
@@ -10,16 +10,16 @@ omserv/apps/sessions.py,sha256=glruQSbOSbCYLPp6nDRNSHCyp5hj4oiOPhh3R0F9BTM,1537
|
|
10
10
|
omserv/apps/templates.py,sha256=PBRZHIF9UbnFnq-4EC6RmPeRkeH8lCBbpJkSdseHs6A,2125
|
11
11
|
omserv/daemon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
omserv/nginx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
omserv/nginx/build.py,sha256=
|
14
|
-
omserv/nginx/configs.py,sha256=
|
13
|
+
omserv/nginx/build.py,sha256=2LzI5eM3U2V0CbUHEOHx4zwnMl5CU2lhu-odPrI7idU,3203
|
14
|
+
omserv/nginx/configs.py,sha256=cOCz3_QxkZfS5j_zQBQNeDWdMjv8CWGB8YqEZ2FL7tI,2106
|
15
15
|
omserv/nginx/logs.py,sha256=cODPsG1j3EQiXbb9SR20NpB9MjGdWN0ArFZ-TA9xf-c,1840
|
16
16
|
omserv/nginx/stubstatus.py,sha256=_VnXZdXxSA7jIelYSwJLf9mOnt_UOvpWghAPWtlWSLw,1857
|
17
17
|
omserv/nginx/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
omserv/nginx/patches/nginx-1.27.3_http_status.patch,sha256=bEDSczpBLcdjcBp_X1m73oxvt8KPeons7v_sUxqBSXM,4335
|
19
|
-
omserv/
|
20
|
-
omserv/
|
21
|
-
omserv/
|
22
|
-
omserv/
|
19
|
+
omserv/nodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
+
omserv/nodes/models.py,sha256=EOaq-aW1rbGOzHTmTULhbVwV5j_burL07qh2QO9smdM,1273
|
21
|
+
omserv/nodes/registry.py,sha256=y67VMowll9IuLiTVgauAcbP8-evFJNqpwocwwt7kZL4,3478
|
22
|
+
omserv/nodes/sql.py,sha256=vy7RP50JiH3jQHMVa7Hxk0pFJK3QcbGeTvyNppB1W4I,2826
|
23
23
|
omserv/server/LICENSE,sha256=VKPNmbyrS9wcwcx20hBlVtLP01brb2dByHrWHeNLPag,1050
|
24
24
|
omserv/server/__init__.py,sha256=jrFdrxfnQwjK5DW5y9w0alw6IKToGn2IQyZDhsuGHv4,372
|
25
25
|
omserv/server/config.py,sha256=oGWL1kuk45bJ6sVr8n3ow5Q-1nz9EqByjoykU2iOHIY,1189
|
@@ -48,9 +48,9 @@ omserv/server/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
48
48
|
omserv/server/streams/httpstream.py,sha256=0DeiAPLGbEGNa0fHTs8lUpi_CFZs4M5_QB-TiS8mobQ,8015
|
49
49
|
omserv/server/streams/utils.py,sha256=aMOrqWIg_Hht5W4kLg3y7oR5AEkVvMrZhyjzo6U5owE,1527
|
50
50
|
omserv/server/streams/wsstream.py,sha256=3Vyzox7dCE1tDSXjb6xBubWo41ZF9d38Hrsrlj6h1J8,15482
|
51
|
-
omserv-0.0.0.
|
52
|
-
omserv-0.0.0.
|
53
|
-
omserv-0.0.0.
|
54
|
-
omserv-0.0.0.
|
55
|
-
omserv-0.0.0.
|
56
|
-
omserv-0.0.0.
|
51
|
+
omserv-0.0.0.dev190.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
52
|
+
omserv-0.0.0.dev190.dist-info/METADATA,sha256=tjpmp09_W5LMbCxvv0MhB4OapPnhXlYClZ4JVSl7Bxo,983
|
53
|
+
omserv-0.0.0.dev190.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
54
|
+
omserv-0.0.0.dev190.dist-info/entry_points.txt,sha256=ivSrdA_ahEbI-eVMu-XZS-z4VrnQISvpecIkOqC9zFM,35
|
55
|
+
omserv-0.0.0.dev190.dist-info/top_level.txt,sha256=HXehpnxeKscKNULzKNzZ27oNawBrsh1PaNAirbX-XNA,7
|
56
|
+
omserv-0.0.0.dev190.dist-info/RECORD,,
|
File without changes
|
/omserv/{node → nodes}/models.py
RENAMED
File without changes
|
File without changes
|
/omserv/{node → nodes}/sql.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|