SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > > site-packages > numpy > core >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11//site-packages/numpy/core/

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
include Directory - -
lib Directory - -
tests Directory - -
__init__.py File 5779 bytes April 17 2025 13:10:58.
__init__.pyi File 126 bytes April 17 2025 13:10:58.
_add_newdocs.py File 208972 bytes April 17 2025 13:10:58.
_add_newdocs_scalars.py File 12106 bytes April 17 2025 13:10:58.
_asarray.py File 3884 bytes April 17 2025 13:10:58.
_asarray.pyi File 1086 bytes April 17 2025 13:10:58.
_dtype.py File 10606 bytes April 17 2025 13:10:58.
_dtype_ctypes.py File 3673 bytes April 17 2025 13:10:58.
_exceptions.py File 5379 bytes April 17 2025 13:10:58.
_internal.py File 28348 bytes April 17 2025 13:10:58.
_internal.pyi File 1032 bytes April 17 2025 13:10:58.
_machar.py File 11565 bytes April 17 2025 13:10:58.
_methods.py File 8613 bytes April 17 2025 13:10:58.
_multiarray_tests.cpython-311-x86_64-linux-gnu.so File 175512 bytes April 17 2025 13:11:30.
_multiarray_umath.cpython-311-x86_64-linux-gnu.so File 6959064 bytes April 17 2025 13:11:30.
_operand_flag_tests.cpython-311-x86_64-linux-gnu.so File 16944 bytes April 17 2025 13:11:30.
_rational_tests.cpython-311-x86_64-linux-gnu.so File 59688 bytes April 17 2025 13:11:30.
_simd.cpython-311-x86_64-linux-gnu.so File 2586024 bytes April 17 2025 13:11:30.
_string_helpers.py File 2852 bytes April 17 2025 13:10:58.
_struct_ufunc_tests.cpython-311-x86_64-linux-gnu.so File 17048 bytes April 17 2025 13:11:30.
_type_aliases.py File 7534 bytes April 17 2025 13:10:58.
_type_aliases.pyi File 404 bytes April 17 2025 13:10:58.
_ufunc_config.py File 13944 bytes April 17 2025 13:10:58.
_ufunc_config.pyi File 1066 bytes April 17 2025 13:10:58.
_umath_tests.cpython-311-x86_64-linux-gnu.so File 41992 bytes April 17 2025 13:11:30.
arrayprint.py File 63608 bytes April 17 2025 13:10:58.
arrayprint.pyi File 4428 bytes April 17 2025 13:10:58.
cversions.py File 347 bytes April 17 2025 13:10:58.
defchararray.py File 73617 bytes April 17 2025 13:10:58.
defchararray.pyi File 9216 bytes April 17 2025 13:10:58.
einsumfunc.py File 51868 bytes April 17 2025 13:10:58.
einsumfunc.pyi File 4860 bytes April 17 2025 13:10:58.
fromnumeric.py File 128821 bytes April 17 2025 13:10:58.
fromnumeric.pyi File 23510 bytes April 17 2025 13:10:58.
function_base.py File 19836 bytes April 17 2025 13:10:58.
function_base.pyi File 4725 bytes April 17 2025 13:10:58.
generate_numpy_api.py File 7654 bytes April 17 2025 13:10:58.
getlimits.py File 25865 bytes April 17 2025 13:10:58.
getlimits.pyi File 82 bytes April 17 2025 13:10:58.
memmap.py File 11771 bytes April 17 2025 13:10:58.
memmap.pyi File 55 bytes April 17 2025 13:10:58.
multiarray.py File 56097 bytes April 17 2025 13:10:58.
multiarray.pyi File 24768 bytes April 17 2025 13:10:58.
numeric.py File 77014 bytes April 17 2025 13:10:58.
numeric.pyi File 14230 bytes April 17 2025 13:10:58.
numerictypes.py File 18098 bytes April 17 2025 13:10:58.
numerictypes.pyi File 3267 bytes April 17 2025 13:10:58.
overrides.py File 7093 bytes April 17 2025 13:10:58.
records.py File 37533 bytes April 17 2025 13:10:58.
records.pyi File 5692 bytes April 17 2025 13:10:58.
setup.py File 48182 bytes April 17 2025 13:10:58.
setup_common.py File 17085 bytes April 17 2025 13:10:58.
shape_base.py File 29743 bytes April 17 2025 13:10:58.
shape_base.pyi File 2774 bytes April 17 2025 13:10:58.
umath.py File 2040 bytes April 17 2025 13:10:58.
umath_tests.py File 389 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11//site-packages/numpy/core//overrides.py

"""Implementation of __array_function__ overrides from NEP-18."""
import collections
import functools
import os

from .._utils import set_module
from .._utils._inspect import getargspec
from numpy.core._multiarray_umath import (
    add_docstring,  _get_implementing_args, _ArrayFunctionDispatcher)


ARRAY_FUNCTIONS = set()

array_function_like_doc = (
    """like : array_like, optional
        Reference object to allow the creation of arrays which are not
        NumPy arrays. If an array-like passed in as ``like`` supports
        the ``__array_function__`` protocol, the result will be defined
        by it. In this case, it ensures the creation of an array object
        compatible with that passed in via this argument."""
)

