[Label / Ref / Grid] add raw constructors

This commit is contained in:
Jan Petykiewicz 2026-04-02 15:46:53 -07:00
commit 46a15e2f0f
3 changed files with 52 additions and 0 deletions

View file

@ -53,6 +53,22 @@ class Label(PositionableImpl, RepeatableImpl, AnnotatableImpl, Bounded, Pivotabl
self.repetition = repetition
self.annotations = annotations if annotations is not None else {}
@classmethod
def _from_raw(
cls,
string: str,
*,
offset: NDArray[numpy.float64],
repetition: Repetition | None = None,
annotations: annotations_t | None = None,
) -> Self:
new = cls.__new__(cls)
new._string = string
new._offset = offset
new._repetition = repetition
new._annotations = annotations if annotations is not None else {}
return new
def __copy__(self) -> Self:
return type(self)(
string=self.string,