ae-base 0.3.64__py3-none-any.whl → 0.3.65__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,6 +32,10 @@ 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
36
+ basic data structure values from config, ini and .env files, while also accepting unquoted strings as a `str` type
37
+ instance.
38
+
35
39
  most programming languages providing a function to determine the sign of a number. the :func:`sign` functino,
36
40
  provided by this module/portion is filling this gap in Python.
37
41
 
@@ -148,6 +152,7 @@ os.path shortcuts
148
152
  the following data items are pointers to shortcut at runtime the lookup to their related functions in the
149
153
  Python module :mod:`os.path`:
150
154
  """
155
+ # pylint: disable=too-many-lines
151
156
  import datetime
152
157
  import getpass
153
158
  import importlib.abc
@@ -171,7 +176,7 @@ from types import ModuleType
171
176
  from typing import Any, Callable, Generator, Iterable, MutableMapping, Optional, Union, cast
172
177
 
173
178
 
174
- __version__ = '0.3.64'
179
+ __version__ = '0.3.65'
175
180
 
176
181
 
177
182
  os_path_abspath = os.path.abspath
@@ -494,6 +499,20 @@ def env_str(name: str, convert_name: bool = False) -> Optional[str]:
494
499
  return os.environ.get(name)
495
500
 
496
501
 
502
+ def evaluate_literal(literal_string: str) -> Any:
503
+ """ evaluates a Python expression while accepting unquoted strings as str type.
504
+
505
+ :param literal_string: any literal of the base types (like dict, list, set, tuple) which are recognized
506
+ by :func:`ast.literal_eval`.
507
+ :return: an instance of the data type or the specified string, even if it is not quoted with
508
+ high comma characters.
509
+ """
510
+ try:
511
+ return literal_eval(literal_string)
512
+ except (IndentationError, SyntaxError, TypeError, ValueError):
513
+ return literal_string
514
+
515
+
497
516
  def force_encoding(text: Union[str, bytes], encoding: str = DEF_ENCODING, errors: str = DEF_ENCODE_ERRORS) -> str:
498
517
  """ force/ensure the encoding of text (str or bytes) without any UnicodeDecodeError/UnicodeEncodeError.
499
518
 
@@ -1,29 +1,29 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ae_base
3
- Version: 0.3.64
3
+ Version: 0.3.65
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
7
7
  Author-email: aecker2@gmail.com
8
- License: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
8
+ License: GPL-3.0-or-later
9
9
  Project-URL: Bug Tracker, https://gitlab.com/ae-group/ae_base/-/issues
10
10
  Project-URL: Documentation, https://ae.readthedocs.io/en/latest/_autosummary/ae.base.html
11
11
  Project-URL: Repository, https://gitlab.com/ae-group/ae_base
12
12
  Project-URL: Source, https://ae.readthedocs.io/en/latest/_modules/ae/base.html
13
13
  Keywords: configuration,development,environment,productivity
14
14
  Classifier: Development Status :: 3 - Alpha
15
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
16
15
  Classifier: Natural Language :: English
17
16
  Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python
19
18
  Classifier: Programming Language :: Python :: 3
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
22
  Requires-Python: >=3.9
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE.md
25
25
  Provides-Extra: dev
26
- Requires-Dist: aedev_tpl_project; extra == "dev"
26
+ Requires-Dist: aedev_project_tpls; extra == "dev"
27
27
  Requires-Dist: ae_ae; extra == "dev"
28
28
  Requires-Dist: anybadge; extra == "dev"
29
29
  Requires-Dist: coverage-badge; extra == "dev"
@@ -69,13 +69,13 @@ Dynamic: summary
69
69
 
70
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.64
72
+ # base 0.3.65
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.63?logo=python)](
78
- https://gitlab.com/ae-group/ae_base/-/tree/release0.3.63)
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)
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=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,,
@@ -1,4 +1,4 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.36 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.project_tpls V0.3.45 -->
2
2
  ### GNU GENERAL PUBLIC LICENSE
3
3
 
4
4
  Version 3, 29 June 2007
@@ -1,7 +0,0 @@
1
- ae/base.py,sha256=STUdNRroIq5IXtXCqWRg8vIu-Vx-qvOT8f7gnv8uhH8,67812
2
- ae_base-0.3.64.dist-info/licenses/LICENSE.md,sha256=vn9XT8MDUxNAWsP60HLwHJp8ZLOI0OJBRe-1N2xXh08,35002
3
- ae_base-0.3.64.dist-info/METADATA,sha256=Yo8TxzMWNjmhRMgJwKFsXW3Ui6M9IA358AIO1abx4mE,5724
4
- ae_base-0.3.64.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- ae_base-0.3.64.dist-info/top_level.txt,sha256=vUdgAslSmhZLXWU48fm8AG2BjVnkOWLco8rzuW-5zY0,3
6
- ae_base-0.3.64.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
7
- ae_base-0.3.64.dist-info/RECORD,,