omlish 0.0.0.dev133__py3-none-any.whl → 0.0.0.dev177__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omlish/.manifests.json +265 -7
- omlish/__about__.py +5 -3
- omlish/antlr/_runtime/__init__.py +0 -22
- omlish/antlr/_runtime/_all.py +24 -0
- omlish/antlr/_runtime/atn/ParserATNSimulator.py +1 -1
- omlish/antlr/_runtime/dfa/DFASerializer.py +1 -1
- omlish/antlr/_runtime/error/DiagnosticErrorListener.py +2 -1
- omlish/antlr/_runtime/xpath/XPath.py +7 -1
- omlish/antlr/_runtime/xpath/XPathLexer.py +1 -1
- omlish/antlr/delimit.py +106 -0
- omlish/antlr/dot.py +31 -0
- omlish/antlr/errors.py +11 -0
- omlish/antlr/input.py +96 -0
- omlish/antlr/parsing.py +19 -0
- omlish/antlr/runtime.py +102 -0
- omlish/antlr/utils.py +38 -0
- omlish/argparse/all.py +45 -0
- omlish/{argparse.py → argparse/cli.py} +112 -107
- omlish/asyncs/__init__.py +0 -35
- omlish/asyncs/all.py +35 -0
- omlish/asyncs/asyncio/all.py +7 -0
- omlish/asyncs/asyncio/channels.py +40 -0
- omlish/asyncs/asyncio/streams.py +45 -0
- omlish/asyncs/asyncio/subprocesses.py +238 -0
- omlish/asyncs/asyncio/timeouts.py +16 -0
- omlish/asyncs/bluelet/LICENSE +6 -0
- omlish/asyncs/bluelet/all.py +67 -0
- omlish/asyncs/bluelet/api.py +23 -0
- omlish/asyncs/bluelet/core.py +178 -0
- omlish/asyncs/bluelet/events.py +78 -0
- omlish/asyncs/bluelet/files.py +80 -0
- omlish/asyncs/bluelet/runner.py +416 -0
- omlish/asyncs/bluelet/sockets.py +214 -0
- omlish/bootstrap/sys.py +3 -3
- omlish/cached.py +2 -2
- omlish/check.py +49 -460
- omlish/codecs/__init__.py +72 -0
- omlish/codecs/base.py +106 -0
- omlish/codecs/bytes.py +119 -0
- omlish/codecs/chain.py +23 -0
- omlish/codecs/funcs.py +39 -0
- omlish/codecs/registry.py +139 -0
- omlish/codecs/standard.py +4 -0
- omlish/codecs/text.py +217 -0
- omlish/collections/cache/impl.py +50 -57
- omlish/collections/coerce.py +1 -0
- omlish/collections/mappings.py +1 -1
- omlish/configs/flattening.py +1 -1
- omlish/defs.py +1 -1
- omlish/diag/_pycharm/runhack.py +8 -2
- omlish/diag/procfs.py +8 -8
- omlish/docker/__init__.py +0 -36
- omlish/docker/all.py +31 -0
- omlish/docker/consts.py +4 -0
- omlish/{lite/docker.py → docker/detect.py} +18 -0
- omlish/docker/{helpers.py → timebomb.py} +0 -21
- omlish/formats/cbor.py +31 -0
- omlish/formats/cloudpickle.py +31 -0
- omlish/formats/codecs.py +93 -0
- omlish/formats/json/codecs.py +29 -0
- omlish/formats/json/delimted.py +4 -0
- omlish/formats/json/stream/errors.py +2 -0
- omlish/formats/json/stream/lex.py +12 -6
- omlish/formats/json/stream/parse.py +38 -22
- omlish/formats/json5.py +31 -0
- omlish/formats/pickle.py +31 -0
- omlish/formats/repr.py +25 -0
- omlish/formats/toml.py +17 -0
- omlish/formats/yaml.py +25 -0
- omlish/funcs/__init__.py +0 -0
- omlish/{genmachine.py → funcs/genmachine.py} +5 -4
- omlish/{matchfns.py → funcs/match.py} +1 -1
- omlish/funcs/pairs.py +215 -0
- omlish/http/__init__.py +0 -48
- omlish/http/all.py +48 -0
- omlish/http/coro/__init__.py +0 -0
- omlish/{lite/fdio/corohttp.py → http/coro/fdio.py} +21 -19
- omlish/{lite/http/coroserver.py → http/coro/server.py} +20 -21
- omlish/{lite/http → http}/handlers.py +3 -2
- omlish/{lite/http → http}/parsing.py +1 -0
- omlish/http/sessions.py +1 -1
- omlish/{lite/http → http}/versions.py +1 -0
- omlish/inject/managed.py +2 -2
- omlish/io/__init__.py +0 -3
- omlish/{lite/io.py → io/buffers.py} +8 -9
- omlish/io/compress/__init__.py +9 -0
- omlish/io/compress/abc.py +104 -0
- omlish/io/compress/adapters.py +148 -0
- omlish/io/compress/base.py +24 -0
- omlish/io/compress/brotli.py +47 -0
- omlish/io/compress/bz2.py +61 -0
- omlish/io/compress/codecs.py +78 -0
- omlish/io/compress/gzip.py +350 -0
- omlish/io/compress/lz4.py +91 -0
- omlish/io/compress/lzma.py +81 -0
- omlish/io/compress/snappy.py +34 -0
- omlish/io/compress/zlib.py +74 -0
- omlish/io/compress/zstd.py +44 -0
- omlish/io/fdio/__init__.py +1 -0
- omlish/{lite → io}/fdio/handlers.py +5 -5
- omlish/{lite → io}/fdio/kqueue.py +8 -8
- omlish/{lite → io}/fdio/manager.py +7 -7
- omlish/{lite → io}/fdio/pollers.py +13 -13
- omlish/io/generators/__init__.py +56 -0
- omlish/io/generators/consts.py +1 -0
- omlish/io/generators/direct.py +13 -0
- omlish/io/generators/readers.py +189 -0
- omlish/io/generators/stepped.py +191 -0
- omlish/io/pyio.py +5 -2
- omlish/iterators/__init__.py +24 -0
- omlish/iterators/iterators.py +132 -0
- omlish/iterators/recipes.py +18 -0
- omlish/iterators/tools.py +96 -0
- omlish/iterators/unique.py +67 -0
- omlish/lang/__init__.py +13 -1
- omlish/lang/functions.py +11 -2
- omlish/lang/generators.py +243 -0
- omlish/lang/iterables.py +46 -49
- omlish/lang/maybes.py +4 -4
- omlish/lite/cached.py +39 -6
- omlish/lite/check.py +438 -75
- omlish/lite/contextmanagers.py +17 -4
- omlish/lite/dataclasses.py +42 -0
- omlish/lite/inject.py +28 -45
- omlish/lite/logs.py +0 -270
- omlish/lite/marshal.py +309 -144
- omlish/lite/pycharm.py +47 -0
- omlish/lite/reflect.py +33 -0
- omlish/lite/resources.py +8 -0
- omlish/lite/runtime.py +4 -4
- omlish/lite/shlex.py +12 -0
- omlish/lite/socketserver.py +2 -2
- omlish/lite/strings.py +31 -0
- omlish/logs/__init__.py +0 -32
- omlish/logs/{_abc.py → abc.py} +0 -1
- omlish/logs/all.py +37 -0
- omlish/logs/{formatters.py → color.py} +1 -2
- omlish/logs/configs.py +7 -38
- omlish/logs/filters.py +10 -0
- omlish/logs/handlers.py +4 -1
- omlish/logs/json.py +56 -0
- omlish/logs/proxy.py +99 -0
- omlish/logs/standard.py +128 -0
- omlish/logs/utils.py +2 -2
- omlish/manifests/__init__.py +2 -0
- omlish/manifests/load.py +209 -0
- omlish/manifests/types.py +17 -0
- omlish/marshal/base.py +1 -1
- omlish/marshal/factories.py +1 -1
- omlish/marshal/forbidden.py +1 -1
- omlish/marshal/iterables.py +1 -1
- omlish/marshal/literals.py +50 -0
- omlish/marshal/mappings.py +1 -1
- omlish/marshal/maybes.py +1 -1
- omlish/marshal/standard.py +5 -1
- omlish/marshal/unions.py +1 -1
- omlish/os/__init__.py +0 -0
- omlish/os/atomics.py +205 -0
- omlish/os/deathsig.py +23 -0
- omlish/{os.py → os/files.py} +0 -9
- omlish/{lite → os}/journald.py +2 -1
- omlish/os/linux.py +484 -0
- omlish/os/paths.py +36 -0
- omlish/{lite → os}/pidfile.py +1 -0
- omlish/os/sizes.py +9 -0
- omlish/reflect/__init__.py +3 -0
- omlish/reflect/subst.py +2 -1
- omlish/reflect/types.py +126 -44
- omlish/secrets/pwhash.py +1 -1
- omlish/secrets/subprocesses.py +3 -1
- omlish/specs/jsonrpc/marshal.py +1 -1
- omlish/specs/openapi/marshal.py +1 -1
- omlish/sql/alchemy/asyncs.py +1 -1
- omlish/sql/queries/__init__.py +9 -1
- omlish/sql/queries/building.py +3 -0
- omlish/sql/queries/exprs.py +10 -27
- omlish/sql/queries/idents.py +48 -10
- omlish/sql/queries/names.py +80 -13
- omlish/sql/queries/params.py +64 -0
- omlish/sql/queries/rendering.py +1 -1
- omlish/subprocesses.py +340 -0
- omlish/term.py +29 -14
- omlish/testing/pytest/marks.py +2 -2
- omlish/testing/pytest/plugins/asyncs.py +6 -1
- omlish/testing/pytest/plugins/logging.py +1 -1
- omlish/testing/pytest/plugins/switches.py +1 -1
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/METADATA +7 -5
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/RECORD +200 -117
- omlish/fnpairs.py +0 -496
- omlish/formats/json/cli/__main__.py +0 -11
- omlish/formats/json/cli/cli.py +0 -298
- omlish/formats/json/cli/formats.py +0 -71
- omlish/formats/json/cli/io.py +0 -74
- omlish/formats/json/cli/parsing.py +0 -82
- omlish/formats/json/cli/processing.py +0 -48
- omlish/formats/json/cli/rendering.py +0 -92
- omlish/iterators.py +0 -300
- omlish/lite/subprocesses.py +0 -130
- /omlish/{formats/json/cli → argparse}/__init__.py +0 -0
- /omlish/{lite/fdio → asyncs/asyncio}/__init__.py +0 -0
- /omlish/asyncs/{asyncio.py → asyncio/asyncio.py} +0 -0
- /omlish/{lite/http → asyncs/bluelet}/__init__.py +0 -0
- /omlish/collections/{_abc.py → abc.py} +0 -0
- /omlish/{fnpipes.py → funcs/pipes.py} +0 -0
- /omlish/io/{_abc.py → abc.py} +0 -0
- /omlish/sql/{_abc.py → abc.py} +0 -0
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/WHEEL +0 -0
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/entry_points.txt +0 -0
- {omlish-0.0.0.dev133.dist-info → omlish-0.0.0.dev177.dist-info}/top_level.txt +0 -0
omlish/.manifests.json
CHANGED
@@ -24,14 +24,272 @@
|
|
24
24
|
}
|
25
25
|
},
|
26
26
|
{
|
27
|
-
"module": ".formats.
|
28
|
-
"attr": "
|
29
|
-
"file": "omlish/formats/
|
30
|
-
"line":
|
27
|
+
"module": ".formats.cbor",
|
28
|
+
"attr": "_CBOR_LAZY_CODEC",
|
29
|
+
"file": "omlish/formats/cbor.py",
|
30
|
+
"line": 30,
|
31
31
|
"value": {
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
32
|
+
"$.codecs.base.LazyLoadedCodec": {
|
33
|
+
"mod_name": "omlish.formats.cbor",
|
34
|
+
"attr_name": "CBOR_CODEC",
|
35
|
+
"name": "cbor",
|
36
|
+
"aliases": null
|
37
|
+
}
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"module": ".formats.cloudpickle",
|
42
|
+
"attr": "_CLOUDPICKLE_LAZY_CODEC",
|
43
|
+
"file": "omlish/formats/cloudpickle.py",
|
44
|
+
"line": 30,
|
45
|
+
"value": {
|
46
|
+
"$.codecs.base.LazyLoadedCodec": {
|
47
|
+
"mod_name": "omlish.formats.cloudpickle",
|
48
|
+
"attr_name": "CLOUDPICKLE_CODEC",
|
49
|
+
"name": "cloudpickle",
|
50
|
+
"aliases": null
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"module": ".formats.json.codecs",
|
56
|
+
"attr": "_JSON_LAZY_CODEC",
|
57
|
+
"file": "omlish/formats/json/codecs.py",
|
58
|
+
"line": 14,
|
59
|
+
"value": {
|
60
|
+
"$.codecs.base.LazyLoadedCodec": {
|
61
|
+
"mod_name": "omlish.formats.json.codecs",
|
62
|
+
"attr_name": "JSON_CODEC",
|
63
|
+
"name": "json",
|
64
|
+
"aliases": null
|
65
|
+
}
|
66
|
+
}
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"module": ".formats.json.codecs",
|
70
|
+
"attr": "_JSON_COMPACT_LAZY_CODEC",
|
71
|
+
"file": "omlish/formats/json/codecs.py",
|
72
|
+
"line": 21,
|
73
|
+
"value": {
|
74
|
+
"$.codecs.base.LazyLoadedCodec": {
|
75
|
+
"mod_name": "omlish.formats.json.codecs",
|
76
|
+
"attr_name": "JSON_COMPACT_CODEC",
|
77
|
+
"name": "json-compact",
|
78
|
+
"aliases": null
|
79
|
+
}
|
80
|
+
}
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"module": ".formats.json.codecs",
|
84
|
+
"attr": "_JSON_PRETTY_LAZY_CODEC",
|
85
|
+
"file": "omlish/formats/json/codecs.py",
|
86
|
+
"line": 28,
|
87
|
+
"value": {
|
88
|
+
"$.codecs.base.LazyLoadedCodec": {
|
89
|
+
"mod_name": "omlish.formats.json.codecs",
|
90
|
+
"attr_name": "JSON_PRETTY_CODEC",
|
91
|
+
"name": "json-pretty",
|
92
|
+
"aliases": null
|
93
|
+
}
|
94
|
+
}
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"module": ".formats.json5",
|
98
|
+
"attr": "_JSON5_LAZY_CODEC",
|
99
|
+
"file": "omlish/formats/json5.py",
|
100
|
+
"line": 30,
|
101
|
+
"value": {
|
102
|
+
"$.codecs.base.LazyLoadedCodec": {
|
103
|
+
"mod_name": "omlish.formats.json5",
|
104
|
+
"attr_name": "JSON5_CODEC",
|
105
|
+
"name": "json5",
|
106
|
+
"aliases": null
|
107
|
+
}
|
108
|
+
}
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"module": ".formats.pickle",
|
112
|
+
"attr": "_PICKLE_LAZY_CODEC",
|
113
|
+
"file": "omlish/formats/pickle.py",
|
114
|
+
"line": 30,
|
115
|
+
"value": {
|
116
|
+
"$.codecs.base.LazyLoadedCodec": {
|
117
|
+
"mod_name": "omlish.formats.pickle",
|
118
|
+
"attr_name": "PICKLE_CODEC",
|
119
|
+
"name": "pickle",
|
120
|
+
"aliases": null
|
121
|
+
}
|
122
|
+
}
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"module": ".formats.repr",
|
126
|
+
"attr": "_REPR_LAZY_CODEC",
|
127
|
+
"file": "omlish/formats/repr.py",
|
128
|
+
"line": 24,
|
129
|
+
"value": {
|
130
|
+
"$.codecs.base.LazyLoadedCodec": {
|
131
|
+
"mod_name": "omlish.formats.repr",
|
132
|
+
"attr_name": "REPR_CODEC",
|
133
|
+
"name": "repr",
|
134
|
+
"aliases": null
|
135
|
+
}
|
136
|
+
}
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"module": ".formats.toml",
|
140
|
+
"attr": "_TOML_LAZY_CODEC",
|
141
|
+
"file": "omlish/formats/toml.py",
|
142
|
+
"line": 16,
|
143
|
+
"value": {
|
144
|
+
"$.codecs.base.LazyLoadedCodec": {
|
145
|
+
"mod_name": "omlish.formats.toml",
|
146
|
+
"attr_name": "TOML_CODEC",
|
147
|
+
"name": "toml",
|
148
|
+
"aliases": null
|
149
|
+
}
|
150
|
+
}
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"module": ".formats.yaml",
|
154
|
+
"attr": "_YAML_LAZY_CODEC",
|
155
|
+
"file": "omlish/formats/yaml.py",
|
156
|
+
"line": 258,
|
157
|
+
"value": {
|
158
|
+
"$.codecs.base.LazyLoadedCodec": {
|
159
|
+
"mod_name": "omlish.formats.yaml",
|
160
|
+
"attr_name": "YAML_CODEC",
|
161
|
+
"name": "yaml",
|
162
|
+
"aliases": [
|
163
|
+
"yml"
|
164
|
+
]
|
165
|
+
}
|
166
|
+
}
|
167
|
+
},
|
168
|
+
{
|
169
|
+
"module": ".formats.yaml",
|
170
|
+
"attr": "_YAML_UNSAFE_LAZY_CODEC",
|
171
|
+
"file": "omlish/formats/yaml.py",
|
172
|
+
"line": 265,
|
173
|
+
"value": {
|
174
|
+
"$.codecs.base.LazyLoadedCodec": {
|
175
|
+
"mod_name": "omlish.formats.yaml",
|
176
|
+
"attr_name": "YAML_UNSAFE_CODEC",
|
177
|
+
"name": "yaml-unsafe",
|
178
|
+
"aliases": null
|
179
|
+
}
|
180
|
+
}
|
181
|
+
},
|
182
|
+
{
|
183
|
+
"module": ".io.compress.brotli",
|
184
|
+
"attr": "_BROTLI_LAZY_CODEC",
|
185
|
+
"file": "omlish/io/compress/brotli.py",
|
186
|
+
"line": 46,
|
187
|
+
"value": {
|
188
|
+
"$.codecs.base.LazyLoadedCodec": {
|
189
|
+
"mod_name": "omlish.io.compress.brotli",
|
190
|
+
"attr_name": "BROTLI_CODEC",
|
191
|
+
"name": "brotli",
|
192
|
+
"aliases": null
|
193
|
+
}
|
194
|
+
}
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"module": ".io.compress.bz2",
|
198
|
+
"attr": "_BZ2_LAZY_CODEC",
|
199
|
+
"file": "omlish/io/compress/bz2.py",
|
200
|
+
"line": 60,
|
201
|
+
"value": {
|
202
|
+
"$.codecs.base.LazyLoadedCodec": {
|
203
|
+
"mod_name": "omlish.io.compress.bz2",
|
204
|
+
"attr_name": "BZ2_CODEC",
|
205
|
+
"name": "bz2",
|
206
|
+
"aliases": null
|
207
|
+
}
|
208
|
+
}
|
209
|
+
},
|
210
|
+
{
|
211
|
+
"module": ".io.compress.gzip",
|
212
|
+
"attr": "_GZIP_LAZY_CODEC",
|
213
|
+
"file": "omlish/io/compress/gzip.py",
|
214
|
+
"line": 349,
|
215
|
+
"value": {
|
216
|
+
"$.codecs.base.LazyLoadedCodec": {
|
217
|
+
"mod_name": "omlish.io.compress.gzip",
|
218
|
+
"attr_name": "GZIP_CODEC",
|
219
|
+
"name": "gzip",
|
220
|
+
"aliases": [
|
221
|
+
"gz"
|
222
|
+
]
|
223
|
+
}
|
224
|
+
}
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"module": ".io.compress.lz4",
|
228
|
+
"attr": "_LZ4_LAZY_CODEC",
|
229
|
+
"file": "omlish/io/compress/lz4.py",
|
230
|
+
"line": 90,
|
231
|
+
"value": {
|
232
|
+
"$.codecs.base.LazyLoadedCodec": {
|
233
|
+
"mod_name": "omlish.io.compress.lz4",
|
234
|
+
"attr_name": "LZ4_CODEC",
|
235
|
+
"name": "lz4",
|
236
|
+
"aliases": null
|
237
|
+
}
|
238
|
+
}
|
239
|
+
},
|
240
|
+
{
|
241
|
+
"module": ".io.compress.lzma",
|
242
|
+
"attr": "_LZMA_LAZY_CODEC",
|
243
|
+
"file": "omlish/io/compress/lzma.py",
|
244
|
+
"line": 80,
|
245
|
+
"value": {
|
246
|
+
"$.codecs.base.LazyLoadedCodec": {
|
247
|
+
"mod_name": "omlish.io.compress.lzma",
|
248
|
+
"attr_name": "LZMA_CODEC",
|
249
|
+
"name": "lzma",
|
250
|
+
"aliases": null
|
251
|
+
}
|
252
|
+
}
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"module": ".io.compress.snappy",
|
256
|
+
"attr": "_SNAPPY_LAZY_CODEC",
|
257
|
+
"file": "omlish/io/compress/snappy.py",
|
258
|
+
"line": 33,
|
259
|
+
"value": {
|
260
|
+
"$.codecs.base.LazyLoadedCodec": {
|
261
|
+
"mod_name": "omlish.io.compress.snappy",
|
262
|
+
"attr_name": "SNAPPY_CODEC",
|
263
|
+
"name": "snappy",
|
264
|
+
"aliases": null
|
265
|
+
}
|
266
|
+
}
|
267
|
+
},
|
268
|
+
{
|
269
|
+
"module": ".io.compress.zlib",
|
270
|
+
"attr": "_ZLIB_LAZY_CODEC",
|
271
|
+
"file": "omlish/io/compress/zlib.py",
|
272
|
+
"line": 73,
|
273
|
+
"value": {
|
274
|
+
"$.codecs.base.LazyLoadedCodec": {
|
275
|
+
"mod_name": "omlish.io.compress.zlib",
|
276
|
+
"attr_name": "ZLIB_CODEC",
|
277
|
+
"name": "zlib",
|
278
|
+
"aliases": null
|
279
|
+
}
|
280
|
+
}
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"module": ".io.compress.zstd",
|
284
|
+
"attr": "_ZSTD_LAZY_CODEC",
|
285
|
+
"file": "omlish/io/compress/zstd.py",
|
286
|
+
"line": 43,
|
287
|
+
"value": {
|
288
|
+
"$.codecs.base.LazyLoadedCodec": {
|
289
|
+
"mod_name": "omlish.io.compress.zstd",
|
290
|
+
"attr_name": "ZSTD_CODEC",
|
291
|
+
"name": "zstd",
|
292
|
+
"aliases": null
|
35
293
|
}
|
36
294
|
}
|
37
295
|
},
|
omlish/__about__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
__version__ = '0.0.0.
|
2
|
-
__revision__ = '
|
1
|
+
__version__ = '0.0.0.dev177'
|
2
|
+
__revision__ = '3c81e0413acb397557436f3f66780dd6e8555500'
|
3
3
|
|
4
4
|
|
5
5
|
#
|
@@ -32,7 +32,7 @@ class Project(ProjectBase):
|
|
32
32
|
|
33
33
|
optional_dependencies = {
|
34
34
|
'async': [
|
35
|
-
'anyio ~= 4.
|
35
|
+
'anyio ~= 4.7',
|
36
36
|
'sniffio ~= 1.3',
|
37
37
|
|
38
38
|
'greenlet ~= 3.1',
|
@@ -48,6 +48,8 @@ class Project(ProjectBase):
|
|
48
48
|
'python-snappy ~= 0.7',
|
49
49
|
|
50
50
|
'zstandard ~= 0.23',
|
51
|
+
|
52
|
+
'brotli ~= 1.1',
|
51
53
|
],
|
52
54
|
|
53
55
|
'diag': [
|
@@ -1,24 +1,2 @@
|
|
1
|
-
# type: ignore
|
2
1
|
# ruff: noqa
|
3
2
|
# flake8: noqa
|
4
|
-
from .Token import Token
|
5
|
-
from .InputStream import InputStream
|
6
|
-
from .FileStream import FileStream
|
7
|
-
from .StdinStream import StdinStream
|
8
|
-
from .BufferedTokenStream import TokenStream
|
9
|
-
from .CommonTokenStream import CommonTokenStream
|
10
|
-
from .Lexer import Lexer
|
11
|
-
from .Parser import Parser
|
12
|
-
from .dfa.DFA import DFA
|
13
|
-
from .atn.ATN import ATN
|
14
|
-
from .atn.ATNDeserializer import ATNDeserializer
|
15
|
-
from .atn.LexerATNSimulator import LexerATNSimulator
|
16
|
-
from .atn.ParserATNSimulator import ParserATNSimulator
|
17
|
-
from .atn.PredictionMode import PredictionMode
|
18
|
-
from .PredictionContext import PredictionContextCache
|
19
|
-
from .ParserRuleContext import RuleContext, ParserRuleContext
|
20
|
-
from .tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode
|
21
|
-
from .error.Errors import RecognitionException, IllegalStateException, NoViableAltException
|
22
|
-
from .error.ErrorStrategy import BailErrorStrategy
|
23
|
-
from .error.DiagnosticErrorListener import DiagnosticErrorListener
|
24
|
-
from .Utils import str_list
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# ruff: noqa
|
2
|
+
# flake8: noqa
|
3
|
+
# type: ignore
|
4
|
+
from .Token import Token
|
5
|
+
from .InputStream import InputStream
|
6
|
+
from .FileStream import FileStream
|
7
|
+
from .StdinStream import StdinStream
|
8
|
+
from .BufferedTokenStream import TokenStream
|
9
|
+
from .CommonTokenStream import CommonTokenStream
|
10
|
+
from .Lexer import Lexer
|
11
|
+
from .Parser import Parser
|
12
|
+
from .dfa.DFA import DFA
|
13
|
+
from .atn.ATN import ATN
|
14
|
+
from .atn.ATNDeserializer import ATNDeserializer
|
15
|
+
from .atn.LexerATNSimulator import LexerATNSimulator
|
16
|
+
from .atn.ParserATNSimulator import ParserATNSimulator
|
17
|
+
from .atn.PredictionMode import PredictionMode
|
18
|
+
from .PredictionContext import PredictionContextCache
|
19
|
+
from .ParserRuleContext import RuleContext, ParserRuleContext
|
20
|
+
from .tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode
|
21
|
+
from .error.Errors import RecognitionException, IllegalStateException, NoViableAltException
|
22
|
+
from .error.ErrorStrategy import BailErrorStrategy
|
23
|
+
from .error.DiagnosticErrorListener import DiagnosticErrorListener
|
24
|
+
from .Utils import str_list
|
@@ -50,7 +50,13 @@
|
|
50
50
|
# <p>
|
51
51
|
# Whitespace is not allowed.</p>
|
52
52
|
#
|
53
|
-
from .. import CommonTokenStream
|
53
|
+
from ..CommonTokenStream import CommonTokenStream
|
54
|
+
from ..dfa.DFA import DFA
|
55
|
+
from ..PredictionContext import PredictionContextCache
|
56
|
+
from ..Lexer import Lexer
|
57
|
+
from ..atn.LexerATNSimulator import LexerATNSimulator
|
58
|
+
from ..ParserRuleContext import ParserRuleContext
|
59
|
+
from ..tree.Tree import TerminalNode
|
54
60
|
from ..InputStream import InputStream
|
55
61
|
from ..Parser import Parser
|
56
62
|
from ..RuleContext import RuleContext
|
omlish/antlr/delimit.py
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# ruff: noqa: N802 N815
|
2
|
+
import io
|
3
|
+
import typing as ta
|
4
|
+
|
5
|
+
from .. import check
|
6
|
+
from . import runtime as antlr4
|
7
|
+
|
8
|
+
|
9
|
+
class DelimitingLexer(antlr4.Lexer):
|
10
|
+
def __init__(
|
11
|
+
self,
|
12
|
+
*args: ta.Any,
|
13
|
+
delimiter_token: ta.Any,
|
14
|
+
delimiters: ta.Iterable[str],
|
15
|
+
no_skip: bool = False,
|
16
|
+
**kwargs,
|
17
|
+
) -> None:
|
18
|
+
super().__init__(*args, **kwargs)
|
19
|
+
|
20
|
+
self._delimiter_token = delimiter_token
|
21
|
+
self._delimiters = set(check.not_isinstance(delimiters, str))
|
22
|
+
self._no_skip = no_skip
|
23
|
+
|
24
|
+
_hitEOF: bool
|
25
|
+
|
26
|
+
def nextToken(self) -> antlr4.Token:
|
27
|
+
if self._input is None:
|
28
|
+
raise antlr4.IllegalStateException('nextToken requires a non-null input stream.')
|
29
|
+
|
30
|
+
token_start_marker = self._input.mark()
|
31
|
+
try:
|
32
|
+
while True:
|
33
|
+
if self._hitEOF:
|
34
|
+
self.emitEOF()
|
35
|
+
return self._token
|
36
|
+
|
37
|
+
self._token: antlr4.Token | None = None
|
38
|
+
self._channel = antlr4.Token.DEFAULT_CHANNEL
|
39
|
+
self._tokenStartCharIndex = self._input.index
|
40
|
+
self._tokenStartColumn = self._interp.column
|
41
|
+
self._tokenStartLine = self._interp.line
|
42
|
+
self._text = None
|
43
|
+
|
44
|
+
continue_outer = False
|
45
|
+
while True:
|
46
|
+
self._type = antlr4.Token.INVALID_TYPE
|
47
|
+
ttype = self.SKIP
|
48
|
+
|
49
|
+
for delimiter in self._delimiters:
|
50
|
+
if self._match_delimiter(delimiter):
|
51
|
+
ttype = self._delimiter_token
|
52
|
+
break
|
53
|
+
else:
|
54
|
+
try:
|
55
|
+
ttype = self._interp.match(self._input, self._mode)
|
56
|
+
except antlr4.LexerNoViableAltException as e:
|
57
|
+
self.notifyListeners(e) # report error
|
58
|
+
self.recover(e)
|
59
|
+
|
60
|
+
if self._input.LA(1) == antlr4.Token.EOF:
|
61
|
+
self._hitEOF = True
|
62
|
+
|
63
|
+
if self._type == antlr4.Token.INVALID_TYPE:
|
64
|
+
self._type = ttype
|
65
|
+
|
66
|
+
if not self._no_skip and self._type == self.SKIP:
|
67
|
+
continue_outer = True
|
68
|
+
break
|
69
|
+
|
70
|
+
if self._type != self.MORE:
|
71
|
+
break
|
72
|
+
|
73
|
+
if continue_outer:
|
74
|
+
continue
|
75
|
+
|
76
|
+
if self._token is None:
|
77
|
+
self.emit()
|
78
|
+
|
79
|
+
return self._token
|
80
|
+
|
81
|
+
finally:
|
82
|
+
self._input.release(token_start_marker)
|
83
|
+
|
84
|
+
def _match_delimiter(self, delimiter: str) -> bool:
|
85
|
+
for i, c in enumerate(delimiter):
|
86
|
+
if chr(self._input.LA(i + 1)) != c:
|
87
|
+
return False
|
88
|
+
self._input.seek(self._input.index + len(delimiter))
|
89
|
+
return True
|
90
|
+
|
91
|
+
def split(self) -> tuple[list[tuple[str, str]], str]:
|
92
|
+
lst = []
|
93
|
+
sb = io.StringIO()
|
94
|
+
while True:
|
95
|
+
token = self.nextToken()
|
96
|
+
if token.type == antlr4.Token.EOF:
|
97
|
+
break
|
98
|
+
if token.type == self._delimiter_token:
|
99
|
+
statement = sb.getvalue().strip()
|
100
|
+
if statement:
|
101
|
+
lst.append((statement, token.text))
|
102
|
+
sb = io.StringIO()
|
103
|
+
else:
|
104
|
+
sb.write(token.text)
|
105
|
+
partial = sb.getvalue()
|
106
|
+
return lst, partial
|
omlish/antlr/dot.py
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
from ..graphs import dot
|
2
|
+
from . import runtime as antlr4
|
3
|
+
from .utils import yield_contexts
|
4
|
+
|
5
|
+
|
6
|
+
def dot_ctx(root: antlr4.ParserRuleContext) -> dot.Graph:
|
7
|
+
stmts: list[dot.Stmt] = [
|
8
|
+
dot.RawStmt('rankdir=LR;'),
|
9
|
+
]
|
10
|
+
|
11
|
+
for c in yield_contexts(root):
|
12
|
+
if isinstance(c, antlr4.TerminalNode):
|
13
|
+
continue
|
14
|
+
|
15
|
+
lbl = [
|
16
|
+
[type(c).__name__],
|
17
|
+
[str(id(c))],
|
18
|
+
[f'{c.start} {c.stop}'],
|
19
|
+
]
|
20
|
+
|
21
|
+
stmts.append(dot.Node(f'_{id(c)}', {'label': lbl, 'shape': 'box'}))
|
22
|
+
|
23
|
+
for n in (c.children or []):
|
24
|
+
if not isinstance(n, antlr4.TerminalNode):
|
25
|
+
stmts.append(dot.Edge(f'_{id(c)}', f'_{id(n)}'))
|
26
|
+
|
27
|
+
return dot.Graph(stmts)
|
28
|
+
|
29
|
+
|
30
|
+
def open_dot_ctx(root: antlr4.ParserRuleContext) -> None:
|
31
|
+
dot.open_dot(dot.render(dot_ctx(root)))
|
omlish/antlr/errors.py
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# ruff: noqa: N802 N803
|
2
|
+
from . import runtime as antlr4
|
3
|
+
|
4
|
+
|
5
|
+
class ParseError(Exception):
|
6
|
+
pass
|
7
|
+
|
8
|
+
|
9
|
+
class SilentRaisingErrorListener(antlr4.ErrorListener):
|
10
|
+
def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e):
|
11
|
+
raise ParseError(recognizer, offendingSymbol, line, column, msg, e)
|
omlish/antlr/input.py
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# ruff: noqa: N802
|
2
|
+
import typing as ta
|
3
|
+
|
4
|
+
|
5
|
+
##
|
6
|
+
|
7
|
+
|
8
|
+
# class InputStream(ta.Protocol):
|
9
|
+
#
|
10
|
+
# @property
|
11
|
+
# def index(self) -> int: ...
|
12
|
+
#
|
13
|
+
# @property
|
14
|
+
# def size(self) -> int: ...
|
15
|
+
#
|
16
|
+
# # Reset the stream so that it's in the same state it was when the object was created *except* the data array is not
|
17
|
+
# # touched.
|
18
|
+
# def reset(self) -> None: ...
|
19
|
+
#
|
20
|
+
# def consume(self) -> None: ...
|
21
|
+
#
|
22
|
+
# def LA(self, offset: int) -> int: ...
|
23
|
+
#
|
24
|
+
# def LT(self, offset: int) -> int: ...
|
25
|
+
#
|
26
|
+
# def mark(self) -> int: ...
|
27
|
+
#
|
28
|
+
# def release(self, marker: int) -> None: ...
|
29
|
+
#
|
30
|
+
# # consume() ahead until p==_index; can't just set p=_index as we must update line and column. If we seek backwards,
|
31
|
+
# # just set p
|
32
|
+
# def seek(self, _index: int) -> None: ...
|
33
|
+
#
|
34
|
+
# def getText(self, start: int, stop: int) -> str: ...
|
35
|
+
#
|
36
|
+
# def __str__(self) -> str: ...
|
37
|
+
|
38
|
+
|
39
|
+
InputStream: ta.TypeAlias = ta.Any
|
40
|
+
|
41
|
+
|
42
|
+
##
|
43
|
+
|
44
|
+
|
45
|
+
# @lang.protocol_check(InputStream)
|
46
|
+
class ProxyInputStream:
|
47
|
+
def __init__(self, target: InputStream) -> None:
|
48
|
+
super().__init__()
|
49
|
+
|
50
|
+
self._target = target
|
51
|
+
|
52
|
+
@property
|
53
|
+
def index(self) -> int:
|
54
|
+
return self._target.index
|
55
|
+
|
56
|
+
@property
|
57
|
+
def size(self) -> int:
|
58
|
+
return self._target.size
|
59
|
+
|
60
|
+
def reset(self) -> None:
|
61
|
+
self._target.reset()
|
62
|
+
|
63
|
+
def consume(self) -> None:
|
64
|
+
self._target.consume()
|
65
|
+
|
66
|
+
def LA(self, offset: int) -> int:
|
67
|
+
return self._target.LA(offset)
|
68
|
+
|
69
|
+
def LT(self, offset: int) -> int:
|
70
|
+
return self._target.LT(offset)
|
71
|
+
|
72
|
+
def mark(self) -> int:
|
73
|
+
return self._target.mark()
|
74
|
+
|
75
|
+
def release(self, marker: int) -> None:
|
76
|
+
return self._target.release(marker)
|
77
|
+
|
78
|
+
def seek(self, _index: int) -> None:
|
79
|
+
return self._target.seek(_index)
|
80
|
+
|
81
|
+
def getText(self, start: int, stop: int) -> str:
|
82
|
+
return self._target.getText(start, stop)
|
83
|
+
|
84
|
+
def __str__(self) -> str:
|
85
|
+
return str(self._target)
|
86
|
+
|
87
|
+
|
88
|
+
##
|
89
|
+
|
90
|
+
|
91
|
+
class CaseInsensitiveInputStream(ProxyInputStream):
|
92
|
+
def LA(self, offset: int) -> int:
|
93
|
+
ret = super().LA(offset)
|
94
|
+
if ret != -1:
|
95
|
+
ret = ord(chr(ret).upper())
|
96
|
+
return ret
|
omlish/antlr/parsing.py
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# ruff: noqa: N802 N803
|
2
|
+
import typing as ta
|
3
|
+
|
4
|
+
from . import runtime as antlr4
|
5
|
+
|
6
|
+
|
7
|
+
LexerT = ta.TypeVar('LexerT', bound=antlr4.Lexer)
|
8
|
+
ParserT = ta.TypeVar('ParserT', bound=antlr4.Parser)
|
9
|
+
|
10
|
+
|
11
|
+
def parse(
|
12
|
+
buf: str,
|
13
|
+
lexer_cls: type[LexerT],
|
14
|
+
parser_cls: type[ParserT],
|
15
|
+
) -> ParserT:
|
16
|
+
lexer = lexer_cls(antlr4.InputStream(buf))
|
17
|
+
stream = antlr4.CommonTokenStream(lexer)
|
18
|
+
stream.fill()
|
19
|
+
return parser_cls(stream)
|