+
    !bt:                     ,   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
HtHt ]t ! R R]4      t ! R R4      t/ tR tR-R	 ltR-R
 ltR-R lt^RIHt ]P2                  ! 4       t]P                  tR tR tR t ^ RIH t  R t!R t#]PH                  t$]]$n%        ].]$n&        ]PN                  t'R]'n%        ].]'n&        ]PP                  t(]](n%        ].](n&        ]PR                  t)]])n%        ].])n&        ]PT                  t+]]+n%        ]].]+n&        ]]+n,        R t*]PZ                  t.]].n%        ]]
]	.].n&        ]].n,        R t-]P^                  t/]]/n%        ]].]/n&        ]]/n,        ]P^                  t0]]0n%        ]].]0n&        ]]0n,        R t/]Pb                  t2]]2n%        ]].]2n&        ]]2n,        R t1]Pf                  t3]]3n%        ]].]3n&        ]Ph                  t4]]4n%        ]].]4n&        ]Pj                  t5]]5n%        ]].]5n&        Rt6]7! ]R4      '       df   ]7! ]R4      '       dW   Rt6]Pp                  t9]]9n%        ]]]! ]	4      .]9n&        ]]9n,        ]Pt                  t;]];n%        ]]]! ]	4      .];n&        ]];n,        R t8R t:Rt<]7! ]R4      '       d   Rt<]Pz                  t=]]=n%        . ]=n&        R t>^ t?^t@^tA^tB^tC^tDRtE^tFR tG^ tH^@tI^tJR!tKR"tLR#tMR$tNR%tOR&tPR'tQR(tRR)tSR*tTR+tU^ tV^tW^tX^tY^tZ^t[^t\R, t]]]! ]^! 4       4       R#   ]" d    R t! ELi ; i).ai  
magic is a wrapper around the libmagic file identification library.

See README for more information.

Usage:

>>> import magic
>>> magic.from_file("testdata/test.pdf")
'PDF document, version 1.2'
>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
>>> magic.from_buffer(open("testdata/test.pdf").read(1024))
'PDF document, version 1.2'
>>>

N)c_char_pc_intc_size_tc_void_pbyrefPOINTERc                   2   a a ] tR t^ t oV 3R ltRtVtV ;t# )MagicExceptionc                :   < \         \        V `  V4       Wn        R # N)super	Exception__init__message)selfr   	__class__s   &&0/usr/lib/python3/dist-packages/magic/__init__.pyr   MagicException.__init__!   s    i'0    )r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r	   r	       s      r   r	   c                   X   a  ] tR t^&t o RtRR ltR tR tR tR t	R t
R	 tR
 tRtV tR# )Magicz3
Magic is a wrapper around the libmagic C library.
Nc                D   \         V n        V'       d   V ;P                  \        ,          un        V'       d   V ;P                  \        ,          un        V'       d   V ;P                  \        ,          un        V'       d   V ;P                  \
        ,          un        V'       d   V ;P                  \        ,          un        V'       d   V ;P                  \        ,          un        \        V P                  4      V n	        \        P                  ! 4       V n        \        V P                  V4       V'       d'   \        '       d   \        4       R8  d   \!        R4      h\"        '       d    V P%                  \&        ^@4       R# R#   \(         d   p Rp?R# Rp?ii ; i)a  
Create a new libmagic wrapper.

mime - if True, mimetypes are returned instead of textual descriptions
mime_encoding - if True, codec is returned
magic_file - use a mime database other than the system default
keep_going - don't stop at the first match, keep going
uncompress - Try to look inside compressed files.
raw - Do not try to decode "non-printable" chars.
extension - Print a slash-separated list of valid extensions for the file type found.
i  z<MAGIC_EXTENSION is not supported in this version of libmagicN)
MAGIC_NONEflagsMAGIC_MIME_TYPEMAGIC_MIME_ENCODINGMAGIC_CONTINUEMAGIC_COMPRESS	MAGIC_RAWMAGIC_EXTENSION
magic_opencookie	threadingLocklock
magic_load_has_versionversionNotImplementedError
_has_paramsetparamMAGIC_PARAM_NAME_MAXr	   )	r   mime
magic_filemime_encoding
keep_going
uncompressraw	extensiones	   &&&&&&&& r   r   Magic.__init__+   s      
JJ/)JJJ--JJJ.(JJJ.(JJJ)#JJJ/)J ,NN$	4;;
+ llgi#o%&dee :2B7  "  s   /F	 	FFc                z   V P                   ;_uu_ 4         \        V4      \        8X  d#   \        \        8w  d   VP	                  RRR7      p\        \        V P                  V4      4      uuRRR4       #   \         d&   pT P                  T4      u Rp?uuRRR4       # Rp?ii ; i  + '       g   i     R# ; i)z 
Identify the contents of `buf`
utf-8replace)errorsN)
r,   typestrbytesencodemaybe_decodemagic_bufferr)   r	   _handle509Bug)r   bufr;   s   && r   from_bufferMagic.from_buffer^   s     YYY	-
 9#u**WY*?C#Lc$BC Y " -))!,, Y- YYs5   B)AA66B&B!B&B)!B&&B))B:	c                n   \        V4      ;_uu_ 4         R R R 4       V P                  ;_uu_ 4         \        \        V P                  V4      4      uuR R R 4       #   + '       g   i     LO; i  \
         d&   pT P                  T4      u R p?uuR R R 4       # R p?ii ; i  + '       g   i     R # ; ir   )
