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

270 lines
14 KiB
Plaintext
Raw Normal View History

Ë
ïÅÙj©1ãóî—UdZddlmZddlmZddlmZmZmZm Z m
Z
m Z m Z ddl
Z
ddlmZe rddlmZddlmZdd lmZmZd
ed < ddlZGd
„de«Zy#e$rdZe
j2d «YŒ'wxYw)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ÚMutableSequenceÚOptionalÚ
TYPE_CHECKINGN)Ú_NamespaceMapping)Ú SoupSieve)Úelement)Ú ResultSetÚTagúOptional[ModuleType]Ú soupsievezEThe soupsieve package is not installed. CSS selectors cannot be used.có*—eZdZdZddd„Zdd„Z dd„Zdd„Z d dd„Z d dd„Z d dd „Z
d dd
„Z d dd „Z d dd „Z
d dd
„Zy)Ú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.
NcóJ—|€t}|€ td«‚||_||_y)NzLCannot execute CSS selectors because the soupsieve package is not installed.)rÚNotImplementedErrorÚapiÚtag)Úselfrrs úKC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\bs4/css.pyÚ__init__z CSS.__init__;s1€Ø ˆ;܈CØ ˆ;Ü%Ø^óð
ðˆŒØˆ�ócóv—t€ td«‚tt|jj |««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.
zMCannot escape CSS identifiers because the soupsieve package is not installed.)rrrÚstrrÚescape)rÚidents rrz
CSS.escapeEs6€ô Ð Ü%Ø_óð
ô”C˜Ÿ™Ÿ™¨Ó/Ó0Ð0rcóv—t||jj«s|€|jj}|S)z%Normalize a dictionary of namespaces.)Ú
isinstancerr
rÚ _namespaces)rÚnsÚselects rÚ_nszCSS._nsQs2€ô˜& $§(¡(×"4Ñ"4Ô5¸"¸*ð—‘×%Ñ%ˆB؈ rcó —ddlm}|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)rN)Úbs4r)rÚresultsrs rÚ_rszCSS._rs\s€õ "ᘘwÓ'Ð'rc ó`—|jj||j||«|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
)rÚcompiler&©rr%Ú
namespacesÚflagsÚkwargss rr,z CSS.compileis/€ð2 ˆt�x‰x×Ñ ¨¯©°¸VÓ(DÀeÑVÈvÑVÐVrc óv—|jj||j|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.
)rÚ
select_onerr&r-s rr2zCSS.select_one„s=€ð4#ˆt�x‰x×"Ñ"Ø �D—H‘H˜dŸh™h z°6Ó:¸Eñ
ØEKñ
ð
rc
óž—|€d}|j|jj||j|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.
r)r*rr%rr&©rr%r.Úlimitr/r0s rr%z
CSS.select¢sS€ð8 ˆ=؈Eà�x‰xØ ˆD�H‰H�O‰OؘŸ™ $§(¡(¨:°vÓ">ÀÀuñ
ØPVñ
ó
ð
rc óx—|jj||j|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.
)rÚiselectrr&r4s rr7z CSS.iselectÇs?€ð> ˆt�x‰x×ÑØ �D—H‘H˜dŸh™h z°6Ó:¸EÀ5ñ
ØLRñ
ð
rc óv—|jj||j|j||«|fi|¤ŽS)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.
)rÚclosestrr&r-s rr9z CSS.closestês=€ð8 ˆt�x‰x×ÑØ �D—H‘H˜dŸh™h z°6Ó:¸Eñ
ØEKñ
ð
rc ó’—tt|jj||j|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.
)rÚboolrÚmatchrr&r-s rr<z CSS.match
sF€ô>Ü Ø ˆD�H‰H�N‰NؘŸ™ $§(¡(¨:°vÓ">Àñ
ØIOñ
ó
ð
rc
ó”—|j|jj||j|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.
)r*rÚfilterrr&r-s rr>z
CSS.filter0sG€ð>�x‰xØ ˆD�H‰H�O‰OؘŸ™ $§(¡(¨:°vÓ">Àñ
ØIOñ
ó
ð
r)N)rz element.Tagrr)r rÚreturnr)r$úOptional[_NamespaceMapping]r%rr?r@)r)zMutableSequence[Tag]r?zResultSet[Tag])Nr)
r%rr.r@r/Úintr0rr?r
)
r%rr.r@r/rAr0rr?zelement.Tag | None)Nrr) r%rr.r@r5rAr/rAr0rr?úResultSet[element.Tag]) r%rr.r@r5rAr/rAr0rr?zIterator[element.Tag])
r%rr.r@r/rAr0rr?zOptional[element.Tag])
r%rr.r@r/rAr0rr?r;)
r%rr.r@r/rAr0rr?rB)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrr&r*r,r2r%r7r9r<r>©rrrr-s„ñ ôó
1ð Ø-ð Ø7:ð à $ó ó (ð 37Øð WàðWð0ðWðð Wð
ð Wð
ó
Wð<37Øð 
àð
ð0ð
ðð 
ð
ð 
ð
ó

ðB37ØØð #
àð#
ð0ð#
ðð #
ð
ð #
ð ð
#
ð
ó#
ðP37ØØð !
àð!
ð0ð!
ðð !
ð
ð !
ð ð
!
ð
ó!
ðL37Øð 
àð
ð0ð
ðð 
ð
ð 
ð
ó