![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|


Public Member Functions | |
| __init__ (self, _IncomingMarkup markup="", Optional[Union[str, Sequence[str]]] features=None, Optional[Union[TreeBuilder, Type[TreeBuilder]]] builder=None, Optional[SoupStrainer] parse_only=None, Optional[_Encoding] from_encoding=None, Optional[_Encodings] exclude_encodings=None, Optional[Dict[Type[PageElement], Type[PageElement]]] element_classes=None, **Any kwargs) | |
| "BeautifulSoup" | copy_self (self) |
| Dict[str, Any] | __getstate__ (self) |
| None | __setstate__ (self, Dict[str, Any] state) |
| None | reset (self) |
| Tag | new_tag (self, str name, Optional[str] namespace=None, Optional[str] nsprefix=None, Optional[_RawAttributeValues] attrs=None, Optional[int] sourceline=None, Optional[int] sourcepos=None, Optional[str] string=None, **_RawAttributeValue kwattrs) |
| Type[NavigableString] | string_container (self, Optional[Type[NavigableString]] base_class=None) |
| NavigableString | new_string (self, str s, Optional[Type[NavigableString]] subclass=None) |
| List[PageElement] | insert_before (self, *_InsertableElement args) |
| List[PageElement] | insert_after (self, *_InsertableElement args) |
| Optional[Tag] | popTag (self) |
| None | pushTag (self, Tag tag) |
| None | endData (self, Optional[Type[NavigableString]] containerClass=None) |
| None | object_was_parsed (self, PageElement o, Optional[Tag] parent=None, Optional[PageElement] most_recent_element=None) |
| Optional[Tag] | handle_starttag (self, str name, Optional[str] namespace, Optional[str] nsprefix, _RawAttributeValues attrs, Optional[int] sourceline=None, Optional[int] sourcepos=None, Optional[Dict[str, str]] namespaces=None) |
| None | handle_endtag (self, str name, Optional[str] nsprefix=None) |
| None | handle_data (self, str data) |
| str | decode (self, Optional[int] indent_level=None, _Encoding eventual_encoding=DEFAULT_OUTPUT_ENCODING, Union[Formatter, str] formatter="minimal", Optional[Iterator[PageElement]] iterator=None, **Any kwargs) |
Public Member Functions inherited from bs4.element.Tag | |
| Self | __deepcopy__ (self, Dict[Any, Any] memo, bool recursive=True) |
| bool | is_empty_element (self) |
| bool | isSelfClosing (self) |
| Optional[str] | string (self) |
| None | string (self, str string) |
| List[PageElement] | insert (self, int position, *_InsertableElement new_children) |
| Self | unwrap (self) |
| _OneElement | replaceWithChildren (self) |
| PageElement | append (self, _InsertableElement tag) |
| List[PageElement] | extend (self, Union[Iterable[_InsertableElement], Tag] tags) |
| None | clear (self, bool decompose=False) |
| None | smooth (self) |
| int | index (self, PageElement element) |
| Optional[_AttributeValue] | get (self, str key, Optional[_AttributeValue] default=None) |
| AttributeValueList | get_attribute_list (self, str key, Optional[AttributeValueList] default=None) |
| bool | has_attr (self, str key) |
| int | __hash__ (self) |
| _AttributeValue | __getitem__ (self, str key) |
| Iterator[PageElement] | __iter__ (self) |
| int | __len__ (self) |
| bool | __contains__ (self, Any x) |
| bool | __bool__ (self) |
| None | __setitem__ (self, str key, _AttributeValue value) |
| None | __delitem__ (self, str key) |
| _SomeTags | __call__ (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | __call__ (self, None name=None, None attrs=None, bool recursive=True, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | __call__ (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Optional[Tag] | __getattr__ (self, str subtag) |
| bool | __eq__ (self, Any other) |
| bool | __ne__ (self, Any other) |
| str | __repr__ (self) |
| bytes | encode (self, _Encoding encoding=DEFAULT_OUTPUT_ENCODING, Optional[int] indent_level=None, _FormatterOrName formatter="minimal", str errors="xmlcharrefreplace") |
| str | prettify (self, None encoding=None, _FormatterOrName formatter="minimal") |
| bytes | prettify (self, _Encoding encoding, _FormatterOrName formatter="minimal") |
| Union[str, bytes] | prettify (self, Optional[_Encoding] encoding=None, _FormatterOrName formatter="minimal") |
| str | decode_contents (self, Optional[int] indent_level=None, _Encoding eventual_encoding=DEFAULT_OUTPUT_ENCODING, _FormatterOrName formatter="minimal") |
| bytes | encode_contents (self, Optional[int] indent_level=None, _Encoding encoding=DEFAULT_OUTPUT_ENCODING, _FormatterOrName formatter="minimal") |
| bytes | renderContents (self, _Encoding encoding=DEFAULT_OUTPUT_ENCODING, bool prettyPrint=False, Optional[int] indentLevel=0) |
| _AtMostOneTag | find (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, None string=None, **_StrainableAttribute kwargs) |
| _AtMostOneNavigableString | find (self, None name=None, None attrs=None, bool recursive=True, _StrainableString string="") |
| Union[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement] | find (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, Optional[_StrainableString] string=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_all (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | find_all (self, None name=None, None attrs=None, bool recursive=True, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | find_all (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, bool recursive=True, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Iterator[PageElement] | children (self) |
| Iterator[PageElement] | self_and_descendants (self) |
| Iterator[PageElement] | descendants (self) |
| Optional[Tag] | select_one (self, str selector, Optional[Dict[str, str]] namespaces=None, **Any kwargs) |
| ResultSet[Tag] | select (self, str selector, Optional[Dict[str, str]] namespaces=None, int limit=0, **Any kwargs) |
| CSS | css (self) |
| Iterator[PageElement] | childGenerator (self) |
| Iterator[PageElement] | recursiveChildGenerator (self) |
| bool | has_key (self, str key) |
Public Member Functions inherited from bs4.element.PageElement | |
| None | setup (self, Optional[Tag] parent=None, _AtMostOneElement previous_element=None, _AtMostOneElement next_element=None, _AtMostOneElement previous_sibling=None, _AtMostOneElement next_sibling=None) |
| str | format_string (self, str s, Optional[_FormatterOrName] formatter) |
| Formatter | formatter_for_name (self, Union[_FormatterOrName, _EntitySubstitutionFunction] formatter_name) |
| Self | __copy__ (self) |
| Iterator[str] | stripped_strings (self) |
| str | get_text (self, str separator="", bool strip=False, Iterable[Type[NavigableString]] types=default) |
| Self | replace_with (self, *_InsertableElement args) |
| Tag | wrap (self, Tag wrap_inside) |
| Self | extract (self, Optional[int] _self_index=None) |
| None | decompose (self) |
| _AtMostOneTag | find_next (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, **_StrainableAttribute kwargs) |
| _AtMostOneNavigableString | find_next (self, None name=None, None attrs=None, _StrainableString string="", **_StrainableAttribute kwargs) |
| Union[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement] | find_next (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_all_next (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | find_all_next (self, None name=None, None attrs=None, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | find_all_next (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _AtMostOneTag | find_next_sibling (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, **_StrainableAttribute kwargs) |
| _AtMostOneNavigableString | find_next_sibling (self, None name=None, None attrs=None, _StrainableString string="", **_StrainableAttribute kwargs) |
| Union[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement] | find_next_sibling (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_next_siblings (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | find_next_siblings (self, None name=None, None attrs=None, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | find_next_siblings (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _AtMostOneTag | find_previous (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, **_StrainableAttribute kwargs) |
| _AtMostOneNavigableString | find_previous (self, None name=None, None attrs=None, _StrainableString string="", **_StrainableAttribute kwargs) |
| Union[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement] | find_previous (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_all_previous (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | find_all_previous (self, None name=None, None attrs=None, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | find_all_previous (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _AtMostOneTag | find_previous_sibling (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, **_StrainableAttribute kwargs) |
| _AtMostOneNavigableString | find_previous_sibling (self, None name=None, None attrs=None, _StrainableString string="", **_StrainableAttribute kwargs) |
| Union[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement] | find_previous_sibling (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_previous_siblings (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, None string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _SomeNavigableStrings | find_previous_siblings (self, None name=None, None attrs=None, _StrainableString string="", Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| Union[_SomeTags, _SomeNavigableStrings, _QueryResults] | find_previous_siblings (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[_StrainableString] string=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _AtMostOneTag | find_parent (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, **_StrainableAttribute kwargs) |
| _SomeTags | find_parents (self, _FindMethodName name=None, Optional[_StrainableAttributes] attrs=None, Optional[int] limit=None, int _stacklevel=2, **_StrainableAttribute kwargs) |
| _AtMostOneElement | next (self) |
| _AtMostOneElement | previous (self) |
| Iterator[PageElement] | next_elements (self) |
| Iterator[PageElement] | self_and_next_elements (self) |
| Iterator[PageElement] | next_siblings (self) |
| Iterator[PageElement] | self_and_next_siblings (self) |
| Iterator[PageElement] | previous_elements (self) |
| Iterator[PageElement] | self_and_previous_elements (self) |
| Iterator[PageElement] | previous_siblings (self) |
| Iterator[PageElement] | self_and_previous_siblings (self) |
| Iterator[Tag] | parents (self) |
| Iterator[PageElement] | self_and_parents (self) |
| bool | decomposed (self) |
| Iterator[PageElement] | nextGenerator (self) |
| Iterator[PageElement] | nextSiblingGenerator (self) |
| Iterator[PageElement] | previousGenerator (self) |
| Iterator[PageElement] | previousSiblingGenerator (self) |
| Iterator[PageElement] | parentGenerator (self) |
Public Attributes | |
| element_classes | |
| builder | |
| is_xml | |
| known_xml | |
| parse_only | |
| markup | |
| original_encoding | |
| declared_html_encoding | |
| contains_replacement_characters | |
| ROOT_TAG_NAME | |
| hidden | |
| current_data | |
| currentTag | |
| tagStack | |
| open_tag_counter | |
| preserve_whitespace_tag_stack | |
| string_container_stack | |
Public Attributes inherited from bs4.element.Tag | |
| parser_class | |
| name | |
| namespace | |
| prefix | |
| sourceline | |
| sourcepos | |
| attribute_value_list_class | |
| attrs | |
| known_xml | |
| hidden | |
| can_be_empty_element | |
| cdata_list_attributes | |
| preserve_whitespace_tags | |
| interesting_string_types | |
| descendants | |
| contents | |
Public Attributes inherited from bs4.element.PageElement | |
| parent | |
| previous_element | |
| next_element | |
| next_sibling | |
| previous_sibling | |
| find_all_next | |
| next_elements | |
| find_next_siblings | |
| next_siblings | |
| find_all_previous | |
| previous_elements | |
| find_previous_siblings | |
| previous_siblings | |
| parents | |
Static Public Attributes | |
| str | ROOT_TAG_NAME = "[document]" |
| list | DEFAULT_BUILDER_FEATURES = ["html", "fast"] |
| str | ASCII_SPACES = "\x20\x0a\x09\x0c\x0d" |
| Dict | element_classes [Type[PageElement], Type[PageElement]] |
| TreeBuilder | builder |
| bool | is_xml |
| Optional | known_xml [bool] |
| Optional | parse_only [SoupStrainer] |
| Optional | markup [_RawMarkup] |
| List | current_data [str] |
| Optional | currentTag [Tag] |
| List | tagStack [Tag] |
| CounterType | open_tag_counter [str] |
| List | preserve_whitespace_tag_stack [Tag] |
| List | string_container_stack [Tag] |
| Optional | original_encoding [_Encoding] |
| Optional | declared_html_encoding [_Encoding] |
| bool | contains_replacement_characters |
Static Public Attributes inherited from bs4.element.Tag | |
| Optional | parser_class [type[BeautifulSoup]] |
| str | name |
| Optional | namespace [str] |
| Optional | prefix [str] |
| _AttributeValues | attrs |
| Optional | sourceline [int] |
| Optional | sourcepos [int] |
| Optional | known_xml [bool] |
| List | contents [PageElement] |
| bool | hidden |
| Optional | interesting_string_types [Set[Type[NavigableString]]] |
| Optional | can_be_empty_element [bool] |
| Optional | cdata_list_attributes [Dict[str, Set[str]]] |
| Optional | preserve_whitespace_tags [Set[str]] |
| parserClass = _deprecated_alias("parserClass", "parser_class", "4.0.0") | |
| dict | MAIN_CONTENT_STRING_TYPES = {NavigableString, CData} |
| Self | replace_with_children = unwrap |
| START_ELEMENT_EVENT = _TreeTraversalEvent() | |
| END_ELEMENT_EVENT = _TreeTraversalEvent() | |
| EMPTY_ELEMENT_EVENT = _TreeTraversalEvent() | |
| STRING_ELEMENT_EVENT = _TreeTraversalEvent() | |
| findChild = _deprecated_function_alias("findChild", "find", "3.0.0") | |
| findAll = _deprecated_function_alias("findAll", "find_all", "4.0.0") | |
| findChildren = _deprecated_function_alias("findChildren", "find_all", "3.0.0") | |
Static Public Attributes inherited from bs4.element.PageElement | |
| Optional | known_xml = None |
| Optional | parent [Tag] |
| _AtMostOneElement | next_element |
| _AtMostOneElement | previous_element |
| _AtMostOneElement | next_sibling |
| _AtMostOneElement | previous_sibling |
| bool | hidden = False |
| nextSibling = _deprecated_alias("nextSibling", "next_sibling", "4.0.0") | |
| previousSibling = _deprecated_alias("previousSibling", "previous_sibling", "4.0.0") | |
| Iterable | default = tuple() |
| str | getText = get_text |
| replaceWith = _deprecated_function_alias("replaceWith", "replace_with", "4.0.0") | |
| findNext = _deprecated_function_alias("findNext", "find_next", "4.0.0") | |
| findAllNext = _deprecated_function_alias("findAllNext", "find_all_next", "4.0.0") | |
| findNextSibling | |
| findNextSiblings | |
| fetchNextSiblings | |
| findPrevious = _deprecated_function_alias("findPrevious", "find_previous", "3.0.0") | |
| findAllPrevious | |
| fetchAllPrevious | |
| findPreviousSibling | |
| findPreviousSiblings | |
| fetchPreviousSiblings | |
| findParent = _deprecated_function_alias("findParent", "find_parent", "4.0.0") | |
| findParents = _deprecated_function_alias("findParents", "find_parents", "4.0.0") | |
| fetchParents = _deprecated_function_alias("fetchParents", "find_parents", "3.0.0") | |
Protected Member Functions | |
| str | _decode_markup (cls, _RawMarkup markup) |
| bool | _markup_is_url (cls, _RawMarkup markup) |
| bool | _markup_resembles_filename (cls, _RawMarkup markup) |
| None | _feed (self) |
| None | _linkage_fixer (self, Tag el) |
| Optional[Tag] | _popToTag (self, str name, Optional[str] nsprefix=None, bool inclusivePop=True) |
Protected Member Functions inherited from bs4.element.Tag | |
| Iterator[str] | _all_strings (self, bool strip=False, _OneOrMoreStringTypes types=PageElement.default) |
| List[PageElement] | _insert (self, int position, _InsertableElement new_child) |
| Iterator[Tuple[_TreeTraversalEvent, PageElement]] | _event_stream (self, Optional[Iterator[PageElement]] iterator=None) |
| str | _indent_string (self, str s, int indent_level, Formatter formatter, bool indent_before, bool indent_after) |
| str | _format_tag (self, str eventual_encoding, Formatter formatter, bool opening) |
| bool | _should_pretty_print (self, int indent_level=1) |
Protected Member Functions inherited from bs4.element.PageElement | |
| bool | _is_xml (self) |
| _AtMostOneElement | _last_descendant (self, bool is_initialized=True, bool accept_self=True) |
| _AtMostOneElement | _find_one (self, Callable method, _FindMethodName name, Optional[_StrainableAttributes] attrs, Optional[_StrainableString] string, **_StrainableAttribute kwargs) |
| _QueryResults | _find_all (self, _FindMethodName name, Optional[_StrainableAttributes] attrs, Optional[_StrainableString] string, Optional[int] limit, Iterator[PageElement] generator, int _stacklevel=3, **_StrainableAttribute kwargs) |
| Iterator[PageElement] | _self_and (self, Iterator[PageElement] other_generator) |
Protected Attributes | |
| _namespaces | |
| _most_recent_element | |
Protected Attributes inherited from bs4.element.Tag | |
| _namespaces | |
Static Protected Attributes | |
| Optional | _most_recent_element [PageElement] |
Static Protected Attributes inherited from bs4.element.PageElement | |
| bool | _decomposed |
| _lastRecursiveChild | |
Additional Inherited Members | |
Properties inherited from bs4.element.Tag | |
| strings = property(_all_strings) | |
Properties inherited from bs4.element.PageElement | |
| text = property(get_text) | |
A data structure representing a parsed HTML or XML document. Most of the methods you'll call on a BeautifulSoup object are inherited from PageElement or Tag. Internally, this class defines the basic interface called by the tree builders when converting an HTML/XML document into a data structure. The interface abstracts away the differences between parsers. To write a new tree builder, you'll need to understand these methods as a whole. These methods will be called by the BeautifulSoup constructor: * reset() * feed(markup) The tree builder may call these methods from its feed() implementation: * handle_starttag(name, attrs) # See note about return value * handle_endtag(name) * handle_data(data) # Appends to the current data node * endData(containerClass) # Ends the current data node No matter how complicated the underlying parser is, you should be able to build a tree using 'start tag' events, 'end tag' events, 'data' events, and "done with data" events. If you encounter an empty-element tag (aka a self-closing tag, like HTML's <br> tag), call handle_starttag and then handle_endtag.
| bs4.BeautifulSoup.__init__ | ( | self, | |
| _IncomingMarkup | markup = "", |
||
| Optional[Union[str, Sequence[str]]] | features = None, |
||
| Optional[Union[TreeBuilder, Type[TreeBuilder]]] | builder = None, |
||
| Optional[SoupStrainer] | parse_only = None, |
||
| Optional[_Encoding] | from_encoding = None, |
||
| Optional[_Encodings] | exclude_encodings = None, |
||
| Optional[Dict[Type[PageElement], Type[PageElement]]] | element_classes = None, |
||
| **Any | kwargs | ||
| ) |
Constructor.
:param markup: A string or a file-like object representing
markup to be parsed.
:param features: Desirable features of the parser to be
used. This may be the name of a specific parser ("lxml",
"lxml-xml", "html.parser", or "html5lib") or it may be the
type of markup to be used ("html", "html5", "xml"). It's
recommended that you name a specific parser, so that
Beautiful Soup gives you the same results across platforms
and virtual environments.
:param builder: A TreeBuilder subclass to instantiate (or
instance to use) instead of looking one up based on
`features`. You only need to use this if you've implemented a
custom TreeBuilder.
:param parse_only: A SoupStrainer. Only parts of the document
matching the SoupStrainer will be considered. This is useful
when parsing part of a document that would otherwise be too
large to fit into memory.
:param from_encoding: A string indicating the encoding of the
document to be parsed. Pass this in if Beautiful Soup is
guessing wrongly about the document's encoding.
:param exclude_encodings: A list of strings indicating
encodings known to be wrong. Pass this in if you don't know
the document's encoding but you know Beautiful Soup's guess is
wrong.
:param element_classes: A dictionary mapping BeautifulSoup
classes like Tag and NavigableString, to other classes you'd
like to be instantiated instead as the parse tree is
built. This is useful for subclassing Tag or NavigableString
to modify default behavior.
:param kwargs: For backwards compatibility purposes, the
constructor accepts certain keyword arguments used in
Beautiful Soup 3. None of these arguments do anything in
Beautiful Soup 4; they will result in a warning and then be
ignored.
Apart from this, any keyword arguments passed into the
BeautifulSoup constructor are propagated to the TreeBuilder
constructor. This makes it possible to configure a
TreeBuilder by passing in arguments, not just by saying which
one to use.
Reimplemented from bs4.element.Tag.
Reimplemented in bs4.BeautifulStoneSoup.
|
protected |
Ensure `markup` is Unicode so it's safe to send into warnings.warn. warnings.warn had this problem back in 2010 but fortunately not anymore. This has not been used for a long time; I just noticed that fact while working on 4.13.0.
|
protected |
Internal method that parses previously set markup, creating a large number of Tag and NavigableString objects.
|
protected |
Make sure linkage of this fragment is sound.
|
protected |
Error-handling method to raise a warning if incoming markup looks
like a URL.
:param markup: A string of markup.
:return: Whether or not the markup resembled a URL
closely enough to justify issuing a warning.
|
protected |
Error-handling method to issue a warning if incoming markup
resembles a filename.
:param markup: A string of markup.
:return: Whether or not the markup resembled a filename
closely enough to justify issuing a warning.
|
protected |
Pops the tag stack up to and including the most recent instance of the given tag. If there are no open tags with the given name, nothing will be popped. :param name: Pop up to the most recent tag with this name. :param nsprefix: The namespace prefix that goes with `name`. :param inclusivePop: It this is false, pops the tag stack up to but *not* including the most recent instqance of the given tag. :meta private:
| "BeautifulSoup" bs4.BeautifulSoup.copy_self | ( | self | ) |
Create a new BeautifulSoup object with the same TreeBuilder, but not associated with any markup. This is the first step of the deepcopy process.
Reimplemented from bs4.element.Tag.
| str bs4.BeautifulSoup.decode | ( | self, | |
| Optional[int] | indent_level = None, |
||
| _Encoding | eventual_encoding = DEFAULT_OUTPUT_ENCODING, |
||
| Union[Formatter, str] | formatter = "minimal", |
||
| Optional[Iterator[PageElement]] | iterator = None, |
||
| **Any | kwargs | ||
| ) |
Returns a string representation of the parse tree
as a full HTML or XML document.
:param indent_level: Each line of the rendering will be
indented this many levels. (The ``formatter`` decides what a
'level' means, in terms of spaces or other characters
output.) This is used internally in recursive calls while
pretty-printing.
:param eventual_encoding: The encoding of the final document.
If this is None, the document will be a Unicode string.
:param formatter: Either a `Formatter` object, or a string naming one of
the standard formatters.
:param iterator: The iterator to use when navigating over the
parse tree. This is only used by `Tag.decode_contents` and
you probably won't need to use it.
Reimplemented from bs4.element.Tag.
| None bs4.BeautifulSoup.endData | ( | self, | |
| Optional[Type[NavigableString]] | containerClass = None |
||
| ) |
Method called by the TreeBuilder when the end of a data segment occurs. :param containerClass: The class to use when incorporating the data segment into the parse tree. :meta private:
| None bs4.BeautifulSoup.handle_data | ( | self, | |
| str | data | ||
| ) |
Called by the tree builder when a chunk of textual data is encountered. :meta private:
| None bs4.BeautifulSoup.handle_endtag | ( | self, | |
| str | name, | ||
| Optional[str] | nsprefix = None |
||
| ) |
Called by the tree builder when an ending tag is encountered. :param name: Name of the tag. :param nsprefix: Namespace prefix for the tag. :meta private:
| Optional[Tag] bs4.BeautifulSoup.handle_starttag | ( | self, | |
| str | name, | ||
| Optional[str] | namespace, | ||
| Optional[str] | nsprefix, | ||
| _RawAttributeValues | attrs, | ||
| Optional[int] | sourceline = None, |
||
| Optional[int] | sourcepos = None, |
||
| Optional[Dict[str, str]] | namespaces = None |
||
| ) |
Called by the tree builder when a new tag is encountered.
:param name: Name of the tag.
:param nsprefix: Namespace prefix for the tag.
:param attrs: A dictionary of attribute values. Note that
attribute values are expected to be simple strings; processing
of multi-valued attributes such as "class" comes later.
:param sourceline: The line number where this tag was found in its
source document.
:param sourcepos: The character position within `sourceline` where this
tag was found.
:param namespaces: A dictionary of all namespace prefix mappings
currently in scope in the document.
If this method returns None, the tag was rejected by an active
`ElementFilter`. You should proceed as if the tag had not occurred
in the document. For instance, if this was a self-closing tag,
don't call handle_endtag.
:meta private:
| List[PageElement] bs4.BeautifulSoup.insert_after | ( | self, | |
| *_InsertableElement | args | ||
| ) |
This method is part of the PageElement API, but `BeautifulSoup` doesn't implement it because there is nothing before or after it in the parse tree.
Reimplemented from bs4.element.PageElement.
| List[PageElement] bs4.BeautifulSoup.insert_before | ( | self, | |
| *_InsertableElement | args | ||
| ) |
This method is part of the PageElement API, but `BeautifulSoup` doesn't implement it because there is nothing before or after it in the parse tree.
Reimplemented from bs4.element.PageElement.
| NavigableString bs4.BeautifulSoup.new_string | ( | self, | |
| str | s, | ||
| Optional[Type[NavigableString]] | subclass = None |
||
| ) |
Create a new `NavigableString` associated with this `BeautifulSoup`
object.
:param s: The string content of the `NavigableString`
:param subclass: The subclass of `NavigableString`, if any, to
use. If a document is being processed, an appropriate
subclass for the current location in the document will
be determined automatically.
| Tag bs4.BeautifulSoup.new_tag | ( | self, | |
| str | name, | ||
| Optional[str] | namespace = None, |
||
| Optional[str] | nsprefix = None, |
||
| Optional[_RawAttributeValues] | attrs = None, |
||
| Optional[int] | sourceline = None, |
||
| Optional[int] | sourcepos = None, |
||
| Optional[str] | string = None, |
||
| **_RawAttributeValue | kwattrs | ||
| ) |
Create a new Tag associated with this BeautifulSoup object.
:param name: The name of the new Tag.
:param namespace: The URI of the new Tag's XML namespace, if any.
:param prefix: The prefix for the new Tag's XML namespace, if any.
:param attrs: A dictionary of this Tag's attribute values; can
be used instead of ``kwattrs`` for attributes like 'class'
that are reserved words in Python.
:param sourceline: The line number where this tag was
(purportedly) found in its source document.
:param sourcepos: The character position within ``sourceline`` where this
tag was (purportedly) found.
:param string: String content for the new Tag, if any.
:param kwattrs: Keyword arguments for the new Tag's attribute values.
| None bs4.BeautifulSoup.object_was_parsed | ( | self, | |
| PageElement | o, | ||
| Optional[Tag] | parent = None, |
||
| Optional[PageElement] | most_recent_element = None |
||
| ) |
Method called by the TreeBuilder to integrate an object into the parse tree. :meta private:
| Optional[Tag] bs4.BeautifulSoup.popTag | ( | self | ) |
Internal method called by _popToTag when a tag is closed. :meta private:
| None bs4.BeautifulSoup.pushTag | ( | self, | |
| Tag | tag | ||
| ) |
Internal method called by handle_starttag when a tag is opened. :meta private:
| None bs4.BeautifulSoup.reset | ( | self | ) |
Reset this object to a state as though it had never parsed any markup.
| Type[NavigableString] bs4.BeautifulSoup.string_container | ( | self, | |
| Optional[Type[NavigableString]] | base_class = None |
||
| ) |
Find the class that should be instantiated to hold a given kind of string. This may be a built-in Beautiful Soup class or a custom class passed in to the BeautifulSoup constructor.