various #16

Merged
dan merged 94 commits from various into dev 2023-12-14 14:04:01 +01:00
Showing only changes of commit db70a49bad - Show all commits

View file

@ -7,6 +7,8 @@ from datetime import datetime
from pathlib import Path
from urllib.parse import urlunparse
from loguru import logger
@dataclass
class BaseUrl:
@ -28,7 +30,7 @@ def get_datetime_string() -> str:
return current_datetime.strftime("%Y-%m-%d-%H-%M-%S")
def rmtree(root_dir: Path):
def rmtree(root_dir: Path) -> None:
"""removes a folder with content recursively"""
if not root_dir.is_dir():
return
@ -50,8 +52,13 @@ def generate_random_string(length: int, punctuation=False) -> str:
return random_string
def load_json_to_environ(cred_file: Path):
def load_json_to_environ(cred_file: Path) -> None:
"""Load the contents of a json file directly into os.environ. Variable names are inherited"""
if not cred_file.is_file():
logger.warning(f"{cred_file} could not be found, no credentials loaded")
return
with open(cred_file, "r") as f:
CREDENTIALS = json.load(f)