ae-base 0.3.67__tar.gz → 0.3.69__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.
@@ -1,4 +1,4 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.53 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.56 -->
2
2
  ### GNU GENERAL PUBLIC LICENSE
3
3
 
4
4
  Version 3, 29 June 2007
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ae_base
3
- Version: 0.3.67
3
+ Version: 0.3.69
4
4
  Summary: ae namespace module portion base: basic constants, helper functions and context managers
5
5
  Home-page: https://gitlab.com/ae-group/ae_base
6
6
  Author: AndiEcker
@@ -65,13 +65,13 @@ Dynamic: summary
65
65
 
66
66
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.96 -->
67
67
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
68
- # base 0.3.67
68
+ # base 0.3.69
69
69
 
70
70
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_base/develop?logo=python)](
71
71
  https://gitlab.com/ae-group/ae_base)
72
72
  [![LatestPyPIrelease](
73
- https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.66?logo=python)](
74
- https://gitlab.com/ae-group/ae_base/-/tree/release0.3.66)
73
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.68?logo=python)](
74
+ https://gitlab.com/ae-group/ae_base/-/tree/release0.3.68)
75
75
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_base)](
76
76
  https://pypi.org/project/ae-base/#history)
77
77
 
@@ -1,12 +1,12 @@
1
1
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.96 -->
2
2
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
3
- # base 0.3.67
3
+ # base 0.3.69
4
4
 
5
5
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_base/develop?logo=python)](
6
6
  https://gitlab.com/ae-group/ae_base)
7
7
  [![LatestPyPIrelease](
8
- https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.66?logo=python)](
9
- https://gitlab.com/ae-group/ae_base/-/tree/release0.3.66)
8
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.68?logo=python)](
9
+ https://gitlab.com/ae-group/ae_base/-/tree/release0.3.68)
10
10
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_base)](
11
11
  https://pypi.org/project/ae-base/#history)
12
12
 
@@ -42,7 +42,7 @@ inspect the operating system and manage environment variables.
42
42
  :func:`~ae.core.start_app_service` and :func:`~ae.core.request_app_permissions`.
43
43
 
44
44
  OS information
45
- ~~~~~~~~~~~~~~
45
+ ^^^^^^^^^^^^^^
46
46
 
47
47
  * :data:`os_platform`: a string identifying the operating system (e.g., 'linux', 'win32', 'android', 'ios').
48
48
  * :data:`os_device_id`: a string with the ID/name of the device.
@@ -53,7 +53,7 @@ OS information
53
53
  * :func:`sys_env_text`: compiles a formatted text block with system environment information, useful for logging.
54
54
 
55
55
  environment variables & `.env` files
56
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57
57
 
58
58
  * :func:`env_str`: retrieves the string value of an OS environment variable, with an option to automatically convert the
59
59
  variable name to the conventional format.
@@ -124,18 +124,18 @@ general utilities & helpers
124
124
  a collection of miscellaneous mathematical, date/time, and other standalone helper functions.
125
125
 
126
126
  mathematical
127
- ~~~~~~~~~~~~
127
+ ^^^^^^^^^^^^
128
128
 
129
129
  * :func:`sign`: returns the sign of a number (-1 for negative, 0 for zero, 1 for positive).
130
130
  * :func:`round_traditional`: rounds a float value using traditional rounding rules (e.g., `0.5` rounds up).
131
131
 
132
132
  date & time
133
- ~~~~~~~~~~~
133
+ ^^^^^^^^^^^
134
134
  * :func:`utc_datetime`: Returns the current date and time as a timezone-naive `datetime` object in UTC.
135
135
  * :func:`now_str`: creates a compact, sortable timestamp string from the current UTC time.
136
136
 
137
137
  miscellaneous
138
- ~~~~~~~~~~~~~
138
+ ^^^^^^^^^^^^^
139
139
  * :func:`dummy_function`: a null function that accepts any arguments and returns `None`.
140
140
 
141
141
 
@@ -158,7 +158,7 @@ base constants
158
158
  predefined constants for project structure, file conventions, and default settings.
159
159
 
160
160
  project & file structure
161
- ~~~~~~~~~~~~~~~~~~~~~~~~
161
+ ^^^^^^^^^^^^^^^^^^^^^^^^
162
162
 
163
163
  * :data:`DOCS_FOLDER`: default name for a project's documentation folder ('docs').
164
164
  * :data:`TESTS_FOLDER`: default name for a project's tests folder ('tests').
@@ -176,7 +176,7 @@ project & file structure
176
176
  :mod:`ae.updater` and :mod:`aedev.project_manager`)
