bare-script 5.1.16__tar.gz → 5.2.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.
Files changed (23) hide show
  1. {bare_script-5.1.16/src/bare_script.egg-info → bare_script-5.2.0}/PKG-INFO +1 -1
  2. {bare_script-5.1.16 → bare_script-5.2.0}/pyproject.toml +1 -1
  3. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/include.py +86 -0
  4. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/include_source.py +362 -182
  5. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/library.py +32 -1
  6. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/options.py +32 -12
  7. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/runtime_c.c +6 -1
  8. bare_script-5.2.0/src/bare_script/wsgi.py +252 -0
  9. {bare_script-5.1.16 → bare_script-5.2.0/src/bare_script.egg-info}/PKG-INFO +1 -1
  10. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script.egg-info/SOURCES.txt +1 -0
  11. {bare_script-5.1.16 → bare_script-5.2.0}/LICENSE +0 -0
  12. {bare_script-5.1.16 → bare_script-5.2.0}/README.md +0 -0
  13. {bare_script-5.1.16 → bare_script-5.2.0}/setup.cfg +0 -0
  14. {bare_script-5.1.16 → bare_script-5.2.0}/setup.py +0 -0
  15. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/__init__.py +0 -0
  16. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/__main__.py +0 -0
  17. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/bare.py +0 -0
  18. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/runtime.py +0 -0
  19. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script/value.py +0 -0
  20. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script.egg-info/dependency_links.txt +0 -0
  21. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script.egg-info/entry_points.txt +0 -0
  22. {bare_script-5.1.16 → bare_script-5.2.0}/src/bare_script.egg-info/requires.txt +0 -0
  23. {bare_script-5.1.16 → bare_script-5.2.0}/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: 5.1.16
3
+ Version: 5.2.0
4
4
  Summary: BareScript; a lightweight scripting and expression language
5
5
  Author-email: "Craig A. Hobbs" <craigahobbs@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bare-script"
7
- version = "5.1.16"
7
+ version = "5.2.0"
8
8
  description = "BareScript; a lightweight scripting and expression language"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -14,6 +14,7 @@ execute_script(
14
14
  {
15
15
  'statements': [
16
16
  {'include': {'includes': [
17
+ {'url': 'barescriptLint.bare', 'system': True},
17
18
  {'url': 'barescriptModel.bare', 'system': True},
18
19
  {'url': 'base64.bare', 'system': True},
19
20
  {'url': 'data.bare', 'system': True},
@@ -21,6 +22,7 @@ execute_script(
21
22
  {'url': 'dataTable.bare', 'system': True},
22
23
  {'url': 'elementModel.bare', 'system': True},
23
24
  {'url': 'gzip.bare', 'system': True},
25
+ {'url': 'hash.bare', 'system': True},
24
26
  {'url': 'markdown.bare', 'system': True},
25
27
  {'url': 'markdownElements.bare', 'system': True},
26
28
  {'url': 'markdownParser.bare', 'system': True},
@@ -66,6 +68,28 @@ def _include_options():
66
68
  return {'globals': _INCLUDE_GLOBALS}
67
69
 
68
70
 
71
+ #
72
+ # barescriptLint.bare
73
+ #
74
+
75
+
76
+ def barescript_lint_unbound_globals(model, globals_=None):
77
+ """
78
+ Compute the unbound global variables of a BareScript script or expression model - the global
79
+ variables and functions it uses that it does not define
80
+
81
+ :param model: The `BareScript model <https://craigahobbs.github.io/bare-script/model/#var.vName='BareScript'>`__ or
82
+ `expression model <https://craigahobbs.github.io/bare-script/model/#var.vName='Expression'>`__
83
+ :type model: dict
84
+ :param globals_: The bound global variables dict (name to value), such as the host's built-in functions
85
+ :type globals_: dict or None
86
+ :return: The sorted list of unbound global variable names
87
+ :rtype: list[str]
88
+ """
89
+
90
+ return _INCLUDE_GLOBALS['barescriptLintUnboundGlobals']([model, globals_], _include_options())
91
+
92
+
69
93
  #
70
94
  # barescriptModel.bare
71
95
  #
@@ -448,6 +472,68 @@ def gzip_uncompress(bytes_):
448
472
  return _INCLUDE_GLOBALS['gzipUncompress']([bytes_], _include_options())
449
473
 
450
474
 
475
+ #
476
+ # hash.bare
477
+ #
478
+
479
+
480
+ def hash_equal(left, right):
481
+ """
482
+ Compare two values (e.g. message authentication codes) in constant time - every byte is compared, so the time
483
+ taken doesn't reveal how much of a guessed value is right
484
+
485
+ :param left: The first byte value array or string
486
+ :type left: list(int) or str
487
+ :param right: The second byte value array or string
488
+ :type right: list(int) or str
489
+ :return: True if the values are equal, False if not, or None if an argument is invalid
490
+ :rtype: bool or None
491
+ """
492
+
493
+ return _INCLUDE_GLOBALS['hashEqual']([left, right], _include_options())
494
+
495
+
496
+ def hash_hex(bytes_):
497
+ """
498
+ Format a byte value array (e.g. a hash) as a lowercase hexadecimal string
499
+
500
+ :param bytes_: The byte value array or string
501
+ :type bytes_: list(int) or str
502
+ :return: The hexadecimal string, or None if the argument is invalid
503
+ :rtype: str or None
504
+ """
505
+
506
+ return _INCLUDE_GLOBALS['hashHex']([bytes_], _include_options())
507
+
508
+
509
+ def hash_hmac_sha256(key, message):
510
+ """
511
+ Compute the HMAC-SHA256 message authentication code of a message (e.g. a JWT HS256 signature)
512
+
513
+ :param key: The key byte value array or string
514
+ :type key: list(int) or str
515
+ :param message: The message byte value array or string
516
+ :type message: list(int) or str
517
+ :return: The 32-byte message authentication code byte value array, or None if an argument is invalid
518
+ :rtype: list(int) or None
519
+ """
520
+
521
+ return _INCLUDE_GLOBALS['hashHMACSHA256']([key, message], _include_options())
522
+
523
+
524
+ def hash_sha256(bytes_):
525
+ """
526
+ Compute the SHA-256 hash of a byte value array (or a string, as UTF-8)
527
+
528
+ :param bytes_: The byte value array (integers 0 to 255) or string
529
+ :type bytes_: list(int) or str
530
+ :return: The 32-byte hash byte value array, or None if the argument is invalid
531
+ :rtype: list(int) or None
532
+ """
533
+
534
+ return _INCLUDE_GLOBALS['hashSHA256']([bytes_], _include_options())
535
+
536
+
451
537
  #
452
538
  # markdown.bare
453
539
  #