Skip to content

decorators

decorators

Decorators for reducing boilerplate required to implement token features.

UseType

Bases: Generic[T]

Placeholder for passing type parameter specification as param.

Source code in src/pygerber/gerberx3/tokenizer/decorators.py
class UseType(Generic[T]):
    """Placeholder for passing type parameter specification as param."""

AnnotateSpecSection

Add Gerber specification reference link to docstring.

Source code in src/pygerber/gerberx3/tokenizer/decorators.py
class AnnotateSpecSection:
    """Add Gerber specification reference link to docstring."""

    def __init__(self, spec_section: Revision202308) -> None:
        self.spec_section = spec_section

    def __call__(self, class_: type[TokenT]) -> type[TokenT]:
        """Update docstring with specification reference."""
        class_.__doc__ = (class_.__doc__ or "") + (
            "\n\n"
            f"See section {self.spec_section.get_sec_id()} of "
            "The Gerber Layer Format Specification "
            f"{Revision.Revision_2023_08} - "
            f"{self.spec_section.get_url()}"
        )
        return class_

__call__

__call__(class_: type[TokenT]) -> type[TokenT]

Update docstring with specification reference.

Source code in src/pygerber/gerberx3/tokenizer/decorators.py
def __call__(self, class_: type[TokenT]) -> type[TokenT]:
    """Update docstring with specification reference."""
    class_.__doc__ = (class_.__doc__ or "") + (
        "\n\n"
        f"See section {self.spec_section.get_sec_id()} of "
        "The Gerber Layer Format Specification "
        f"{Revision.Revision_2023_08} - "
        f"{self.spec_section.get_url()}"
    )
    return class_