Skip to content

Commit

Permalink
fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
eternal-sorrow committed Feb 27, 2025
1 parent 179170f commit 9697745
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions i3ipc/con.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import re
import sys
from .connection import Connection
from .model import Rect, Gaps
from . import replies
from collections import deque
from typing import Any, cast, Generic, Literal, Optional, TypeVar
from typing import Any, cast, Generic, Literal, Optional, TypeVar, TYPE_CHECKING

if TYPE_CHECKING:
from .connection import Connection

_Con = TypeVar('_Con', bound='Con')

Expand Down Expand Up @@ -121,7 +123,7 @@ class Con(Generic[_Con]):
representation: str
visible: bool

def __init__(self: _Con, data: dict[str, Any], parent: _Con, conn: Connection):
def __init__(self: _Con, data: dict[str, Any], parent: _Con, conn: 'Connection'):
self.ipc_data = data
self._conn = conn
self.parent = parent
Expand Down
11 changes: 7 additions & 4 deletions i3ipc/events.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from . import con, connection
from . import con
from .replies import BarConfigReply, InputReply
from enum import Enum
from typing import Any, Optional
from typing import Any, Optional, TYPE_CHECKING

if TYPE_CHECKING:
from .connection import Connection


class IpcBaseEvent:
Expand Down Expand Up @@ -66,7 +69,7 @@ class WorkspaceEvent(IpcBaseEvent):
:ivar ipc_data: The raw data from the i3 ipc.
:vartype ipc_data: dict
"""
def __init__(self, data: dict[str, Any], conn: connection.Connection, _Con=con.Con):
def __init__(self, data: dict[str, Any], conn: 'Connection', _Con=con.Con):
self.ipc_data = data
self.change: str = data['change']
self.current: Optional[con.Con] = None
Expand Down Expand Up @@ -127,7 +130,7 @@ class WindowEvent(IpcBaseEvent):
:ivar ipc_data: The raw data from the i3 ipc.
:vartype ipc_data: dict
"""
def __init__(self, data: dict[str, Any], conn: connection.Connection, _Con=con.Con):
def __init__(self, data: dict[str, Any], conn: 'Connection', _Con=con.Con):
self.ipc_data = data
self.change: str = data['change']
self.container = _Con(data['container'], None, conn)
Expand Down

0 comments on commit 9697745

Please sign in to comment.