Add ezdxf stubs

This commit is contained in:
jan 2026-02-16 18:04:16 -08:00
commit 0f49924aa6
4 changed files with 53 additions and 0 deletions

12
stubs/ezdxf/__init__.pyi Normal file
View file

@ -0,0 +1,12 @@
from typing import Any, TextIO, Iterable
from .layouts import Modelspace, BlockRecords
class Drawing:
blocks: BlockRecords
@property
def layers(self) -> Iterable[Any]: ...
def modelspace(self) -> Modelspace: ...
def write(self, stream: TextIO) -> None: ...
def new(version: str = ..., setup: bool = ...) -> Drawing: ...
def read(stream: TextIO) -> Drawing: ...

17
stubs/ezdxf/entities.pyi Normal file
View file

@ -0,0 +1,17 @@
from typing import Any, Iterable, Tuple, Sequence
class DXFEntity:
def dxfattribs(self) -> dict[str, Any]: ...
def dxftype(self) -> str: ...
class LWPolyline(DXFEntity):
def get_points(self) -> Iterable[Tuple[float, ...]]: ...
class Polyline(DXFEntity):
def points(self) -> Iterable[Any]: ... # has .xyz
class Text(DXFEntity):
def get_placement(self) -> Tuple[int, Tuple[float, float, float]]: ...
def set_placement(self, p: Sequence[float], align: int = ...) -> Text: ...
class Insert(DXFEntity): ...

4
stubs/ezdxf/enums.pyi Normal file
View file

@ -0,0 +1,4 @@
from enum import IntEnum
class TextEntityAlignment(IntEnum):
BOTTOM_LEFT = ...

20
stubs/ezdxf/layouts.pyi Normal file
View file

@ -0,0 +1,20 @@
from typing import Any, Iterator, Sequence, Union, Iterable
from .entities import DXFEntity
class BaseLayout:
def __iter__(self) -> Iterator[DXFEntity]: ...
def add_lwpolyline(self, points: Iterable[Sequence[float]], dxfattribs: dict[str, Any] = ...) -> Any: ...
def add_text(self, text: str, dxfattribs: dict[str, Any] = ...) -> Any: ...
def add_blockref(self, name: str, insert: Any, dxfattribs: dict[str, Any] = ...) -> Any: ...
class Modelspace(BaseLayout):
@property
def name(self) -> str: ...
class BlockLayout(BaseLayout):
@property
def name(self) -> str: ...
class BlockRecords:
def new(self, name: str) -> BlockLayout: ...
def __iter__(self) -> Iterator[BlockLayout]: ...