jsonata-python 0.5.1__py3-none-any.whl → 0.5.3__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.
- jsonata/cli/__main__.py +9 -5
- jsonata/tokenizer.py +4 -1
- {jsonata_python-0.5.1.dist-info → jsonata_python-0.5.3.dist-info}/METADATA +10 -4
- {jsonata_python-0.5.1.dist-info → jsonata_python-0.5.3.dist-info}/RECORD +6 -6
- {jsonata_python-0.5.1.dist-info → jsonata_python-0.5.3.dist-info}/WHEEL +1 -1
- {jsonata_python-0.5.1.dist-info → jsonata_python-0.5.3.dist-info}/licenses/LICENSE +0 -0
jsonata/cli/__main__.py
CHANGED
|
@@ -34,7 +34,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
|
|
|
34
34
|
"""
|
|
35
35
|
parser = argparse.ArgumentParser(prog="jsonata.cli", description="Pure Python JSONata CLI")
|
|
36
36
|
parser.add_argument(
|
|
37
|
-
"-v", "--version", action='version', version='%(prog)s 0.5.
|
|
37
|
+
"-v", "--version", action='version', version='%(prog)s 0.5.3')
|
|
38
38
|
|
|
39
39
|
parser.add_argument(
|
|
40
40
|
"-e", "--expression", metavar="<file>",
|
|
@@ -54,7 +54,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
|
|
|
54
54
|
)
|
|
55
55
|
parser.add_argument(
|
|
56
56
|
"-o", "--output", metavar="<arg>",
|
|
57
|
-
help="JSON output file (
|
|
57
|
+
help="JSON output file (default=stdout)"
|
|
58
58
|
)
|
|
59
59
|
parser.add_argument(
|
|
60
60
|
"-oc", "--ocharset", default="utf-8", metavar="<arg>",
|
|
@@ -78,7 +78,7 @@ def get_options(argv: Optional[list[str]] = None) -> argparse.ArgumentParser:
|
|
|
78
78
|
)
|
|
79
79
|
parser.add_argument(
|
|
80
80
|
"-it", "--interactive", default=False, action="store_true",
|
|
81
|
-
help="Interactive REPL"
|
|
81
|
+
help="Interactive REPL (requires input file)"
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
# The expression
|
|
@@ -160,8 +160,9 @@ def main(argv: Optional[list[str]] = None) -> int:
|
|
|
160
160
|
options = parser.parse_args(argv)
|
|
161
161
|
|
|
162
162
|
if options.expression is None and options.expr is None:
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
if not options.interactive:
|
|
164
|
+
parser.print_help()
|
|
165
|
+
return 1
|
|
165
166
|
|
|
166
167
|
icharset = options.icharset
|
|
167
168
|
ocharset = options.icharset
|
|
@@ -187,6 +188,9 @@ def main(argv: Optional[list[str]] = None) -> int:
|
|
|
187
188
|
bindings = json.loads(bindings_str)
|
|
188
189
|
|
|
189
190
|
if options.input == '-' or options.input is None:
|
|
191
|
+
if options.interactive:
|
|
192
|
+
parser.print_help()
|
|
193
|
+
return 1
|
|
190
194
|
input = sys.stdin.read()
|
|
191
195
|
else:
|
|
192
196
|
with open(options.input, 'r', encoding=icharset) as fd:
|
jsonata/tokenizer.py
CHANGED
|
@@ -138,7 +138,10 @@ class Tokenizer:
|
|
|
138
138
|
start = self.position
|
|
139
139
|
while current_char == 'i' or current_char == 'm':
|
|
140
140
|
self.position += 1
|
|
141
|
-
|
|
141
|
+
if self.position < self.length:
|
|
142
|
+
current_char = self.path[self.position]
|
|
143
|
+
else:
|
|
144
|
+
current_char = None
|
|
142
145
|
flags = self.path[start:self.position] + 'g'
|
|
143
146
|
|
|
144
147
|
# Convert flags to Java Pattern flags
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: jsonata-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: Pure Python implementation of JSONata
|
|
5
5
|
Project-URL: Homepage, https://github.com/rayokota/jsonata-python
|
|
6
6
|
Project-URL: Bug Reports, https://github.com/rayokota/jsonata-python/issues
|
|
@@ -207,6 +207,7 @@ License: Apache License
|
|
|
207
207
|
See the License for the specific language governing permissions and
|
|
208
208
|
limitations under the License.
|
|
209
209
|
|
|
210
|
+
License-File: LICENSE
|
|
210
211
|
Keywords: json,jsonata
|
|
211
212
|
Classifier: Development Status :: 4 - Beta
|
|
212
213
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -277,7 +278,7 @@ options:
|
|
|
277
278
|
-f {auto,json,string}, --format {auto,json,string}
|
|
278
279
|
Input format (default=auto)
|
|
279
280
|
-o <arg>, --output <arg>
|
|
280
|
-
JSON output file (
|
|
281
|
+
JSON output file (default=stdout)
|
|
281
282
|
-oc <arg>, --ocharset <arg>
|
|
282
283
|
Output character set (default=utf-8)
|
|
283
284
|
-time Print performance timers to stderr
|
|
@@ -286,7 +287,7 @@ options:
|
|
|
286
287
|
JSONata variable bindings
|
|
287
288
|
-bf <file>, --bindings-file <file>
|
|
288
289
|
JSONata variable bindings file
|
|
289
|
-
-it, --interactive Interactive REPL
|
|
290
|
+
-it, --interactive Interactive REPL (requires input file)
|
|
290
291
|
```
|
|
291
292
|
|
|
292
293
|
### Examples
|
|
@@ -316,6 +317,11 @@ helloworld.json
|
|
|
316
317
|
"frederic.smith@very-serious.com"
|
|
317
318
|
]
|
|
318
319
|
}
|
|
320
|
+
|
|
321
|
+
% python3 -m jsonata.cli -i helloworld.json -it
|
|
322
|
+
Enter an expression to have it evaluated.
|
|
323
|
+
JSONata> (a & b)
|
|
324
|
+
hello world
|
|
319
325
|
```
|
|
320
326
|
|
|
321
327
|
## Running Tests
|
|
@@ -7,11 +7,11 @@ jsonata/jsonata.py,sha256=jZIxVrNcZI3aBvE0PURZ4-cxpaK9JiJVH5Q_cllCXS0,84247
|
|
|
7
7
|
jsonata/parser.py,sha256=U8nNxvsDIy0wVTfNCs2DNN7RjNVm0SqfociD9cRcsWM,53877
|
|
8
8
|
jsonata/signature.py,sha256=j7eNKUuGx_9vCt5Qv8BPM7iV5vH26U0Kx8zrkDcctME,20194
|
|
9
9
|
jsonata/timebox.py,sha256=bnevNR_ONvKUiIZCJZEWsRiR0gCWTGOwn5RCY7dKqYc,2861
|
|
10
|
-
jsonata/tokenizer.py,sha256=
|
|
10
|
+
jsonata/tokenizer.py,sha256=X-JsARtkBIN6bO8_TElpw3SCageQMtfBWlexuhG2Sds,11982
|
|
11
11
|
jsonata/utils.py,sha256=U13I49Ie3hEn3PKGR4361TPengDAkbyHmwipDFZJlXo,5192
|
|
12
12
|
jsonata/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
jsonata/cli/__main__.py,sha256=
|
|
14
|
-
jsonata_python-0.5.
|
|
15
|
-
jsonata_python-0.5.
|
|
16
|
-
jsonata_python-0.5.
|
|
17
|
-
jsonata_python-0.5.
|
|
13
|
+
jsonata/cli/__main__.py,sha256=d_tNQ3Y_yN9o_NzBip8LdhsAVLAAA62GeowFKc6zx3Y,7125
|
|
14
|
+
jsonata_python-0.5.3.dist-info/METADATA,sha256=_qkeeFX_iFWyljejtPGrx3Xjt8mgkX0tKIkTk_-uNlc,17442
|
|
15
|
+
jsonata_python-0.5.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
jsonata_python-0.5.3.dist-info/licenses/LICENSE,sha256=y16Ofl9KOYjhBjwULGDcLfdWBfTEZRXnduOspt-XbhQ,11325
|
|
17
|
+
jsonata_python-0.5.3.dist-info/RECORD,,
|
|
File without changes
|