bare-script 4.2.3__tar.gz → 4.2.5__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.
Files changed (44) hide show
  1. {bare_script-4.2.3/src/bare_script.egg-info → bare_script-4.2.5}/PKG-INFO +1 -1
  2. {bare_script-4.2.3 → bare_script-4.2.5}/setup.cfg +1 -1
  3. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/library.py +24 -22
  4. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/value.py +6 -1
  5. {bare_script-4.2.3 → bare_script-4.2.5/src/bare_script.egg-info}/PKG-INFO +1 -1
  6. {bare_script-4.2.3 → bare_script-4.2.5}/LICENSE +0 -0
  7. {bare_script-4.2.3 → bare_script-4.2.5}/README.md +0 -0
  8. {bare_script-4.2.3 → bare_script-4.2.5}/pyproject.toml +0 -0
  9. {bare_script-4.2.3 → bare_script-4.2.5}/setup.py +0 -0
  10. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/__init__.py +0 -0
  11. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/__main__.py +0 -0
  12. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/bare.py +0 -0
  13. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/__init__.py +0 -0
  14. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/args.bare +0 -0
  15. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/baredoc.bare +0 -0
  16. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/baredocCLI.bare +0 -0
  17. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/data.bare +0 -0
  18. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/dataLineChart.bare +0 -0
  19. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/dataTable.bare +0 -0
  20. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/dataUtil.bare +0 -0
  21. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/diff.bare +0 -0
  22. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/draw.bare +0 -0
  23. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/elementModel.bare +0 -0
  24. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/forms.bare +0 -0
  25. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/markdown.bare +0 -0
  26. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/markdownElements.bare +0 -0
  27. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/markdownHighlight.bare +0 -0
  28. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/markdownParser.bare +0 -0
  29. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/markdownUp.bare +0 -0
  30. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/pager.bare +0 -0
  31. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/qrcode.bare +0 -0
  32. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/schemaDoc.bare +0 -0
  33. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/unittest.bare +0 -0
  34. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/include/unittestMock.bare +0 -0
  35. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/model.py +0 -0
  36. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/options.py +0 -0
  37. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/parser.py +0 -0
  38. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/runtime.py +0 -0
  39. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script/runtime_c.c +0 -0
  40. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script.egg-info/SOURCES.txt +0 -0
  41. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script.egg-info/dependency_links.txt +0 -0
  42. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script.egg-info/entry_points.txt +0 -0
  43. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script.egg-info/requires.txt +0 -0
  44. {bare_script-4.2.3 → bare_script-4.2.5}/src/bare_script.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bare-script
3
- Version: 4.2.3
3
+ Version: 4.2.5
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bare-script
3
- version = 4.2.3
3
+ version = 4.2.5
4
4
  url = https://github.com/craigahobbs/bare-script
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -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[int(index)]
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[int(index)]
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(int(index), len(array)):
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(int(index), len(array)):
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(int(index), -1, -1):
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(int(index), -1, -1):
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(int(size)))
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[int(index)] = value
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[int(start):int(end)]
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(int(year), int(month))
597
+ _, month_days = calendar.monthrange(year, month)
598
598
  day += month_days
599
599
  elif day > 28:
600
- _, month_days = calendar.monthrange(int(year), int(month))
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(int(year), int(month))
605
+ _, month_days = calendar.monthrange(year, month)
606
606
 
607
607
  # Return the datetime
608
- return datetime.datetime(int(year), int(month), int(day), int(hour), int(minute), int(second), int(millisecond) * 1000)
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, int(indent) if indent is not None else None)
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, int(radix))
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):.{int(digits)}f}'
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
@@ -1044,6 +1044,8 @@ _NUMBER_TO_FIXED_ARGS = value_args_model([
1044
1044
  # $return: The integer as a string of the given base
1045
1045
  def _number_to_string(args, unused_options):
1046
1046
  x, radix = value_args_validate(_NUMBER_TO_STRING_ARGS, args)
1047
+ if not x:
1048
+ return '0'
1047
1049
  digits = []
1048
1050
  while x:
1049
1051
  digits.append(_NUMBER_TO_STRING_DIGITS[x % radix])
@@ -1468,7 +1470,7 @@ def _string_char_at(args, unused_options):
1468
1470
  if index >= len(string):
1469
1471
  raise ValueArgsError('index', index)
1470
1472
 
1471
- return string[int(index)]
1473
+ return string[index]
1472
1474
 
1473
1475
  _STRING_CHAR_AT_ARGS = value_args_model([
1474
1476
  {'name': 'string', 'type': 'string'},
@@ -1487,7 +1489,7 @@ def _string_char_code_at(args, unused_options):
1487
1489
  if index >= len(string):
1488
1490
  raise ValueArgsError('index', index)
1489
1491
 
1490
- return ord(string[int(index)])
1492
+ return ord(string[index])
1491
1493
 
1492
1494
  _STRING_CHAR_CODE_AT_ARGS = value_args_model([
1493
1495
  {'name': 'string', 'type': 'string'},
@@ -1564,7 +1566,7 @@ def _string_index_of(args, unused_options):
1564
1566
  if index > len(string):
1565
1567
  raise ValueArgsError('index', index, -1)
1566
1568
 
1567
- return string.find(search, int(index))
1569
+ return string.find(search, index)
1568
1570
 
1569
1571
  _STRING_INDEX_OF_ARGS = value_args_model([
1570
1572
  {'name': 'string', 'type': 'string'},
@@ -1586,7 +1588,7 @@ def _string_last_index_of(args, unused_options):
1586
1588
  if index > len(string):
1587
1589
  raise ValueArgsError('index', index, -1)
1588
1590
 
1589
- return string.rfind(search, 0, int(index) + len(search))
1591
+ return string.rfind(search, 0, index + len(search))
1590
1592
 
1591
1593
  _STRING_LAST_INDEX_OF_ARGS = value_args_model([
1592
1594
  {'name': 'string', 'type': 'string'},
@@ -1645,7 +1647,7 @@ _STRING_NEW_ARGS = value_args_model([
1645
1647
  # $return: The repeated string
1646
1648
  def _string_repeat(args, unused_options):
1647
1649
  string, count = value_args_validate(_STRING_REPEAT_ARGS, args)
1648
- return string * int(count)
1650
+ return string * count
1649
1651
 
1650
1652
  _STRING_REPEAT_ARGS = value_args_model([
1651
1653
  {'name': 'string', 'type': 'string'},
@@ -1686,7 +1688,7 @@ def _string_slice(args, unused_options):
1686
1688
  if end > len(string):
1687
1689
  raise ValueArgsError('end', end)
1688
1690
 
1689
- return string[int(start):int(end)]
1691
+ return string[start:end]
1690
1692
 
1691
1693
  _STRING_SLICE_ARGS = value_args_model([
1692
1694
  {'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
- if ((fn_arg.get('integer') and int(arg_value) != arg_value) or
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bare-script
3
- Version: 4.2.3
3
+ Version: 4.2.5
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
File without changes
File without changes
File without changes
File without changes