various #16
1 changed files with 9 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue