pyiron_workflow.type_hinting module

This module provides helper functions for evaluating data relative to type hints, and type hints relative to each other.

pyiron_workflow.type_hinting.type_hint_is_as_or_more_specific_than(hint, other) bool[source]
pyiron_workflow.type_hinting.type_hint_to_tuple(type_hint) tuple[source]
pyiron_workflow.type_hinting.valid_value(value, type_hint, strict_callables: bool = True) bool[source]

Check if a value is a valid representation of a type hint.

Parameters:
  • value – The value to verify.

  • type_hint – The type hint against which

  • strict_callables (bool) – Whether to convert callable hints into collections.abc.Callable. This can be important as the interaction of callable and check_type is very relaxed, e.g. a class that fails to define __call__ will still pass as callable. Converting to the formal typing hint resolves this and gives more intuitive results. Default is True.

Returns:

Whether the value conforms to the hint.

Return type:

(bool)