Skip to main content
Glama

API Docs MCP Server

css.cpython-310.pyc12.5 kB
o �I�g�1�@s�UdZddlmZddlmZddlmZmZmZm Z m Z m Z ddl Z ddl mZe r?ddlmZddlmZdd lmZmZd ed <zddlZWneyYdZe �d �YnwGd d�de�ZdS)a,Integration code for CSS selectors using `Soup Sieve <https://facelessuser.github.io/soupsieve/>`_ (pypi: ``soupsieve``). Acquire a `CSS` object through the `element.Tag.css` attribute of the starting point of your CSS selector, or (if you want to run a selector against the entire document) of the `BeautifulSoup` object itself. The main advantage of doing this instead of using ``soupsieve`` functions is that you don't need to keep passing the `element.Tag` to be selected against, since the `CSS` object is permanently scoped to that `element.Tag`. �)� annotations)� ModuleType)�Any�cast�Iterable�Iterator�Optional� TYPE_CHECKINGN)�_NamespaceMapping)� SoupSieve)�element)� ResultSet�Tag�Optional[ModuleType]� soupsievezEThe soupsieve package is not installed. CSS selectors cannot be used.c@s�eZdZdZd3d4dd�Zd5d d �Zd6dd�Zd7dd�Z  d8d9dd �Z  d8d:d"d#�Z   d;d<d&d'�Z   d;d=d)d*�Z  d8d>d,d-�Z  d8d?d/d0�Z  d8d@d1d2�ZdS)A�CSSa�A proxy object against the ``soupsieve`` library, to simplify its CSS selector API. You don't need to instantiate this class yourself; instead, use `element.Tag.css`. :param tag: All CSS selectors run by this object will use this as their starting point. :param api: An optional drop-in replacement for the ``soupsieve`` module, intended for use in unit tests. N�tag� element.Tag�apircCs,|durt}|durtd��||_||_dS)NzLCannot execute CSS selectors because the soupsieve package is not installed.)r�NotImplementedErrorrr)�selfrr�r�UC:\Users\apqls\Documents\Github\tkbase\api-docs-mcp\venv\Lib\site-packages\bs4/css.py�__init__:s� z CSS.__init__�ident�str�returncCs"tdurtd��tt|j�|��S)z�Escape a CSS identifier. This is a simple wrapper around `soupsieve.escape() <https://facelessuser.github.io/soupsieve/api/#soupsieveescape>`_. See the documentation for that function for more information. NzMCannot escape CSS identifiers because the soupsieve package is not installed.)rrrrr�escape)rrrrrrDs �z CSS.escape�ns�Optional[_NamespaceMapping]�selectcCs"t||jj�s|dur|jj}|S)z%Normalize a dictionary of namespaces.N)� isinstancerr r� _namespaces)rrr rrr�_nsPszCSS._ns�results� Iterable[Tag]�ResultSet[Tag]cCsddlm}|d|�S)a?Normalize a list of results to a py:class:`ResultSet`. A py:class:`ResultSet` is more consistent with the rest of Beautiful Soup's API, and :py:meth:`ResultSet.__getattr__` has a helpful error message if you try to treat a list of results as a single result (a common mistake). r)r N)�bs4r )rr$r rrr�_rs[s zCSS._rsr� namespaces�flags�int�kwargsrr cKs |jj||�||�|fi|��S)aPre-compile a selector and return the compiled object. :param selector: A CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will use the prefixes it encountered while parsing the document. :param flags: Flags to be passed into Soup Sieve's `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method. :param kwargs: Keyword arguments to be passed into Soup Sieve's `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method. :return: A precompiled selector object. :rtype: soupsieve.SoupSieve N)r�compiler#�rr r)r*r,rrrr-hs z CSS.compile�element.Tag | NonecK�$|jj||j|�||�|fi|��S)a�Perform a CSS selection operation on the current Tag and return the first result, if any. This uses the Soup Sieve library. For more information, see that library's documentation for the `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method. :param selector: A CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will use the prefixes it encountered while parsing the document. :param flags: Flags to be passed into Soup Sieve's `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method. :param kwargs: Keyword arguments to be passed into Soup Sieve's `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method. N)r� select_onerr#r.rrrr1�s ��zCSS.select_one�limit�ResultSet[element.Tag]c Ks8|durd}|�|jj||j|�||�||fi|���S)a�Perform a CSS selection operation on the current `element.Tag`. This uses the Soup Sieve library. For more information, see that library's documentation for the `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method. :param selector: A CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will pass in the prefixes it encountered while parsing the document. :param limit: After finding this number of results, stop looking. :param flags: Flags to be passed into Soup Sieve's `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method. :param kwargs: Keyword arguments to be passed into Soup Sieve's `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method. Nr)r(rr rr#�rr r)r2r*r,rrrr �s���z CSS.select�Iterator[element.Tag]cKs&|jj||j|�||�||fi|��S)aUPerform a CSS selection operation on the current `element.Tag`. This uses the Soup Sieve library. For more information, see that library's documentation for the `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method. It is the same as select(), but it returns a generator instead of a list. :param selector: A string containing a CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will pass in the prefixes it encountered while parsing the document. :param limit: After finding this number of results, stop looking. :param flags: Flags to be passed into Soup Sieve's `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method. :param kwargs: Keyword arguments to be passed into Soup Sieve's `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method. N)r�iselectrr#r4rrrr6�s ��z CSS.iselect�Optional[element.Tag]cKr0)a�Find the `element.Tag` closest to this one that matches the given selector. This uses the Soup Sieve library. For more information, see that library's documentation for the `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method. :param selector: A string containing a CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will pass in the prefixes it encountered while parsing the document. :param flags: Flags to be passed into Soup Sieve's `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method. :param kwargs: Keyword arguments to be passed into Soup Sieve's `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method. N)r�closestrr#r.rrrr8�s ��z CSS.closest�boolc Ks*tt|jj||j|�||�|fi|���S)a�Check whether or not this `element.Tag` matches the given CSS selector. This uses the Soup Sieve library. For more information, see that library's documentation for the `soupsieve.match() <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_ method. :param: a CSS selector. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will pass in the prefixes it encountered while parsing the document. :param flags: Flags to be passed into Soup Sieve's `soupsieve.match() <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_ method. :param kwargs: Keyword arguments to be passed into SoupSieve's `soupsieve.match() <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_ method. N)rr9r�matchrr#r.rrrr: s���z CSS.matchc Ks*|�|jj||j|�||�|fi|���S)aNFilter this `element.Tag`'s direct children based on the given CSS selector. This uses the Soup Sieve library. It works the same way as passing a `element.Tag` into that library's `soupsieve.filter() <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_ method. For more information, see the documentation for `soupsieve.filter() <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_. :param namespaces: A dictionary mapping namespace prefixes used in the CSS selector to namespace URIs. By default, Beautiful Soup will pass in the prefixes it encountered while parsing the document. :param flags: Flags to be passed into Soup Sieve's `soupsieve.filter() <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_ method. :param kwargs: Keyword arguments to be passed into SoupSieve's `soupsieve.filter() <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_ method. N)r(r�filterrr#r.rrrr;/s���z CSS.filter)N)rrrr)rrrr)rrr rrr)r$r%rr&)Nr) r rr)rr*r+r,rrr ) r rr)rr*r+r,rrr/)Nrr) r rr)rr2r+r*r+r,rrr3) r rr)rr2r+r*r+r,rrr5) r rr)rr*r+r,rrr7) r rr)rr*r+r,rrr9) r rr)rr*r+r,rrr3)�__name__� __module__� __qualname__�__doc__rrr#r(r-r1r r6r8r:r;rrrrr,s:  � �! �( �& �# �)�r)r?� __future__r�typesr�typingrrrrrr �warningsZ bs4._typingr rr r'r Z bs4.elementr r�__annotations__� ImportError�warn�objectrrrrr�<module>s(        ��

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