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
@@ -1,15 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import Optional
|
||||
|
||||
from fabric.utils import GLib
|
||||
|
||||
from .canvas import DockCanvas
|
||||
from .constants import ANIM_INTERVAL_MS, IDLE_THRESHOLD, LERP_FACTOR
|
||||
from .layout import DockLayout
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .canvas import DockCanvas
|
||||
|
||||
|
||||
class DockAnimator:
|
||||
def __init__(self, canvas: DockCanvas):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
@@ -810,9 +808,9 @@ class DockCanvas(Gtk.DrawingArea):
|
||||
|
||||
if item.is_pinned and not item.is_running:
|
||||
self._handle_pinned_click(event, item)
|
||||
elif item.is_running and not item.is_pinned:
|
||||
self._handle_instance_click(event, item)
|
||||
elif item.is_pinned and item.is_running:
|
||||
elif (item.is_running and not item.is_pinned) or (
|
||||
item.is_pinned and item.is_running
|
||||
):
|
||||
self._handle_instance_click(event, item)
|
||||
|
||||
return True
|
||||
@@ -894,7 +892,7 @@ class DockCanvas(Gtk.DrawingArea):
|
||||
def _read_pinned_apps(self) -> list:
|
||||
try:
|
||||
if os.path.exists(PINNED_APPS_FILE):
|
||||
with open(PINNED_APPS_FILE, "r") as f:
|
||||
with open(PINNED_APPS_FILE) as f:
|
||||
data = tomlkit.load(f)
|
||||
return list(data.get("pinned", []))
|
||||
except Exception as e:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from utils.utils import toml_file
|
||||
|
||||
PINNED_APPS_FILE = toml_file("dock.toml")
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from typing import TYPE_CHECKING, List, Tuple
|
||||
from typing import List, Tuple
|
||||
|
||||
from .canvas import DockItem
|
||||
from .constants import (
|
||||
BG_PADDING_H,
|
||||
BG_PADDING_V,
|
||||
@@ -13,9 +12,6 @@ from .constants import (
|
||||
SIGMA_FACTOR,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .canvas import DockItem
|
||||
|
||||
|
||||
class DockLayout:
|
||||
@staticmethod
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from fabric.utils import GLib, logger, random
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.eventbox import EventBox
|
||||
|
||||
Reference in new issue
Block a user