soupsieve API reference
113 public APIs from soupsieve (facelessuser/soupsieve) — 22 classes, 20 functions, 71 methods. Signatures extracted by static analysis of the actual source.
Repository: facelessuser/soupsieve
| Kind | Count |
|---|---|
| Classes | 22 |
| Functions | 20 |
| Methods | 71 |
API list
class
hatch_build.CustomMetadataHookOur metadata hook.
class
soupsieve.__meta__.VersionGet the version (PEP 440).
func
soupsieve.__meta__.parse_version(ver:str) -> VersionParse version into a comparable Version tuple.
func
soupsieve.closest(select:str, tag:bs4.Tag, namespaces:dict[str, str] | None=None, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> bs4.Tag | NoneMatch closest ancestor.
func
soupsieve.compile(pattern:str, namespaces:dict[str, str] | None=None, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> cm.SoupSieveCompile CSS pattern.
class
soupsieve.css_match.CSSMatchPerform CSS matching.
method
soupsieve.css_match.CSSMatch.closest() -> bs4.Tag | NoneMatch closest ancestor.
method
soupsieve.css_match.CSSMatch.extended_language_filter(lang_range:str, lang_tag:str) -> boolFilter the language tags.
method
soupsieve.css_match.CSSMatch.filter() -> list[bs4.Tag]Filter tag's children.
method
soupsieve.css_match.CSSMatch.find_bidi(el:bs4.Tag) -> int | NoneGet directionality from element text.
func
soupsieve.css_match.CSSMatch.get_parent_form(el:bs4.Tag) -> bs4.Tag | NoneFind this input's form.
method
soupsieve.css_match.CSSMatch.get_prefix(el:bs4.Tag) -> str | NoneGet prefix.
method
soupsieve.css_match.CSSMatch.get_tag(el:bs4.Tag | None) -> str | NoneGet tag.
method
soupsieve.css_match.CSSMatch.get_tag_ns(el:bs4.Tag | None) -> strGet tag namespace.
method
soupsieve.css_match.CSSMatch.is_html_tag(el:bs4.Tag | None) -> boolCheck if tag is in HTML namespace.
method
soupsieve.css_match.CSSMatch.match(el:bs4.Tag) -> boolMatch.
method
soupsieve.css_match.CSSMatch.match_attribute_name(el:bs4.Tag, attr:str, prefix:str | None) -> str | Sequence[str] | NoneMatch attribute name and return value if it exists.
method
soupsieve.css_match.CSSMatch.match_attributes(el:bs4.Tag, attributes:tuple[ct.SelectorAttribute, ...]) -> boolMatch attributes.
method
soupsieve.css_match.CSSMatch.match_classes(el:bs4.Tag, classes:tuple[str, ...]) -> boolMatch element's classes.
method
soupsieve.css_match.CSSMatch.match_contains(el:bs4.Tag, contains:tuple[ct.SelectorContains, ...]) -> boolMatch element if it contains text.
method
soupsieve.css_match.CSSMatch.match_default(el:bs4.Tag) -> boolMatch default.
method
soupsieve.css_match.CSSMatch.match_defined(el:bs4.Tag) -> boolMatch defined.
method
soupsieve.css_match.CSSMatch.match_dir(el:bs4.Tag | None, directionality:int) -> boolCheck directionality.
method
soupsieve.css_match.CSSMatch.match_empty(el:bs4.Tag) -> boolCheck if element is empty (if requested).
method
soupsieve.css_match.CSSMatch.match_future_child(parent:bs4.Tag, relation:ct.SelectorList, recursive:bool=False) -> boolMatch future child.
method
soupsieve.css_match.CSSMatch.match_future_relations(el:bs4.Tag, relation:ct.SelectorList) -> boolMatch future relationship.
method
soupsieve.css_match.CSSMatch.match_id(el:bs4.Tag, ids:tuple[str, ...]) -> boolMatch element's ID.
method
soupsieve.css_match.CSSMatch.match_indeterminate(el:bs4.Tag) -> boolMatch default.
method
soupsieve.css_match.CSSMatch.match_lang(el:bs4.Tag, langs:tuple[ct.SelectorLang, ...]) -> boolMatch languages.
method
soupsieve.css_match.CSSMatch.match_namespace(el:bs4.Tag, tag:ct.SelectorTag) -> boolMatch the namespace of the element.
method
soupsieve.css_match.CSSMatch.match_nth(el:bs4.Tag, nth:tuple[ct.SelectorNth, ...]) -> boolMatch `nth` elements.
method
soupsieve.css_match.CSSMatch.match_nth_tag_type(el:bs4.Tag, child:bs4.Tag) -> boolMatch tag type for `nth` matches.
method
soupsieve.css_match.CSSMatch.match_past_relations(el:bs4.Tag, relation:ct.SelectorList) -> boolMatch past relationship.
method
soupsieve.css_match.CSSMatch.match_placeholder_shown(el:bs4.Tag) -> boolMatch placeholder shown according to HTML spec.
method
soupsieve.css_match.CSSMatch.match_range(el:bs4.Tag, condition:int) -> boolMatch range.
method
soupsieve.css_match.CSSMatch.match_relations(el:bs4.Tag, relation:ct.SelectorList) -> boolMatch relationship to other elements.
method
soupsieve.css_match.CSSMatch.match_root(el:bs4.Tag) -> boolMatch element as root.
method
soupsieve.css_match.CSSMatch.match_scope(el:bs4.Tag) -> boolMatch element as scope.
method
soupsieve.css_match.CSSMatch.match_selectors(el:bs4.Tag, selectors:ct.SelectorList) -> boolCheck if element matches one of the selectors.
method
soupsieve.css_match.CSSMatch.match_subselectors(el:bs4.Tag, selectors:tuple[ct.SelectorList, ...]) -> boolMatch selectors.
method
soupsieve.css_match.CSSMatch.match_tag(el:bs4.Tag, tag:ct.SelectorTag | None) -> boolMatch the tag.
method
soupsieve.css_match.CSSMatch.match_tagname(el:bs4.Tag, tag:ct.SelectorTag) -> boolMatch tag name.
method
soupsieve.css_match.CSSMatch.select(limit:int=0) -> Iterator[bs4.Tag]Match all tags under the targeted tag.
method
soupsieve.css_match.CSSMatch.supports_namespaces() -> boolCheck if namespaces are supported in the HTML type.
class
soupsieve.css_match.InputsClass for parsing and validating input items.
method
soupsieve.css_match.Inputs.parse_value(itype:str, value:str | None) -> tuple[float, ...] | NoneParse the input value.
method
soupsieve.css_match.Inputs.validate_day(year:int, month:int, day:int) -> boolValidate day.
method
soupsieve.css_match.Inputs.validate_hour(hour:int) -> boolValidate hour.
method
soupsieve.css_match.Inputs.validate_minutes(minutes:int) -> boolValidate minutes.
method
soupsieve.css_match.Inputs.validate_month(month:int) -> boolValidate month.
method
soupsieve.css_match.Inputs.validate_week(year:int, week:int) -> boolValidate week.
method
soupsieve.css_match.Inputs.validate_year(year:int) -> boolValidate year.
class
soupsieve.css_match.SoupSieveCompiled Soup Sieve selector matching object.
method
soupsieve.css_match.SoupSieve.closest(tag:bs4.Tag) -> bs4.Tag | NoneMatch closest ancestor.
method
soupsieve.css_match.SoupSieve.filter(iterable:Iterable[bs4.Tag]) -> list[bs4.Tag]Filter.
method
soupsieve.css_match.SoupSieve.iselect(tag:bs4.Tag, limit:int=0) -> Iterator[bs4.Tag]Iterate the specified tags.
method
soupsieve.css_match.SoupSieve.match(tag:bs4.Tag) -> boolMatch.
method
soupsieve.css_match.SoupSieve.select(tag:bs4.Tag, limit:int=0) -> list[bs4.Tag]Select the specified tags.
method
soupsieve.css_match.SoupSieve.select_one(tag:bs4.Tag) -> bs4.Tag | NoneSelect a single tag.
class
soupsieve.css_parser.CSSParserParse CSS selectors.
method
soupsieve.css_parser.CSSParser.increment_count(increment:int=1) -> NoneCheck the current selector count.
method
soupsieve.css_parser.CSSParser.parse_class_id(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse HTML classes and ids.
method
soupsieve.css_parser.CSSParser.parse_combinator(sel:_Selector, m:Match[str], has_selector:bool, selectors:list[_Selector], relations:list[_Selector], is_pseudo:bool, is_forgive:bool, index:int) -> tuple[bool, _Selector]Parse combinator tokens.
method
soupsieve.css_parser.CSSParser.parse_has_combinator(sel:_Selector, m:Match[str], has_selector:bool, selectors:list[_Selector], rel_type:str, index:int) -> tuple[bool, _Selector, str]Parse combinator tokens.
method
soupsieve.css_parser.CSSParser.parse_pseudo_class(sel:_Selector, m:Match[str], has_selector:bool, iselector:Iterator[tuple[str, Match[str]]], is_html:bool) -> tuple[bool, bool]Parse pseudo class.
method
soupsieve.css_parser.CSSParser.parse_pseudo_class_custom(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse custom pseudo class alias.
method
soupsieve.css_parser.CSSParser.parse_pseudo_contains(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse contains.
method
soupsieve.css_parser.CSSParser.parse_pseudo_dir(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse pseudo direction.
method
soupsieve.css_parser.CSSParser.parse_pseudo_lang(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse pseudo language.
method
soupsieve.css_parser.CSSParser.parse_pseudo_nth(sel:_Selector, m:Match[str], has_selector:bool, iselector:Iterator[tuple[str, Match[str]]]) -> boolParse `nth` pseudo.
method
soupsieve.css_parser.CSSParser.parse_pseudo_open(sel:_Selector, name:str, has_selector:bool, iselector:Iterator[tuple[str, Match[str]]], index:int) -> boolParse pseudo with opening bracket.
method
soupsieve.css_parser.CSSParser.parse_selectors(iselector:Iterator[tuple[str, Match[str]]], index:int=0, flags:int=0) -> ct.SelectorListParse selectors.
method
soupsieve.css_parser.CSSParser.parse_tag_pattern(sel:_Selector, m:Match[str], has_selector:bool) -> boolParse tag pattern from regex match.
method
soupsieve.css_parser.CSSParser.process_selectors(index:int=0, flags:int=0) -> ct.SelectorListProcess selectors.
method
soupsieve.css_parser.CSSParser.selector_iter(pattern:str) -> Iterator[tuple[str, Match[str]]]Iterate selector tokens.
class
soupsieve.css_parser.PseudoSelectorMapPseudo selector map.
class
soupsieve.css_parser.SelectorPatternSelector pattern.
method
soupsieve.css_parser.SelectorPattern.get_name() -> strGet name.
method
soupsieve.css_parser.SelectorPattern.match(selector:str, index:int, flags:int) -> Match[str] | NoneMatch the selector.
method
soupsieve.css_parser.SelectorPattern.re_pattern() -> re.Pattern[str]Retrieve the compiled regular expression pattern.
class
soupsieve.css_parser.SpecialPseudoPatternSelector pattern.
method
soupsieve.css_parser.SpecialPseudoPattern.get_name() -> strGet name.
method
soupsieve.css_parser.SpecialPseudoPattern.match(selector:str, index:int, flags:int) -> Match[str] | NoneMatch the selector.
func
soupsieve.css_parser.css_unescape(content:str) -> strUnescape CSS value.
func
soupsieve.css_parser.escape(ident:str) -> strEscape identifier.
func
soupsieve.css_parser.process_custom(custom:ct.CustomSelectors | None) -> dict[str, str | ct.SelectorList]Process custom.
func
soupsieve.css_parser.replace(m:Match[str]) -> strReplace with the appropriate substitute.
class
soupsieve.css_types.CustomSelectorsCustom selectors.
class
soupsieve.css_types.ImmutableImmutable.
method
soupsieve.css_types.Immutable.pretty() -> NonePretty print.
class
soupsieve.css_types.ImmutableDictHashable, immutable dictionary.
class
soupsieve.css_types.NamespacesNamespaces.
class
soupsieve.css_types.SelectorSelector.
class
soupsieve.css_types.SelectorAttributeSelector attribute rule.
class
soupsieve.css_types.SelectorContainsSelector contains rule.
class
soupsieve.css_types.SelectorLangSelector language rules.
class
soupsieve.css_types.SelectorListSelector list.
class
soupsieve.css_types.SelectorNthSelector nth type.
class
soupsieve.css_types.SelectorNullNull Selector.
class
soupsieve.css_types.SelectorTagSelector tag.
func
soupsieve.css_types.pickle_register(obj:Any) -> NoneAllow object to be pickled.
func
soupsieve.escape(ident:str) -> strEscape identifier.
func
soupsieve.filter(select:str, iterable:Iterable[bs4.Tag], namespaces:dict[str, str] | None=None, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> list[bs4.Tag]Filter list of nodes.
func
soupsieve.iselect(select:str, tag:bs4.Tag, namespaces:dict[str, str] | None=None, limit:int=0, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> Iterator[bs4.Tag]Iterate the specified tags.
func
soupsieve.match(select:str, tag:bs4.Tag, namespaces:dict[str, str] | None=None, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> boolMatch node.
func
soupsieve.pretty.pretty(obj:Any) -> strMake the object output string pretty.
func
soupsieve.purge() -> NonePurge cached patterns.
func
soupsieve.select(select:str, tag:bs4.Tag, namespaces:dict[str, str] | None=None, limit:int=0, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> list[bs4.Tag]Select the specified tags.
func
soupsieve.select_one(select:str, tag:bs4.Tag, namespaces:dict[str, str] | None=None, flags:int=0, *custom:dict[str, str] | None=None, **kwargs:Any) -> bs4.Tag | NoneSelect a single tag.
class
soupsieve.util.SelectorSyntaxErrorSyntax error in a CSS selector.
func
soupsieve.util.get_pattern_context(pattern:str, index:int) -> tuple[str, int, int]Get the pattern context.
func
soupsieve.util.lower(string:str) -> strLower.
func
soupsieve.util.warn_deprecated(message:str, stacklevel:int=2) -> NoneWarn deprecated.
About this data
These signatures were extracted from the public source of facelessuser/soupsieve
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.