-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SR class for wrapping whole SR blocks
- Loading branch information
Showing
7 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""`pygerber.nodes.aperture.SR` module contains definition of `SR` class.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Callable | ||
|
||
from pygerber.gerberx3.ast.nodes.aperture.SR_close import SRclose | ||
from pygerber.gerberx3.ast.nodes.aperture.SR_open import SRopen | ||
from pygerber.gerberx3.ast.nodes.base import Node | ||
|
||
if TYPE_CHECKING: | ||
from typing_extensions import Self | ||
|
||
from pygerber.gerberx3.ast.visitor import AstVisitor | ||
|
||
|
||
class SR(Node): | ||
"""Represents SR Gerber extended command.""" | ||
|
||
open: SRopen | ||
nodes: list[Node] | ||
close: SRclose | ||
|
||
def visit(self, visitor: AstVisitor) -> None: | ||
"""Handle visitor call.""" | ||
visitor.on_sr(self) | ||
|
||
def get_visitor_callback_function( | ||
self, visitor: AstVisitor | ||
) -> Callable[[Self], None]: | ||
"""Get callback function for the node.""" | ||
return visitor.on_sr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters