
    *pjU                       % S r SSKJr  SSKrSSKrSSKJr  SrS\S'   Sr	S	\S
'   Sr
S\S'   0 rS\S'   S|S}S jjr    S~S jrSS jrSS jrSS jrSS jr S|       SS jjr0 SS_SS_SS_SS_SS_S S!_S"S#_S$S%_S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_0 S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_SFSG_SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_STSU_SVSW_SXSY_E0 SZS[_S\S]_S^S__S`Sa_SbSc_SdSe_SfSg_ShSi_SjSk_SlSm_SnSo_SpSq_SrSs_StSu_SvSw_SxSy_ErSz\S{'   g)z&Internal shared utilities for chardet.    )annotationsN)Callablei@ intDEFAULT_MAX_BYTESg?floatMINIMUM_THRESHOLDi   _DEFAULT_CHUNK_SIZEz3dict[str, Callable[..., codecs.IncrementalDecoder]]_INCREMENTAL_DECODERSc                N    U [         :w  a  [        R                  " S[        US9  gg)zDEmit a deprecation warning if *chunk_size* differs from the default.zEchunk_size is not used in this version of chardet and will be ignored
stacklevelN)r	   warningswarnDeprecationWarning)
chunk_sizer   s     J/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/chardet/_utils.py_warn_deprecated_chunk_sizer   !   s%    ((S!	
 )    c                    [         R                  U 5      nUc    [        R                  " U 5      nU[         U '   U" 5       $ ! [         a     gf = f)aM  Return a fresh incremental decoder for *encoding*, or ``None``.

The class lookup is cached; ``None`` means the codec does not exist.
Every decode below catches ``UnicodeError`` rather than
``UnicodeDecodeError`` because the utf-16/utf-32 incremental decoders
raise a bare ``UnicodeError`` when the stream does not start with a BOM.
N)r
   getcodecsgetincrementaldecoderLookupError)encodingdecoder_classs     r   _incremental_decoderr   +   sX     *--h7M	"88BM +8h'?  		s   A   
AAc                d    [        U5      nUc  g UR                  U SS9  g! [         a     gf = f)a  Return ``True`` if *data* decodes cleanly under *encoding*.

Equivalent to ``data.decode(encoding, errors="strict")`` except that an
incomplete multi-byte sequence at the *end* of *data* is accepted instead of
raising.

Detection input is nearly always a prefix of a larger whole.  Callers pass
the first N bytes of a file, and chardet slices further on its own.
For a two-byte encoding any of those cuts lands mid-character roughly half
the time.

A one-shot strict decode cannot tell a truncated tail from corrupt data: it
raises either way, so the candidate is discarded and every CJK encoding can
disappear from the candidate set over a single dangling lead byte. An
incremental decoder with ``final=False`` defers the partial tail instead,
while still raising on genuine corruption anywhere before it.

:param data: The raw byte data to test.
:param encoding: Name of the codec to test *data* against.
:returns: ``True`` if *data* decodes without error, ``False`` otherwise.
FfinalTr   decodeUnicodeErrordatar   decoders      r   decodes_without_errorr&   ?   sD    , #8,Gt5)      " 
//c                d    [        U5      nUc  g UR                  U SS9  g! [         a     gf = f)a'  Return ``True`` if *data* decodes under *encoding* with nothing deferred.

The strict sibling of :func:`decodes_without_error`: ``final=True`` makes
an incomplete multi-byte sequence at the end of *data* an error rather
than a deferred tail.  This is the question that matters when *data* is
the caller's entire input --- ``data.decode(encoding)`` will make exactly
this judgment.

:param data: The raw byte data to test.
:param encoding: Name of the codec to test *data* against.
:returns: ``True`` if *data* decodes completely, ``False`` otherwise.
FTr   r    r#   s      r   decodes_completelyr)   _   sD     #8,Gt4(   r'   c                    [        U5      nUc  g UR                  U SS9nU(       a  UR                  5       (       d  g UR                  SSS9  g! [         a     gf = f! [         a     gf = f)a  Return ``True`` if *data* is ASCII text plus an incomplete tail.

One decode pass answers both halves of the decode-safety question:
the tolerant (``final=False``) decode yields the text before any
deferred tail, and flushing the decoder afterwards raises exactly when
a deferred tail existed.  True means the candidate decoded real ASCII
characters and then hit an incomplete multi-byte sequence at the end
--- its only *non-ASCII* evidence is the undecodable tail itself.

Deliberately False when the tolerant decode yields nothing at all
(the entire input is one dangling sequence): that candidate has zero
decoded evidence, not ASCII evidence, and a clipped multi-byte
fragment is better served by the ranking's own judgment.

:param data: The raw byte data to test.
:param encoding: Name of the codec to decode *data* with.
:returns: ``True`` if *data* decodes to non-empty pure ASCII with an
    incomplete sequence deferred at the end.
Fr   r   T)r   r!   r"   isascii)r$   r   r%   texts       r   dangling_tail_with_ascii_prefixr-   v   s    ( #8,G~~d%~0 t||~~s$'     s"   A A  
AA 
A-,A-c                ~    [        U [        5      (       d  [        U [        5      (       a  U S:  a  Sn[        U5      eg)z:Raise ValueError if *max_bytes* is not a positive integer.   z$max_bytes must be a positive integerN)
isinstanceboolr   
ValueError)	max_bytesmsgs     r   _validate_max_bytesr5      s8    )T""*Y*D*D	TU4o IVr   c                J    U (       a  [         R                  " S[        US9  gU$ )zEResolve the deprecated *should_rename_legacy* into *prefer_superset*.z?should_rename_legacy is deprecated, use prefer_superset insteadr   T)r   r   r   )should_rename_legacyprefer_supersetr   s      r   _resolve_prefer_supersetr9      s'     M!	

 r   ararabicbe
belarusianbg	bulgarianbrbretoncsczechcywelshdadanishdegermanelgreekenenglisheo	esperantoesspanishetestonianfafarsififinnishfrfrenchgairishgdgaelichehebrewhrcroatianhu	hungarianid
indonesianis	icelandicititalianjajapanesekkkazakhkokoreanlt
lithuanianlvlatvianmk
macedonianmsmalaymtmaltesenldutchno	norwegianplpolishpt
portugueseroromanianrurussianskslovakslslovenesrserbiansvswedishtgtajikththaitrturkishuk	ukrainianundundeterminedururduvi
vietnamesezhchinesezdict[str, str]ISO_TO_LANGUAGE)   )r   r   r   r   returnNone)r   strr   z codecs.IncrementalDecoder | None)r$   bytesr   r   r   r1   )r3   r   r   r   )r7   r1   r8   r1   r   r   r   r1   )__doc__
__future__r   r   r   collections.abcr   r   __annotations__r   r	   r
   r   r   r&   r)   r-   r5   r9   r    r   r   <module>r      s/   , "   $ ! 3     5  " S ! NP J O
%(@.!H JK15CF	 3#(3#,3# 	+3# 	(	3#
 	'3# 	'3# 	(3# 	(3# 	'3# 	)3# 	+3# 	)3# 	*3# 	'3# 	)3#  	(!3#" 	'#3#$ 	(%3#& 	('3#( 	*)3#* 	++3#, 	,-3#. 	+/3#0 	)13#2 	*33#4 	(53#6 	(73#8 	,93#: 	);3#< 	,=3#> 	'?3#@ 	)A3#B 	'C3#D 	+E3#F 	(G3#H 	,I3#J 	*K3#L 	)M3#N 	(O3#P 	)Q3#R 	)S3#T 	)U3#V 	'W3#X 	&Y3#Z 	)[3#\ 	+]3#^ 
>_3#` 	&a3#b 	,c3#d 	)e3# 3r   