177
177
 
178
178
  formats & default settings
179
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
179
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
180
180
 
181
181
  * :data:`DATE_ISO`: ISO format string for dates ("%Y-%m-%d").
182
182
  * :data:`DATE_TIME_ISO`: ISO format string for :mod:`datetime.datetime` dates ("%Y-%m-%d %H:%M:%S.%f").
@@ -200,7 +200,7 @@ simplify file system interactions with wrappers and context managers.
200
200
  * :func:`in_wd`: a context manager that temporarily switches the current working directory.
201
201
 
202
202
  os.path shortcuts
203
- ~~~~~~~~~~~~~~~~~
203
+ ^^^^^^^^^^^^^^^^^
204
204
 
205
205
  the following are direct references to functions in the :mod:`os.path` module for convenient and quicker access:
206
206
 
@@ -245,7 +245,7 @@ from types import ModuleType
245
245
  from typing import Any, Callable, Generator, Iterable, MutableMapping, Optional, Union, cast
246
246
 
247
247
 
248
- __version__ = '0.3.67'
248
+ __version__ = '0.3.69'
249
249
 
250
250
 
251
251
  os_path_abspath = os.path.abspath
@@ -428,7 +428,6 @@ def deep_dict_update(data: dict, update: dict, overwrite: bool = True):
428
428
  data[upd_key] = upd_val
429
429
 
430
430
 
431
- URI_SEP_CHAR = '⫻' # U+2AFB: TRIPLE SOLIDUS BINARY RELATION
432
431
  # noinspection GrazieInspection
