Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
bs4.css.CSS Class Reference
Inheritance diagram for bs4.css.CSS:
Inheritance graph
[legend]
Collaboration diagram for bs4.css.CSS:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, element.Tag tag, Optional[ModuleType] api=None)
 
str escape (self, str ident)
 
SoupSieve compile (self, str select, Optional[_NamespaceMapping] namespaces=None, int flags=0, **Any kwargs)
 
element.Tag|None select_one (self, str select, Optional[_NamespaceMapping] namespaces=None, int flags=0, **Any kwargs)
 
ResultSet[element.Tagselect (self, str select, Optional[_NamespaceMapping] namespaces=None, int limit=0, int flags=0, **Any kwargs)
 
Iterator[element.Tagiselect (self, str select, Optional[_NamespaceMapping] namespaces=None, int limit=0, int flags=0, **Any kwargs)
 
Optional[element.Tagclosest (self, str select, Optional[_NamespaceMapping] namespaces=None, int flags=0, **Any kwargs)
 
bool match (self, str select, Optional[_NamespaceMapping] namespaces=None, int flags=0, **Any kwargs)
 
ResultSet[element.Tagfilter (self, str select, Optional[_NamespaceMapping] namespaces=None, int flags=0, **Any kwargs)
 

Public Attributes

 api
 
 tag
 

Protected Member Functions

Optional[_NamespaceMapping] _ns (self, Optional[_NamespaceMapping] ns, str select)
 
ResultSet[Tag_rs (self, MutableSequence[Tag] results)
 

Detailed Description

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.

Member Function Documentation

◆ _ns()

Optional[_NamespaceMapping] bs4.css.CSS._ns (   self,
Optional[_NamespaceMapping]  ns,
str   select 
)
protected
Normalize a dictionary of namespaces.

◆ _rs()

ResultSet[Tag] bs4.css.CSS._rs (   self,
MutableSequence[Tag results 
)
protected
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).

◆ closest()

Optional[element.Tag] bs4.css.CSS.closest (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   flags = 0,
**Any  kwargs 
)
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.

◆ compile()

SoupSieve bs4.css.CSS.compile (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   flags = 0,
**Any  kwargs 
)
Pre-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

◆ escape()

str bs4.css.CSS.escape (   self,
str  ident 
)
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.

◆ filter()

ResultSet[element.Tag] bs4.css.CSS.filter (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   flags = 0,
**Any  kwargs 
)
Filter 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.

◆ iselect()

Iterator[element.Tag] bs4.css.CSS.iselect (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   limit = 0,
int   flags = 0,
**Any  kwargs 
)
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.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.

◆ match()

bool bs4.css.CSS.match (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   flags = 0,
**Any  kwargs 
)
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.

◆ select()

ResultSet[element.Tag] bs4.css.CSS.select (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   limit = 0,
int   flags = 0,
**Any  kwargs 
)
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.

◆ select_one()

element.Tag | None bs4.css.CSS.select_one (   self,
str  select,
Optional[_NamespaceMapping]   namespaces = None,
int   flags = 0,
**Any  kwargs 
)
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.

The documentation for this class was generated from the following file: