Skip to content

Commit 6d3eb8a

Browse files
committed
fix: Resolve circular import in types.py by using TYPE_CHECKING
The ValidatorProtocol was referencing ValidationResult which was moved to validator.py, causing a circular import. Fixed by importing ValidationResult only during type checking using TYPE_CHECKING guard and __future__ annotations.
1 parent 775fa2f commit 6d3eb8a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xml_lib/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
"""Type definitions and protocols for xml-lib."""
22

3+
from __future__ import annotations
4+
35
from dataclasses import dataclass, field
46
from datetime import datetime
57
from enum import Enum
68
from pathlib import Path
7-
from typing import Any, Literal, Protocol, TypeAlias
9+
from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias
10+
11+
if TYPE_CHECKING:
12+
from xml_lib.validator import ValidationResult
813

914
# Phase types
1015
PhaseType: TypeAlias = Literal["begin", "start", "iteration", "end", "continuum"]

0 commit comments

Comments
 (0)