refactor light.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.const import SUBCLASS_MARKER, DXF2007
from ezdxf.lldxf.attributes import (
@@ -16,7 +17,9 @@ from .dxfgfx import acdb_entity, DXFGraphic
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__ = ["Light"]
@@ -104,8 +107,8 @@ class Light(DXFGraphic):
MIN_DXF_VERSION_FOR_EXPORT = DXF2007
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(
@@ -113,7 +116,7 @@ class Light(DXFGraphic):
)
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_light.name)
@@ -141,7 +144,7 @@ class Light(DXFGraphic):
],
)
- def transform(self, m: "Matrix44") -> "Light":
+ def transform(self, m: Matrix44) -> Light:
"""Transform the LIGHT entity by transformation matrix `m` inplace."""
self.dxf.location = m.transform(self.dxf.location)
self.dxf.target = m.transform(self.dxf.target)
