implement HeaderVarDef as NamedTuple
-# Purpose: header variables factory
# Copyright (c) 2010-2021, Manfred Moitzi
# License: MIT License
-from typing import Sequence, Union
+from typing import Sequence, Union, Callable, Any, NamedTuple, Optional
from .types import DXFVertex, DXFTag, cast_tag_value
@@ -17,13 +16,11 @@ def Point3D(value: Sequence[float]) -> DXFVertex:
return DXFVertex(10, (value[0], value[1], value[2]))
-class HeaderVarDef:
- def __init__(self, name, code, factory, mindxf, maxdxf, priority,
- default=None):
- self.name = name
- self.code = code
- self.factory = factory
- self.mindxf = mindxf
- self.maxdxf = maxdxf
- self.priority = priority
- self.default = default
+class HeaderVarDef(NamedTuple):
+ name: str
+ code: int
+ factory: Callable[[Any], Any]
+ mindxf: str
+ maxdxf: str
+ priority: int
+ default: Optional[Any] = None
