# encoding: utf-8
# module dipy.reconst.quick_squash
# from C:\Users\xukai\Downloads\发票2\venv\Lib\site-packages\dipy\reconst\quick_squash.cp311-win_amd64.pyd
# by generator 1.147
""" Detect common dtype across object array """

# imports
import builtins as __builtins__ # <module 'builtins' (built-in)>
import numpy as np # C:\Users\xukai\Downloads\发票2\venv\Lib\site-packages\numpy\__init__.py
from _functools import reduce


# functions

def quick_squash(arr): # real signature unknown; restored from __doc__
    """
    Try and make a standard array from an object array
    
        This function takes an object array and attempts to convert it to a more
        useful dtype. If array can be converted to a better dtype, Nones are
        replaced by `fill`. To make the behaviour of this function more clear, here
        are the most common cases:
    
        1.  `obj_arr` is an array of scalars of type `T`. Returns an array like
            `obj_arr.astype(T)`
        2.  `obj_arr` is an array of arrays. All items in `obj_arr` have the same
            shape ``S``. Returns an array with shape ``obj_arr.shape + S``
        3.  `obj_arr` is an array of arrays of different shapes. Returns `obj_arr`.
        4.  Items in `obj_arr` are not ndarrays or scalars. Returns `obj_arr`.
    
        Parameters
        ----------
        obj_arr : array, dtype=object
            The array to be converted.
        mask : array, dtype=bool, optional
           mask is nonzero where `obj_arr` has Nones.
        fill : number, optional
            Nones are replaced by `fill`.
    
        Returns
        -------
        result : array
    
        Examples
        --------
        >>> arr = np.empty(3, dtype=object)
        >>> arr.fill(2)
        >>> quick_squash(arr)
        array([2, 2, 2])
        >>> arr[0] = None
        >>> quick_squash(arr)
        array([0, 2, 2])
        >>> arr.fill(np.ones(2))
        >>> r = quick_squash(arr)
        >>> r.shape
        (3, 2)
        >>> r.dtype
        dtype('float64')
    """
    pass

def __pyx_unpickle_Enum(*args, **kwargs): # real signature unknown
    pass

# no classes
# variables with complex values

SCALAR_TYPES = np.ScalarType

__loader__ = None # (!) real value is '<_frozen_importlib_external.ExtensionFileLoader object at 0x0000021D451E0CD0>'

__spec__ = None # (!) real value is "ModuleSpec(name='dipy.reconst.quick_squash', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x0000021D451E0CD0>, origin='C:\\\\Users\\\\xukai\\\\Downloads\\\\??2\\\\venv\\\\Lib\\\\site-packages\\\\dipy\\\\reconst\\\\quick_squash.cp311-win_amd64.pyd')"

__test__ = {
    'quick_squash (line 18)': "Try and make a standard array from an object array\n\n    This function takes an object array and attempts to convert it to a more\n    useful dtype. If array can be converted to a better dtype, Nones are\n    replaced by `fill`. To make the behaviour of this function more clear, here\n    are the most common cases:\n\n    1.  `obj_arr` is an array of scalars of type `T`. Returns an array like\n        `obj_arr.astype(T)`\n    2.  `obj_arr` is an array of arrays. All items in `obj_arr` have the same\n        shape ``S``. Returns an array with shape ``obj_arr.shape + S``\n    3.  `obj_arr` is an array of arrays of different shapes. Returns `obj_arr`.\n    4.  Items in `obj_arr` are not ndarrays or scalars. Returns `obj_arr`.\n\n    Parameters\n    ----------\n    obj_arr : array, dtype=object\n        The array to be converted.\n    mask : array, dtype=bool, optional\n       mask is nonzero where `obj_arr` has Nones.\n    fill : number, optional\n        Nones are replaced by `fill`.\n\n    Returns\n    -------\n    result : array\n\n    Examples\n    --------\n    >>> arr = np.empty(3, dtype=object)\n    >>> arr.fill(2)\n    >>> quick_squash(arr)\n    array([2, 2, 2])\n    >>> arr[0] = None\n    >>> quick_squash(arr)\n    array([0, 2, 2])\n    >>> arr.fill(np.ones(2))\n    >>> r = quick_squash(arr)\n    >>> r.shape\n    (3, 2)\n    >>> r.dtype\n    dtype('float64')\n    ",
}

