$29 GRAYBYTE WORDPRESS FILE MANAGER $17

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.173
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/core/__pycache__/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/core/__pycache__//memmap.cpython-311.pyc
�

�|oi�-���ddlmZddlZddlmZddlmZmZm	Z	ddl
mZmZdgZ
e	Zgd	�Zd
dgZdd
d
dd�Zed��Gd�de����ZdS)�)�nullcontextN�)�
set_module�)�uint8�ndarray�dtype)�	os_fspath�is_pathlib_path�memmap)�r�c�r+�w+rrr
r)�readonly�copyonwrite�	readwrite�write�numpyc�P��eZdZdZdZeddddfd�Zd�Zd	�Zd�fd
�	Z	�fd�Z
�xZS)
ra�Create a memory-map to an array stored in a *binary* file on disk.

    Memory-mapped files are used for accessing small segments of large files
    on disk, without reading the entire file into memory.  NumPy's
    memmap's are array-like objects.  This differs from Python's ``mmap``
    module, which uses file-like objects.

    This subclass of ndarray has some unpleasant interactions with
    some operations, because it doesn't quite fit properly as a subclass.
    An alternative to using this subclass is to create the ``mmap``
    object yourself, then create an ndarray with ndarray.__new__ directly,
    passing the object created in its 'buffer=' parameter.

    This class may at some point be turned into a factory function
    which returns a view into an mmap buffer.

    Flush the memmap instance to write the changes to the file. Currently there
    is no API to close the underlying ``mmap``. It is tricky to ensure the
    resource is actually closed, since it may be shared between different
    memmap instances.


    Parameters
    ----------
    filename : str, file-like object, or pathlib.Path instance
        The file name or file object to be used as the array data buffer.
    dtype : data-type, optional
        The data-type used to interpret the file contents.
        Default is `uint8`.
    mode : {'r+', 'r', 'w+', 'c'}, optional
        The file is opened in this mode:

        +------+-------------------------------------------------------------+
        | 'r'  | Open existing file for reading only.                        |
        +------+-------------------------------------------------------------+
        | 'r+' | Open existing file for reading and writing.                 |
        +------+-------------------------------------------------------------+
        | 'w+' | Create or overwrite existing file for reading and writing.  |
        |      | If ``mode == 'w+'`` then `shape` must also be specified.    |
        +------+-------------------------------------------------------------+
        | 'c'  | Copy-on-write: assignments affect data in memory, but       |
        |      | changes are not saved to disk.  The file on disk is         |
        |      | read-only.                                                  |
        +------+-------------------------------------------------------------+

        Default is 'r+'.
    offset : int, optional
        In the file, array data starts at this offset. Since `offset` is
        measured in bytes, it should normally be a multiple of the byte-size
        of `dtype`. When ``mode != 'r'``, even positive offsets beyond end of
        file are valid; The file will be extended to accommodate the
        additional data. By default, ``memmap`` will start at the beginning of
        the file, even if ``filename`` is a file pointer ``fp`` and
        ``fp.tell() != 0``.
    shape : tuple, optional
        The desired shape of the array. If ``mode == 'r'`` and the number
        of remaining bytes after `offset` is not a multiple of the byte-size
        of `dtype`, you must specify `shape`. By default, the returned array
        will be 1-D with the number of elements determined by file size
        and data-type.
    order : {'C', 'F'}, optional
        Specify the order of the ndarray memory layout:
        :term:`row-major`, C-style or :term:`column-major`,
        Fortran-style.  This only has an effect if the shape is
        greater than 1-D.  The default order is 'C'.

    Attributes
    ----------
    filename : str or pathlib.Path instance
        Path to the mapped file.
    offset : int
        Offset position in the file.
    mode : str
        File mode.

    Methods
    -------
    flush
        Flush any changes in memory to file on disk.
        When you delete a memmap object, flush is called first to write
        changes to disk.


    See also
    --------
    lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file.

    Notes
    -----
    The memmap object can be used anywhere an ndarray is accepted.
    Given a memmap ``fp``, ``isinstance(fp, numpy.ndarray)`` returns
    ``True``.

    Memory-mapped files cannot be larger than 2GB on 32-bit systems.

    When a memmap causes a file to be created or extended beyond its
    current size in the filesystem, the contents of the new part are
    unspecified. On systems with POSIX filesystem semantics, the extended
    part will be filled with zero bytes.

    Examples
    --------
    >>> data = np.arange(12, dtype='float32')
    >>> data.resize((3,4))

    This example uses a temporary file so that doctest doesn't write
    files to your directory. You would use a 'normal' filename.

    >>> from tempfile import mkdtemp
    >>> import os.path as path
    >>> filename = path.join(mkdtemp(), 'newfile.dat')

    Create a memmap with dtype and shape that matches our data:

    >>> fp = np.memmap(filename, dtype='float32', mode='w+', shape=(3,4))
    >>> fp
    memmap([[0., 0., 0., 0.],
            [0., 0., 0., 0.],
            [0., 0., 0., 0.]], dtype=float32)

    Write data to memmap array:

    >>> fp[:] = data[:]
    >>> fp
    memmap([[  0.,   1.,   2.,   3.],
            [  4.,   5.,   6.,   7.],
            [  8.,   9.,  10.,  11.]], dtype=float32)

    >>> fp.filename == path.abspath(filename)
    True

    Flushes memory changes to disk in order to read them back

    >>> fp.flush()

    Load the memmap and verify data was stored:

    >>> newfp = np.memmap(filename, dtype='float32', mode='r', shape=(3,4))
    >>> newfp
    memmap([[  0.,   1.,   2.,   3.],
            [  4.,   5.,   6.,   7.],
            [  8.,   9.,  10.,  11.]], dtype=float32)

    Read-only memmap:

    >>> fpr = np.memmap(filename, dtype='float32', mode='r', shape=(3,4))
    >>> fpr.flags.writeable
    False

    Copy-on-write memmap:

    >>> fpc = np.memmap(filename, dtype='float32', mode='c', shape=(3,4))
    >>> fpc.flags.writeable
    True

    It's possible to assign to copy-on-write array, but values are only
    written into the memory copy of the array, and not written to disk:

    >>> fpc
    memmap([[  0.,   1.,   2.,   3.],
            [  4.,   5.,   6.,   7.],
            [  8.,   9.,  10.,  11.]], dtype=float32)
    >>> fpc[0,:] = 0
    >>> fpc
    memmap([[  0.,   0.,   0.,   0.],
            [  4.,   5.,   6.,   7.],
            [  8.,   9.,  10.,  11.]], dtype=float32)

    File on disk is unchanged:

    >>> fpr
    memmap([[  0.,   1.,   2.,   3.],
            [  4.,   5.,   6.,   7.],
            [  8.,   9.,  10.,  11.]], dtype=float32)

    Offset into a memmap:

    >>> fpo = np.memmap(filename, dtype='float32', mode='r', offset=16)
    >>> fpo
    memmap([  4.,   5.,   6.,   7.,   8.,   9.,  10.,  11.], dtype=float32)

    gY�rrN�Cc
�"�ddl}ddl}	t|}np#t$rc}	|tvrPtd�ttt�����z|����d�Yd}	~	nd}	~	wwxYw|dkr|�td���t|d��rt|��}
n(tt|��|dkrdn|dz��}
|
5}|�
dd	��|���}t|��}
|
j}|�"||z
}||zrtd
���||z}|f}n6t#|t$��s|f}t'jd��}|D]}||z}�t+|||zz��}|dvrH||krB|�
|dz
d��|�d
��|���|dkr|j}n|dkr|j}n|j}|||jzz
}||z}||z
}|�|���|||���}t;j|||
|||���}||_||_ ||_!tE|��r|�#��|_$nVt|d��r?t#|j%tL��r%|j'�(|j%��|_$nd|_$ddd��n#1swxYwY|S)Nrz#mode must be one of {!r} (got {!r})rz#shape must be given if mode == 'w+'�readrr
�brz?Size of available data is not a multiple of the data-type size.r)rr�)�access�offset)r	�bufferr�order�name))�mmap�os.path�mode_equivalents�KeyError�valid_filemodes�
ValueError�format�list�keys�hasattrr�openr
�seek�tell�
dtypedescr�itemsize�
isinstance�tuple�np�intp�intr�flush�ACCESS_COPY�ACCESS_READ�ACCESS_WRITE�ALLOCATIONGRANULARITY�filenor�__new__�_mmapr�moder�resolve�filenamer �str�path�abspath)�subtyper?r	r=r�shaperr!�os�e�f_ctx�fid�flen�descr�_dbytes�bytes�size�k�acc�start�array_offset�mm�selfs                       �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/core/memmap.pyr;zmemmap.__new__�s���	��������	�#�D�)�D�D���	�	�	��?�*�*� �9��V�O�d�3C�3H�3H�3J�3J�.K�.K�K�T�R�R�����+�*�*�*�*�����	�����4�<�<�E�M��B�C�C�C��8�V�$�$�	R���)�)�E�E���8�,�,�d�c�k�k�s�s�t�S�.P�Q�Q�E�
�6	%�c��H�H�Q��N�N�N��8�8�:�:�D��u�%�%�E��n�G��}��v�
���7�?�?�$�&>�?�?�?���'������!�%��/�/�%�"�H�E��w�q�z�z�����A��A�I�D�D����g��-�.�.�E��|�#�#��u���������A�&�&�&��	�	�%� � � ��	�	�����s�{�{��&��������&����'���V�d�&@�@�@�E��U�N�E�!�E�>�L����3�:�:�<�<��s�5��I�I�B��?�7�E��r�*6�e�E�E�E�D��D�J� �D�K��D�I��x�(�(�	
%�!)� 0� 0� 2� 2��
�
���f�%�%�
%�*�S�X�s�*C�*C�
%� "������ 9� 9��
�
�!%��
�m6	%�6	%�6	%�6	%�6	%�6	%�6	%�6	%�6	%�6	%�6	%����6	%�6	%�6	%�6	%�p�s(�
�
B�AB�B�)HL�L�Lc���t|d��rGtj||��r2|j|_|j|_|j|_|j|_dSd|_d|_d|_d|_dS)Nr<)r*r2�may_share_memoryr<r?rr=)rS�objs  rT�__array_finalize__zmemmap.__array_finalize__!sp���3�� � �		�R�%8��s�%C�%C�		���D�J��L�D�M��*�D�K���D�I�I�I��D�J� �D�M��D�K��D�I�I�I�c�x�|j�0t|jd��r|j���dSdSdS)z�
        Write any changes in the array to the file on disk.

        For further information, see `memmap`.

        Parameters
        ----------
        None

        See Also
        --------
        memmap

        Nr5)�baser*r5)rSs rTr5zmemmap.flush-sC���9� �W�T�Y��%@�%@� ��I�O�O������!� � � rYc����t���||��}||ust|��tur|S|jdkr|dS|�tj��S)N�)�super�__array_wrap__�typerrD�viewr2r)rS�arr�context�	__class__s   �rTr_zmemmap.__array_wrap__?sf����g�g�$�$�S�'�2�2��
