A python library for helper functions
Project description
egos-helpers
A python library for helper functions. Used in the egos-tech projects.
Functions
gather_environ: Return a dict of environment variables correlating to the keys dict.short_msg: Truncates the message tocharscharacters and adds two dots at the end.strtobool: Converts a string to a booleanredact: Replaces inmessagetheparamstring withreplace_value
See egos_helpers/core.py for the full description of each function.
Usage example
Install egos-helpers:
python3 -m venv .venv
source .venv/bin/activate
# if you don't have a requirements.txt file
pip install -U egos-helpers
# if you do have a requirements.txt file
pip install -U -r requirements.txt
In your python project:
from egos_helpers import gather_environ
class MyClass:
keys = {
'key_one': {
'default': ['one', 2],
'type': "list",
},
'key_two':{
'hidden': True,
'default': False,
'type': "boolean",
},
'key_three': {
'default': [],
'type': "filter",
},
'key_four': {
'default': None,
'redact': True,
'type': 'string',
},
'key_five': {
'default': 12,
'type': 'int',
},
'key_six': {
'default': 'INFO',
'type': 'enum',
'values': [
'DEBUG',
'INFO',
'WARNING',
'ERROR'
],
},
'key_seven': {
'default': '12',
'deprecated': True,
'replaced_by': 'key_five',
'type': 'int',
}
}
def __init__(self):
envkeys = gather_environ(keys=MyClass.keys)
print(envkeys)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
egos_helpers-1.2.0.tar.gz
(8.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file egos_helpers-1.2.0.tar.gz.
File metadata
- Download URL: egos_helpers-1.2.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b483922506e5beab01cd6a6193b2cbfd9b1388556709b830006c9e9e6281fd
|
|
| MD5 |
71a0da1ba605532dd2c355d0360f0cc2
|
|
| BLAKE2b-256 |
ec36fdc8e31290bf5a623935aef460978bc6a12bde9afd05803933d676532179
|
File details
Details for the file egos_helpers-1.2.0-py3-none-any.whl.
File metadata
- Download URL: egos_helpers-1.2.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37ce6b09eeffd4a5f95a349d60c09addbcf177f02ca22a4609e3b6290a5341b7
|
|
| MD5 |
8c21ed4d95bcc60a92b2f117f6d774bc
|
|
| BLAKE2b-256 |
61e9b1c036018b44c54a2d10b158b4818ffd14a4d79bf22d7754d63e72dda9c3
|