Files
cms-website/.deps_siteforge_v812/bs4/__pycache__/dammit.cpython-312.pyc
T

422 lines
47 KiB
Plaintext
Raw Normal View History

Ë
ïÅÙjÀÞãó(—UdZdZddlmZddlmZddlZddlmZddlZddl m
Z
m Z ddl m
Z
dd lmZmZmZmZmZmZmZmZmZmZdd
lmZdd lmZmZddlZdZee
e d < ddl!Z!e!Zd
e%dee&fd„Z'dZ(e&e d<dZ)e&e d<e*«Z+eeee&effe d<ejXe)j[d«ej\«ejXe(j[d«ej\«dœe+e%<ejXe)ej\«ejXe(ej\«dœe+e&<Gd„de/«Z0e0jc«Gd„d«Z2Gd„d«Z3y#e"$r* ddl#Z#e#Zn#e"$r ddl$Z$e$Zn #e"$rYnwxYwYnwxYwY�Œ'wxYw)a~Beautiful Soup bonus library: Unicode, Dammit
This library converts a bytestream to Unicode through any means
necessary. It is heavily based on code from Mark Pilgrim's `Universal
Feed Parser <https://pypi.org/project/feedparser/>`_, now maintained
by Kurt McKee. It does not rewrite the body of an XML or HTML document
to reflect a new encoding; that's the job of `TreeBuilder`.
ÚMITé)Úcodepoint2name)Ú defaultdictN)Úhtml5)ÚLoggerÚ getLogger)Ú
ModuleType)
ÚDictÚIteratorÚListÚOptionalÚPatternÚSetÚTupleÚTypeÚUnionÚcast)ÚLiteral)Ú _EncodingÚ
_EncodingsÚchardet_moduleÚsÚreturncód—t�t|t«ryt}|j|«dS)z?Try as hard as possible to detect the encoding of a bytestring.NÚencoding)rÚ
isinstanceÚstrÚdetect)rÚmodules úNC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\bs4/dammit.pyÚ_chardet_dammitr!Gs-€äФ¨A¬sÔ!3ØÜ
€FØ �=‰=˜Ó ˜JÑ 'Ð'óz$^\s*<\?.*encoding=['"](.*?)['"].*\?>Ú xml_encodingz0<\s*meta[^>]+charset\s*=\s*["']?([^>]*?)[ /;'">]Ú html_metaÚ encoding_resÚascii)ÚhtmlÚxmlcó”—eZdZUdZeeefed<eeefed<eeed<eeed<ed#d„«Z d d
d d d
dœZ
eeefed<e jde j«Ze jd«Zeeed<e jd«Zeeed<ede j"defd„«Zede j"defd„«Zede j"defd„«Zede j"defd„«Zededefd„«Zed$dededefd„«Ze d$dededefd„«Zededefd „«Zededefd!„«Zededefd"„«Zy)%ÚEntitySubstitutionzFThe ability to substitute XML or HTML entities for certain characters.ÚHTML_ENTITY_TO_CHARACTERÚCHARACTER_TO_HTML_ENTITYÚCHARACTER_TO_HTML_ENTITY_REÚ*CHARACTER_TO_HTML_ENTITY_WITH_AMPERSAND_RErNcón—i}i}t«}tt«}ttj««D]ª\}}|j d«r|dd}n|}||vr|||<|||<t
|«dk(rt|«dkr|dvrŒNt
|«dkDrtd„|D««rŒot
|«dk(r|dk7r|j|«Œ”||d j|«Œ¬t«}|D]T} || }
|
s|j| «Œd
j|
D� cgc]} | d‘Œ c} «} |j| ›d | ›d �«ŒVt|j««D]}
|
D]}|j|«ŒŒd
dj|«z}|jd«d
dj|«z}ttj««D]\}}t|«}|||<Œ||_||_t#j$|«|_t#j$|«|_ycc} w)uåInitialize variables used by this class to manage the plethora of
HTML5 named entities.
This function sets the following class variables:
CHARACTER_TO_HTML_ENTITY - A mapping of Unicode strings like "⦨" to
entity names like "angmsdaa". When a single Unicode string has
multiple entity names, we try to choose the most commonly-used
name.
HTML_ENTITY_TO_CHARACTER: A mapping of entity names like "angmsdaa" to
Unicode strings like "⦨".
CHARACTER_TO_HTML_ENTITY_RE: A regular expression matching (almost) any
Unicode string that corresponds to an HTML5 named entity.
CHARACTER_TO_HTML_ENTITY_WITH_AMPERSAND_RE: A very similar
regular expression to CHARACTER_TO_HTML_ENTITY_RE, but which
also matches unescaped ampersands. This is used by the 'html'
formatted to provide backwards-compatibility, even though the HTML5
spec allows most ampersands to go unescaped.
Ú;Néÿÿÿÿéé€z<>c3ó8K—|]}t|«dk–—Œy­w)r3N)Úord)Ú.0Úxs r Ú <genexpr>z?EntitySubstitution._populate_class_variables.<locals>.<genexpr>Åsèø€Ð)JÁ ¸1¬#¨a«&°3­,Á ùs‚Ú&rÚz(?![z])z(%s)Ú|)ÚsetrÚsortedrÚitemsÚendswithÚlenr5ÚallÚaddÚjoinÚlistÚvaluesrÚchrr,r+ÚreÚcompiler-r.)ÚclsÚunicode_to_nameÚname_to_unicodeÚshort_entitiesÚ long_entities_by_first_characterÚname_with_semicolonÚ characterÚnameÚ particlesÚshortÚ
long_versionsr7ÚignoreÚ
long_entitiesÚ long_entityÚ
re_definitionÚre_definition_with_ampersandÚ codepoints r Ú_populate_class_variablesz,EntitySubstitution._populate_class_variables€s1€ð0ˆØˆä›ˆÜ+6´sÓ+;Ð(ä.4´U·[±[³]Ö.CÑ *Ð  ð#×+Ñ+¨CÔ0Ø*¨3¨BÐ/‘à*�ð
˜?Ñ*Ø(1� Ñ%ð
*.ˆO˜IÑ &ô�9‹~ Ò"¤s¨9£~¸Ò';À ÐQUÑ@Uð
ä�9‹~ Ò!¤cÑ)JÁ Ó)JÔ&Jðô�9‹~ Ò" y°CÒ'7Ø×"Ñ" 9Õ-à0°¸1±Ñ>×BÑBÀ9ÕMð{/DôB“Eˆ Û#ˆEØ<¸UÑCˆMÙ Ø—
‘
˜eÕ$àŸ™±
Ó!>±
¨1 ! A£$°
Ñ!>Ó?�ð—
‘
ªe²VÐ<Õ=ð$ô"Ð"B×"IÑ"IÓ"KÖLˆMÛ,� Ø—
‘
˜kÕ*ñ -ðMð §¡¨)Ó!4Ñ4ˆ
à�
‰
�cÔØ'-°·±¸Ó0CÑ'CÐ$ô $¤N×$8Ñ$8Ó$:Ö;‰OˆI�tܘI›ˆIØ)-ˆO˜IÒ &ð <ð(7ˆÔ$Ø'6ˆÔ$Ü*,¯*©*°]Ó*CˆÔ'Ü9;¿¹Ø (ó:
ˆÕ6ùò7"?sÄ H2
ÚaposÚquotÚampÚltÚgt)Ú'Ú"r9Ú<Ú>ÚCHARACTER_TO_XML_ENTITYz&(#\d+|#x[0-9a-fA-F]+|\w+);z&([<>]|&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;))ÚBARE_AMPERSAND_OR_BRACKETz([<>&])ÚAMPERSAND_OR_BRACKETÚmatchobjcór—|jd«}|jj|«}|€d|zSd|zS)zpUsed with a regular expression to substitute the
appropriate HTML entity for a special character string.rú&amp;%s;ú&%s;)Úgroupr,Úget)rIrgÚoriginal_entityÚentitys r Ú_substitute_html_entityz*EntitySubstitution._substitute_html_entitysB€ð#Ÿ.™.¨Ó+ˆØ×-Ñ-×1Ñ1°/ÓBˆØ ˆ>Ø Ñ/Ð /ؘ‰Ðr"cóH—|j|jd«}d|zS)zoUsed with a regular expression to substitute the
appropriate XML entity for a special character string.rrj)rdrk)rIrgrns r Ú_substitute_xml_entityz)EntitySubstitution._substitute_xml_entity)s'€ð×,Ñ,¨X¯^©^¸AÓ->Ñ?ˆØ˜‰Ðr"có*—d|jd«zS)Nrir2)rk)rIrgs r Ú_escape_entity_namez&EntitySubstitution._escape_entity_name0s€à˜HŸN™N¨1Ó-Ñ-Ð-r"cóT—|jd«}||jvrd|zSd|zS)Nr2rjri)rkr+)rIrgÚpossible_entitys r Ú _escape_unrecognized_entity_namez3EntitySubstitution._escape_unrecognized_entity_name4s4€à"Ÿ.™.¨Ó+ˆØ ˜c×:Ñ:Ñ :ؘOÑ+Ð +ؘOÑ+Ð+r"ÚvaluecóT—d}d|vrd|vrd}|jd|«}nd}||z|zS)aƒMake a value into a quoted XML attribute, possibly escaping it.
Most strings will be quoted using double quotes.
Bob's Bar -> "Bob's Bar"
If a string contains double quotes, it will be quoted using
single quotes.
Welcome to "my bar" -> 'Welcome to "my bar"'
If a string contains both single and double quotes, the
double quotes will be escaped, and the string will be quoted
using double quotes.
Welcome to "Bob's Bar" -> Welcome to &quot;Bob's bar&quot;
:param value: The XML attribute value to quote
:return: The quoted value
rar`z&quot;)Úreplace)rIrwÚ
quote_withÚ replace_withs r Úquoted_attribute_valuez)EntitySubstitution.quoted_attribute_value;sE€ð,ˆ
Ø �%‰<Ø�e‰|ð (� ØŸ
™
 c¨<Ó8‘ð!�
ؘEÑ! JÑ.Ð.r"Úmake_quoted_attributecóx—|jj|j|«}|r|j|«}|S)avReplace special XML characters with named XML entities.
The less-than sign will become &lt;, the greater-than sign
will become &gt;, and any ampersands will become &amp;. If you
want ampersands that seem to be part of an entity definition
to be left alone, use `substitute_xml_containing_entities`
instead.
:param value: A string to be substituted.
:param make_quoted_attribute: If True, then the string will be
quoted, as befits an attribute value.
:return: A version of ``value`` with special characters replaced
with named entities.
)rfÚsubrqr|©rIrwr}s r Úsubstitute_xmlz!EntitySubstitution.substitute_xmlcs:€ð&×(Ñ(×,Ñ,¨S×-GÑ-GÈÓOˆá Ø×.Ñ.¨uÓ5ˆE؈ r"cóx—|jj|j|«}|r|j|«}|S)aŸSubstitute XML entities for special XML characters.
:param value: A string to be substituted. The less-than sign will
become &lt;, the greater-than sign will become &gt;, and any
ampersands that are not part of an entity defition will
become &amp;.
:param make_quoted_attribute: If True, then the string will be
quoted, as befits an attribute value.
)rerrqr|r€s r Ú"substitute_xml_containing_entitiesz5EntitySubstitution.substitute_xml_containing_entities|s:€ð ×-Ñ-×1Ñ1°#×2LÑ2LÈeÓTˆá Ø×.Ñ.¨uÓ5ˆE؈ r"rcóN—|jj|j|«S)aReplace certain Unicode characters with named HTML entities.
This differs from ``data.encode(encoding, 'xmlcharrefreplace')``
in that the goal is to make the result more readable (to those
with ASCII displays) rather than to recover from
errors. There's absolutely nothing wrong with a UTF-8 string
containg a LATIN SMALL LETTER E WITH ACUTE, but replacing that
character with "&eacute;" will make it more readable to some
people.
:param s: The string to be modified.
:return: The string with some Unicode characters replaced with
HTML entities.
)r.rro©rIrs r Úsubstitute_htmlz"EntitySubstitution.substitute_html’s(€ð"×=Ñ=×AÑAØ × 'Ñ '¨ó
ð
r"cóž—|jj|j|«}|jj|j|«}|S)aHReplace certain Unicode characters with named HTML entities
using HTML5 rules.
Specifically, this method is much less aggressive about
escaping ampersands than substitute_html. Only ambiguous
ampersands are escaped, per the HTML5 standard:
"An ambiguous ampersand is a U+0026 AMPERSAND character (&)
that is followed by one or more ASCII alphanumerics, followed
by a U+003B SEMICOLON character (;), where these characters do
not match any of the names given in the named character
references section."
Unlike substitute_html5_raw, this method assumes HTML entities
were converted to Unicode characters on the way in, as
Beautiful Soup does. By the time Beautiful Soup does its work,
the only ambiguous ampersands that need to be escaped are the
ones that were escaped in the original markup when mentioning
HTML entities.
:param s: The string to be modified.
:return: The string with some Unicode characters replaced with
HTML entities.
)Ú
ANY_ENTITY_RErrsr-ror…s r Úsubstitute_html5z#EntitySubstitution.substitute_html5§sG€ð6
× Ñ × !Ñ ! #×"9Ñ"9¸1Ó =ˆð
× +Ñ +× /Ñ /°×0KÑ0KÈQÓ Oˆàˆr"cóž—|jj|j|«}|jj|j|«}|S)a¥Replace certain Unicode characters with named HTML entities
using HTML5 rules.
substitute_html5_raw is similar to substitute_html5 but it is
designed for standalone use (whereas substitute_html5 is
designed for use with Beautiful Soup).
:param s: The string to be modified.
:return: The string with some Unicode characters replaced with
HTML entities.
)rˆrrvr-ror…s r Úsubstitute_html5_rawz'EntitySubstitution.substitute_html5_rawÉsG€ð
× Ñ × !Ñ ! #×"FÑ"FÈÓ Jˆð
× +Ñ +× /Ñ /°×0KÑ0KÈQÓ Oˆàˆr")rN)F)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r
rÚ__annotations__rÚ classmethodrZrdrGrHÚIrˆrerfÚMatchrorqrsrvr|Úboolr�rƒr†r‰r‹©r"r r*r*bsI…ÙPð
# 3¨ 8™nÓ,ð # 3¨ 8™nÓ,ð")¨¡Ó-ð18¸± Ó<àòA
óðA
ðNØ
Ø
Ø
Ø
ñ /ИT # s (™^óð�B—J‘JÐ>ÀÇÁÓE€Mð /9¨b¯j©jØ8ó/Иw s™|óð*4¨¯©°IÓ)>И' #™,Ó>àð¨r¯x©xð¸Còóððð¨b¯h©hð¸3òóðð ð.¨2¯8©8ð.¸ò.óð.ðð,¸¿¹ð,ÀSò,óð,ð ð%/¨3ð%/°3ò%/óð%/ðNñ 3ð¸tðÐPSòóðð0à7<ñØðØ04ðà òóðð*ð
 ð
¨ò
óð
ð(ð ð¨òóððBð Sð¨Sòóñr"r*có\—eZdZUdZ ddedeedeedeedeedeef d „Zee d<ee d<ee d<ee
e d
<ee d<ee
e d <ee d<ee
e d <d
ee
de e
defd„Z e
dee
fd„«Zededeeee
ffd„«Ze ddeeefdededee
fd„«Zy)ÚEncodingDetectoraúThis class is capable of guessing a number of possible encodings
for a bytestring.
Order of precedence:
1. Encodings you specifically tell EncodingDetector to try first
(the ``known_definite_encodings`` argument to the constructor).
2. An encoding determined by sniffing the document's byte-order mark.
3. Encodings you specifically tell EncodingDetector to try if
byte-order mark sniffing fails (the ``user_encodings`` argument to the
constructor).
4. An encoding declared within the bytestring itself, either in an
XML declaration (if the bytestring is to be interpreted as an XML
document), or in a <meta> tag (if the bytestring is to be
interpreted as an HTML document.)
5. An encoding detected through textual analysis by chardet,
cchardet, or a similar external library.
6. UTF-8.
7. Windows-1252.
:param markup: Some markup in an unknown encoding.
:param known_definite_encodings: When determining the encoding
of ``markup``, these encodings will be tried first, in
order. In HTML terms, this corresponds to the "known
definite encoding" step defined in `section 13.2.3.1 of the HTML standard <https://html.spec.whatwg.org/multipage/parsing.html#parsing-with-a-known-character-encoding>`_.
:param user_encodings: These encodings will be tried after the
``known_definite_encodings`` have been tried and failed, and
after an attempt to sniff the encoding by looking at a
byte order mark has failed. In HTML terms, this
corresponds to the step "user has explicitly instructed
the user agent to override the document's character
encoding", defined in `section 13.2.3.2 of the HTML standard <https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding>`_.
:param override_encodings: A **deprecated** alias for
``known_definite_encodings``. Any encodings here will be tried
immediately after the encodings in
``known_definite_encodings``.
:param is_html: If True, this markup is considered to be
HTML. Otherwise it's assumed to be XML.
:param exclude_encodings: These encodings will not be tried,
even if they otherwise would be.
NÚmarkupÚknown_definite_encodingsÚis_htmlÚexclude_encodingsÚuser_encodingsÚoverride_encodingscó„—t|xsg«|_|r1tjdtd¬«|xj|z
c_|xsg|_|xsg}t
|D�cgc]}|j«‘Œc}«|_d|_ |€dn||_
d|_ |j|«\|_
|_ycc}w)NzcThe 'override_encodings' argument was deprecated in 4.10.0. Use 'known_definite_encodings' instead.é)Ú
stacklevelF)rDr™ÚwarningsÚwarnÚDeprecationWarningrœr<Úlowerr›Úchardet_encodingršÚdeclared_encodingÚstrip_byte_order_markr˜Úsniffed_encoding)Úselfr˜r™ršr›rœr�r7s r Ú__init__zEncodingDetector.__init__s¿€ô)-Ð-EÒ-KÈÓ(LˆÔ%Ù Ü �M‰MØuÜ"Øõ
ð
× )Ò )Ð-?Ñ ?Õ )Ø,Ò2°ˆÔØ-Ò3°ÐÜ!$Ñ9JÓ%KÑ9J°A a§g¡g¥iÐ9JÑ%KÓ!LˆÔØ $ˆÔØ ' ‘u°WˆŒ Ø04ˆÔð.2×-GÑ-GÈÓ-OÑ*ˆŒ �TÕ*ùò
&LsÁ"B=r¥r¦r¨rÚtriedrcót—|€y|j«}||jvry||vr|j|«yy)zÕShould we even bother to try this encoding?
:param encoding: Name of an encoding.
:param tried: Encodings that have already been tried. This
will be modified as a side effect.
FT)r¤r›rB)r©rr«s r Ú_usablezEncodingDetector._usable@sD€ð Ð ØØ—>‘>Ó#ˆØ �t×-Ñ-Ñ -ØØ ˜5Ñ Ø �I‰I�hÔ ØØr"c#óúK—t«}|jD]}|j||«sŒ|–—Œ|j�*|j|j|«r|j–—|jD]}|j||«sŒ|–—Œ|j
€+|j
|j|j«|_|j
�*|j|j
|«r|j
–—|j€t|j«|_ |j�*|j|j|«r|j–—dD]}|j||«sŒ|–—Œy­w)zÐYield a number of encodings that might work for this markup.
:yield: A sequence of strings. Each is the name of an encoding
that *might* work to convert a bytestring into Unicode.
N)úutf-8ú windows-1252) r<r™r­r¨rœr¦Úfind_declared_encodingr˜ršr¥r!)r©r«Úes r Ú encodingszEncodingDetector.encodingsQsYèø€ô!$£ˆð×.Ô.ˆAØ�|‰|˜A˜uÕ%Ø“ð/ð × Ñ Ð ,°·±Ø × !Ñ ! 5ô2
ð×'Ñ'Ò 'ð×$Ô$ˆAØ�|‰|˜A˜uÕ%Ø“ð%ð × !Ñ !Ð )Ø%)×%@Ñ%@Ø— ‘ ˜TŸ\™\ó&ˆDÔ "ð × !Ñ !Ð -°$·,±,Ø × "Ñ " Eô3
ð×(Ñ(Ò (ð × Ñ Ð (Ü$3°D·K±KÓ$@ˆDÔ !Ø × Ñ Ð ,°·±Ø × !Ñ ! 5ô2
ð×'Ñ'Ò 'ó+ˆAØ�|‰|˜A˜uÕ%Ø“ñ+ùs‚,E;¯AE;Â
C&E;Å4E;ÚdatacóD—d}t|t«r||fSt|«dk\r|dddk(r|dddk7r d}|dd}||fSt|«dk\r|dddk(r|dddk7r d}|dd}||fS|dd d
k(r d }|d d}||fS|ddd k(r d
}|dd}||fS|dddk(rd}|dd}||fS)aIf a byte-order mark is present, strip it and return the encoding it implies.
:param data: A bytestring that may or may not begin with a
byte-order mark.
:return: A 2-tuple (data stripped of byte-order mark, encoding implied by byte-order mark)
Néésþÿszutf-16besÿþzutf-16lerŸsr¯sþÿzutf-32besÿþzutf-32le)rrr@)rIr´rs r r§z&EncodingDetector.strip_byte_order_mark…s)€ðˆÜ �dœCÔ à˜�>Ð !ä
�‹Y˜!Š^Ø�b�q�˜[Ò(Ø�a˜�˜kÒ)à!ˆHؘ˜�8ˆDð"�Xˆ~Ðô�‹Y˜!Š^Ø�b�q�˜[Ò(Ø�a˜�˜kÒ)à!ˆHؘ˜�8ˆDð�Xˆ~Ðð�"�1ˆX˜Ò
(؈Hؘ˜�8ˆDð�Xˆ~Ðð
�"�1ˆXÐ,Ò
,Ø!ˆHؘ˜�8ˆDð�Xˆ~Ðð�"�1ˆXÐ,Ò
,Ø!ˆHؘ˜�8ˆDØ�Xˆ~Ðr"Úsearch_entire_documentcó¾—|rt|«x}}n#d}tdtt|«dz««}t|t«rt
t}n
t
t }|d}|d}d} |j||¬«}
|
s|r|j||¬«}
|
�|
j«d} | r2t| t«r| jd d
«} | j«Sy) a'Given a document, tries to find an encoding declared within the
text of the document itself.
An XML encoding is declared at the beginning of the document.
An HTML encoding is declared in a <meta> tag, hopefully near the
beginning of the document.
:param markup: Some markup.
:param is_html: If True, this markup is considered to be HTML. Otherwise
it's assumed to be XML.
:param search_entire_document: Since an encoding is supposed
to declared near the beginning of the document, most of
the time it's only necessary to search a few kilobytes of
data. Set this to True to force this method to search the
entire document.
:return: The declared encoding, if one is found.
iigš™™™™™©?r(r'N)Úendposrr&ry) r@ÚmaxÚintrÚbytesr%rÚsearchÚgroupsÚdecoder¤) rIr˜ršr¸Ú
xml_endposÚ html_endposÚresÚxml_reÚhtml_rer¦Údeclared_encoding_matchs r r±z'EncodingDetector.find_declared_encoding«sâ€ñ2 "Ü'*¨6£{Ð 2ˆJ™àˆJܘd¤C¬¨F« °dÑ(:Ó$;Ó<ˆKä �fœeÔ $ÜœuÑ%‰CäœsÑ#ˆCà�U‘ˆØ�f‘+ˆØ15ÐØ"(§-¡-°¸z -Ó"JÐÙ&©7Ø&-§n¡n°VÀK nÓ&PÐ #Ø "Ð .Ø 7× >Ñ >Ó @ÀÑ CÐ Ù ÜÐ+¬UÔ3Ø$5×$<Ñ$<¸WÀiÓ$PÐ!Ø$×*Ñ*Ó,Ð ,Ør")NFNNN)FF)rŒr�rŽr�r½r
rr”rªr�rrr­Úpropertyr r³r‘rr§rrr±r•r"r r—r—ås|…ñ4ðr:>Ø"'Ø26Ø/3Ø37ñPàðPð#+¨:Ñ"6ðPð˜$‘ð Pð
$ JÑ/ð Pð ! Ñ,ð
Pð% ZÑ0óPð6)Ó(ØÓØ!Ó!ؘyÑ)Ó)Ø
ƒMØ  Ñ*Ó*Ø ƒMؘyÑ)Ó)ð ¨Ñ 3ð¸CÀ ¹NðÈtóð"ð1˜8 IÑ.ò1óð1ðfð#¨ð#°5¸ÀÈÑ@SÐ9SÑ3Tò#óð#ðJðØ',ñ /à�e˜S�jÑ!ð/ðð/ð!%ð /ð
�)Ñ ò /óñ/r"r—cóF —eZdZUdZgddgddfdedeedeedded eed
eed eefd „Z ee
d<ee e
d
<ee
d<ee e
d<ee e
d<e
ee e fe
d<ee
d<dej"defd„ZdddœZee e fe
d<gd¢Zee
d< �dde de dee fd„Z �ddede de de fd „Zedee fd!„«Zd"e dee fd#„Zd"e dee fd$„Zid%d&“d'd(“d)d*“d+d,“d-d.“d/d0“d1d2“d3d4“d5d6“d7d8“d9d:“d;d<“d=d>“d?d@“dAdB“dCd@“dDd@“dEdFdGdHdIdJdKdLdMdNdOdPd@dQdRdSœ¥Zeeee ee e fffe
dT<id%dU“d'd(“d)dV“d+dW“d-dX“d/dY“d1dZ“d3d[“d5d\“d7d]“d9d^“d;d_“d=d`“d?d@“dAda“dCd@“dDd@“idbdc“dddc“dedf“dgdf“dhdi“djdk“dldm“dndo“dpdq“drds“dtdu“dvdw“dxd@“dydz“d{d|“d}d(“d~d“¥id€d�“d‚dƒ“d„d…“d†d‡“dˆd‰“dŠd^“d‹dŒ“d�dŽ“d�d�“d‘d’“d“d“d”d(“d•d–“d—dk“d˜d™“dšd›“dœd�“¥idždŸ“d dc“d¡d¢“d£d¤“d¥di“d¦dV“d§d¨“d©d�“dªd«“d¬d­“d®d¯“d°d±“d²d@“d³d´“dµd´“d¶d´“d·d´“¥id¸d´“d¹d´“dºd»“d¼d½“d¾d¿“dÀd¿“dÁd¿“dÂd¿“dÃdÄ“dÅdÄ“dÆdÄ“dÇdÄ“dÈdÉ“dÊdË“dÌdÍ“dÎdÍ“dÏdÍ“¥idÐdÍ“dÑdÍ“dÒdi“dÓdÍ“dÔdÕ“dÖdÕ“d×dÕ“dØdÕ“dÙd|“dÚdÛ“dÜdÝ“dÞdß“dàdß“dádß“dâdß“dãdß“dädß“¥idådæ“dçd�“dèdé“dêdé“dëdé“dìdé“dídî“dïdî“dðdî“dñdî“dòd™“dódô“dõd™“död™“d÷d™“død™“dùd™“¥dúd™d¢d¢d¢d¢dûdÛdûdüœ ¥Zeee fe
dý<idþdÿ“�d�d“�d�d“�d�d“�d�d“�d�d “�d
�d “�d �d
“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“i�d �d!“�d"�d#“�d$�d%“�d&�d'“�d(�d)“�d*�d+“�d,�d-“�d.�d/“�d0�d1“�d2�d3“�d4�d5“�d6�d7“�d8�d9“�d:�d;“�d<�d=“�d>�d?“�d@�dA“¥i�dB�dC“�dD�dE“�dF�dG“�dH�dI“�dJ�dK“�dL�dM“�dN�dO“�dP�dQ“�dR�dS“�dT�dU“�dV�dW“�dX�dY“�dZ�d[“�d\�d]“�d^�d_“�d`�da“�db�dc“¥i�dd�de“�df�dg“�dh�di“�dj�dk“�dl�dm“�dn�do“�dp�dq“�dr�ds“�dt�du“�dv�dw“�dx�dy“�dz�d{“�d|�d}“�d~�d“�d€�d�“�d‚�dƒ“�d„�d…“¥i�d†�d‡“�dˆ�d‰“�dŠ�d‹“�dŒ�d�“�dŽ�d�“�d��d‘“�d’�d““�d”�d•“�d–�d—“�d˜�d™“�dš�d›“�dœ�d�“�dž�dŸ“�d �d¡“�d¢�d£“�d¤�d¥“�d¦�d§“¥i�d¨�d©“�dª�d«“�d¬�d­“�d®�d¯“�d°�d±“�d²�d³“�d´�dµ“�d¶d~“�d·�d¸“�d¹�dº“�d»�d¼“�d½�d¾“�d¿�dÀ“�dÁ�d“�dÃ�dÄ“�dÅ�dÆ“�dÇ�dÈ“¥i�dÉ�dÊ“�dË�dÌ“�dÍ�dΓ�dÏ�dГ�dÑ�dÒ“�dÓ�dÔ“�dÕ�dÖ“�d×�dØ“�dÙ�dÚ“�dÛ�dÜ“�dÝ�dÞ“�dß�dà“�dá�dâ“�dã�dä“�då�dæ“�dç�dè“�dé�dê“¥�dë�dì�dí�dî�dZee efe
�dð<e!g�dñ¢«Z"e#e e
�dò<g�dó¢Z$e
ee e e fe
�dô<e$�dõ�dõZ%e e
�dö<e$�d÷�døZ&e e
�dù<e'�dúe dee eff�dû„«Z(e' �d�düe�dýe �dþe def�dÿ„«Z)y(Ú
UnicodeDammita#A class for detecting the encoding of a bytestring containing an
HTML or XML document, and decoding it to Unicode. If the source
encoding is windows-1252, `UnicodeDammit` can also replace
Microsoft smart quotes with their HTML or XML equivalents.
:param markup: HTML or XML markup in an unknown encoding.
:param known_definite_encodings: When determining the encoding
of ``markup``, these encodings will be tried first, in
order. In HTML terms, this corresponds to the "known
definite encoding" step defined in `section 13.2.3.1 of the HTML standard <https://html.spec.whatwg.org/multipage/parsing.html#parsing-with-a-known-character-encoding>`_.
:param user_encodings: These encodings will be tried after the
``known_definite_encodings`` have been tried and failed, and
after an attempt to sniff the encoding by looking at a
byte order mark has failed. In HTML terms, this
corresponds to the step "user has explicitly instructed
the user agent to override the document's character
encoding", defined in `section 13.2.3.2 of the HTML standard <https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding>`_.
:param override_encodings: A **deprecated** alias for
``known_definite_encodings``. Any encodings here will be tried
immediately after the encodings in
``known_definite_encodings``.
:param smart_quotes_to: By default, Microsoft smart quotes will,
like all other characters, be converted to Unicode
characters. Setting this to ``ascii`` will convert them to ASCII
quotes instead. Setting it to ``xml`` will convert them to XML
entity references, and setting it to ``html`` will convert them
to HTML entity references.
:param is_html: If True, ``markup`` is treated as an HTML
document. Otherwise it's treated as an XML document.
:param exclude_encodings: These encodings will not be considered,
even if the sniffing code thinks they might make sense.
NFr˜r™Úsmart_quotes_to)r&r(r'ršr›rœr�có¢—||_g|_d|_||_t t
«|_t||||||«|_t|t«r%|jd«|_ ||_
d|_y|jj|_ d}|jjD]-} |jj}|j!| «}|€Œ-n|sX|jjD]?} | dk7r|j!| d«}|€Œ|j j#d«d|_n|€d|_d|_
y||_
y)NFÚutf8r&ryzSSome characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.T)rÊÚtried_encodingsÚcontains_replacement_charactersršrrŒÚlogr—ÚdetectorrrÚencoder˜Úunicode_markupÚoriginal_encodingr³Ú
_convert_fromÚwarning)
r©r˜r™rÊršr›rœr�Úurs
r rªzUnicodeDammit.__init__sM€ð /ˆÔØ!ˆÔØ/4ˆÔ,؈Œ ÜœXÓ&ˆŒÜ(Ø Ø $Ø Ø Ø Ø ó

ˆŒ
ô �fœcÔ "Ø Ÿ-™-¨Ó/ˆDŒKØ"(ˆDÔ Ø%)ˆDÔ "Ø ð—m‘m×*Ñ*ˆŒ à ˆØŸ
™
×/Ô/ˆHØ—]‘]×)Ñ)ˆFØ×"Ñ" 8Ó,ˆA؉}Ùð 0ñ ð!ŸM™M×3Ô3�ؘwÒ&Ø×*Ñ*¨8°YÓ?�AØ‘=Ø—H‘H×$Ñ$ð?ôð
<@�DÔ8Ùð4ð(
ˆ9Ø%)ˆDÔ "Ø"&ˆDÕ à"#ˆDÕ r"rÒrÎrÓrÍrÏÚmatchrcóÖ—|jd«}|jdk(r1||jvr|j|j«}|S|}|S||jvr‡|j|}t |«t urE|jdk(rd|dj«zdz}|Sd|dj«zdz}|Stt|«}|j«}|S|}|S)züChanges a MS smart quote character to an XML or HTML
entity, or an ASCII character.
TODO: Since this is only used to convert smart quotes, it
could be simplified, and MS_CHARS_TO_ASCII made much less
parochial.
r2r&r(s&#xó;ó&r) rkrÊÚMS_CHARS_TO_ASCIIrÑÚMS_CHARSÚtypeÚtuplerr)r©r×ÚorigrÚ
substitutionss r Ú _sub_ms_charzUnicodeDammit._sub_ms_charls €ð—k‘k !“nˆà × Ñ  7Ò *Ø�t×-Ñ-Ñ-Ø×,Ñ,¨TÑ2×9Ñ9Ó;�ð(ˆ
ð!�ð ˆ
ð�t—}‘}Ñ$Ø $§
¡
¨dÑ 3�
ܘ
Ó&¬%Ñ/Ø×+Ñ+¨uÒ4Ø$ }°QÑ'7×'>Ñ'>Ó'@Ñ@À4ÑG˜ðˆ
ð# ]°1Ñ%5×%<Ñ%<Ó%>Ñ>ÀÑE˜ðˆ
ô
%)¬¨mÓ$<�MØ'×.Ñ.Ó0�Cð
ˆ
ð�؈