433
432
  ASCII_UNICODE = (
434
433
  ('/', '⁄'), # U+2044: Fraction Slash; '∕' U+2215: Division Slash; '⧸' U+29F8: Big Solidus;
@@ -466,13 +465,19 @@ ASCII_UNICODE = (
466
465
  # ' ' U+202F: Narrow No-Break Space (NNBSP); ' ' U+205F Medium Mathematical Space;
467
466
  # '␠' U+2420 symbol for space; '␣' U+2423 Open Box; ' ' U+3000: Ideographic Space
468
467
  (chr(127), '␡'), # U+2421: DELETE SYMBOL
469
- # ('_', '𛲖'), # U+1BC96: Duployan Affix Low Line; '_' U+FF3F Fullwidth Low Line
470
- )
471
- """ transformation table of special ASCII to Unicode alternative character,
468
+ # ('_', '𛲖'), # U+1BC96: Duployan Affix Low Line; '_' U+FF3F Fullwidth Low Line
469
+ ) + tuple((chr(low_asc_ord), chr(0x2400 + low_asc_ord)) for low_asc_ord in range(32))
470
+ """ transformation table of special ASCII characters to a similar/alternative non-functional/-escaping Unicode char,
472
471
  see https://www.compart.com/en/unicode/category/Po and https://xahlee.info/comp/unicode_naming_slash.html (http!) """
473
472
 
474
- ASCII_TO_UNICODE = dict(ASCII_UNICODE) #: map to convert ASCII to an alternative defused Unicode character
475
- UNICODE_TO_ASCII = {unicode_char: ascii_char for ascii_char, unicode_char in ASCII_UNICODE} #: Unicode to ASCII map
473
+ URI_SEP_STR = '://' #: separator between service and address(host/path) in URIs
474
+ URI_SEP_UNICODE_CHAR = '⫻' #: single Unicode char for :data:`URI_SEP_STR` U+2AFB: TRIPLE SOLIDUS BINARY RELATION
475
+
476
+ ASCII_TO_UNICODE = str.maketrans(dict(ASCII_UNICODE))
477
+ """ :func:`str.translate` map to convert ASCII to an alternative defused Unicode character - used by :func:`defuse` """
478
+ UNICODE_TO_ASCII = str.maketrans({unicode_char: ascii_char for ascii_char, unicode_char in
479
+ ASCII_UNICODE + ((URI_SEP_STR, URI_SEP_UNICODE_CHAR), )})
480
+ """ :func:`str.translate` Unicode to ASCII map - used by :func:`dedefuse` """
476
481
 
477
482
 
478
483
  def dedefuse(value: str) -> str:
@@ -481,15 +486,7 @@ def dedefuse(value: str) -> str:
481
486
  :param value: string defused with the function :func:`defuse`.
482
487
  :return: re-activated form of the string (with all ASCII special characters recovered).
483
488
  """
484
- original = ""
485
- for char in value:
486
- if char in UNICODE_TO_ASCII:
487
- char = UNICODE_TO_ASCII[char]
488
- elif 0x2400 <= (code := ord(char)) <= 0x241F:
489
- char = chr(code - 0x2400)
490
- original += char
491
-
492
- return original.replace(URI_SEP_CHAR, '://')
489
+ return value.translate(UNICODE_TO_ASCII)
493
490
 
494
491
 
495
492
  def defuse(value: str) -> str:
@@ -515,15 +512,7 @@ def defuse(value: str) -> str:
515
512
  .. hint:: use the :func:`dedefuse` function to convert the defused string back to the corresponding URI/file-path.
516
513
 
517
514
  """
518
- defused = ""
519
- value = value.replace('://', URI_SEP_CHAR) # make URIs shorter
520
- for char in value:
521
- if char in ASCII_TO_UNICODE:
522
- char = ASCII_TO_UNICODE[char]
523
- elif (code := ord(char)) <= 31:
524
- char = chr(0x2400 + code)
525
- defused += char
526
- return defused
515
+ return value.replace(URI_SEP_STR, URI_SEP_UNICODE_CHAR).translate(ASCII_TO_UNICODE) # replace makes URIs shorter
527
516
 
528
517
 
529
518
  def dummy_function(*_args, **_kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ae_base
3
- Version: 0.3.67
3
+ Version: 0.3.69
4
4
  Summary: ae namespace module portion base: basic constants, helper functions and context managers
5
5
  Home-page: https://gitlab.com/ae-group/ae_base
6
6
  Author: AndiEcker
@@ -65,13 +65,13 @@ Dynamic: summary
65
65
 
66
66
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.96 -->
67
67
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
68
- # base 0.3.67
68
+ # base 0.3.69
69
69
 
70
70
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_base/develop?logo=python)](
71
71
  https://gitlab.com/ae-group/ae_base)
72
72
  [![LatestPyPIrelease](
73
- https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.66?logo=python)](
74
- https://gitlab.com/ae-group/ae_base/-/tree/release0.3.66)
73
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.68?logo=python)](
74
+ https://gitlab.com/ae-group/ae_base/-/tree/release0.3.68)
75
75
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_base)](
76
76
  https://pypi.org/project/ae-base/#history)
77
77
 
@@ -1,4 +1,4 @@
1
- # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.53
1
+ # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.56
2
2
  [build-system]
3
3
  requires = ["setuptools>=42", "wheel"]
4
4
  build-backend = "setuptools.build_meta"
@@ -1,4 +1,4 @@
1
- # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.53
1
+ # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.56
2
2
  """ setup of ae namespace module portion base: basic constants, helper functions and context managers. """
3
3
  # noinspection PyUnresolvedReferences
4
4
  import sys
@@ -25,13 +25,13 @@ setup_kwargs = {
25
25
  'license': 'GPL-3.0-or-later',
26
26
  'long_description': ('<!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.96 -->\n'
27
27
  '<!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->\n'
28
- '# base 0.3.67\n'
28
+ '# base 0.3.69\n'
29
29
  '\n'
30
30
  '[![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_base/develop?logo=python)](\n'
31
31
  ' https://gitlab.com/ae-group/ae_base)\n'
32
32
  '[![LatestPyPIrelease](\n'
33
- ' https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.66?logo=python)](\n'
34
- ' https://gitlab.com/ae-group/ae_base/-/tree/release0.3.66)\n'
33
+ ' https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.68?logo=python)](\n'
34
+ ' https://gitlab.com/ae-group/ae_base/-/tree/release0.3.68)\n'
35
35
  '[![PyPIVersions](https://img.shields.io/pypi/v/ae_base)](\n'
36
36
  ' https://pypi.org/project/ae-base/#history)\n'
37
37
  '\n'
@@ -108,7 +108,7 @@ setup_kwargs = {
108
108
  'Source': 'https://ae.readthedocs.io/en/latest/_modules/ae/base.html'},
109
109
  'python_requires': '>=3.9',
110
110
  'url': 'https://gitlab.com/ae-group/ae_base',
111
- 'version': '0.3.67',
111
+ 'version': '0.3.69',
112
112
  'zip_safe': True,
113
113
  }
114
114
 
@@ -21,8 +21,8 @@ from urllib.error import HTTPError, URLError
21
21
 
22
22
  # noinspection PyProtectedMember
23
23
  from ae.base import (
24
- ASCII_TO_UNICODE, BUILD_CONFIG_FILE, DOTENV_FILE_NAME, PY_EXT, PY_INIT, PY_MAIN, TESTS_FOLDER, UNICODE_TO_ASCII,
25
- UNSET, URI_SEP_CHAR,
24
+ ASCII_TO_UNICODE, ASCII_UNICODE, BUILD_CONFIG_FILE, DOTENV_FILE_NAME, PY_EXT, PY_INIT, PY_MAIN, TESTS_FOLDER,
25
+ UNICODE_TO_ASCII, UNSET, URI_SEP_STR, URI_SEP_UNICODE_CHAR,
26
26
  app_name_guess, ascii_str, build_config_variable_values, camel_to_snake,
27
27
  dedefuse, deep_dict_update, defuse, dummy_function, duplicates, env_str, evaluate_literal,
28
28
  force_encoding, format_given, full_stack_trace, import_module, instantiate_config_parser, in_wd,
@@ -157,11 +157,11 @@ class TestBaseHelpers:
157
157
  assert all(ord(_) >= 128 for _ in uni_str)
158
158
  assert all(ord(_) < 128 for _ in ascii_str(uni_str))
159
159
 
160
- uni_str = "".join(UNICODE_TO_ASCII.keys())
160
+ uni_str = "".join(_uco for _asc, _uco in ASCII_UNICODE)
161
161
  assert any(ord(_) >= 128 for _ in uni_str)
162
162
  assert all(ord(_) < 128 for _ in ascii_str(uni_str))
163
163
 
164
- asc_str = "".join(ASCII_TO_UNICODE.keys())
164
+ asc_str = "".join(_asc for _asc, _uco in ASCII_UNICODE)
165
165
  assert any(ord(_) < 128 for _ in asc_str)
166
166
  assert all(ord(_) < 128 for _ in ascii_str(asc_str))
167
167
 
@@ -172,10 +172,10 @@ class TestBaseHelpers:
172
172
  uni_str = "äÄßéÉíÍñÑòÒùÙ"
173
173
  assert str_ascii(ascii_str(uni_str)) == uni_str
174
174
 
175
- uni_str = "".join(UNICODE_TO_ASCII.keys())
175
+ uni_str = "".join(_uco for _asc, _uco in ASCII_UNICODE)
176
176
  assert str_ascii(ascii_str(uni_str)) == uni_str
177
177
 
178
- asc_str = "".join(ASCII_TO_UNICODE.keys())
178
+ asc_str = "".join(_asc for _asc, _uco in ASCII_UNICODE)
179
179
  assert str_ascii(ascii_str(asc_str)) == asc_str
180
180
 
181
181
  def test_str_ascii_errors(self):
@@ -320,16 +320,18 @@ class TestBaseHelpers:
320
320
  os.remove(tst_fna2)
321
321
 
322
322
  def test_defuse_maps_integrity(self):
323
- assert URI_SEP_CHAR not in UNICODE_TO_ASCII
324
- assert len(UNICODE_TO_ASCII) == len(ASCII_TO_UNICODE) # check for duplicates in the ASCII_UNICODE map
323
+ assert len(ASCII_TO_UNICODE) == len(ASCII_UNICODE) # duplicates check in ASCII_UNICODE map
324
+ assert len(UNICODE_TO_ASCII) == len(ASCII_UNICODE) + 1 # -"-, having also the ord(URI_SEP_UNICODE_CHAR) key
325
+ assert ord(URI_SEP_UNICODE_CHAR) in UNICODE_TO_ASCII
326
+ assert UNICODE_TO_ASCII[ord(URI_SEP_UNICODE_CHAR)] == URI_SEP_STR
325
327
 
326
328
  def test_defuse_maps_not_touching_chars_allowed_as_slug_and_filename(self):
327
- assert '-' not in ASCII_TO_UNICODE
328
- assert '_' not in ASCII_TO_UNICODE
329
- assert '.' not in ASCII_TO_UNICODE
330
- assert '~' not in ASCII_TO_UNICODE
329
+ assert ord('-') not in ASCII_TO_UNICODE
330
+ assert ord('_') not in ASCII_TO_UNICODE
331
+ assert ord('.') not in ASCII_TO_UNICODE
332
+ assert ord('~') not in ASCII_TO_UNICODE
331
333
  for char in string.ascii_letters + string.digits:
332
- assert char not in ASCII_TO_UNICODE
334
+ assert ord(char) not in ASCII_TO_UNICODE
333
335
 
334
336
  def test_dummy_function(self):
335
337
  assert dummy_function() is None
File without changes