bare-script 4.2.3__tar.gz → 4.2.4__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-4.2.3/src/bare_script.egg-info → bare_script-4.2.4}/PKG-INFO +1 -1
- {bare_script-4.2.3 → bare_script-4.2.4}/setup.cfg +1 -1
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/library.py +22 -22
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/value.py +6 -1
- {bare_script-4.2.3 → bare_script-4.2.4/src/bare_script.egg-info}/PKG-INFO +1 -1
- {bare_script-4.2.3 → bare_script-4.2.4}/LICENSE +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/README.md +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/pyproject.toml +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/setup.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/__init__.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/__main__.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/bare.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/__init__.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/args.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/baredoc.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/baredocCLI.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/data.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/dataLineChart.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/dataTable.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/dataUtil.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/diff.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/draw.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/elementModel.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/forms.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/markdown.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/markdownElements.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/markdownHighlight.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/markdownParser.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/markdownUp.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/pager.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/qrcode.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/schemaDoc.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/unittest.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/include/unittestMock.bare +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/model.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/options.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/parser.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/runtime.py +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script/runtime_c.c +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script.egg-info/SOURCES.txt +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script.egg-info/dependency_links.txt +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script.egg-info/entry_points.txt +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script.egg-info/requires.txt +0 -0
- {bare_script-4.2.3 → bare_script-4.2.4}/src/bare_script.egg-info/top_level.txt +0 -0
|
@@ -69,7 +69,7 @@ def _array_delete(args, unused_options):
|
|
|
69
69
|
if index >= len(array):
|
|
70
70
|
raise ValueArgsError('index', index)
|
|
71
71
|
|
|
72
|
-
del array[
|
|
72
|
+
del array[index]
|
|
73
73
|
|
|
74
74
|
_ARRAY_DELETE_ARGS = value_args_model([
|
|
75
75
|
{'name': 'array', 'type': 'array'},
|
|
@@ -132,7 +132,7 @@ def _array_get(args, unused_options):
|
|
|
132
132
|
if index >= len(array):
|
|
133
133
|
raise ValueArgsError('index', index)
|
|
134
134
|
|
|
135
|
-
return array[
|
|
135
|
+
return array[index]
|
|
136
136
|
|
|
137
137
|
_ARRAY_GET_ARGS = value_args_model([
|
|
138
138
|
{'name': 'array', 'type': 'array'},
|
|
@@ -154,11 +154,11 @@ def _array_index_of(args, options):
|
|
|
154
154
|
|
|
155
155
|
# Value function?
|
|
156
156
|
if value_type(value) == 'function':
|
|
157
|
-
for ix in range(
|
|
157
|
+
for ix in range(index, len(array)):
|
|
158
158
|
if value_boolean(value([array[ix]], options)):
|
|
159
159
|
return ix
|
|
160
160
|
else:
|
|
161
|
-
for ix in range(
|
|
161
|
+
for ix in range(index, len(array)):
|
|
162
162
|
if value_compare(array[ix], value) == 0:
|
|
163
163
|
return ix
|
|
164
164
|
|
|
@@ -203,11 +203,11 @@ def _array_last_index_of(args, options):
|
|
|
203
203
|
|
|
204
204
|
# Value function?
|
|
205
205
|
if value_type(value) == 'function':
|
|
206
|
-
for ix in range(
|
|
206
|
+
for ix in range(index, -1, -1):
|
|
207
207
|
if value_boolean(value([array[ix]], options)):
|
|
208
208
|
return ix
|
|
209
209
|
else:
|
|
210
|
-
for ix in range(
|
|
210
|
+
for ix in range(index, -1, -1):
|
|
211
211
|
if value_compare(array[ix], value) == 0:
|
|
212
212
|
return ix
|
|
213
213
|
|
|
@@ -251,7 +251,7 @@ def _array_new(args, unused_options):
|
|
|
251
251
|
# $return: The new array
|
|
252
252
|
def _array_new_size(args, unused_options):
|
|
253
253
|
size, value = value_args_validate(_ARRAY_NEW_SIZE_ARGS, args)
|
|
254
|
-
return list(value for _ in range(
|
|
254
|
+
return list(value for _ in range(size))
|
|
255
255
|
|
|
256
256
|
_ARRAY_NEW_SIZE_ARGS = value_args_model([
|
|
257
257
|
{'name': 'size', 'type': 'number', 'default': 0, 'integer': True, 'gte': 0},
|
|
@@ -320,7 +320,7 @@ def _array_set(args, unused_options):
|
|
|
320
320
|
if index >= len(array):
|
|
321
321
|
raise ValueArgsError('index', index)
|
|
322
322
|
|
|
323
|
-
array[
|
|
323
|
+
array[index] = value
|
|
324
324
|
return value
|
|
325
325
|
|
|
326
326
|
_ARRAY_SET_ARGS = value_args_model([
|
|
@@ -365,7 +365,7 @@ def _array_slice(args, unused_options):
|
|
|
365
365
|
if end > len(array):
|
|
366
366
|
raise ValueArgsError('end', end)
|
|
367
367
|
|
|
368
|
-
return array[
|
|
368
|
+
return array[start:end]
|
|
369
369
|
|
|
370
370
|
_ARRAY_SLICE_ARGS = value_args_model([
|
|
371
371
|
{'name': 'array', 'type': 'array'},
|
|
@@ -594,18 +594,18 @@ def _datetime_new(args, unused_options):
|
|
|
594
594
|
while day < 1:
|
|
595
595
|
year = year if month != 1 else year - 1
|
|
596
596
|
month = month - 1 if month != 1 else 12
|
|
597
|
-
_, month_days = calendar.monthrange(
|
|
597
|
+
_, month_days = calendar.monthrange(year, month)
|
|
598
598
|
day += month_days
|
|
599
599
|
elif day > 28:
|
|
600
|
-
_, month_days = calendar.monthrange(
|
|
600
|
+
_, month_days = calendar.monthrange(year, month)
|
|
601
601
|
while day > month_days:
|
|
602
602
|
day -= month_days
|
|
603
603
|
year = year if month != 12 else year + 1
|
|
604
604
|
month = month + 1 if month != 12 else 1
|
|
605
|
-
_, month_days = calendar.monthrange(
|
|
605
|
+
_, month_days = calendar.monthrange(year, month)
|
|
606
606
|
|
|
607
607
|
# Return the datetime
|
|
608
|
-
return datetime.datetime(
|
|
608
|
+
return datetime.datetime(year, month, day, hour, minute, second, millisecond * 1000)
|
|
609
609
|
|
|
610
610
|
_DATETIME_NEW_ARGS = value_args_model([
|
|
611
611
|
{'name': 'year', 'type': 'number', 'integer': True, 'gte': 100},
|
|
@@ -690,7 +690,7 @@ _JSON_PARSE_ARGS = value_args_model([
|
|
|
690
690
|
# $return: The JSON string
|
|
691
691
|
def _json_stringify(args, unused_options):
|
|
692
692
|
value, indent = value_args_validate(_JSON_STRINGIFY_ARGS, args)
|
|
693
|
-
return value_json(value,
|
|
693
|
+
return value_json(value, indent)
|
|
694
694
|
|
|
695
695
|
_JSON_STRINGIFY_ARGS = value_args_model([
|
|
696
696
|
{'name': 'value'},
|
|
@@ -1007,7 +1007,7 @@ _NUMBER_PARSE_FLOAT_ARGS = value_args_model([
|
|
|
1007
1007
|
# $return: The integer
|
|
1008
1008
|
def _number_parse_int(args, unused_options):
|
|
1009
1009
|
string, radix = value_args_validate(_NUMBER_PARSE_INT_ARGS, args)
|
|
1010
|
-
return value_parse_integer(string,
|
|
1010
|
+
return value_parse_integer(string, radix)
|
|
1011
1011
|
|
|
1012
1012
|
_NUMBER_PARSE_INT_ARGS = value_args_model([
|
|
1013
1013
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1024,7 +1024,7 @@ _NUMBER_PARSE_INT_ARGS = value_args_model([
|
|
|
1024
1024
|
# $return: The fixed-point notation string
|
|
1025
1025
|
def _number_to_fixed(args, unused_options):
|
|
1026
1026
|
x, digits, trim = value_args_validate(_NUMBER_TO_FIXED_ARGS, args)
|
|
1027
|
-
result = f'{value_round_number(x, digits):.{
|
|
1027
|
+
result = f'{value_round_number(x, digits):.{digits}f}'
|
|
1028
1028
|
if trim:
|
|
1029
1029
|
return R_NUMBER_CLEANUP.sub('', result)
|
|
1030
1030
|
return result
|
|
@@ -1468,7 +1468,7 @@ def _string_char_at(args, unused_options):
|
|
|
1468
1468
|
if index >= len(string):
|
|
1469
1469
|
raise ValueArgsError('index', index)
|
|
1470
1470
|
|
|
1471
|
-
return string[
|
|
1471
|
+
return string[index]
|
|
1472
1472
|
|
|
1473
1473
|
_STRING_CHAR_AT_ARGS = value_args_model([
|
|
1474
1474
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1487,7 +1487,7 @@ def _string_char_code_at(args, unused_options):
|
|
|
1487
1487
|
if index >= len(string):
|
|
1488
1488
|
raise ValueArgsError('index', index)
|
|
1489
1489
|
|
|
1490
|
-
return ord(string[
|
|
1490
|
+
return ord(string[index])
|
|
1491
1491
|
|
|
1492
1492
|
_STRING_CHAR_CODE_AT_ARGS = value_args_model([
|
|
1493
1493
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1564,7 +1564,7 @@ def _string_index_of(args, unused_options):
|
|
|
1564
1564
|
if index > len(string):
|
|
1565
1565
|
raise ValueArgsError('index', index, -1)
|
|
1566
1566
|
|
|
1567
|
-
return string.find(search,
|
|
1567
|
+
return string.find(search, index)
|
|
1568
1568
|
|
|
1569
1569
|
_STRING_INDEX_OF_ARGS = value_args_model([
|
|
1570
1570
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1586,7 +1586,7 @@ def _string_last_index_of(args, unused_options):
|
|
|
1586
1586
|
if index > len(string):
|
|
1587
1587
|
raise ValueArgsError('index', index, -1)
|
|
1588
1588
|
|
|
1589
|
-
return string.rfind(search, 0,
|
|
1589
|
+
return string.rfind(search, 0, index + len(search))
|
|
1590
1590
|
|
|
1591
1591
|
_STRING_LAST_INDEX_OF_ARGS = value_args_model([
|
|
1592
1592
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1645,7 +1645,7 @@ _STRING_NEW_ARGS = value_args_model([
|
|
|
1645
1645
|
# $return: The repeated string
|
|
1646
1646
|
def _string_repeat(args, unused_options):
|
|
1647
1647
|
string, count = value_args_validate(_STRING_REPEAT_ARGS, args)
|
|
1648
|
-
return string *
|
|
1648
|
+
return string * count
|
|
1649
1649
|
|
|
1650
1650
|
_STRING_REPEAT_ARGS = value_args_model([
|
|
1651
1651
|
{'name': 'string', 'type': 'string'},
|
|
@@ -1686,7 +1686,7 @@ def _string_slice(args, unused_options):
|
|
|
1686
1686
|
if end > len(string):
|
|
1687
1687
|
raise ValueArgsError('end', end)
|
|
1688
1688
|
|
|
1689
|
-
return string[
|
|
1689
|
+
return string[start:end]
|
|
1690
1690
|
|
|
1691
1691
|
_STRING_SLICE_ARGS = value_args_model([
|
|
1692
1692
|
{'name': 'string', 'type': 'string'},
|
|
@@ -306,12 +306,17 @@ def value_args_validate(fn_args, args, error_return_value=None):
|
|
|
306
306
|
arg_lte = fn_arg.get('lte')
|
|
307
307
|
arg_gt = fn_arg.get('gt')
|
|
308
308
|
arg_gte = fn_arg.get('gte')
|
|
309
|
-
|
|
309
|
+
arg_integer = fn_arg.get('integer')
|
|
310
|
+
if ((arg_integer and int(arg_value) != arg_value) or
|
|
310
311
|
(arg_lt is not None and not (arg_value < arg_lt)) or
|
|
311
312
|
(arg_lte is not None and not (arg_value <= arg_lte)) or
|
|
312
313
|
(arg_gt is not None and not (arg_value > arg_gt)) or
|
|
313
314
|
(arg_gte is not None and not (arg_value >= arg_gte))):
|
|
314
315
|
raise ValueArgsError(fn_arg['name'], arg_value, error_return_value)
|
|
316
|
+
|
|
317
|
+
# Normalize integer arguments to int (the parser produces floats for numeric literals)
|
|
318
|
+
if arg_integer:
|
|
319
|
+
args[ix] = int(arg_value)
|
|
315
320
|
elif arg_type == 'string':
|
|
316
321
|
arg_value_type = type(arg_value)
|
|
317
322
|
if arg_value_type is not str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|