ae-base 0.3.65__py3-none-any.whl → 0.3.66__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
@@ -32,7 +32,7 @@ sortable and compact string from a timestamp.
32
32
  base helper functions
33
33
  ---------------------
34
34
 
35
- the function :func:`evaluate_literal` can be used as an replacement of :func:`ast.literal_eval` to retrieve
35
+ the function :func:`evaluate_literal` can be used as a replacement of :func:`ast.literal_eval` to retrieve
36
36
  basic data structure values from config, ini and .env files, while also accepting unquoted strings as a `str` type
37
37
  instance.
38
38
 
@@ -176,7 +176,7 @@ from types import ModuleType
176
176
  from typing import Any, Callable, Generator, Iterable, MutableMapping, Optional, Union, cast
177
177
 
178
178
 
179
- __version__ = '0.3.65'
179
+ __version__ = '0.3.66'
180
180
 
181
181
 
182
182
  os_path_abspath = os.path.abspath
@@ -360,6 +360,7 @@ def deep_dict_update(data: dict, update: dict, overwrite: bool = True):
360
360
 
361
361
 
362
362
  URI_SEP_CHAR = '⫻' # U+2AFB: TRIPLE SOLIDUS BINARY RELATION
363
+ # noinspection GrazieInspection
363
364
  ASCII_UNICODE = (
364
365
  ('/', '⁄'), # U+2044: Fraction Slash; '∕' U+2215: Division Slash; '⧸' U+29F8: Big Solidus;
365
366
  # '╱' U+FF0F: Fullwidth Solidus; '╱' U+2571: Box Drawings Light Diagonal Upper Right to Lower Left
@@ -433,7 +434,7 @@ def defuse(value: str) -> str:
433
434
  in most unix variants only the slash and the ASCII 0 characters are not allowed in file names.
434
435
 
435
436
  in MS Windows are not allowed: ASCII 0..31 / | \\ : * ? ” % < > ( ). some blogs recommend also not allowing
436
- (convert) the characters # and '.
437
+ (convert) the characters `#` and `'`.
437
438
 
438
439
  only old POSIX seems to be even more restricted (only allowing alphanumeric characters plus . - and _).
439
440
 
@@ -649,14 +650,26 @@ def in_wd(new_cwd: str) -> Generator[None, None, None]:
649
650
  os.chdir(cur_dir)
650
651
 
651
652
 
652
- def load_dotenvs():
653
- """ detect and load multiple ``.env`` files in/above the current working directory and the calling module folder.
653
+ def load_dotenvs(from_module_path: bool = False):
654
+ """ detect and load not defined OS environment variables from ``.env`` files.
654
655
 
655
- .. hint:: call from the main module of project/app in order to also load ``.env`` files in/above the project folder.
656
+ :param from_module_path: pass True to load OS environment variables (that are not already loaded from ``.env``
657
+ files situated in or above the current working directory) also from/above the folder of
658
+ the first module in the call stack that gets not excluded/skipped by :func:`stack_var`.
659
+
660
+ in order to also load ``.env`` files in/above the project folder.
661
+ call this function from the main module of project/app.
662
+
663
+ .. note::
664
+ only variables that are not already defined in the OS environment variables mapping :data:`os.environ` will be
665
+ loaded/added. variables will be loaded first from the first ``.env`` file found in or above the current working
666
+ directory, while the variable values in the deeper situated files are overwriting the values defined in the
667
+ ``.env`` files situated in the above folders.
656
668
  """
657
669
  env_vars = os.environ
658
670
  load_env_var_defaults(os.getcwd(), env_vars)
659
- if file_name := stack_var('__file__'):
671
+
672
+ if from_module_path and (file_name := stack_var('__file__')):
660
673
  load_env_var_defaults(os_path_dirname(os_path_abspath(file_name)), env_vars)
661
674
 
662
675
 
@@ -788,11 +801,12 @@ def module_name(*skip_modules: str, depth: int = 0) -> Optional[str]:
788
801
 
789
802
 
790
803
  def norm_line_sep(text: str) -> str:
804
+ # noinspection GrazieInspection
791
805
  """ convert any combination of line separators in the :paramref:`~norm_line_sep.text` arg to new-line characters.
792
806
 
793
- :param text: string containing any combination of line separators ('\\\\r\\\\n' or '\\\\r').
794
- :return: normalized/converted string with only new-line ('\\\\n') line separator characters.
795
- """
807
+ :param text: string containing any combination of line separators ('\\\\r\\\\n' or '\\\\r').
808
+ :return: normalized/converted string with only new-line ('\\\\n') line separator characters.
809
+ """
796
810
  return text.replace('\r\n', '\n').replace('\r', '\n')
797
811
 
798
812
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ae_base
3
- Version: 0.3.65
3
+ Version: 0.3.66
4
4
  Summary: ae namespace module portion base: basic constants, helper functions and context manager
5
5
  Home-page: https://gitlab.com/ae-group/ae_base
6
6
  Author: AndiEcker
@@ -67,15 +67,15 @@ Dynamic: provides-extra
67
67
  Dynamic: requires-python
68
68
  Dynamic: summary
69
69
 
70
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.96 -->
70
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae v0.3.96 -->
71
71
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
72
- # base 0.3.65
72
+ # base 0.3.66
73
73
 
74
74
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_base/develop?logo=python)](
75
75
  https://gitlab.com/ae-group/ae_base)
76
76
  [![LatestPyPIrelease](
77
- https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.64?logo=python)](
78
- https://gitlab.com/ae-group/ae_base/-/tree/release0.3.64)
77
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_base/release0.3.65?logo=python)](
78
+ https://gitlab.com/ae-group/ae_base/-/tree/release0.3.65)
79
79
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_base)](
80
80
  https://pypi.org/project/ae-base/#history)
81
81
 
@@ -0,0 +1,7 @@
1
+ ae/base.py,sha256=JHqqxdP33QB7BI5NfLKBTF1QU2o_DIpIId9VQv8UKYs,69668
2
+ ae_base-0.3.66.dist-info/licenses/LICENSE.md,sha256=tgCt6xhP3pM6OcWOWsCTUNed3CEhLTOaRgBMUMynA0I,35003
3
+ ae_base-0.3.66.dist-info/METADATA,sha256=iDIXXfhbEK4B89iEK3tOqf8INLUpauy6WJvYeqzEMJs,5619
4
+ ae_base-0.3.66.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ ae_base-0.3.66.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
6
+ ae_base-0.3.66.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
+ ae_base-0.3.66.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls V0.3.45 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls v0.3.46 -->
2
2
  ### GNU GENERAL PUBLIC LICENSE
3
3
 
4
4
  Version 3, 29 June 2007
@@ -1,7 +0,0 @@
1
- ae/base.py,sha256=dMNP9veLav-IvUULLmNPs1PXpHQ2xAn5WMva9qIVRKk,68719
2
- ae_base-0.3.65.dist-info/licenses/LICENSE.md,sha256=-UEWsJNTHESFg25my1bZ5yx9aZzHD04wbguYc6ZfgEY,35003
3
- ae_base-0.3.65.dist-info/METADATA,sha256=s82tpQCZKNjEzSNvz-9KEWY5AkXzRDHIzUJChWcg-vk,5619
4
- ae_base-0.3.65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- ae_base-0.3.65.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
6
- ae_base-0.3.65.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
- ae_base-0.3.65.dist-info/RECORD,,