bare-script 3.3.2__tar.gz → 3.4.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 (35) hide show
  1. {bare_script-3.3.2/src/bare_script.egg-info → bare_script-3.4.0}/PKG-INFO +2 -1
  2. {bare_script-3.3.2 → bare_script-3.4.0}/setup.cfg +2 -2
  3. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/bare.py +3 -3
  4. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/baredoc.py +2 -2
  5. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/library.py +2 -3
  6. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/options.py +19 -8
  7. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/runtime.py +2 -2
  8. {bare_script-3.3.2 → bare_script-3.4.0/src/bare_script.egg-info}/PKG-INFO +2 -1
  9. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script.egg-info/SOURCES.txt +1 -6
  10. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script.egg-info/requires.txt +1 -0
  11. bare_script-3.3.2/src/bare_script/include/args.mds +0 -12
  12. bare_script-3.3.2/src/bare_script/include/forms.mds +0 -12
  13. bare_script-3.3.2/src/bare_script/include/pager.mds +0 -12
  14. bare_script-3.3.2/src/bare_script/include/unittest.mds +0 -12
  15. bare_script-3.3.2/src/bare_script/include/unittestMock.mds +0 -12
  16. {bare_script-3.3.2 → bare_script-3.4.0}/LICENSE +0 -0
  17. {bare_script-3.3.2 → bare_script-3.4.0}/README.md +0 -0
  18. {bare_script-3.3.2 → bare_script-3.4.0}/pyproject.toml +0 -0
  19. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/__init__.py +0 -0
  20. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/__main__.py +0 -0
  21. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/data.py +0 -0
  22. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/__init__.py +0 -0
  23. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/args.bare +0 -0
  24. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/diff.bare +0 -0
  25. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/forms.bare +0 -0
  26. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/markdownUp.bare +0 -0
  27. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/pager.bare +0 -0
  28. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/unittest.bare +0 -0
  29. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/include/unittestMock.bare +0 -0
  30. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/model.py +0 -0
  31. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/parser.py +0 -0
  32. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script/value.py +0 -0
  33. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script.egg-info/dependency_links.txt +0 -0
  34. {bare_script-3.3.2 → bare_script-3.4.0}/src/bare_script.egg-info/entry_points.txt +0 -0
  35. {bare_script-3.3.2 → bare_script-3.4.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: 3.3.2
3
+ Version: 3.4.0
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -21,6 +21,7 @@ Classifier: Topic :: Utilities
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: schema-markdown>=1.2.0
24
+ Requires-Dist: urllib3>=2.5.0
24
25
  Dynamic: license-file
25
26
 
26
27
  # bare-script
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = bare-script
3
- version = 3.3.2
3
+ version = 3.4.0
4
4
  url = https://github.com/craigahobbs/bare-script
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -28,6 +28,7 @@ package_dir =
28
28
  = src
29
29
  install_requires =
30
30
  schema-markdown >= 1.2.0
31
+ urllib3 >= 2.5.0
31
32
 
32
33
  [options.entry_points]
33
34
  console_scripts =
@@ -37,7 +38,6 @@ console_scripts =
37
38
  [options.package_data]
38
39
  bare_script =
39
40
  include/*.bare
40
- include/*.mds
41
41
  include/*.txt
42
42
 
43
43
  [egg_info]
@@ -60,7 +60,7 @@ def main(argv=None):
60
60
  script_source = None
61
61
  try:
62
62
  script_source = fetch_read_write({'url': script_value})
63
- except: # pylint: disable=bare-except
63
+ except:
64
64
  pass
65
65
  if script_source is None:
66
66
  raise ValueError(f'Failed to load "{script_value}"')
@@ -113,10 +113,10 @@ def main(argv=None):
113
113
  if status_code != 0:
114
114
  break
115
115
 
116
- except Exception as e: # pylint: disable=broad-exception-caught
116
+ except Exception as exc:
117
117
  if error_name is not None:
118
118
  print(f'{error_name}:')
119
- print(str(e).strip())
119
+ print(str(exc).strip())
120
120
  status_code = 1
121
121
 
122
122
  # Return the status code
@@ -32,7 +32,7 @@ def main(argv=None):
32
32
  try:
33
33
  with open(file_, 'r', encoding='utf-8') as fh:
34
34
  source = fh.read()
35
- except: # pylint: disable=bare-except
35
+ except:
36
36
  pass
37
37
  if source is None:
38
38
  errors.append(f'Failed to load "{file_}"')
@@ -163,7 +163,7 @@ def main(argv=None):
163
163
  with open(args.output, 'w', encoding='utf-8') as fh:
164
164
  fh.write(library_json)
165
165
  success = True
166
- except: # pylint: disable=bare-except
166
+ except:
167
167
  pass
168
168
  if not success:
169
169
  print(f'error: Failed to write "{args.output}"')
@@ -1314,9 +1314,8 @@ struct RegexMatch
1314
1314
  # $function: regexNew
1315
1315
  # $group: Regex
1316
1316
  # $doc: Create a regular expression
1317
- # pylint: disable=line-too-long
1317
+ # pylint: disable-next=line-too-long
1318
1318
  # $arg pattern: The [regular expression pattern string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions#writing_a_regular_expression_pattern)
1319
- # pylint: enable=line-too-long
1320
1319
  # $arg flags: The regular expression flags. The string may contain the following characters:
1321
1320
  # $arg flags: - **i** - case-insensitive search
1322
1321
  # $arg flags: - **m** - multi-line search - "^" and "$" matches next to newline characters
@@ -1820,7 +1819,7 @@ def _system_fetch(args, options):
1820
1819
  if fetch_fn is not None:
1821
1820
  try:
1822
1821
  response = fetch_fn(request_fetch)
1823
- except: # pylint: disable=bare-except
1822
+ except:
1824
1823
  pass
1825
1824
  responses.append(response)
1826
1825
 
@@ -8,7 +8,14 @@ BareScript runtime option function implementations
8
8
  import os
9
9
  from pathlib import Path
10
10
  import re
11
- import urllib.request
11
+
12
+ import urllib3
13
+
14
+
15
+ # The fetch connection pool
16
+ FETCH_POOL_COUNT = int(os.getenv('BARESCRIPT_FETCH_POOL_COUNT', '10'))
17
+ FETCH_POOL_SIZE = int(os.getenv('BARESCRIPT_FETCH_POOL_SIZE', '10'))
18
+ FETCH_POOL_MANAGER = urllib3.PoolManager(num_pools=FETCH_POOL_COUNT, maxsize=FETCH_POOL_SIZE)
12
19
 
13
20
 
14
21
  def fetch_http(request):
@@ -16,14 +23,18 @@ def fetch_http(request):
16
23
  A :func:`fetch function <fetch_fn>` implementation that fetches resources using HTTP GET and POST
17
24
  """
18
25
 
26
+ url = request['url']
19
27
  body = request.get('body')
20
- req = urllib.request.Request(
21
- request['url'],
22
- data=body.encode('utf-8') if body is not None else None,
23
- headers=request.get('headers', {})
24
- )
25
- with urllib.request.urlopen(req) as response:
26
- return response.read().decode('utf-8')
28
+ headers = request.get('headers') or {}
29
+ method = 'GET' if body is None else 'POST'
30
+ try:
31
+ response = FETCH_POOL_MANAGER.request(method, url, body=body, headers=headers, retries=0)
32
+ if response.status != 200:
33
+ raise urllib3.exceptions.HTTPError(f'Fetch "{method}" "{url}" failed ({response.status})')
34
+ response_text = response.data.decode('utf-8')
35
+ finally:
36
+ response.close()
37
+ return response_text
27
38
 
28
39
 
29
40
  def fetch_read_only(request):
@@ -116,7 +116,7 @@ def _execute_script_helper(statements, options, locals_):
116
116
  # Fetch the URL
117
117
  try:
118
118
  script_text = fetch_fn({'url': url}) if fetch_fn is not None else None
119
- except: # pylint: disable=bare-except
119
+ except:
120
120
  script_text = None
121
121
  if script_text is None:
122
122
  raise BareScriptRuntimeError(f'Include of "{url}" failed')
@@ -238,7 +238,7 @@ def evaluate_expression(expr, options=None, locals_=None, builtins=True):
238
238
  return func_value(func_args, options)
239
239
  except BareScriptRuntimeError:
240
240
  raise
241
- except Exception as error: # pylint: disable=broad-exception-caught
241
+ except Exception as error:
242
242
  # Log and return null
243
243
  if options is not None and 'logFn' in options and options.get('debug'):
244
244
  options['logFn'](f'BareScript: Function "{func_name}" failed with error: {error}')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bare-script
3
- Version: 3.3.2
3
+ Version: 3.4.0
4
4
  Summary: bare-script
5
5
  Home-page: https://github.com/craigahobbs/bare-script
6
6
  Author: Craig A. Hobbs
@@ -21,6 +21,7 @@ Classifier: Topic :: Utilities
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: schema-markdown>=1.2.0
24
+ Requires-Dist: urllib3>=2.5.0
24
25
  Dynamic: license-file
25
26
 
26
27
  # bare-script
@@ -21,14 +21,9 @@ src/bare_script.egg-info/requires.txt
21
21
  src/bare_script.egg-info/top_level.txt
22
22
  src/bare_script/include/__init__.py
23
23
  src/bare_script/include/args.bare
24
- src/bare_script/include/args.mds
25
24
  src/bare_script/include/diff.bare
26
25
  src/bare_script/include/forms.bare
27
- src/bare_script/include/forms.mds
28
26
  src/bare_script/include/markdownUp.bare
29
27
  src/bare_script/include/pager.bare
30
- src/bare_script/include/pager.mds
31
28
  src/bare_script/include/unittest.bare
32
- src/bare_script/include/unittest.mds
33
- src/bare_script/include/unittestMock.bare
34
- src/bare_script/include/unittestMock.mds
29
+ src/bare_script/include/unittestMock.bare
@@ -1 +1,2 @@
1
1
  schema-markdown>=1.2.0
2
+ urllib3>=2.5.0
@@ -1,12 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
-
4
-
5
- # Include sentinel
6
- if systemGlobalGet('argsSentinel'):
7
- return
8
- endif
9
-
10
-
11
- systemLog('MarkdownUp - args.mds: args.mds is now args.bare - please update before 2025-06-01')
12
- include 'args.bare'
@@ -1,12 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
-
4
-
5
- # Include sentinel
6
- if systemGlobalGet('formsSentinel'):
7
- return
8
- endif
9
-
10
-
11
- systemLog('MarkdownUp - forms.mds: forms.mds is now forms.bare - please update before 2025-06-01')
12
- include 'forms.bare'
@@ -1,12 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
-
4
-
5
- # Include sentinel
6
- if systemGlobalGet('pagerSentinel'):
7
- return
8
- endif
9
-
10
-
11
- systemLog('MarkdownUp - pager.mds: pager.mds is now pager.bare - please update before 2025-06-01')
12
- include 'pager.bare'
@@ -1,12 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
-
4
-
5
- # Include sentinel
6
- if systemGlobalGet('unittestSentinel'):
7
- return
8
- endif
9
-
10
-
11
- systemLog('MarkdownUp - unittest.mds: unittest.mds is now unittest.bare - please update before 2025-06-01')
12
- include 'unittest.bare'
@@ -1,12 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
-
4
-
5
- # Include sentinel
6
- if systemGlobalGet('unittestMockSentinel'):
7
- return
8
- endif
9
-
10
-
11
- systemLog('MarkdownUp - unittestMock.mds: unittestMock.mds is now unittestMock.bare - please update before 2025-06-01')
12
- include 'unittestMock.bare'
File without changes
File without changes
File without changes