def set_array_function_like_doc(public_api):
    if public_api.__doc__ is not None:
        public_api.__doc__ = public_api.__doc__.replace(
            "${ARRAY_FUNCTION_LIKE}",
            array_function_like_doc,
        )
    return public_api


add_docstring(
    _ArrayFunctionDispatcher,
    """
    Class to wrap functions with checks for __array_function__ overrides.

    All arguments are required, and can only be passed by position.

    Parameters
    ----------
    dispatcher : function or None
        The dispatcher function that returns a single sequence-like object
        of all arguments relevant.  It must have the same signature (except
        the default values) as the actual implementation.
        If ``None``, this is a ``like=`` dispatcher and the
        ``_ArrayFunctionDispatcher`` must be called with ``like`` as the
        first (additional and positional) argument.
    implementation : function
        Function that implements the operation on NumPy arrays without
        overrides.  Arguments passed calling the ``_ArrayFunctionDispatcher``
        will be forwarded to this (and the ``dispatcher``) as if using
        ``*args, **kwargs``.

    Attributes
    ----------
    _implementation : function
        The original implementation passed in.
    """)


# exposed for testing purposes; used internally by _ArrayFunctionDispatcher
add_docstring(
    _get_implementing_args,
    """
    Collect arguments on which to call __array_function__.

    Parameters
    ----------
    relevant_args : iterable of array-like
        Iterable of possibly array-like arguments to check for
        __array_function__ methods.

    Returns
    -------
    Sequence of arguments with __array_function__ methods, in the order in
    which they should be called.
    """)


ArgSpec = collections.namedtuple('ArgSpec', 'args varargs keywords defaults')


def verify_matching_signatures(implementation, dispatcher):
    """Verify that a dispatcher function has the right signature."""
    implementation_spec = ArgSpec(*getargspec(implementation))
    dispatcher_spec = ArgSpec(*getargspec(dispatcher))

    if (implementation_spec.args != dispatcher_spec.args or
            implementation_spec.varargs != dispatcher_spec.varargs or
            implementation_spec.keywords != dispatcher_spec.keywords or
            (bool(implementation_spec.defaults) !=
             bool(dispatcher_spec.defaults)) or
            (implementation_spec.defaults is not None and
             len(implementation_spec.defaults) !=
             len(dispatcher_spec.defaults))):
        raise RuntimeError('implementation and dispatcher for %s have '
                           'different function signatures' % implementation)

    if implementation_spec.defaults is not None:
        if dispatcher_spec.defaults != (None,) * len(dispatcher_spec.defaults):
            raise RuntimeError('dispatcher functions can only use None for '
                               'default argument values')


def array_function_dispatch(dispatcher=None, module=None, verify=True,
                            docs_from_dispatcher=False):
    """Decorator for adding dispatch with the __array_function__ protocol.

    See NEP-18 for example usage.

    Parameters
    ----------
    dispatcher : callable or None
        Function that when called like ``dispatcher(*args, **kwargs)`` with
        arguments from the NumPy function call returns an iterable of
        array-like arguments to check for ``__array_function__``.

        If `None`, the first argument is used as the single `like=` argument
        and not passed on.  A function implementing `like=` must call its
        dispatcher with `like` as the first non-keyword argument.
    module : str, optional
        __module__ attribute to set on new function, e.g., ``module='numpy'``.
        By default, module is copied from the decorated function.
    verify : bool, optional
        If True, verify the that the signature of the dispatcher and decorated
        function signatures match exactly: all required and optional arguments
        should appear in order with the same names, but the default values for
        all optional arguments should be ``None``. Only disable verification
        if the dispatcher's signature needs to deviate for some particular
        reason, e.g., because the function has a signature like
        ``func(*args, **kwargs)``.
    docs_from_dispatcher : bool, optional
        If True, copy docs from the dispatcher function onto the dispatched
        function, rather than from the implementation. This is useful for
        functions defined in C, which otherwise don't have docstrings.

    Returns
    -------
    Function suitable for decorating the implementation of a NumPy function.

    """
    def decorator(implementation):
        if verify:
            if dispatcher is not None:
                verify_matching_signatures(implementation, dispatcher)
            else:
                # Using __code__ directly similar to verify_matching_signature
                co = implementation.__code__
                last_arg = co.co_argcount + co.co_kwonlyargcount - 1
                last_arg = co.co_varnames[last_arg]
                if last_arg != "like" or co.co_kwonlyargcount == 0:
                    raise RuntimeError(
                        "__array_function__ expects `like=` to be the last "
                        "argument and a keyword-only argument. "
                        f"{implementation} does not seem to comply.")

        if docs_from_dispatcher:
            add_docstring(implementation, dispatcher.__doc__)

        public_api = _ArrayFunctionDispatcher(dispatcher, implementation)
        public_api = functools.wraps(implementation)(public_api)

        if module is not None:
            public_api.__module__ = module

        ARRAY_FUNCTIONS.add(public_api)

        return public_api

    return decorator


def array_function_from_dispatcher(
        implementation, module=None, verify=True, docs_from_dispatcher=True):
    """Like array_function_dispatcher, but with function arguments flipped."""

    def decorator(dispatcher):
        return array_function_dispatch(
            dispatcher, module, verify=verify,
            docs_from_dispatcher=docs_from_dispatcher)(implementation)
    return decorator

SILENT KILLER Tool