sob/model.py
def _marshal_typed(
    data: abc.MarshallableTypes,
    types: Union[Iterable[Union[type, abc.Property]], abc.Types],
) -> Any:
    """
    This attempts to initialize the provided type(s) with `data`, and accepts
    the first which does not raise an error
    """
    # For each potential type, attempt to marshal the data, and accept the
    # first result which does not throw an error
    marshalled_data: Any = UNDEFINED
    for type_ in types:
        if isinstance(type_, abc.Property):
            try:
                marshalled_data = _marshal_property_value(type_, data)
                break
            except TypeError:
                pass
        elif isinstance(type_, type) and isinstance(data, type_):
            marshalled_data = data
            break
    # If no matches are found, raise a `TypeError` with sufficient
    # information about the data and `types` to debug
    if marshalled_data is UNDEFINED:
        raise TypeError(
            f"{repr(data)} cannot be interpreted as any of the designated "
            f"types: {repr(types)}"
        )
    return marshalled_data

    This attempts to initialize the provided type(s) with `data`, and accepts
    the first which does not raise an error
    
This attempts to initialize the provided type(s) with `data`, and accepts
the first which does not raise an error
This attempts to initialize the provided type ( s ) with ` data ` and accepts the first which does not raise an error
def _marshal_typed(
    data: abc.MarshallableTypes,
    types: Union[Iterable[Union[type, abc.Property]], abc.Types],
) -> Any:
    marshalled_data: Any = UNDEFINED
    for type_ in types:
        if isinstance(type_, abc.Property):
            try:
                marshalled_data = _marshal_property_value(type_, data)
                break
            except TypeError:
                pass
        elif isinstance(type_, type) and isinstance(data, type_):
            marshalled_data = data
            break
    if marshalled_data is UNDEFINED:
        raise TypeError(
            f"{repr(data)} cannot be interpreted as any of the designated "
            f"types: {repr(types)}"
        )
    return marshalled_data
def _marshal_typed ( data : abc . MarshallableTypes , types : Union [ Iterable [ Union [ type , abc . Property ] ] , abc . Types ] , ) -> Any : marshalled_data : Any = UNDEFINED for type_ in types : if isinstance ( type_ , abc . Property ) : try : marshalled_data = _marshal_property_value ( type_ , data ) break except TypeError : pass elif isinstance ( type_ , type ) and isinstance ( data , type_ ) : marshalled_data = data break if marshalled_data is UNDEFINED : raise TypeError ( f"{repr(data)} cannot be interpreted as any of the designated " f"types: {repr(types)}" ) return marshalled_data
This attempts to initialize the provided type(s) with `data`, and accepts
the first which does not raise an error
This attempts to initialize the provided type ( s ) with ` data ` and accepts the first which does not raise an error
"""
    This attempts to initialize the provided type(s) with `data`, and accepts
    the first which does not raise an error
    """ # For each potential type, attempt to marshal the data, and accept the # first result which does not throw an error # If no matches are found, raise a `TypeError` with sufficient # information about the data and `types` to debug
data
abc.MarshallableTypes
types
Union[Iterable[Union[type, abc.Property]], abc.Types]