Skip to main content
Glama

API Docs MCP Server

dammit.cpython-310.pyc34.1 kB
o �I�g��@s�UdZdZddlmZddlmZddlZddlmZddlZddl m Z m Z ddl m Z dd lmZmZmZmZmZmZmZmZmZmZdd lmZdd lmZmZddlZdZee e d <zddl!Z!e!ZWn-e"y�zddl#Z#e#ZWne"y�zddl$Z$e$ZWn e"y�YnwYnwYnwd e%dee&fdd�Z'dZ(e&e d<dZ)e&e d<e*�Z+eeee&effe d<e�,e)�-d�ej.�e�,e(�-d�ej.�d�e+e%<e�,e)ej.�e�,e(ej.�d�e+e&<Gdd�de/�Z0e0�1�Gdd�d�Z2Gdd�d�Z3dS)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�returncCs(tdus t|t�r dSt}|�|�dS)z?Try as hard as possible to detect the encoding of a bytestring.N�encoding)r� isinstance�str�detect)r�module�r�XC:\Users\apqls\Documents\Github\tkbase\api-docs-mcp\venv\Lib\site-packages\bs4/dammit.py�_chardet_dammitGsr z$^\s*<\?.*encoding=['"](.*?)['"].*\?>� xml_encodingz0<\s*meta[^>]+charset\s*=\s*["']?([^>]*?)[ /;'">]� html_meta� encoding_res�ascii)�html�xmlc@s�eZdZUdZeeefed<eeefed<eeed<eeed<ed/dd ��Z d d d d dd�Z eeefed<e � de j �Ze � d�Zeeed<e � d�Zeeed<ede jdefdd��Zede jdefdd��Zede jdefdd��Zede jdefdd��Zededefd d!��Zed0ded#edefd$d%��Ze "d0ded#edefd&d'��Zed(edefd)d*��Zed(edefd+d,��Zed(edefd-d.��ZdS)1�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_RErNcCs�i}i}t�}tt�}tt���D]X\}}|�d�r!|dd�}n|}||vr+|||<|||<t|�dkr@t|�dkr@|dvr@qt|�dkrPtdd�|D��rPqt|�dkr`|d kr`|� |�q||d � |�qt�}|D]!} || } | s}|� | �qod � d d �| D��} |� d| | f�qot |� ��D] } | D]} |� | �q�q�dd� |�}|� d �dd� |�}t t ���D] \}}t|�}|||<q�||_||_t�|�|_t�|�|_dS)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<>css�|] }t|�dkVqdS)r/N)�ord��.0�xrrr� <genexpr>�s�z?EntitySubstitution._populate_class_variables.<locals>.<genexpr>�&r�cSsg|]}|d�qS)r.rr1rrr� <listcomp>��z@EntitySubstitution._populate_class_variables.<locals>.<listcomp>z %s(?![%s])z(%s)�|)�setr�sortedr�items�endswith�lenr0�all�add�join�list�valuesr�chrr)r(�re�compiler*r+)�clsZunicode_to_nameZname_to_unicodeZshort_entitiesZ long_entities_by_first_characterZname_with_semicolon� character�nameZ particles�shortZ long_versions�ignoreZ long_entitiesZ long_entityZ re_definitionZre_definition_with_ampersand� codepointrrr�_populate_class_variables�sR     �    �z,EntitySubstitution._populate_class_variablesZapos�quot�amp�lt�gt)�'�"r5�<�>�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�matchobjcCs.|�d�}|j�|�}|durd|Sd|S)zpUsed with a regular expression to substitute the appropriate HTML entity for a special character string.rN�&amp;%s;�&%s;)�groupr)�get)rGrYZoriginal_entity�entityrrr�_substitute_html_entitys  z*EntitySubstitution._substitute_html_entitycCs|j|�d�}d|S)zoUsed with a regular expression to substitute the appropriate XML entity for a special character string.rr[N)rVr\)rGrYr^rrr�_substitute_xml_entity)sz)EntitySubstitution._substitute_xml_entitycCsd|�d�S)NrZr.)r\)rGrYrrr�_escape_entity_name0sz&EntitySubstitution._escape_entity_namecCs$|�d�}||jvrd|Sd|S)Nr.r[rZ)r\r()rGrYZpossible_entityrrr� _escape_unrecognized_entity_name4s  z3EntitySubstitution._escape_unrecognized_entity_name�valuecCs6d}d|vrd|vrd}|�d|�}nd}|||S)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 rSrRz&quot;N)�replace)rGrcZ quote_withZ replace_withrrr�quoted_attribute_value;s z)EntitySubstitution.quoted_attribute_valueF�make_quoted_attributecC�"|j�|j|�}|r|�|�}|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. N)rX�subr`re�rGrcrfrrr�substitute_xmlcs z!EntitySubstitution.substitute_xmlcCrg)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. N)rWrhr`rerirrr�"substitute_xml_containing_entities|s z5EntitySubstitution.substitute_xml_containing_entitiesrcCs|j�|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. N)r+rhr_�rGrrrr�substitute_html�s�z"EntitySubstitution.substitute_htmlcC�$|j�|j|�}|j�|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. N)� ANY_ENTITY_RErhrar*r_rlrrr�substitute_html5�sz#EntitySubstitution.substitute_html5cCrn)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. N)rorhrbr*r_rlrrr�substitute_html5_raw�sz'EntitySubstitution.substitute_html5_raw)rN)F)�__name__� __module__� __qualname__�__doc__r r�__annotations__r � classmethodrMrVrErF�IrorWrX�Matchr_r`rarbre�boolrjrkrmrprqrrrrr'bs^    � � '��� �!r'c@s&eZdZUdZ     ddedeedeedeedeed eef d d �Zee d<ee d<ee d<ee e d <ee d<ee e d <ee d<ee e d<dee de e defdd�Z e dee fdd��Zededeeee ffdd��Ze  ddeeefdededee fdd��ZdS)�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. NF�markup�known_definite_encodings�is_html�exclude_encodings�user_encodings�override_encodingscCs�t|pg�|_|rtjdtdd�|j|7_|pg|_|p g}tdd�|D��|_d|_|dur4dn||_ d|_ |� |�\|_ |_ dS)NzcThe 'override_encodings' argument was deprecated in 4.10.0. Use 'known_definite_encodings' instead.�)� stacklevelcSsg|]}|���qSr)�lowerr1rrrr7/r8z-EncodingDetector.__init__.<locals>.<listcomp>F)rBr}�warnings�warn�DeprecationWarningr�r:r�chardet_encodingr~�declared_encoding�strip_byte_order_markr|�sniffed_encoding)�selfr|r}r~rr�r�rrr�__init__s � zEncodingDetector.__init__r�r�r�r�triedrcCs<|durdS|��}||jvrdS||vr|�|�dSdS)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. NFT)r�rr@)r�rr�rrr�_usable@s  zEncodingDetector._usableccs��t�}|jD] }|�||�r|Vq|jdur#|�|j|�r#|jV|jD] }|�||�r1|Vq&|jdur@|�|j|j�|_|jdurP|�|j|�rP|jV|j dur[t |j�|_ |j durk|�|j |�rk|j VdD] }|�||�rx|VqmdS)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��errr� encodingsQsB�  ��  � ��  � ��zEncodingDetector.encodings�datacCsd}t|t�r ||fSt|�dkr-|dd�dkr-|dd�dkr-d}|dd�}||fSt|�dkrO|dd�dkrO|dd�dkrOd}|dd�}||fS|dd �d krcd }|d d�}||fS|dd�d krwd }|dd�}||fS|dd�dkr�d}|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>)rGr�rrrrr��sB  ���  ����  � � � z&EncodingDetector.strip_byte_order_mark�search_entire_documentc Cs�|r t|�}}n d}tdtt|�d��}t|t�r tt}ntt}|d}|d}d} |j||d�} | s@|r@|j||d�} | durJ| ��d} | r[t| t�rW| � d d �} | � �SdS) 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$rd) r>�max�intr�bytesr#r�search�groups�decoder�) rGr|r~r�Z xml_endposZ html_endpos�res�xml_reZhtml_rer�Zdeclared_encoding_matchrrrr��s(     z'EncodingDetector.find_declared_encoding)NFNNN)FF)rrrsrtrur�r rrzr�rvrrr��propertyr r�rwrr�rrr�rrrrr{�sZ 9������ �   3 %� ����r{c@s� eZdZUdZgddgddfdedeedeedded eed eed eefd d �Z ee d<ee e d<ee d<ee e d<ee e d<e ee e fe d<ee d<dejdefdd�Zddd�Zee e fe d<gd�Zee d< �dde de dee fd d!�Z �dd"ed#e de de fd$d%�Zedee fd&d'��Zd(e dee fd)d*�Zd(e dee fd+d,�Zid-d.�d/d0�d1d2�d3d4�d5d6�d7d8�d9d:�d;d<�d=d>�d?d@�dAdB�dCdD�dEdF�dGdH�dIdJ�dKdH�dLdH�dMdNdOdPdQdRdSdTdUdVdWdXdHdYdZd[��Zeeee ee e fffe d\<id-d]�d/d0�d1d^�d3d_�d5d`�d7da�d9db�d;dc�d=dd�d?de�dAdf�dCdg�dEdh�dGdH�dIdi�dKdH�dLdH�idjdk�dldk�dmdn�dodn�dpdq�drds�dtdu�dvdw�dxdy�dzd{�d|d}�d~d�d�dH�d�d��d�d��d�d0�d�d���id�d��d�d��d�d��d�d��d�d��d�df�d�d��d�d��d�d��d�d��d�d��d�d0�d�d��d�ds�d�d��d�d��d�d���id�d��d�dk�d�d��d�d��d�dq�d�d^�d�d��d�d��d�d��d�d��d�d��d�d��d�dH�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�dq�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���dd���dd����dd�d�d�d�d��dd�d�d� �Zeee fe �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/��d0�d1��d2�d3��d4�d5��d6�d7��d8�d9��d:�d;��d<�d=��d>�d?��d@�dA��dB�dC��dD�dE��dF�dG��dH�dI��i�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��dd�de��df�dg��dh�di��dj�dk��i�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���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���Zee efe �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�de�de �de def�d�d��Z%dS(� 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~rr�r�c Cs||_g|_d|_||_tt�|_t||||||�|_t |t �s$|dkr1||_ t |�|_ d|_ dS|jj |_ d}|jjD]} |jj }|�| �}|durMqNq<|sp|jjD]} | dkr`|�| d�}|duro|j�d�d|_qpqT|dur|d|_ d|_ dS||_ dS)NF�r$rdzSSome characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.T)r��tried_encodings�contains_replacement_charactersr~rrr�logr{�detectorrrr|�unicode_markup�original_encodingr�� _convert_from�warning) r�r|r}r�r~rr�r��urrrrr�sR  �     �  ��  zUnicodeDammit.__init__r�r�r�r�r��matchrcCs�|�d�}|jdkr||jvr|j|��}|S|}|S||jvrT|j|}t|�turI|jdkr=d|d��d}|Sd|d��d}|Stt|�}|��}|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. r.r$r&s&#x�;�&rN) r\r��MS_CHARS_TO_ASCII�encode�MS_CHARS�type�tuplerr)r�r��origrhZ substitutionsrrr� _sub_ms_charls(   � �    � ��zUnicodeDammit._sub_ms_charz mac-romanz shift-jis)� macintoshzx-sjis�CHARSET_ALIASES)r�z iso-8859-1z iso-8859-2�ENCODINGS_WITH_SMART_QUOTES�strict�proposed�errorscCs�|�|�}|dus||f|jvrdS|}|j�||f�|j}|jdur7||jvr7d}t�|�}|�|j |�}z|� |||�}||_ ||_ W|j St yRYdSw)aBAttempt to convert the markup to the proposed encoding. :param proposed: The name of a character encoding. :param errors: An error handling strategy, used when calling `str`. :return: The converted markup, or `None` if the proposed encoding/error handling strategy didn't work. Ns([�-�]))� find_codecr��appendr|r�r�rErFrhr�� _to_unicoder�r�� Exception)r�r�r�Z lookup_resultr|Zsmart_quotes_reZsmart_quotes_compiledr�rrrr��s* ��  ��zUnicodeDammit._convert_fromr�rcCs t|||�S)z�Given a bytestring and its encoding, decodes the string into Unicode. :param encoding: The name of an encoding. :param errors: An error handling strategy, used when calling `str`. N)r)r�r�rr�rrrr��s zUnicodeDammit._to_unicodecCs|jsdS|jjS)zqIf the markup is an HTML document, returns the encoding, if any, declared *inside* the document. N)r~r�r�)r�rrr�declared_html_encoding�sz$UnicodeDammit.declared_html_encoding�charsetcCs`|�|j�||��p'|o|�|�dd��p'|o|�|�dd��p'|o%|��p'|}|r.|��SdS)z�Look up the Python codec corresponding to a given character set. :param charset: The name of a character set. :return: The name of a Python codec. �-r6�_N)�_codecr�r]rdr�)r�r�rcrrrr��s�� ��zUnicodeDammit.find_codecc Cs:|s|Sd}z t�|�|}W|SttfyY|Sw)N)�codecs�lookup� LookupError� ValueError)r�r��codecrrrr��s ��zUnicodeDammit._codec��)�euroZ20AC��� ��)�sbquoZ201A��)�fnofZ192��)�bdquoZ201E��)�hellipZ2026��)�daggerZ2020��)�DaggerZ2021��)�circZ2C6��)�permilZ2030��)�ScaronZ160��)�lsaquoZ2039��)�OEligZ152���?��)z#x17DZ17D����)�lsquoZ2018)�rsquoZ2019)�ldquoZ201C)�rdquoZ201D)�bullZ2022)�ndashZ2013)�mdashZ2014)�tildeZ2DC)�tradeZ2122)�scaronZ161)�rsaquoZ203A)�oeligZ153)z#x17EZ17E)�Yumlr6)������������������������������r�ZEUR�,�fz,,z...�+z++�^�%�SrTZOE�Zr�rRr�r�rSr�r��*r�r�r�z--r�~rz(TM)rrrrUrZoerr�zr�Y�����!���c��ZGBP���$��ZYEN��r9����z..��r6��z(th)��z<<������z(R)�����o��z+-���2���3����r����P�������1����z>>��z1/4��z1/2��z3/4�����A������������ZAE���C���E��������rx���������D���N���O���������������U�����������b���B���a������������Zae����r����������i�����������n�����������/�y) ������������������r�r/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ž�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¸�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Ò��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í��sî��sï��sð��sñ��sò��só��sô��sõ��sö��s÷��sø��sù��sú��sûsüsýsþ)�������WINDOWS_1252_TO_UTF8))r�r�r�)r�r�r�)r�r�r��MULTIBYTE_MARKERS_AND_SIZESr�FIRST_MULTIBYTE_MARKERr-r.�LAST_MULTIBYTE_MARKER�utf8r��in_bytes� main_encoding�embedded_encodingc Cs|�dd���dvrtd��|��dvrtd��g}d}d}|t|�krt||}||jkrI||jkrI|jD]8\}} } ||krH|| krH|| 7}qnq5|dkrj||jvrj|�|||��|�|j|�|d 7}|}n|d 7}|t|�ks$|dkrz|S|�||d ��d � |�S) aFix characters from one encoding embedded in some other encoding. Currently the only situation supported is Windows-1252 (or its subset ISO-8859-1), embedded in UTF-8. :param in_bytes: A bytestring that you suspect contains characters from multiple encodings. Note that this *must* be a bytestring. If you've already converted the document to Unicode, you're too late. :param main_encoding: The primary encoding of ``in_bytes``. :param embedded_encoding: The encoding that was used to embed characters in the main document. :return: A bytestring similar to ``in_bytes``, in which ``embedded_encoding`` characters have been converted to their ``main_encoding`` equivalents. r�r�)r�� windows_1252zPWindows-1252 and ISO-8859-1 are the only currently supported embedded encodings.)rr�z4UTF-8 is the only currently supported main encoding.rr/r.Nr�) rdr��NotImplementedErrorr>rrrrr�rA) rGrrr Z byte_chunksZ chunk_start�pos�byte�start�end�sizerrr� detwingle;s<� � � � zUnicodeDammit.detwingle)r�)rr�)&rrrsrtrur�r rrrzr�rvrrr rrrEryr�r�r r�r�r�r�r�r�r�r�rr�rr�rrrrwrrrrrr��s� +��� ���� �K   )���� �(���� � �������� � � � � �����(�+�������� � � � � ������������������� �!�"�#�$�%�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�@�A�B�C�D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]�^�_�`�a�b�c�d�e�f�g�h�i�j�k�l�m�n�o�p�q�r�s�t�u�v�w�x�y�� �������� � � � � ������������������� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�@�A�B�C�D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]�^�_�`�a�b�c�d�e�f�g�h�i�j�k�l�m�n�o�p�q�r�s�t�u�v�w�x�"~�����r�)4ru� __license__� html.entitiesr� collectionsrr�rrE�loggingrr�typesr�typingr r r r r rrrrrZtyping_extensionsrZ bs4._typingrrr�rrvZcchardet� ImportError�chardetZcharset_normalizerr�rr r!r"�dictr#rFr�rx�objectr'rMr{r�rrrr�<module>sf    0    �����  � �   �z

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShotaNagafuchi/api-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server