Skip to content
Snippets Groups Projects
Commit b23716bd authored by Frederik Hennig's avatar Frederik Hennig
Browse files

make SupportsFieldExtraction and SupportsVectorExtraction runtime-checkable

parent bd46f5bf
No related branches found
No related tags found
1 merge request!26Fixes to postprocessing: Remove unused code, test vector extraction, unify treatment of scalar fields
Pipeline #77183 passed
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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment