403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/io/matlab/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/io/matlab/__pycache__/_miobase.cpython-311.pyc
�

d�cl2�
�:�dZddlZddlZddlZddlmZddlmZ	gd�Z
Gd�de��ZGd	�d
e��Z
Gd�de��Zd
ddddddddd�	Zeje��Z	d�Zd�Zdd�d�ZeZd�Zd%d�ZGd�d ��ZGd!�d"��Zd#�Zd$�ZdS)&zf
Base classes for MATLAB file stream reading.

MATLAB is a registered trademark of the Mathworks inc.
�N)�doccer�)�_byteordercodes)
�
MatFileReader�MatReadError�MatReadWarning�MatVarReader�
MatWriteError�arr_dtype_number�arr_to_chars�convert_dtypes�doc_dict�	docfiller�get_matfile_version�matdims�
read_dtypec��eZdZdZdS)rz"Exception indicating a read issue.N��__name__�
__module__�__qualname__�__doc__���:/usr/lib/python3/dist-packages/scipy/io/matlab/_miobase.pyrrs������,�,�,�,rrc��eZdZdZdS)r
z#Exception indicating a write issue.Nrrrrr
r
s������-�-�-�-rr
c��eZdZdZdS)rzWarning class for read issues.Nrrrrrr s������(�(�(�(rrzfile_name : str
   Name of the mat file (do not need .mat extension if
   appendmat==True) Can also pass open file-like object.z�appendmat : bool, optional
   True to append the .mat extension to the end of the given
   filename, if not already present. Default is True.a�byte_order : str or None, optional
   None by default, implying byte order guessed from mat
   file. Otherwise can be one of ('native', '=', 'little', '<',
   'BIG', '>').
mat_dtype : bool, optional
   If True, return arrays in same dtype as would be loaded into
   MATLAB (instead of the dtype with which they are saved).
squeeze_me : bool, optional
   Whether to squeeze unit matrix dimensions or not.
chars_as_strings : bool, optional
   Whether to convert char arrays to string arrays.
matlab_compatible : bool, optional
   Returns matrices as would be loaded by MATLAB (implies
   squeeze_me=False, chars_as_strings=False, mat_dtype=True,
   struct_as_record=True).abstruct_as_record : bool, optional
   Whether to load MATLAB structs as NumPy record arrays, or as
   old-style NumPy arrays with dtype=object. Setting this flag to
   False replicates the behavior of SciPy version 0.7.x (returning
   numpy object arrays). The default setting is True, because it
   allows easier round-trip load and save of MATLAB files.zAmat_stream : file-like
   Object with file API, open for reading.along_field_names : bool, optional
   * False - maximum field name length in a structure is 31 characters
     which is the documented maximum length. This is the default.
   * True - maximum field name length in a structure is 63 characters
     which works for MATLAB 7.6z[do_compression : bool, optional
   Whether to compress matrices on write. Default is False.z�oned_as : {'row', 'column'}, optional
   If 'column', write 1-D NumPy arrays as column vectors.
   If 'row', write 1D NumPy arrays as row vectors.zbunicode_strings : bool, optional
   If True, write strings as Unicode, else MATLAB usual encoding.)	�file_arg�
append_arg�	load_args�
struct_arg�
matstream_arg�long_fields�do_compression�oned_as�unicode_stringsc��|���}|D]2}tj||���|��||<�3|S)a� Convert dtypes in mapping to given order

    Parameters
    ----------
    dtype_template : mapping
       mapping with values returning numpy dtype from ``np.dtype(val)``
    order_code : str
       an order code suitable for using in ``dtype.newbyteorder()``

    Returns
    -------
    dtypes : mapping
       mapping where values have been replaced by
       ``np.dtype(val).newbyteorder(order_code)``

    )�copy�np�dtype�newbyteorder)�dtype_template�
order_code�dtypes�ks    rr
r
�sR��"�
 �
 �
"�
"�F�
�A�A���H�V�A�Y�'�'�4�4�Z�@�@��q�	�	��Mrc�j�|j}tjd||�|��d���}|S)af
    Generic get of byte stream data of known type

    Parameters
    ----------
    mat_stream : file_like object
        MATLAB (tm) mat file stream
    a_dtype : dtype
        dtype of array to read. `a_dtype` is assumed to be correct
        endianness.

    Returns
    -------
    arr : ndarray
        Array of dtype `a_dtype` read from stream.

    r�F)�shaper*�buffer�order)�itemsizer)�ndarray�read)�
mat_stream�a_dtype�	num_bytes�arrs    rrr�s@��$� �I�
�*�2�"�&�O�O�I�6�6�� � � �C��JrT��	appendmatc�z�ddlm}|||���5}t|��cddd��S#1swxYwYdS)a�
    Return major, minor tuple depending on apparent mat file type

    Where:

     #. 0,x -> version 4 format mat files
     #. 1,x -> version 5 format mat files
     #. 2,x -> version 7.3 format mat files (HDF format)

    Parameters
    ----------
    file_name : str
       Name of the mat file (do not need .mat extension if
       appendmat==True). Can also pass open file-like object.
    appendmat : bool, optional
       True to append the .mat extension to the end of the given
       filename, if not already present. Default is True.

    Returns
    -------
    major_version : {0, 1, 2}
        major MATLAB File format version
    minor_version : int
        minor MATLAB file format version

    Raises
    ------
    MatReadError
        If the file is empty.
    ValueError
        The matfile version is unknown.

    Notes
    -----
    Has the side effect of setting the file read pointer to 0
    r)�_open_file_contextr<N)�_mior?�_get_matfile_version)�	file_namer=r?�fileobjs    r�matfile_versionrD�s���J)�(�(�(�(�(�	�	�I��	;�	;�	;�-�w�#�G�,�,�-�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-�-�-s�0�4�4c�T�|�d��|�d��}t|��dkrtd���t	jdtj|���}d|vr|�d��dS|�d��|�d��}|�d��t|dd	k��}t||��}t|d
|z
��}||f}|dvr|Std|z���)
Nr�zMat file appears to be empty)rF�r2r*r3�rr�|��Ir)rrJz%Unknown mat file type, version %s, %s)	�seekr7�lenrr)r6�uint8�int�
ValueError)rC�
mopt_bytes�	mopt_ints�tst_str�maj_ind�maj_val�min_val�rets        rrArA�s���L�L��O�O�O����a���J�
�:���!����9�:�:�:��
��R�X�j�I�I�I�I��I�~�~����Q�����u��L�L������l�l�1�o�o�G��L�L��O�O�O��'�!�*��'�(�(�G��'�'�"�#�#�G��'�!�g�+�&�'�'�G��G�
�C��&����
�
�<�s�B�
C�
C�Cr�columnc��|j}|dkrdSt|��dkr6|ddkrdS|dkr|dzS|dkrd|zStd	|z���|S)
a�
    Determine equivalent MATLAB dimensions for given array

    Parameters
    ----------
    arr : ndarray
        Input array
    oned_as : {'column', 'row'}, optional
        Whether 1-D arrays are returned as MATLAB row or column matrices.
        Default is 'column'.

    Returns
    -------
    dims : tuple
        Shape tuple, in the form MATLAB expects it.

    Notes
    -----
    We had to decide what shape a 1 dimensional array would be by
    default. ``np.atleast_2d`` thinks it is a row vector. The
    default for a vector in MATLAB (e.g., ``>> 1:12``) is a row vector.

    Versions of scipy up to and including 0.11 resulted (accidentally)
    in 1-D arrays being read as column vectors. For the moment, we
    maintain the same tradition here.

    Examples
    --------
    >>> matdims(np.array(1)) # NumPy scalar
    (1, 1)
    >>> matdims(np.array([1])) # 1-D array, 1 element
    (1, 1)
    >>> matdims(np.array([1,2])) # 1-D array, 2 elements
    (2, 1)
    >>> matdims(np.array([[2],[3]])) # 2-D array, column vector
    (2, 1)
    >>> matdims(np.array([[2,3]])) # 2-D array, row vector
    (1, 2)
    >>> matdims(np.array([[[2,3]]])) # 3-D array, rowish vector
    (1, 1, 2)
    >>> matdims(np.array([])) # empty 1-D array
    (0, 0)
    >>> matdims(np.array([[]])) # empty 2-D array
    (0, 0)
    >>> matdims(np.array([[[]]])) # empty 3-D array
    (0, 0, 0)

    Optional argument flips 1-D shape behavior.

    >>> matdims(np.array([1,2]), 'row') # 1-D array, 2 elements
    (1, 2)

    The argument has to make sense though

    >>> matdims(np.array([1,2]), 'bizarre')
    Traceback (most recent call last):
       ...
    ValueError: 1-D option "bizarre" is strange

    r)rrrrrHrX)r�rowz1-D option "%s" is strange)r2rMrP)r;r%r2s   rrr�s���z
