Common packages from SEACHAD
Project description
to create the library
- first delete /dist
- change TOML version
- python -m build
- twine upload dist/*
with this the library is updated and uploaded in order to refresh en environments 5) pip install --upgrade --no-cache-dir nombre_del_paquete
terminal_colors
Allows print with colors
Very easy!!!
>>> import terminal_colors as tc
tc._print(f"{tc.Y}Print in rellow, {tc.G}print in green, {tc.B}, print in blue")
tc._print(f"print in yellow", tc.Y)
tc._print(f"print without marks", time_and_module_mark=False)
def test_print():
# utilizando el HELPER
tc._print("Hola mundo", tc.B) # imprimirá por defecto en CYAN con BRIGHT (así sabemos que se está usando esta función por defecto)
tc._print(f"{tc.Y}Hola {tc.R}mundo") # imprimirá en AZUL sobre ROJO en BRIGHT
tc._print("Hola mundo", tc.W) # vuelve a imprimir en CYAN con BRIGHT (así sabemos que se está usando esta función por defecto)
# utilizando las primitivas
tc.print_in_color(tc.fg.BLUE+tc.bg.RED+tc.style.BRIGHT)
tc.print("Show me your color")
tc.print_in_color(tc.fg.WHITE)
tc.print( "All following prints will be WHITE ...")
tc.print( "continues WHITE...")
tc.print_in_color()
tc.print( "Now default color")
cache_REDIS
Usage of REDIS
functionallities:
- seamless communication with REDIS
- encrypted information
- allow to store in a singleton in memory (for fastest access) only alive during execution, no persistence
common
incluida soporte a diversas funcionaliades para la plataforma
deal with dates -> ejemplos
>>> # significa ahora
cadena = "@D:NOW@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}", Y)
cadena = "@D:NOW-6MONTH:LASTDAY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
# current year
cadena = "@D:CY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
# current month
cadena = "@D:CM@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
# current H
cadena = "@D:CH@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
# current quarter
cadena = "@D:CQ@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
# ejemplos:
cadena = "@D:NOW@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:NOW-100DAY@" # -> esto sería START-SIGN-NUMBER-DATAFRAME
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:NOW-3DAY@" # -> esto sería START-SIGN-NUMBER-DATAFRAME
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:NOW-3DAY:LASTDAY@" # -> esto sería START-SIGN-NUMBER-DATAFRAME y MODIFIER
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:NOW:LFEB-35DAY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:2030:FFEB-35DAY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
#cadenas de fechas para producción en Cloudmore
cadena = "@D:NOW-6MONTH:LASTDAY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
cadena = "@D:NOW:LASTDAY@"
_print( f"cadena {cadena} = {dealWithDates(cadena)}")
encriptación y desencriptación (funciones básicas)
generación de claves de encriptación
>>> CACHE_KEY = common.get_user_env("CM_ENCRYPTION_PASSWORD")
# estas claves son estáticas y no permiten su modificación en el tiempo
# encriptación por defecto en base a lo que nos venga dado
ENCRYPTION_METHOD = common.encryption_get_method_to_encrypt()
CACHED_GENERATED_KEY = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = ENCRYPTION_METHOD)
CACHED_GENERATED_KEY_fernet = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = common.ENCRYPTION_METHOD_FERNET)
CACHED_GENERATED_KEY_aes = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = common.ENCRYPTION_METHOD_AES)
CACHED_GENERATED_KEY_chacha20 = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = common.ENCRYPTION_METHOD_CHACHA20)
CACHED_GENERATED_KEY_obfuscate_base64 = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = common.ENCRYPTION_METHOD_OBFUSCATE_BASE64)
encriptación y desencriptación de información
>>> common.encryption_set_temporal_include_encryption_prefix(True)
encryption_support = common.get_user_env("CM_ENCRYPTION_SUPPORT", "False")
if encryption_support.lower() == "true":
encryption_support = True
else:
encryption_support = False
from common import ENCRYPTION_PREFIX_MARK
# encryption_mark = os.getenv("CM_ENCRYPTION_MARK", ENCRYPTION_PREFIX_MARK)
encryption_mark = ENCRYPTION_PREFIX_MARK
encrytion_mark = eval(f"b'{encryption_mark}'")
string_to_encrypt = "Hello, World from Seachad!"
# ? vamos a encriptar y desencriptar
common.encryption_set_temporal_support("xxx_zzzz", True)
# ! NO ENCRYPTED STRING DECRYPTED OK
encrypted_strings = {}
original = string_to_encrypt
decrypted = string_to_encrypt
encrypted_strings["no_encryption"] = {
"original": original,
"encrypted" : original,
"decrypted" : decrypted,
"check" : original == decrypted
}
# ! ENCRYPTED STRING USING FERNET DECRYPTED OK
CACHED_GENERATED_KEY = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = "fernet")
common.encryption_set_temporal_encryption_method(common.get_encryption_method_by_name("fernet"))
original = string_to_encrypt
encrypted = common.encrypt(string_to_encrypt, CACHED_GENERATED_KEY, returns_string = True)
decrypted = common.decrypt(encrypted, CACHED_GENERATED_KEY, returns_string = True)
encrypted_strings["fernet"] = {
"original": original,
"encrypted" : encrypted,
"decrypted" : decrypted,
"check" : original == decrypted
}
# ! ENCRYPTED STRING USING AES DECRYPTED OK
CACHED_GENERATED_KEY = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = "aes")
common.encryption_set_temporal_encryption_method(common.get_encryption_method_by_name("aes"))
original = string_to_encrypt
encrypted = common.encrypt(string_to_encrypt, CACHED_GENERATED_KEY, returns_string = True)
decrypted = common.decrypt(encrypted, CACHED_GENERATED_KEY, returns_string = True)
encrypted_strings["aes"] = {
"original": original,
"encrypted" : encrypted,
"decrypted" : decrypted,
"check" : original == decrypted
}
# ! ENCRYPTED STRING USING CHACHA20 DECRYPTED OK
CACHED_GENERATED_KEY = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = "chacha20")
common.encryption_set_temporal_encryption_method(common.get_encryption_method_by_name("chacha20"))
encrypted = common.encrypt(string_to_encrypt, CACHED_GENERATED_KEY, returns_string = True)
decrypted = common.decrypt(encrypted, CACHED_GENERATED_KEY, returns_string = True)
encrypted_strings["chacha20"] = {
"original": original,
"encrypted" : encrypted,
"decrypted" : decrypted,
"check" : original == decrypted
}
# ! ENCRYPTED STRING USING OBFUSCATE BASE64 DECRYPTED OK
CACHED_GENERATED_KEY = common.generateEncryptionKey(password = CACHE_KEY, encryption_method = "obfuscation_base64")
common.encryption_set_temporal_encryption_method(common.get_encryption_method_by_name("obfuscate_base64"))
encrypted = common.encrypt(string_to_encrypt, CACHED_GENERATED_KEY, returns_string = True)
decrypted = common.decrypt(encrypted, CACHED_GENERATED_KEY, returns_string = True)
encrypted_strings["obfuscate_base64"] = {
"original": original,
"encrypted" : encrypted,
"decrypted" : decrypted,
"check" : original == decrypted
}
ar_decorator_functions
incluida soporte a control automático de errores avanzado y controles de integridad, básicamente
incluye decoradores para control de errores y para control de integridad. Se proporcionarán ejemplos más adelante (pendiente de pruebas)
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
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 seachad-0.1.34.tar.gz.
File metadata
- Download URL: seachad-0.1.34.tar.gz
- Upload date:
- Size: 119.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
004d34dc6a554e59a35cf5f26d7bb7a6dd66a93adbfcdd711e469d22f97f1fe3
|
|
| MD5 |
ea6d5912fa72791d1aed660531eb8d88
|
|
| BLAKE2b-256 |
b84efa532a6db83b0204a58910b4878073155cff88b6fc081a90f87dd5ad6f7d
|
File details
Details for the file seachad-0.1.34-py3-none-any.whl.
File metadata
- Download URL: seachad-0.1.34-py3-none-any.whl
- Upload date:
- Size: 123.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8400fbb3b0a1b34ce29db86fd524224e8f37f273072f013842ad992548b2f39
|
|
| MD5 |
18f54453f0d6792d51c06ad585d40214
|
|
| BLAKE2b-256 |
6a92749f15c887fa5808bb8086b854d294f33ca46a0363d9065fb7b6f1a19695
|