refactor block.py type annotations
# 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,
@@ -24,7 +25,8 @@ from .dxfentity import base_class, SubclassProcessor, DXFEntity
from .factory import register_entity
if TYPE_CHECKING:
- from ezdxf.eztypes import TagWriter, DXFNamespace
+ from ezdxf.entities import DXFNamespace
+ from ezdxf.lldxf.tagwriter import AbstractTagWriter
__all__ = ["Block", "EndBlk"]
@@ -115,8 +117,8 @@ class Block(DXFEntity):
REFERENCED = 64
def load_dxf_attribs(
- self, processor: SubclassProcessor = None
- ) -> "DXFNamespace":
+ self, processor: Optional[SubclassProcessor] = None
+ ) -> DXFNamespace:
"""Loading interface. (internal API)"""
dxf = super().load_dxf_attribs(processor)
if processor is None:
@@ -130,7 +132,7 @@ class Block(DXFEntity):
dxf.name = PAPER_SPACE_R2000
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)
@@ -196,15 +198,15 @@ class EndBlk(DXFEntity):
DXFATTRIBS = DXFAttributes(base_class, acdb_entity, acdb_block_end)
def load_dxf_attribs(
- self, processor: SubclassProcessor = None
- ) -> "DXFNamespace":
+ self, processor: Optional[SubclassProcessor] = None
+ ) -> DXFNamespace:
"""Loading interface. (internal API)"""
dxf = super().load_dxf_attribs(processor)
if processor:
processor.simple_dxfattribs_loader(dxf, acdb_entity_group_codes) # type: ignore
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)
