Skip to content

Commit e97795e

Browse files
committed
Typing improvements
1 parent 0ff6fdb commit e97795e

File tree

1 file changed

+7
-4
lines changed
  • cadquery/occ_impl/exporters

1 file changed

+7
-4
lines changed

cadquery/occ_impl/exporters/dxf.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
from ezdxf.entities import factory
88
from OCP.GeomConvert import GeomConvert
99
from OCP.gp import gp_Dir
10+
from typing_extensions import Self
1011

1112
from ...cq import Face, Plane, Workplane
1213
from ...units import RAD2DEG
1314
from ..shapes import Edge
1415
from .utils import toCompound
1516

1617
ApproxOptions = Literal["spline", "arc"]
17-
DxfEntityAttributes = Tuple[str, Dict[str, Any]]
18+
DxfEntityAttributes = Tuple[
19+
Literal["ARC", "CIRCLE", "ELLIPSE", "SPLINE",], Dict[str, Any]
20+
]
1821

1922

2023
class DxfDocument:
@@ -64,7 +67,7 @@ def __init__(
6467
metadata: Union[Dict[str, str], None] = None,
6568
approx: Optional[ApproxOptions] = None,
6669
tolerance: float = 1e-3,
67-
) -> None:
70+
):
6871
"""Initialize DXF document.
6972
7073
:param dxfversion: :attr:`DXF version specifier <ezdxf-stable:ezdxf.document.Drawing.dxfversion>`
@@ -106,7 +109,7 @@ def __init__(
106109

107110
def add_layer(
108111
self, name: str, *, color: int = 1, linetype: str = "CONTINUOUS"
109-
) -> "DxfDocument":
112+
) -> Self:
110113
"""Create a layer definition
111114
112115
Refer to :ref:`ezdxf layers <ezdxf-stable:layer_concept>` and
@@ -120,7 +123,7 @@ def add_layer(
120123

121124
return self
122125

123-
def add_shape(self, workplane: Workplane, layer: str = "") -> "DxfDocument":
126+
def add_shape(self, workplane: Workplane, layer: str = "") -> Self:
124127
"""Add CadQuery shape to a DXF layer.
125128
126129
:param workplane: CadQuery Workplane

0 commit comments

Comments
 (0)