omdev 0.0.0.dev346__py3-none-any.whl → 0.0.0.dev348__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.
Potentially problematic release.
This version of omdev might be problematic. Click here for more details.
- omdev/tools/json/cli.py +4 -0
- omdev/tools/json/processing.py +10 -1
- omdev/tools/json/rendering.py +10 -0
- omdev/tools/jsonview/cli.py +9 -0
- omdev/tools/jsonview/resources/jsonview.css +5 -0
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/RECORD +11 -11
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/licenses/LICENSE +0 -0
- {omdev-0.0.0.dev346.dist-info → omdev-0.0.0.dev348.dist-info}/top_level.txt +0 -0
omdev/tools/json/cli.py
CHANGED
|
@@ -84,6 +84,7 @@ def _build_args_parser() -> argparse.ArgumentParser:
|
|
|
84
84
|
|
|
85
85
|
parser.add_argument('-x', '--jmespath-expr')
|
|
86
86
|
parser.add_argument('-F', '--flat', action='store_true')
|
|
87
|
+
parser.add_argument('-E', '--omit-empty', action='store_true')
|
|
87
88
|
|
|
88
89
|
parser.add_argument('-z', '--compact', action='store_true')
|
|
89
90
|
parser.add_argument('-p', '--pretty', action='store_true')
|
|
@@ -92,6 +93,7 @@ def _build_args_parser() -> argparse.ArgumentParser:
|
|
|
92
93
|
parser.add_argument('-R', '--raw', action='store_true')
|
|
93
94
|
parser.add_argument('-U', '--unicode', action='store_true')
|
|
94
95
|
parser.add_argument('-c', '--color', action='store_true')
|
|
96
|
+
parser.add_argument('-5', '--five', action='store_true')
|
|
95
97
|
|
|
96
98
|
parser.add_argument('-L', '--less', action='store_true')
|
|
97
99
|
|
|
@@ -128,6 +130,7 @@ def _process_args(args: ta.Any) -> RunConfiguration:
|
|
|
128
130
|
processing = ProcessingOptions(
|
|
129
131
|
jmespath_expr=args.jmespath_expr,
|
|
130
132
|
flat=args.flat,
|
|
133
|
+
omit_empty=args.omit_empty,
|
|
131
134
|
)
|
|
132
135
|
|
|
133
136
|
#
|
|
@@ -152,6 +155,7 @@ def _process_args(args: ta.Any) -> RunConfiguration:
|
|
|
152
155
|
raw=args.raw,
|
|
153
156
|
unicode=args.unicode,
|
|
154
157
|
color=args.color,
|
|
158
|
+
five=args.five,
|
|
155
159
|
)
|
|
156
160
|
|
|
157
161
|
#
|
omdev/tools/json/processing.py
CHANGED
|
@@ -17,6 +17,7 @@ else:
|
|
|
17
17
|
class ProcessingOptions:
|
|
18
18
|
jmespath_expr: ta.Any | None = None
|
|
19
19
|
flat: bool = False
|
|
20
|
+
omit_empty: bool = False
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class Processor:
|
|
@@ -34,6 +35,7 @@ class Processor:
|
|
|
34
35
|
if self._jmespath_expr is not None:
|
|
35
36
|
v = self._jmespath_expr.search(v)
|
|
36
37
|
|
|
38
|
+
vs: ta.Iterable[ta.Any]
|
|
37
39
|
if self._opts.flat:
|
|
38
40
|
if (
|
|
39
41
|
not isinstance(v, ta.Iterable) or # noqa
|
|
@@ -42,7 +44,14 @@ class Processor:
|
|
|
42
44
|
):
|
|
43
45
|
raise TypeError(f'Flat output must be flat collections, got {type(v)}', v)
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
vs = v
|
|
46
48
|
|
|
47
49
|
else:
|
|
50
|
+
vs = [v]
|
|
51
|
+
|
|
52
|
+
for v in vs:
|
|
53
|
+
if self._opts.omit_empty:
|
|
54
|
+
if v is None or (isinstance(v, (ta.Sequence, ta.Mapping)) and not v):
|
|
55
|
+
continue
|
|
56
|
+
|
|
48
57
|
yield v
|
omdev/tools/json/rendering.py
CHANGED
|
@@ -6,6 +6,7 @@ from omlish import lang
|
|
|
6
6
|
from omlish.formats.json.rendering import JsonRenderer
|
|
7
7
|
from omlish.formats.json.stream.parsing import JsonStreamParserEvent
|
|
8
8
|
from omlish.formats.json.stream.rendering import StreamJsonRenderer
|
|
9
|
+
from omlish.formats.json5.rendering import Json5Renderer
|
|
9
10
|
from omlish.term import codes as tc
|
|
10
11
|
|
|
11
12
|
|
|
@@ -20,6 +21,7 @@ class RenderingOptions:
|
|
|
20
21
|
raw: bool = False
|
|
21
22
|
unicode: bool = False
|
|
22
23
|
color: bool = False
|
|
24
|
+
five: bool = False
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
def make_render_kwargs(opts: RenderingOptions) -> ta.Mapping[str, ta.Any]:
|
|
@@ -61,6 +63,14 @@ class EagerRenderer(Renderer):
|
|
|
61
63
|
|
|
62
64
|
return v
|
|
63
65
|
|
|
66
|
+
elif self._opts.five:
|
|
67
|
+
return Json5Renderer.render_str(
|
|
68
|
+
v,
|
|
69
|
+
**self._kw,
|
|
70
|
+
**(dict(style=term_color) if self._opts.color else {}),
|
|
71
|
+
multiline_strings=True,
|
|
72
|
+
)
|
|
73
|
+
|
|
64
74
|
elif self._opts.color:
|
|
65
75
|
return JsonRenderer.render_str(
|
|
66
76
|
v,
|
omdev/tools/jsonview/cli.py
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TODO:
|
|
3
|
+
- read from stdin
|
|
4
|
+
- evaluate jmespath on server using extended engine
|
|
5
|
+
- integrate with json tool
|
|
6
|
+
- use omlish server and templates
|
|
7
|
+
- vendor deps, serve local
|
|
8
|
+
- update to https://github.com/josdejong/svelte-jsoneditor
|
|
9
|
+
"""
|
|
1
10
|
import argparse
|
|
2
11
|
import http.server
|
|
3
12
|
import json
|
|
@@ -7,6 +7,7 @@ html, body {
|
|
|
7
7
|
flex-direction: column;
|
|
8
8
|
font-family: sans-serif;
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
.input-area {
|
|
11
12
|
padding: 10px;
|
|
12
13
|
display: flex;
|
|
@@ -15,6 +16,7 @@ html, body {
|
|
|
15
16
|
border-bottom: 1px solid #ccc;
|
|
16
17
|
flex-shrink: 0;
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
#jmespath-input {
|
|
19
21
|
flex-grow: 1;
|
|
20
22
|
padding: 8px;
|
|
@@ -22,11 +24,14 @@ html, body {
|
|
|
22
24
|
border-radius: 4px;
|
|
23
25
|
font-size: 14px;
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
#error-message {
|
|
26
29
|
color: red;
|
|
27
30
|
font-size: 14px;
|
|
28
31
|
white-space: nowrap;
|
|
29
32
|
}
|
|
33
|
+
|
|
30
34
|
#jsoneditor {
|
|
31
35
|
flex-grow: 1;
|
|
36
|
+
overflow: auto;
|
|
32
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: omdev
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev348
|
|
4
4
|
Summary: omdev
|
|
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.dev348
|
|
16
16
|
Provides-Extra: all
|
|
17
17
|
Requires-Dist: black~=25.1; extra == "all"
|
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
|
@@ -288,24 +288,24 @@ omdev/tools/git/consts.py,sha256=JuXivUNDkNhM4pe97icjRVAKM8cNRbrODquHINNKqOE,40
|
|
|
288
288
|
omdev/tools/git/messages.py,sha256=NWztIK0nAKJIOVzuVQcR_5LHZUgqyVkrOlpl7dFLMdU,2424
|
|
289
289
|
omdev/tools/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
290
290
|
omdev/tools/json/__main__.py,sha256=wqpkN_NsQyNwKW4qjVj8ADJ4_C98KhrFBtE-Z1UamfU,168
|
|
291
|
-
omdev/tools/json/cli.py,sha256=
|
|
291
|
+
omdev/tools/json/cli.py,sha256=GLRg1dz_Y7HEzBtpiLWDZxmuqALMG3--22GFLyaQfl4,9786
|
|
292
292
|
omdev/tools/json/formats.py,sha256=0IXHUIkcbKnTVP0a53wYWsBMpfVtGTrHN04zRAs2JZo,2049
|
|
293
293
|
omdev/tools/json/io.py,sha256=sfj2hJS9Hy3aUR8a_lLzOrYcmL9fSKyvOHiofdUASsI,1427
|
|
294
294
|
omdev/tools/json/parsing.py,sha256=csoTuG2C2AJB7PgG4TKt2XqdiBAQXtpXRWBxoMkk14g,2103
|
|
295
|
-
omdev/tools/json/processing.py,sha256=
|
|
296
|
-
omdev/tools/json/rendering.py,sha256=
|
|
295
|
+
omdev/tools/json/processing.py,sha256=BKy385d86psrHVJGsu7U8_giUPUcU_R1s56u9v066VY,1461
|
|
296
|
+
omdev/tools/json/rendering.py,sha256=t33eXnUoYTmusETBnrYrLCpkWLQNvkGmixudrd8C1ag,2573
|
|
297
297
|
omdev/tools/jsonview/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
298
298
|
omdev/tools/jsonview/__main__.py,sha256=BF-MVWpPJJeQYUqJA48G395kxw0lEJnV-hRLV_F9G2A,173
|
|
299
|
-
omdev/tools/jsonview/cli.py,sha256=
|
|
299
|
+
omdev/tools/jsonview/cli.py,sha256=8pHULS_xxDV00kM8bO5dLH7i-zqQIoNjXTKFwhxSZ_A,4245
|
|
300
300
|
omdev/tools/jsonview/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
301
|
-
omdev/tools/jsonview/resources/jsonview.css,sha256=
|
|
301
|
+
omdev/tools/jsonview/resources/jsonview.css,sha256=RqQMm98EnQkbVM-8BgjNduzUfsVDMzgNC_NjjwG0bqI,579
|
|
302
302
|
omdev/tools/jsonview/resources/jsonview.js,sha256=faDvXDOXKvEvjOuIlz4D3F2ReQXb_buXDU27hKuuqAw,1648
|
|
303
303
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
304
304
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
|
305
305
|
omdev/tools/pawk/pawk.py,sha256=zsEkfQX0jF5bn712uqPAyBSdJt2dno1LH2oeSMNfXQI,11424
|
|
306
|
-
omdev-0.0.0.
|
|
307
|
-
omdev-0.0.0.
|
|
308
|
-
omdev-0.0.0.
|
|
309
|
-
omdev-0.0.0.
|
|
310
|
-
omdev-0.0.0.
|
|
311
|
-
omdev-0.0.0.
|
|
306
|
+
omdev-0.0.0.dev348.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
|
307
|
+
omdev-0.0.0.dev348.dist-info/METADATA,sha256=3XnrSJqO59iNALGmqB8NZMrGvwyvRXdIl4SP0V2CTao,1674
|
|
308
|
+
omdev-0.0.0.dev348.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
309
|
+
omdev-0.0.0.dev348.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
|
310
|
+
omdev-0.0.0.dev348.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
|
311
|
+
omdev-0.0.0.dev348.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|