Function __init__
Synopsis
def __init__(self, type_pattern=typing.Any, tests=None)
Description
No description yet.
Source
Lines 57-66 in anyfig/fields.py.
def __init__(self, type_pattern=typing.Any, tests=None):
err_msg = f"Expected 'type_pattern' to be a type or a typing pattern but got {type(type_pattern)}"
assert issubclass(type(type_pattern), type(type)) or issubclass(
type(type_pattern), typing._Final), err_msg
self.type_pattern = type_pattern
self.wrapping_phase = True
tests = [] if tests is None else tests
self.tests = tests if isinstance(tests, Iterable) else [tests]