Function __init__


def __init__(self, type_pattern=typing.Any, tests=None)


No description yet.


Lines 57-66 in anyfig/

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]

Add Discussion as Guest

Log in