Add ALT text to images

Correct static methods
Tidy up code
This commit is contained in:
Michał Gdula 2023-03-11 22:14:03 +00:00
parent e192554a0b
commit 3ee287d6e3
23 changed files with 427 additions and 430 deletions

View file

@ -8,8 +8,10 @@ import platformdirs
import logging
import yaml
USER_DIR = platformdirs.user_config_dir('onlylegs')
class SetupApp:
"""
Setup the application on first run
@ -36,7 +38,8 @@ class SetupApp:
print("You can find the config files at:", USER_DIR)
sys.exit()
def make_dir(self):
@staticmethod
def make_dir():
"""
Create the user directory
"""
@ -49,7 +52,8 @@ class SetupApp:
print("Error creating user directory:", err)
sys.exit(1)
def make_env(self):
@staticmethod
def make_env():
"""
Create the .env file with default values
"""
@ -67,7 +71,8 @@ class SetupApp:
print("Generated default .env file, please edit!")
def make_yaml(self):
@staticmethod
def make_yaml():
"""
Create the YAML config file with default values
"""
@ -107,17 +112,18 @@ class SetupApp:
print("Generated default YAML config, please edit!")
def logging_config(self):
LOGS_PATH = os.path.join(platformdirs.user_config_dir('onlylegs'), 'logs')
@staticmethod
def logging_config():
logs_path = os.path.join(platformdirs.user_config_dir('onlylegs'), 'logs')
if not os.path.isdir(LOGS_PATH):
os.mkdir(LOGS_PATH)
print("Created logs directory at:", LOGS_PATH)
if not os.path.isdir(logs_path):
os.mkdir(logs_path)
print("Created logs directory at:", logs_path)
logging.getLogger('werkzeug').disabled = True
logging.basicConfig(
filename=os.path.join(LOGS_PATH, 'only.log'),
filename=os.path.join(logs_path, 'only.log'),
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S',
format='%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s',
encoding='utf-8')
encoding='utf-8')