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
1 merge request!26Fixes to postprocessing: Remove unused code, test vector extraction, unify treatment of scalar fields
Pipeline #77183 passed with stages
in 3 minutes and 20 seconds
from __future__ import annotations
from typing import Protocol
from typing import Protocol, runtime_checkable
from abc import abstractmethod
from .expressions import AugExpr
@runtime_checkable
class SupportsFieldExtraction(Protocol):
"""Protocol for field pointer and indexing extraction.
......@@ -13,7 +14,7 @@ class SupportsFieldExtraction(Protocol):
They can therefore be passed to `sfg.map_field <SfgBasicComposer.map_field>`.
"""
# how-to-guide begin
# how-to-guide begin
@abstractmethod
def _extract_ptr(self) -> AugExpr:
"""Extract the field base pointer.
......@@ -47,9 +48,12 @@ class SupportsFieldExtraction(Protocol):
:meta public:
"""
# how-to-guide end
@runtime_checkable
class SupportsVectorExtraction(Protocol):
"""Protocol for component extraction from a vector.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment