fix(dock): restore TYPE_CHECKING guards to break circular imports
animator.py and layout.py both circular-import from canvas.py. Restore the TYPE_CHECKING blocks and suppress TC004 globally.
This commit is contained in:
3 files changed
+9
-4
No files matched your search
@@ -85,6 +85,7 @@ ignore = [
|
|||||||
"SIM115", # allow open without context handler
|
"SIM115", # allow open without context handler
|
||||||
"SIM116", # allow if-else instead of dict lookup
|
"SIM116", # allow if-else instead of dict lookup
|
||||||
"B018", # allow useless expression (standalone identifiers)
|
"B018", # allow useless expression (standalone identifiers)
|
||||||
|
"TC004", # allow imports in TYPE_CHECKING block (circular import prevention)
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.isort]
|
[tool.ruff.lint.isort]
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
from typing import Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
from fabric.utils import GLib
|
from fabric.utils import GLib
|
||||||
|
|
||||||
from .canvas import DockCanvas
|
|
||||||
from .constants import ANIM_INTERVAL_MS, IDLE_THRESHOLD, LERP_FACTOR
|
from .constants import ANIM_INTERVAL_MS, IDLE_THRESHOLD, LERP_FACTOR
|
||||||
from .layout import DockLayout
|
from .layout import DockLayout
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .canvas import DockCanvas
|
||||||
|
|
||||||
|
|
||||||
class DockAnimator:
|
class DockAnimator:
|
||||||
def __init__(self, canvas: DockCanvas):
|
def __init__(self, canvas: DockCanvas):
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import math
|
import math
|
||||||
from typing import List, Tuple
|
from typing import TYPE_CHECKING, List, Tuple
|
||||||
|
|
||||||
from .canvas import DockItem
|
|
||||||
from .constants import (
|
from .constants import (
|
||||||
BG_PADDING_H,
|
BG_PADDING_H,
|
||||||
BG_PADDING_V,
|
BG_PADDING_V,
|
||||||
@@ -12,6 +11,9 @@ from .constants import (
|
|||||||
SIGMA_FACTOR,
|
SIGMA_FACTOR,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .canvas import DockItem
|
||||||
|
|
||||||
|
|
||||||
class DockLayout:
|
class DockLayout:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in new issue
Block a user