INNER CODE UNIT · Python

_check_object_elements

briscverse/ryp · ryp.py:974

def _check_object_elements(python_object: Any,
                           python_object_description: str,
                           is_pandas: bool,
                           allowed_types: tuple[type, ...] | type,
                           disallowed_types: tuple[type, ...] | type,
                           allowed_dtypes: set) -> None:
    """
    Raise a TypeError if not all elements of python_object have the specified
    types/dtypes.
    
    Args:
        python_object: a 1D NumPy array, pandas Series or Index, or polars
                       Series with dtype=object or dtype=pl.Object
        python_object_description: a description of python_object
        is_pandas: whether python_object is a pandas Series or Index
        allowed_types: the allowed types of the elements
        disallowed_types: the unallowed types of the elements, necessary if
                          they are subtypes of allowed_types (e.g. bool -> int)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…