ae-base 0.3.67__py3-none-any.whl → 0.3.69__py3-none-any.whl

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.
ae/base.py CHANGED
@@ -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
 
@@ -0,0 +1,7 @@
1
+ ae/base.py,sha256=6OPSCEjga6s7iOAklyen7q1WKFc3T6YhHFyW1O5F4zc,77075
2
+ ae_base-0.3.69.dist-info/licenses/LICENSE.md,sha256=0g3tHWG2bfmLGyuM0e0YzSXT8As8eN1b0VQIqXMWTMg,35003
3
+ ae_base-0.3.69.dist-info/METADATA,sha256=mlFlGyFQbldQgCNL33UOqoveoNvfYBSkh3OHFKy3miA,5469
4
+ ae_base-0.3.69.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ ae_base-0.3.69.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
6
+ ae_base-0.3.69.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
+ ae_base-0.3.69.dist-info/RECORD,,
@@ -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,7 +0,0 @@
1
- ae/base.py,sha256=aEJAZNKzsY0XCiFga5CDqcnNoL5X9uaaRv5WGN8rWTM,77020
2
- ae_base-0.3.67.dist-info/licenses/LICENSE.md,sha256=hlo7PHR_Bh9Fv5DMlZv7Nbq-i_-KmNDpZ_wOSLFsLEs,35003
3
- ae_base-0.3.67.dist-info/METADATA,sha256=-YtEa0YEng9v25SWrjzmNuJhm0nNyCiSqdz-_Bafwfw,5469
4
- ae_base-0.3.67.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- ae_base-0.3.67.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
6
- ae_base-0.3.67.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
- ae_base-0.3.67.dist-info/RECORD,,