refactor helix.py type annotations
-# Copyright (c) 2019-2021 Manfred Moitzi
+# Copyright (c) 2019-2022 Manfred Moitzi
# License: MIT License
-from typing import TYPE_CHECKING
+from __future__ import annotations
+from typing import TYPE_CHECKING, Optional
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttr,
@@ -18,7 +19,9 @@ from .dxfgfx import acdb_entity
from .factory import register_entity
if TYPE_CHECKING:
- from ezdxf.eztypes import TagWriter, DXFNamespace, Matrix44
+ from ezdxf.entities import DXFNamespace
+ from ezdxf.lldxf.tagwriter import AbstractTagWriter
+ from ezdxf.math import Matrix44
__all__ = ["Helix"]
@@ -77,8 +80,8 @@ class Helix(Spline):
DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_spline, acdb_helix)
def load_dxf_attribs(
- self, processor: SubclassProcessor = None
- ) -> "DXFNamespace":
+ self, processor: Optional[SubclassProcessor] = None
+ ) -> DXFNamespace:
dxf = super().load_dxf_attribs(processor)
if processor:
processor.fast_load_dxfattribs(
@@ -86,7 +89,7 @@ class Helix(Spline):
)
return dxf
- def export_entity(self, tagwriter: "TagWriter") -> None:
+ def export_entity(self, tagwriter: AbstractTagWriter) -> None:
"""Export entity specific data as DXF tags."""
super().export_entity(tagwriter)
tagwriter.write_tag2(SUBCLASS_MARKER, acdb_helix.name)
@@ -106,7 +109,7 @@ class Helix(Spline):
],
)
- def transform(self, m: "Matrix44") -> "Helix":
+ def transform(self, m: Matrix44) -> Helix:
"""Transform the HELIX entity by transformation matrix `m` inplace."""
super().transform(m)
self.dxf.axis_base_point = m.transform(self.dxf.axis_base_point)
