mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-06 09:22:26 +00:00
* add log path * add test to check if log file is in correct dir * env path * black * mypy fix * add styles folder and styles from repo * add timezone as env variable * fix changes with main * fix test * flake8 * fix linting * fix linting * fix issue with light mpl stylesheet * change timezone variable name * change names * change names * names * simplify paths.py * change some names * fix error in logic * remove 3.11 from testing for now
41 lines
884 B
Python
41 lines
884 B
Python
# IMPORTATION STANDARD
|
|
import os
|
|
from typing import List
|
|
from openbb_terminal.core.config.paths import (
|
|
SETTINGS_DIRECTORY,
|
|
USER_DATA_DIRECTORY,
|
|
USER_ENV_FILE,
|
|
REPOSITORY_ENV_FILE,
|
|
USER_STYLES_DIRECTORY,
|
|
)
|
|
|
|
|
|
def create_paths(list_dirs: List):
|
|
"""
|
|
Creates dirs for user data outside the
|
|
terminal if they don't exist
|
|
"""
|
|
for dirs in list_dirs:
|
|
if not os.path.exists(dirs):
|
|
os.mkdir(dirs)
|
|
|
|
|
|
def create_files(list_files: List):
|
|
"""
|
|
Creates files outside the terminal if they don't exist
|
|
"""
|
|
for filename in list_files:
|
|
if not filename.is_file():
|
|
with open(str(filename), "w"):
|
|
pass
|
|
|
|
|
|
dirs_list = [
|
|
SETTINGS_DIRECTORY,
|
|
USER_DATA_DIRECTORY,
|
|
USER_STYLES_DIRECTORY,
|
|
]
|
|
dirs_files = [USER_ENV_FILE, REPOSITORY_ENV_FILE]
|
|
create_paths(dirs_list)
|
|
create_files(dirs_files)
|