
    ;i_
              	       V   d Z ddlZddlZ eej                  j                  ej                  j                  ej                  j                  e            d            5 Z	 ej                  e	j                               Zddd        G d d      Zd Zd Zd Zd	 Zy# 1 sw Y    xY w)
zV
Description: File format determination library
Author: Mykyta Paliienko
License: MIT
    Nz	data.jsonc                   (    e Zd ZdZd Zd Zd Zd Zy)Infoa  
    Generates object with given arguments

    Takes:
        type_ (list) -> list of file types
        extension (list) -> list of file extensions
        mime (list) -> list of file MIME types

    Returns:
        (<class 'fleep.Info'>) -> Class instance
    c                 .    || _         || _        || _        y )Ntype	extensionmime)selftype_r   r	   s       A/home/ubuntu/myenv/lib/python3.12/site-packages/fleep/__init__.py__init__zInfo.__init__    s    	"	    c                     || j                   v S )z- Checks if file type matches with given type )r   )r
   r   s     r   type_matcheszInfo.type_matches%   s    		!!r   c                     || j                   v S )z7 Checks if file extension matches with given extension )r   )r
   r   s     r   extension_matcheszInfo.extension_matches)   s    DNN**r   c                     || j                   v S )z7 Checks if file MIME type matches with given MIME type )r	   )r
   r	   s     r   mime_matcheszInfo.mime_matches-   s    tyy  r   N)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r      s    

"+!r   r   c                 "   t        | t              st        d      t               t               t               d}dj	                  | D cg c]  }dj                  |       c}      }t        D ]J  }|d   D ]@  }|d   dz  |d   z   }|||t        |      |z    k(  s&dD ]  }t        |      ||   ||   <    B L dD ]1  }t        ||   ||   j                  d	      D cg c]  }| c}||<   3 t        |d
   |d   |d         S c c}w c c}w )z
    Determines file format and picks suitable file types, extensions and MIME types

    Takes:
        obj (bytes) -> byte sequence (128 bytes are enough)

    Returns:
        (<class 'fleep.Info'>) -> Class instance
    zobject type must be bytesr    z{:02X}	signatureoffset   T)keyreverser   r   r	   )
isinstancebytes	TypeErrordictjoinformatdatalensortedgetr   )objinfobytestreamelementr   r   r   s           r   r*   r*   2   s5    c5!344 VD XX=xt,=>F = - 	=IX&*WX->>FF6#i.6*ABB8 =C.1)nDIgcl+=	== - `,249$s)--Y],^_W_S	` Vd;/f>> > `s   	D 	Dc            	      ^    t        t        t        D  cg c]  } | d   	 c}             S c c} w )z( Returns a list of supported file types r   r)   setr'   xs    r   supported_typesr5   U   $    #$/Qqy/011/   *c            	      ^    t        t        t        D  cg c]  } | d   	 c}             S c c} w )z- Returns a list of supported file extensions r   r1   r3   s    r   supported_extensionsr9   Z   s$    #t4!q~45664r7   c            	      ^    t        t        t        D  cg c]  } | d   	 c}             S c c} w )z- Returns a list of supported file MIME types r	   r1   r3   s    r   supported_mimesr;   _   r6   r7   )r   osjsonopenpathr%   dirnameabspath__file__	data_fileloadsreadr'   r   r*   r5   r9   r;   r   r   r   <module>rF      s    
  
"'',,rwwrwwx'@A;
OP (T]4::inn&'D(! !> ?F2
7
2a( (s   !BB(