_real_openr,   rE   r5   r)   r	   rG   )r   filenamer;   s   && r   	from_fileMagic.from_filen   s{    !! " YYY-#Jt{{H$EF Y "! " -))!,,	 Y- YYs?   AB#A0A-	0B ;BB B#B  B##B4	c                   V P                   ;_uu_ 4         \        \        V P                  V4      4      uuR R R 4       #   \         d&   pT P                  T4      u R p?uuR R R 4       # R p?ii ; i  + '       g   i     R # ; ir   )r,   rE   magic_descriptorr)   r	   rG   )r   fdr;   s   && r   from_descriptorMagic.from_descriptory   s_    YYY-#$4T[["$EF Y " -))!,,	 Y- YYs4   A3A  A0A+A0A3+A00A33B	c                `    VP                   f    V P                  \        ,          '       d   R# Vh)Nzapplication/octet-stream)r   r!   r"   )r   r;   s   &&r   rG   Magic._handle509Bug   s$     99$**">">-Gr   c                .    \        V P                  W4      # r   )magic_setparamr)   )r   paramvals   &&&r   r2   Magic.setparam   s    dkk566r   c                .    \        V P                  V4      # r   )magic_getparamr)   )r   rY   s   &&r   getparamMagic.getparam   s    dkk511r   c                    \        V R 4      '       dA   V P                  '       d-   \        '       d   \        V P                  4       RV n        R# R# R# R# )r)   N)hasattrr)   magic_close)r   s   &r   __del__Magic.__del__   s;     4""t{{{{{$DK 8C{"r   )r)   r!   r,   )FNFFFFF)r   r   r   r   __doc__r   rI   rN   rS   rG   r2   r^   rc   r   r   )r   s   @r   r   r   &   s8     1f- 	--72 r   r   c                 b    \         P                  V 4      pVf   \        V R7      ;p\         V &   V# )N)r4   )
_instancesgetr   )r4   is   & r   _get_magic_typerj      s.    tAy$$//JtHr   Fc                :    \        V4      pVP                  V 4      # )z"
Accepts a filename and returns the detected filetype.  Return
value is the mimetype if mime=True, otherwise a human readable
name.

>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
)rj   rN   )rM   r4   ms   && r   rN   rN      s     	A;;x  r   c                :    \        V4      pVP                  V 4      # )z
Accepts a binary string and returns the detected filetype.  Return
value is the mimetype if mime=True, otherwise a human readable
name.

>>> magic.from_buffer(open("testdata/test.pdf").read(1024))
'PDF document, version 1.2'
)rj   rI   )bufferr4   rl   s   && r   rI   rI      s     	A==  r   c                :    \        V4      pVP                  V 4      # )z
Accepts a file descriptor and returns the detected filetype.  Return
value is the mimetype if mime=True, otherwise a human readable
name.

>>> f = open("testdata/test.pdf")
>>> magic.from_descriptor(f.fileno())
'PDF document, version 1.2'
)rj   rS   )rR   r4   rl   s   && r   rS   rS      s     	AR  r   )loaderc                 H    V f   \        V^ ,          4      p\        V4      hV # r   magic_errorr	   resultfuncargserrs   &&& r   errorcheck_nullry      s%    ~$q'"S!!r   c                 N    V R8X  d   \        V^ ,          4      p\        V4      hV # )   rr   rt   s   &&& r   errorcheck_negative_oner}      s'    |$q'"S!!r   c                 H    \         \        8X  d   V # V P                  R R4      # )r>   backslashreplace)rB   rC   decode)ss   &r   rE   rE      s"    
e| xx!344r   )PathLikec                 R    \        V \        4      '       d   V P                  4       # V # r   )
isinstancer   
__fspath__rM   s   &r   unpathr      s#    h))&&((Or   c                     V # r    r   s   &r   r   r      s    r   c                 4   V f   R # \        V 4      p \        P                  ^ ,          ^8*  ;'       d    \        V \        4      ;'       g3    \        P                  ^ ,          ^8  ;'       d    \        V \
        4      pV'       d   V P                  RR4      # V # )Nr>   surrogateescape)r   sysversion_infor   unicoderB   rD   )rM   
is_unicodes   & r   coerce_filenamer      s    hH ""1%* / /Hg.- -""1%* , ,Xs+  w(9::r   c                 ,    \        V \        V4      4      # r   )_magic_filer   r)   rM   s   &&r   r5   r5   (      vx899r   c                 ,    \        W\        V4      4      # r   )_magic_bufferlen)r)   rH   s   &&r   rF   rF   2  s    c#h//r   c                     \        W4      # r   )_magic_descriptor)r)   rR   s   &&r   rQ   rQ   A  s    V((r   c                 ,    \        V \        V4      4      # r   )_magic_loadr   r   s   &&r   r-   r-   K  r   r   rX   r]   Tc                 p    \         '       g   \        R 4      h\        V4      p\        W\	        V4      4      # )zmagic_setparam not implemented)r1   r0   r   _magic_setparamr   )r)   rY   rZ   vs   &&& r   rX   rX   i  s-    :!"BCCA6%(33r   c                     \         '       g   \        R 4      h\        4       p\        W\	        V4      4       VP
                  # )zmagic_getparam not implemented)r1   r0   r   _magic_getparamr   value)r)   rY   rZ   s   && r   r]   r]   p  s2    :!"BCC
*CF5:.99r   magic_versionc                  D    \         '       g   \        R 4      h\        4       # )zmagic_version not implemented)r.   r0   r   r   r   r   r/   r/     s    <!"ABB?r   i   i      i   i   i    i @  i   i   i   i   i   i   c                   a
 ^ RI o
^ RIp^ RIHp V
3R lp. ROpV F  pV! VP                  V,          4      W&   K   	  VP                  R4      p\        R.4      pVP                  P                  4        FQ  w  rVP                  V4      '       g   K  W9   d*   W9   d   K,  W,          V	8w  d   \        RV,           4      hKM  WV&   KS  	  R# )    N)compatc                    <a  V V3R  lpV# )c                  @   < SP                  R \        4       S! V / VB # )zUsing compatibility mode with libmagic's python binding. See https://github.com/ahupp/python-magic/blob/master/COMPAT.md for details.)warnPendingDeprecationWarning)rw   kwargsfnwarningss   *,r   _3_add_compat.<locals>.deprecation_wrapper.<locals>._  s*    MM_)+
 t&v&&r   r   )r   r   r   s   f r   deprecation_wrapper(_add_compat.<locals>.deprecation_wrapper  s    	' r   z	^[A-Z_]+$
MAGIC_MIMEzinconsistent value for )detect_from_filenamedetect_from_contentdetect_from_fobjopen)
r   remagicr   __dict__compilesetitemsmatchr   )	to_moduler   r   r   r   fnameis_const_reallowed_inconsistentnamer   r   s   &         @r   _add_compatr     s    	
B .vu/EF	  **[)K~.,,.T"" /?e+#$=$DEE"'$ /r   )F)_re   r   globctypesctypes.utilr*   loggingr   r   r   r   r   r   r   rL   r   r	   r   rg   rj   rN   rI   rS    rp   load_liblibmagicmagic_try   r}   rE   osr   r   ImportErrorr   r(   restypeargtypesrb   rs   magic_errnor5   r   errcheckrF   r   rQ   r   r-   r   magic_setflagsmagic_checkmagic_compiler1   ra   rX   r   r]   r   r.   r   r/   r    MAGIC_DEBUGMAGIC_SYMLINKr%   MAGIC_DEVICESr"   r#   r   r'   r$   MAGIC_CHECKMAGIC_PRESERVE_ATIMEr&   MAGIC_ERRORMAGIC_NO_CHECK_COMPRESSMAGIC_NO_CHECK_TARMAGIC_NO_CHECK_SOFTMAGIC_NO_CHECK_APPTYPEMAGIC_NO_CHECK_ELFMAGIC_NO_CHECK_ASCIIMAGIC_NO_CHECK_TROFFMAGIC_NO_CHECK_FORTRANMAGIC_NO_CHECK_TOKENSMAGIC_PARAM_INDIR_MAXr3   MAGIC_PARAM_ELF_PHNUM_MAXMAGIC_PARAM_ELF_SHNUM_MAXMAGIC_PARAM_ELF_NOTES_MAXMAGIC_PARAM_REGEX_MAXMAGIC_PARAM_BYTES_MAXr   globalsr   r   r   <module>r      s  $       F F 
Y v vr 

!
!! ??
//5	*   

 g
 "" y "" y "" y !! * & : %%  !8X6 ( 0 ,, #  $e,  +  -- $  %u-  ,  ) !! * . : (( "E* "" * && !8, 

8%&&78=M+N+NJ--O#O '0ABO6O--O#O '0ABO6O4 
8_%%L**M!MM 
  
 	"   !    !          #(L GI y  s   	L 
LL