Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils-sfg
Commits
b23716bd
Commit
b23716bd
authored
2 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
make SupportsFieldExtraction and SupportsVectorExtraction runtime-checkable
parent
bd46f5bf
No related branches found
No related tags found
1 merge request
!26
Fixes to postprocessing: Remove unused code, test vector extraction, unify treatment of scalar fields
Pipeline
#77183
passed
2 months ago
Stage: Code Quality
Stage: Tests
Stage: Documentation
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencilssfg/lang/extractions.py
+6
-2
6 additions, 2 deletions
src/pystencilssfg/lang/extractions.py
with
6 additions
and
2 deletions
src/pystencilssfg/lang/extractions.py
+
6
−
2
View file @
b23716bd
from
__future__
import
annotations
from
__future__
import
annotations
from
typing
import
Protocol
from
typing
import
Protocol
,
runtime_checkable
from
abc
import
abstractmethod
from
abc
import
abstractmethod
from
.expressions
import
AugExpr
from
.expressions
import
AugExpr
@runtime_checkable
class
SupportsFieldExtraction
(
Protocol
):
class
SupportsFieldExtraction
(
Protocol
):
"""
Protocol for field pointer and indexing extraction.
"""
Protocol for field pointer and indexing extraction.
...
@@ -13,7 +14,7 @@ class SupportsFieldExtraction(Protocol):
...
@@ -13,7 +14,7 @@ class SupportsFieldExtraction(Protocol):
They can therefore be passed to `sfg.map_field <SfgBasicComposer.map_field>`.
They can therefore be passed to `sfg.map_field <SfgBasicComposer.map_field>`.
"""
"""
# how-to-guide begin
# how-to-guide begin
@abstractmethod
@abstractmethod
def
_extract_ptr
(
self
)
->
AugExpr
:
def
_extract_ptr
(
self
)
->
AugExpr
:
"""
Extract the field base pointer.
"""
Extract the field base pointer.
...
@@ -47,9 +48,12 @@ class SupportsFieldExtraction(Protocol):
...
@@ -47,9 +48,12 @@ class SupportsFieldExtraction(Protocol):
:meta public:
:meta public:
"""
"""
# how-to-guide end
# how-to-guide end
@runtime_checkable
class
SupportsVectorExtraction
(
Protocol
):
class
SupportsVectorExtraction
(
Protocol
):
"""
Protocol for component extraction from a vector.
"""
Protocol for component extraction from a vector.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment