%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/magic/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/magic/__pycache__/compat.cpython-312.pyc

�

!��b| ���dZddlZddlmZddl�ddlmZddlmZiZej�ed<dxZ
ZdxZZ
d	xZZd
xZZdxZZdxZZd
xZZdxZZdxZZdxZZdxZZdxZ Z!dxZ"Z#dxZ$Z%dxZ&Z'dxZ(Z)dxZ*Z+dxZ,Z-dxZ.Z/dxZ0Z1dxZ2Z3dxZ4Z5dxZ6Z7dxZ8Z9edd �Z:Gd!�d"e;�Z<ge<_=e>e<�Z?edj�ZAe?eA_BeCgeA_Dedj�ZFdeF_Be?geF_Dedj�ZHeIeH_Be?eIgeH_Dedj�ZKeIeK_Be?eCgeK_Dedj�ZMeIeM_Be?eNeOgeM_Dedj�ZQeIeQ_Be?geQ_Dedj�ZSeCeS_Be?eCgeS_Dedj�ZUeCeU_Be?eIgeU_Dedj�ZWeCeW_Be?eIgeW_Dedj�ZYeCeY_Be?eIgeY_Dedj�Z[eCe[_Be?eIge[_Dedj�Z]eCe]_Be?ge]_DGd#�d$e^�Z_d%�Z`e_eAe"��Zaeaj��e_eAe
��Zcecj��d&�Zdd'�Zed(�Zfd)�Zgy)*z
Python bindings for libmagic
�N)�
namedtuple)�*)�find_library�)�loader�magic����� �@��iiiiii i@i�iiiii i�?�	FileMagic)�	mime_type�encoding�namec��eZdZy)�	magic_setN)�__name__�
__module__�__qualname__���./usr/lib/python3/dist-packages/magic/compat.pyrr3s��rrc�v�eZdZd�Zd�Zed��Zed��Zd�Zd�Z	d�Z
d�Zd	�Zdd�Z
d�Zd
�Zd�Zd�Zy
)�Magicc��||_y�N)�_magic_t)�self�mss  r�__init__zMagic.__init__ls	����
rc�.�t|j�y)zO
        Closes the magic database and deallocates any resources used.
        N)�_closer!�r"s r�closezMagic.closeos��	�t�}�}�rc�z�|�yt|t�r|S	t|d�S#t$rt|�cYSwxYw�Nzutf-8)�
isinstance�str�	TypeError)�ss r�__tostrz
Magic.__tostrusB���9���a����H�	��q�'�?�"���	��q�6�M�	���#�:�:c�z�|�yt|t�r|S	t|d�S#t$rt|�cYSwxYwr*)r+�bytesr-)�bs r�	__tobyteszMagic.__tobytes�sC���9���a����H�	���G�$�$���	���8�O�	�r0c�z�tjt|jtj	|���S)z�
        Returns a textual description of the contents of the argument passed
        as a filename or None if an error occurred and the MAGIC_ERROR flag
        is set. A call to errno() will return the numeric error code.
        )r�
_Magic__tostr�_filer!�_Magic__tobytes�r"�filenames  r�filez
Magic.file�s'���}�}�U�4�=�=�%�/�/�(�2K�L�M�Mrc�T�tjt|j|��S)z�
        Returns a textual description of the contents of the argument passed
        as a file descriptor or None if an error occurred and the MAGIC_ERROR
        flag is set. A call to errno() will return the numeric error code.
        )rr6�_descriptorr!)r"�fds  r�
descriptorzMagic.descriptor�s���}�}�[�����;�<�<rc	�h�tjt|j|t	|���S)z�
        Returns a textual description of the contents of the argument passed
        as a buffer or None if an error occurred and the MAGIC_ERROR flag
        is set. A call to errno() will return the numeric error code.
        )rr6�_bufferr!�len)r"�bufs  r�bufferzMagic.buffer�s$���}�}�W�T�]�]�C��S��B�C�Crc�R�tjt|j��S)zh
        Returns a textual explanation of the last error or None
        if there was no error.
        )rr6�_errorr!r's r�errorzMagic.error�s��
�}�}�V�D�M�M�2�3�3rc�.�t|j|�S)a*
        Set flags on the magic object which determine how magic checking
        behaves; a bitwise OR of the flags described in libmagic(3), but
        without the MAGIC_ prefix.

        Returns -1 on systems that don't support utime(2) or utimes(2)
        when PRESERVE_ATIME is set.
        )�	_setflagsr!)r"�flagss  r�setflagszMagic.setflags�s�������.�.rNc�T�t|jtj|��S)a	
        Must be called to load entries in the colon separated list of database
        files passed as argument or the default database file if no argument
        before any magic queries can be performed.

        Returns 0 on success and -1 on failure.
        )�_loadr!rr8r9s  r�loadz
Magic.load�s���T�]�]�E�O�O�H�$=�>�>rc�T�t|jtj|��S)aD
        Compile entries in the colon separated list of database files
        passed as argument or the default database file if no argument.
        The compiled files created are named from the basename(1) of each file
        argument with ".mgc" appended to it.

        Returns 0 on success and -1 on failure.
        )�_compiler!rr8�r"�dbss  r�compilez
