ae-base 0.3.67__py3-none-any.whl → 0.3.68__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 +14 -25
- {ae_base-0.3.67.dist-info → ae_base-0.3.68.dist-info}/METADATA +4 -4
- ae_base-0.3.68.dist-info/RECORD +7 -0
- {ae_base-0.3.67.dist-info → ae_base-0.3.68.dist-info}/licenses/LICENSE.md +1 -1
- ae_base-0.3.67.dist-info/RECORD +0 -7
- {ae_base-0.3.67.dist-info → ae_base-0.3.68.dist-info}/WHEEL +0 -0
- {ae_base-0.3.67.dist-info → ae_base-0.3.68.dist-info}/top_level.txt +0 -0
- {ae_base-0.3.67.dist-info → ae_base-0.3.68.dist-info}/zip-safe +0 -0
ae/base.py
CHANGED
|
@@ -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.
|
|
248
|
+
__version__ = '0.3.68'
|
|
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
|
-
# ('_', '𛲖'),
|
|
470
|
-
)
|
|
471
|
-
""" transformation table of special ASCII to
|
|
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
|
-
|
|
475
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
Version: 0.3.68
|
|
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.
|
|
68
|
+
# base 0.3.68
|
|
69
69
|
|
|
70
70
|
[](
|
|
71
71
|
https://gitlab.com/ae-group/ae_base)
|
|
72
72
|
[](
|
|
74
|
+
https://gitlab.com/ae-group/ae_base/-/tree/release0.3.67)
|
|
75
75
|
[](
|
|
76
76
|
https://pypi.org/project/ae-base/#history)
|
|
77
77
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
ae/base.py,sha256=B4qkfPNmuDeyFCLY7t2QbDtCv2uFpE8novuc8UTgh7M,77075
|
|
2
|
+
ae_base-0.3.68.dist-info/licenses/LICENSE.md,sha256=K2nZMCD-VuxJiIVGUFsN_TSl68W3biSTBew0_9jOUXc,35003
|
|
3
|
+
ae_base-0.3.68.dist-info/METADATA,sha256=kQkdHTEjrkMJJgBCyls3hAJL4w2OKOagFbZf3V7sK2A,5469
|
|
4
|
+
ae_base-0.3.68.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
ae_base-0.3.68.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
|
|
6
|
+
ae_base-0.3.68.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
7
|
+
ae_base-0.3.68.dist-info/RECORD,,
|
ae_base-0.3.67.dist-info/RECORD
DELETED
|
@@ -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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|