Files
OpenBB/openbb_terminal/core/config/make_paths.py
Om Gupta f18c44b066 New path for styles and add timezone as environment variable (#2509)
* 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
2022-09-16 17:46:20 +01:00

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)