Magic.compile�s����
�
�u���s�';�<�<rc�T�t|jtj|��S�z�
        Check the validity of entries in the colon separated list of
        database files passed as argument or the default database file
        if no argument.

        Returns 0 on success and -1 on failure.
        )�_checkr!rr8rQs  r�checkzMagic.check�s���d�m�m�U�_�_�S�%9�:�:rc�T�t|jtj|��SrU)�_listr!rr8rQs  r�listz
Magic.list�s���T�]�]�E�O�O�C�$8�9�9rc�,�t|j�S)a
        Returns a numeric error code. If return value is 0, an internal
        magic error occurred. If return value is non-zero, the value is
        an OS error code. Use the errno module or os.strerror() can be used
        to provide detailed error information.
        )�_errnor!r's r�errnozMagic.errno�s���d�m�m�$�$rr )rrrr$r(�staticmethodr6r8r;r?rDrGrKrNrSrWrZr]rrrrrksh������������N�=�D�4�	/�?�	=�;�:�%rrc�*�tt|��S)zd
    Returns a magic object on success and None on failure.
    Flags argument as for setflags.
    )r�_open)rJs r�openra�s��
��u���rc��|jd�}|d}t|�dk(r|d}nd}t|||jdd���S)Nz; rr	r�zcharset=)rrr)�splitrBr�replace)�
mime_detected�
type_detected�splatr�
mime_encodings     r�_create_filemagicrj�sW������%�E��a��I�
�5�z�Q���a��
��
��-�9�+�3�3�J��C�E�Erc�f�ttj|�tj|��S)zdDetect mime type, encoding and file type from a filename

    Returns a `FileMagic` namedtuple.
    )rj�
mime_magicr;�
none_magic)r:s r�detect_from_filenamerns(���Z�_�_�X�6�'�_�_�X�6�8�8rc��|j�}ttj|�tj|��S)zjDetect mime type, encoding and file type from file-like object

    Returns a `FileMagic` namedtuple.
    )�filenorjrlr?rm)�fobj�file_descriptors  r�detect_from_fobjrs
s9���k�k�m�O��Z�2�2�?�C�'�2�2�?�C�E�Erc�f�ttj|�tj|��S)z_Detect mime type, encoding and file type from bytes

    Returns a `FileMagic` namedtuple.
    )rjrlrDrm)�byte_contents r�detect_from_contentrvs,���Z�.�.�|�<�'�.�.�|�<�>�>r)h�__doc__�ctypes�collectionsr�ctypes.utilrrcr�
_libraries�load_lib�
MAGIC_NONE�NONE�MAGIC_DEBUG�DEBUG�
MAGIC_SYMLINK�SYMLINK�MAGIC_COMPRESS�COMPRESS�
MAGIC_DEVICES�DEVICES�MAGIC_MIME_TYPE�	MIME_TYPE�MAGIC_CONTINUE�CONTINUE�MAGIC_CHECK�CHECK�MAGIC_PRESERVE_ATIME�PRESERVE_ATIME�	MAGIC_RAW�RAW�MAGIC_ERROR�ERROR�MAGIC_MIME_ENCODING�
MIME_ENCODING�
MAGIC_MIME�MIME�MAGIC_APPLE�APPLE�MAGIC_NO_CHECK_COMPRESS�NO_CHECK_COMPRESS�MAGIC_NO_CHECK_TAR�NO_CHECK_TAR�MAGIC_NO_CHECK_SOFT�
NO_CHECK_SOFT�MAGIC_NO_CHECK_APPTYPE�NO_CHECK_APPTYPE�MAGIC_NO_CHECK_ELF�NO_CHECK_ELF�MAGIC_NO_CHECK_TEXT�
NO_CHECK_TEXT�MAGIC_NO_CHECK_CDF�NO_CHECK_CDF�MAGIC_NO_CHECK_TOKENS�NO_CHECK_TOKENS�MAGIC_NO_CHECK_ENCODING�NO_CHECK_ENCODING�MAGIC_NO_CHECK_BUILTIN�NO_CHECK_BUILTINr�	Structurer�_fields_�POINTER�magic_t�
magic_openr`�restype�c_int�argtypes�magic_closer&�
magic_filer7�c_char_p�magic_descriptorr=�magic_bufferrA�c_void_p�c_size_t�magic_errorrF�magic_setflagsrI�
magic_loadrM�
magic_compilerP�magic_checkrV�
magic_listrY�magic_errnor\�objectrrarlrNrmrjrnrsrvrrr�<module>r�sc����"��$��
�
�%�f�o�o�'�
�7����
�T����e���
��������
�� � ��)��������e�(+�+��~���	�C����e�&*�*��m���
�T����e�.2�2��+�$(�(��\�&+�+��m�,1�1��)�$)�)��\�&,�,��m�$*�*��\�*1�1���.5�5��+�,3�3��)��{�$E�F�	�	�	�	��	��
�)�
���7��&�&����
�����	�G�	�	(�	(������)����7��&�&����
��8�$�����!�2�2�������'���
�W�
�
*�
*������X�x�0���	�G�	�	(�	(������)����w��.�.�	��	���u�%�	���7��&�&����
��8�$����g��,�,������h�'���	�G�	�	(�	(������H�%����7��&�&����
��8�$���	�G�	�	(�	(������)���z%�F�z%�z��5��$�
%�
�
����
�5��$�
%�
�
����	E�8�E�>r

Zerion Mini Shell 1.0