style: enforce consistent codestyle via ruff config and auto-fixes
- Configure ruff: isort, pyupgrade, bugbear, flake8 rules - Auto-fix import sorting, redundant parens, exception chaining - Remove from __future__ import annotations (Python 3.13+) - Convert debug print() to logger calls - Fix typo applicaiton → application in icon_resolver - Remove bare returns in animator setters - Move TYPE_CHECKING imports to runtime where used at runtime
This commit is contained in:
60 files changed
+243
-217
No files matched your search
+12
-4
@@ -1,20 +1,28 @@
|
||||
from fabric.utils import logger
|
||||
|
||||
from fabric.utils import GLib, get_relative_path, os
|
||||
from fabric.utils import GLib, get_relative_path, logger, os
|
||||
|
||||
from utils.functions import parse_timeout_string
|
||||
from utils.utils import toml_file
|
||||
|
||||
HOME_DIR = GLib.get_home_dir()
|
||||
APP_NAME = "modus1"
|
||||
|
||||
CACHE_DIR = str(GLib.get_user_cache_dir()) + f"/{APP_NAME}"
|
||||
|
||||
CONFIG_DIR = os.path.expanduser(f"~/.config/{APP_NAME}")
|
||||
|
||||
SYSTEM_CACHE_DIR = GLib.get_user_cache_dir()
|
||||
WALLPAPER_PATH = f"{HOME_DIR}/Pictures/Wallpapers"
|
||||
WALLPAPER_THUMBS_PATH = f"{WALLPAPER_PATH}/.thumbnails"
|
||||
WALLPAPERS_THUMBNAILS_SIZE = 200
|
||||
WALLPAPERS_DIR_DEFAULT = get_relative_path("../assets/wallpapers_example/")
|
||||
|
||||
CONFIG_FILE = toml_file("config.toml")
|
||||
|
||||
|
||||
CLIPBOARD_THUMBS_DIR = f"{GLib.get_user_cache_dir()}/{APP_NAME}/clipboard_thumbs"
|
||||
CLIPBOARD_DB_PATH = f"{GLib.get_user_cache_dir()}/cliphist/db"
|
||||
|
||||
|
||||
def load_config():
|
||||
"""Load the configuration from config.toml"""
|
||||
try:
|
||||
@@ -30,7 +38,7 @@ def load_config():
|
||||
try:
|
||||
import tomlkit
|
||||
|
||||
with open(CONFIG_FILE, "r") as f:
|
||||
with open(CONFIG_FILE) as f:
|
||||
config = dict(tomlkit.load(f))
|
||||
except Exception as e:
|
||||
logger.error(f"Error loading config: {e}")
|
||||
|
||||
Reference in new issue
Block a user