bare-script 0.9.10__tar.gz → 3.0.0__tar.gz
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.
- {bare-script-0.9.10/src/bare_script.egg-info → bare-script-3.0.0}/PKG-INFO +24 -4
- {bare-script-0.9.10 → bare-script-3.0.0}/README.rst +21 -2
- {bare-script-0.9.10 → bare-script-3.0.0}/setup.cfg +3 -2
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/data.py +8 -10
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/library.py +168 -185
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/model.py +3 -3
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/parser.py +65 -65
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/runtime.py +14 -22
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/value.py +22 -4
- {bare-script-0.9.10 → bare-script-3.0.0/src/bare_script.egg-info}/PKG-INFO +24 -4
- {bare-script-0.9.10 → bare-script-3.0.0}/LICENSE +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/pyproject.toml +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/__init__.py +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/__main__.py +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/bare.py +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/baredoc.py +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script/options.py +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script.egg-info/SOURCES.txt +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script.egg-info/requires.txt +0 -0
- {bare-script-0.9.10 → bare-script-3.0.0}/src/bare_script.egg-info/top_level.txt +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bare-script
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: bare-script
|
|
5
5
|
Home-page: https://github.com/craigahobbs/bare-script
|
|
6
6
|
Author: Craig A. Hobbs
|
|
7
7
|
Author-email: craigahobbs@gmail.com
|
|
8
8
|
License: MIT
|
|
9
9
|
Keywords: bare-script
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
19
20
|
Classifier: Topic :: Utilities
|
|
20
21
|
Description-Content-Type: text/x-rst
|
|
21
22
|
License-File: LICENSE
|
|
@@ -42,7 +43,22 @@ bare-script
|
|
|
42
43
|
|
|
43
44
|
|badge-status| |badge-version| |badge-license| |badge-python|
|
|
44
45
|
|
|
45
|
-
BareScript
|
|
46
|
+
`BareScript <https://craigahobbs.github.io/bare-script/language/>`__
|
|
47
|
+
is a simple, lightweight, and portable programming language. Its Pythonic syntax is influenced by
|
|
48
|
+
JavaScript, C, and the Unix Shell. BareScript also has a
|
|
49
|
+
`library of built-in functions <#the-barescript-library>`__
|
|
50
|
+
for common programming operations. BareScript can be
|
|
51
|
+
`embedded within applications <#markdownup-a-markdown-viewer-with-barescript>`__
|
|
52
|
+
or used as a
|
|
53
|
+
stand-alone programming language using the
|
|
54
|
+
`command-line interface <#the-barescript-command-line-interface-cli>`__.
|
|
55
|
+
|
|
56
|
+
There are two implementations of BareScript:
|
|
57
|
+
`BareScript for Python <https://github.com/craigahobbs/bare-script-py#readme>`__
|
|
58
|
+
(this package) and
|
|
59
|
+
`BareScript for JavaScript <https://github.com/craigahobbs/bare-script#readme>`__.
|
|
60
|
+
Both implementations have 100% unit test coverage with identical unit test suites, so you can be
|
|
61
|
+
confident that BareScript will execute the same regardless of the underlying runtime environment.
|
|
46
62
|
|
|
47
63
|
|
|
48
64
|
Links
|
|
@@ -109,7 +125,7 @@ functions.
|
|
|
109
125
|
...
|
|
110
126
|
>>> # Execute the script
|
|
111
127
|
... print(execute_script(script, {'fetchFn': fetch_http}))
|
|
112
|
-
The BareScript Library has
|
|
128
|
+
The BareScript Library has 105 functions
|
|
113
129
|
|
|
114
130
|
|
|
115
131
|
Evaluating BareScript Expressions
|
|
@@ -153,6 +169,10 @@ files use the ".bare" file extension.
|
|
|
153
169
|
**Note:** In the BareScript CLI, import statements and the
|
|
154
170
|
`systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__
|
|
155
171
|
function read non-URL paths from the local file system.
|
|
172
|
+
`systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__
|
|
173
|
+
calls with a non-URL path and a
|
|
174
|
+
`request body <https://craigahobbs.github.io/bare-script-py/library/model.html#var.vName='SystemFetchRequest'>`__
|
|
175
|
+
write the body to the path.
|
|
156
176
|
|
|
157
177
|
|
|
158
178
|
MarkdownUp, a Markdown Viewer with BareScript
|
|
@@ -19,7 +19,22 @@ bare-script
|
|
|
19
19
|
|
|
20
20
|
|badge-status| |badge-version| |badge-license| |badge-python|
|
|
21
21
|
|
|
22
|
-
BareScript
|
|
22
|
+
`BareScript <https://craigahobbs.github.io/bare-script/language/>`__
|
|
23
|
+
is a simple, lightweight, and portable programming language. Its Pythonic syntax is influenced by
|
|
24
|
+
JavaScript, C, and the Unix Shell. BareScript also has a
|
|
25
|
+
`library of built-in functions <#the-barescript-library>`__
|
|
26
|
+
for common programming operations. BareScript can be
|
|
27
|
+
`embedded within applications <#markdownup-a-markdown-viewer-with-barescript>`__
|
|
28
|
+
or used as a
|
|
29
|
+
stand-alone programming language using the
|
|
30
|
+
`command-line interface <#the-barescript-command-line-interface-cli>`__.
|
|
31
|
+
|
|
32
|
+
There are two implementations of BareScript:
|
|
33
|
+
`BareScript for Python <https://github.com/craigahobbs/bare-script-py#readme>`__
|
|
34
|
+
(this package) and
|
|
35
|
+
`BareScript for JavaScript <https://github.com/craigahobbs/bare-script#readme>`__.
|
|
36
|
+
Both implementations have 100% unit test coverage with identical unit test suites, so you can be
|
|
37
|
+
confident that BareScript will execute the same regardless of the underlying runtime environment.
|
|
23
38
|
|
|
24
39
|
|
|
25
40
|
Links
|
|
@@ -86,7 +101,7 @@ functions.
|
|
|
86
101
|
...
|
|
87
102
|
>>> # Execute the script
|
|
88
103
|
... print(execute_script(script, {'fetchFn': fetch_http}))
|
|
89
|
-
The BareScript Library has
|
|
104
|
+
The BareScript Library has 105 functions
|
|
90
105
|
|
|
91
106
|
|
|
92
107
|
Evaluating BareScript Expressions
|
|
@@ -130,6 +145,10 @@ files use the ".bare" file extension.
|
|
|
130
145
|
**Note:** In the BareScript CLI, import statements and the
|
|
131
146
|
`systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__
|
|
132
147
|
function read non-URL paths from the local file system.
|
|
148
|
+
`systemFetch <https://craigahobbs.github.io/bare-script-py/library/#var.vGroup='System'&systemfetch>`__
|
|
149
|
+
calls with a non-URL path and a
|
|
150
|
+
`request body <https://craigahobbs.github.io/bare-script-py/library/model.html#var.vName='SystemFetchRequest'>`__
|
|
151
|
+
write the body to the path.
|
|
133
152
|
|
|
134
153
|
|
|
135
154
|
MarkdownUp, a Markdown Viewer with BareScript
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = bare-script
|
|
3
|
-
version = 0.
|
|
3
|
+
version = 3.0.0
|
|
4
4
|
url = https://github.com/craigahobbs/bare-script
|
|
5
5
|
author = Craig A. Hobbs
|
|
6
6
|
author_email = craigahobbs@gmail.com
|
|
@@ -10,7 +10,7 @@ long_description = file:README.rst
|
|
|
10
10
|
long_description_content_type = text/x-rst
|
|
11
11
|
keywords = bare-script
|
|
12
12
|
classifiers =
|
|
13
|
-
Development Status ::
|
|
13
|
+
Development Status :: 5 - Production/Stable
|
|
14
14
|
Intended Audience :: Developers
|
|
15
15
|
License :: OSI Approved :: MIT License
|
|
16
16
|
Operating System :: OS Independent
|
|
@@ -19,6 +19,7 @@ classifiers =
|
|
|
19
19
|
Programming Language :: Python :: 3.10
|
|
20
20
|
Programming Language :: Python :: 3.11
|
|
21
21
|
Programming Language :: Python :: 3.12
|
|
22
|
+
Topic :: Software Development :: Interpreters
|
|
22
23
|
Topic :: Utilities
|
|
23
24
|
|
|
24
25
|
[options]
|
|
@@ -13,7 +13,7 @@ import statistics
|
|
|
13
13
|
from schema_markdown import parse_schema_markdown, validate_type
|
|
14
14
|
|
|
15
15
|
from .parser import parse_expression
|
|
16
|
-
from .value import
|
|
16
|
+
from .value import value_boolean, value_compare, value_json, value_parse_datetime, value_parse_number
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
# Helper to dynamically import evaluate_expression to avoid the circular dependency
|
|
@@ -59,11 +59,11 @@ def validate_data(data, csv=False):
|
|
|
59
59
|
types[field] = None
|
|
60
60
|
|
|
61
61
|
# Can the string be parsed into another type?
|
|
62
|
-
elif
|
|
62
|
+
elif value_parse_datetime(value) is not None:
|
|
63
63
|
types[field] = 'datetime'
|
|
64
64
|
elif value in ('true', 'false'):
|
|
65
65
|
types[field] = 'boolean'
|
|
66
|
-
elif
|
|
66
|
+
elif value_parse_number(value) is not None:
|
|
67
67
|
types[field] = 'number'
|
|
68
68
|
else:
|
|
69
69
|
types[field] = 'string'
|
|
@@ -94,7 +94,7 @@ def validate_data(data, csv=False):
|
|
|
94
94
|
if value == '':
|
|
95
95
|
number_value = None
|
|
96
96
|
else:
|
|
97
|
-
number_value =
|
|
97
|
+
number_value = value_parse_number(value)
|
|
98
98
|
if number_value is None:
|
|
99
99
|
throw_field_error(field, field_type, value)
|
|
100
100
|
row[field] = number_value
|
|
@@ -107,7 +107,7 @@ def validate_data(data, csv=False):
|
|
|
107
107
|
if value == '':
|
|
108
108
|
datetime_value = None
|
|
109
109
|
else:
|
|
110
|
-
datetime_value =
|
|
110
|
+
datetime_value = value_parse_datetime(value)
|
|
111
111
|
if datetime_value is None:
|
|
112
112
|
throw_field_error(field, field_type, value)
|
|
113
113
|
row[field] = datetime_value
|
|
@@ -175,14 +175,12 @@ def join_data(left_data, right_data, join_expr, right_expr=None, is_left_join=Fa
|
|
|
175
175
|
if field_name not in left_names:
|
|
176
176
|
right_names[field_name] = field_name
|
|
177
177
|
else:
|
|
178
|
-
unique_name = field_name
|
|
179
178
|
ix_unique = 2
|
|
180
179
|
unique_name = f'{field_name}{ix_unique}'
|
|
181
|
-
right_names
|
|
182
|
-
while unique_name in left_names or unique_name in right_names_raw:
|
|
180
|
+
while unique_name in left_names or unique_name in right_names or unique_name in right_names_raw:
|
|
183
181
|
ix_unique += 1
|
|
184
182
|
unique_name = f'{field_name}{ix_unique}'
|
|
185
|
-
|
|
183
|
+
right_names[field_name] = unique_name
|
|
186
184
|
|
|
187
185
|
# Create the evaluation options object
|
|
188
186
|
eval_options = options
|
|
@@ -305,7 +303,7 @@ def aggregate_data(data, aggregation):
|
|
|
305
303
|
|
|
306
304
|
:param data: The data array
|
|
307
305
|
:type data: list[dict]
|
|
308
|
-
:param aggregation: The `aggregation model
|
|
306
|
+
:param aggregation: The `aggregation model <./library/model.html#var.vName='Aggregation'>`__
|
|
309
307
|
:type aggregation: dict
|
|
310
308
|
:return: The aggregated data array
|
|
311
309
|
:rtype: list[dict]
|