�I�E���{�{��v�
�5�z�z�Q�����8�q�=�=��6�
��
 �
 ��4�<��
��
�
��%�<���9�&�'�(�(�
(��Lrc�$�eZdZdZd�Zd�Zd�ZdS)r	z; Abstract class defining required interface for var readersc��dS)Nr)�self�file_readers  r�__init__zMatVarReader.__init__Ms���rc��dS)z Returns header Nr�r]s r�read_headerzMatVarReader.read_headerP����rc��dS)z Reads array given header Nr)r]�headers  r�array_from_headerzMatVarReader.array_from_headerTrcrN)rrrrr_rbrfrrrr	r	KsG������E�E�
�
�
�
�
�
�
�
�
�
�
rr	c�L�eZdZdZe								d	d���Zd�Zd�Zd�ZdS)
ra
 Base object for reading mat files

    To make this class functional, you will need to override the
    following methods:

    matrix_getter_factory   - gives object to fetch next matrix from stream
    guess_byte_order        - guesses file byte order from file
    NFTc
�,�||_i|_|s|���}ntj|��}||_||_|r|���n||_||_	||_
||_|	|_|	rd|_d|_dSdS)z�
        Initializer for mat file reader

        mat_stream : file-like
            object with file API, open for reading
    %(load_args)s
        TFN)
r8r.�guess_byte_order�boc�
to_numpy_code�
byte_order�struct_as_record�set_matlab_compatible�
squeeze_me�chars_as_strings�	mat_dtype� verify_compressed_data_integrity�simplify_cells)
r]r8rlrqrorp�matlab_compatiblermrrrss
          rr_zMatFileReader.__init__cs���$%�������	7��.�.�0�0�J�J��*�:�6�6�J�$��� 0����	'��&�&�(�(�(�(�(�D�O�$4�D�!�&�D�N�0P��-�,����	*�"�D�O�$)�D�!�!�!�	*�	*rc�0�d|_d|_d|_dS)z4 Sets options to return arrays as MATLAB loads them TFN)rqrorpras rrnz#MatFileReader.set_matlab_compatible�s�������� %����rc��tjS)z9 As we do not know what file type we have, assume native )rj�native_coderas rrizMatFileReader.guess_byte_order�s
����rc���|j�d��}|j���}|j�|dz
��t	|��dkS)Nrr)r8r7�tellrLrM)r]�b�curposs   r�
end_of_streamzMatFileReader.end_of_stream�sT���O� � ��#�#����%�%�'�'������V�A�X�&�&�&��1�v�v��{�r)NFFTFTTF)	rrrrrr_rnrir|rrrrrYs���������� � �!�"&�#(�"&�26� %�#*�#*�#*��Y�#*�J&�&�&��������rrc�n�tj|jjdd�t|��z��S)z3 Return dtype for given number of items per elementNrJ)r)r*�str)r;�nums  rrr�s*��
�8�C�I�M�"�1�"�%��C���0�1�1�1rc��t|j��}|sdg}|�t|jjdd�����t
j|t|d��|���}|t
j	d|j���kg}t
j
|��s|S|���}d|t|��<|S)z$ Convert string array to char array rrJNrG�)r*� )
�listr2�appendrOr*r~r)r6r�array�anyr(�tuple)r;�dims�emptiess   rrr�s�����	�?�?�D����s���K�K��C�I�M�!�"�"�%�&�&�'�'�'�
�*�4�+�C��3�3��!�!�!�C��b�h�r���3�3�3�3�4�G�
�6�'�?�?���
�

�(�(�*�*�C��C��g�����Jr)rX)r�operator�	functools�numpyr)�
scipy._librr�rrj�__all__�	Exceptionrr
�UserWarningrr�filldocrr
rrDrrArr	rrrrrr�<module>r�s(����
������������������$�$�$�$�$�$�����-�-�-�-�-�9�-�-�-�.�.�.�.�.�I�.�.�.�)�)�)�)�)�[�)�)�)�
<�
9�
� 
>�
.�
#�
?�
6�
E�a1F�1F�	�h
�F�N�8�$�$�	�*�Z���.���4-1�'-�'-�'-�'-�'-�T&��D�D�D�2J�J�J�J�Z
�
�
�
�
�
�
�
�>�>�>�>�>�>�>�>�B2�2�2�
����r

Youez - 2016 - github.com/yon3zu
LinuXploit