�3�;�;�$�t�*�*�F�2�2��J��9��?�?��r�7�N��x�x��
�#�#�#rYc���t���|��}t|��tur"|j�|�t���S|S)N)r`)r^�__getitem__r`rr<rar)rS�index�resrds   �rTrfzmemmap.__getitem__NsK����g�g�!�!�%�(�(����9�9����3�9�#4��8�8��8�)�)�)��
rY)N)�__name__�
__module__�__qualname__�__doc__�__array_priority__rr;rXr5r_rf�
__classcell__)rds@rTrrs��������u�u�n ��).�T�!��#�N�N�N�N�`
�
�
����$
$�
$�
$�
$�
$�
$���������rY)�
contextlibrrr2�_utilsr�numericrrr	�numpy.compatr
r�__all__r.r%�writeable_filemodesr#rr]rYrT�<module>rus���"�"�"�"�"�"�����������*�*�*�*�*�*�*�*�*�*�3�3�3�3�3�3�3�3��*��
�
�(�(�(���T�l������	�����G���{�{�{�{�{�W�{�{���{�{�{rY


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
11 Feb 2026 9.30 AM
root / root
0755
__init__.cpython-311.pyc
5.763 KB
11 Feb 2026 9.33 AM
root / root
0644
_add_newdocs.cpython-311.pyc
201.147 KB
11 Feb 2026 9.33 AM
root / root
0644
_add_newdocs_scalars.cpython-311.pyc
13.565 KB
11 Feb 2026 9.33 AM
root / root
0644
_asarray.cpython-311.pyc
4.548 KB
11 Feb 2026 9.33 AM
root / root
0644
_dtype.cpython-311.pyc
13.505 KB
11 Feb 2026 9.33 AM
root / root
0644
_dtype_ctypes.cpython-311.pyc
5.165 KB
11 Feb 2026 9.33 AM
root / root
0644
_exceptions.cpython-311.pyc
9.201 KB
11 Feb 2026 9.33 AM
root / root
0644
_internal.cpython-311.pyc
37.174 KB
11 Feb 2026 9.33 AM
root / root
0644
_machar.cpython-311.pyc
12.408 KB
11 Feb 2026 9.33 AM
root / root
0644
_methods.cpython-311.pyc
11.421 KB
11 Feb 2026 9.33 AM
root / root
0644
_string_helpers.cpython-311.pyc
3.504 KB
11 Feb 2026 9.33 AM
root / root
0644
_type_aliases.cpython-311.pyc
8.971 KB
11 Feb 2026 9.33 AM
root / root
0644
_ufunc_config.cpython-311.pyc
17.081 KB
11 Feb 2026 9.33 AM
root / root
0644
arrayprint.cpython-311.pyc
74.873 KB
11 Feb 2026 9.33 AM
root / root
0644
cversions.cpython-311.pyc
0.73 KB
20 Jan 2026 1.01 PM
root / root
0644
defchararray.cpython-311.pyc
86.34 KB
11 Feb 2026 9.33 AM
root / root
0644
einsumfunc.cpython-311.pyc
53.66 KB
11 Feb 2026 9.33 AM
root / root
0644
fromnumeric.cpython-311.pyc
135.147 KB
11 Feb 2026 9.33 AM
root / root
0644
function_base.cpython-311.pyc
21.749 KB
11 Feb 2026 9.33 AM
root / root
0644
generate_numpy_api.cpython-311.pyc
9.256 KB
20 Jan 2026 1.01 PM
root / root
0644
getlimits.cpython-311.pyc
29.305 KB
11 Feb 2026 9.33 AM
root / root
0644
memmap.cpython-311.pyc
13.2 KB
11 Feb 2026 9.33 AM
root / root
0644
multiarray.cpython-311.pyc
56.09 KB
11 Feb 2026 9.33 AM
root / root
0644
numeric.cpython-311.pyc
88.526 KB
11 Feb 2026 9.33 AM
root / root
0644
numerictypes.cpython-311.pyc
21.381 KB
11 Feb 2026 9.33 AM
root / root
0644
overrides.cpython-311.pyc
7.775 KB
11 Feb 2026 9.33 AM
root / root
0644
records.cpython-311.pyc
43.074 KB
11 Feb 2026 9.33 AM
root / root
0644
setup.cpython-311.pyc
56.761 KB
20 Jan 2026 1.01 PM
root / root
0644
setup_common.cpython-311.pyc
15.612 KB
20 Jan 2026 1.01 PM
root / root
0644
shape_base.cpython-311.pyc
33.267 KB
11 Feb 2026 9.33 AM
root / root
0644
umath.cpython-311.pyc
1.771 KB
11 Feb 2026 9.33 AM
root / root
0644
umath_tests.cpython-311.pyc
0.63 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF