html5lib API Reference

Full documentation for html5lib (1.1)

html5lib.HTMLParser
Python Library Documentation: class HTMLParser in module html5lib.html5parser

class HTMLParser(builtins.object)
 |  HTMLParser(tree=None, strict=False, namespaceHTMLElements=True, debug=False)
 |
 |  HTML parser
 |
 |  Generates a tree structure from a stream of (possibly malformed) HTML.
 |
 |  Methods defined here:
 |
 |  __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False)
 |      :arg tree: a treebuilder class controlling the type of tree that will be
 |          returned. Built in treebuilders can be accessed through
 |          html5lib.treebuilders.getTreeBuilder(treeType)
 |
 |      :arg strict: raise an exception when a parse error is encountered
 |
 |      :arg namespaceHTMLElements: whether or not to namespace HTML elements
 |
 |      :arg debug: whether or not to enable debug mode which logs things
 |
 |      Example:
 |
 |      >>> from html5lib.html5parser import HTMLParser
 |      >>> parser = HTMLParser()                     # generates parser with etree builder
 |      >>> parser = HTMLParser('lxml', strict=True)  # generates parser with lxml builder which is strict
 |
 |  adjustForeignAttributes(self, token)
 |
 |  adjustMathMLAttributes(self, token)
 |
 |  adjustSVGAttributes(self, token)
 |
 |  isHTMLIntegrationPoint(self, element)
 |
 |  isMathMLTextIntegrationPoint(self, element)
 |
 |  mainLoop(self)
 |
 |  parse(self, stream, *args, **kwargs)
 |      Parse a HTML document into a well-formed tree
 |
 |      :arg stream: a file-like object or string containing the HTML to be parsed
 |
 |          The optional encoding parameter must be a string that indicates
 |          the encoding.  If specified, that encoding will be used,
 |          regardless of any BOM or later declaration (such as in a meta
 |          element).
 |
 |      :arg scripting: treat noscript elements as if JavaScript was turned on
 |
 |      :returns: parsed tree
 |
 |      Example:
 |
 |      >>> from html5lib.html5parser import HTMLParser
 |      >>> parser = HTMLParser()
 |      >>> parser.parse('<html><body><p>This is a doc</p></body></html>')
 |      <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>
 |
 |  parseError(self, errorcode='XXX-undefined-error', datavars=None)
 |
 |  parseFragment(self, stream, *args, **kwargs)
 |      Parse a HTML fragment into a well-formed tree fragment
 |
 |      :arg container: name of the element we're setting the innerHTML
 |          property if set to None, default to 'div'
 |
 |      :arg stream: a file-like object or string containing the HTML to be parsed
 |
 |          The optional encoding parameter must be a string that indicates
 |          the encoding.  If specified, that encoding will be used,
 |          regardless of any BOM or later declaration (such as in a meta
 |          element)
 |
 |      :arg scripting: treat noscript elements as if JavaScript was turned on
 |
 |      :returns: parsed tree
 |
 |      Example:
 |
 |      >>> from html5lib.html5libparser import HTMLParser
 |      >>> parser = HTMLParser()
 |      >>> parser.parseFragment('<b>this is a fragment</b>')
 |      <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
 |
 |  parseRCDataRawtext(self, token, contentType)
 |
 |  reparseTokenNormal(self, token)
 |
 |  reset(self)
 |
 |  resetInsertionMode(self)
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  documentEncoding
 |      Name of the character encoding that was used to decode the input stream, or
 |      :obj:`None` if that is not determined yet
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
html5lib.absolute_import
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
html5lib.constants
Python Library Documentation: module html5lib.constants in html5lib

NAME
    html5lib.constants

CLASSES
    builtins.UserWarning(builtins.Warning)
        DataLossWarning

    class DataLossWarning(builtins.UserWarning)
     |  Raised when the current tree is unable to represent the input data
     |
     |  Method resolution order:
     |      DataLossWarning
     |      builtins.UserWarning
     |      builtins.Warning
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.UserWarning:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.UserWarning:
     |
     |  __new__(*args, **kwargs) class method of builtins.UserWarning
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  add_note(...)
     |      Exception.add_note(note) --
     |      add a note to the exception
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

DATA
    E = {'XXX-undefined-error': 'Undefined error (this sucks and should be...
    EOF = None
    adjustForeignAttributes = {'xlink:actuate': ('xlink', 'actuate', 'http...
    adjustMathMLAttributes = {'definitionurl': 'definitionURL'}
    adjustSVGAttributes = {'attributename': 'attributeName', 'attributetyp...
    asciiLetters = frozenset({'A', 'B', 'C', 'D', 'E', 'F', ...})
    asciiLowercase = frozenset({'a', 'b', 'c', 'd', 'e', 'f', ...})
    asciiUpper2Lower = {65: 97, 66: 98, 67: 99, 68: 100, 69: 101, 70: 102,...
    asciiUppercase = frozenset({'A', 'B', 'C', 'D', 'E', 'F', ...})
    booleanAttributes = {'': frozenset({'irrelevant', 'itemscope'}), 'audi...
    cdataElements = frozenset({'textarea', 'title'})
    digits = frozenset({'0', '1', '2', '3', '4', '5', ...})
    entities = {'AElig': 'Æ', 'AElig;': 'Æ', 'AMP': '&', 'AMP;': '&', 'Aac...
    entitiesWindows1252 = (8364, 65533, 8218, 402, 8222, 8230, 8224, 8225,...
    formattingElements = frozenset({('http://www.w3.org/1999/xhtml', 'a'),...
    headingElements = ('h1', 'h2', 'h3', 'h4', 'h5', 'h6')
    hexDigits = frozenset({'0', '1', '2', '3', '4', '5', ...})
    htmlIntegrationPointElements = frozenset({('http://www.w3.org/1998/Mat...
    mathmlTextIntegrationPointElements = frozenset({('http://www.w3.org/19...
    namespaces = {'html': 'http://www.w3.org/1999/xhtml', 'mathml': 'http:...
    prefixes = {'http://www.w3.org/1998/Math/MathML': 'math', 'http://www....
    rcdataElements = frozenset({'iframe', 'noembed', 'noframes', 'noscript...
    replacementCharacters = {0: '�', 13: '\r', 128: '€', 129: '\x81', 130:...
    scopingElements = frozenset({('http://www.w3.org/1998/Math/MathML', 'a...
    spaceCharacters = frozenset({'\t', '\n', '\x0c', '\r', ' '})
    specialElements = frozenset({('http://www.w3.org/1999/xhtml', 'address...
    tableInsertModeElements = frozenset({'table', 'tbody', 'tfoot', 'thead...
    tagTokenTypes = frozenset({3, 4, 5})
    tokenTypes = {'Characters': 1, 'Comment': 6, 'Doctype': 0, 'EmptyTag':...
    unadjustForeignAttributes = {('http://www.w3.org/1999/xlink', 'actuate...
    voidElements = frozenset({'area', 'base', 'br', 'col', 'command', 'emb...
    xmlEntities = frozenset({'amp;', 'apos;', 'gt;', 'lt;', 'quot;'})

FILE
    c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\html5lib\constants.py

html5lib.division
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
html5lib.getTreeBuilder
Python Library Documentation: function getTreeBuilder in module html5lib.treebuilders

getTreeBuilder(treeType, implementation=None, **kwargs)
    Get a TreeBuilder class for various types of trees with built-in support

    :arg treeType: the name of the tree type required (case-insensitive). Supported
        values are:

        * "dom" - A generic builder for DOM implementations, defaulting to a
          xml.dom.minidom based implementation.
        * "etree" - A generic builder for tree implementations exposing an
          ElementTree-like interface, defaulting to xml.etree.cElementTree if
          available and xml.etree.ElementTree if not.
        * "lxml" - A etree-based builder for lxml.etree, handling limitations
          of lxml's implementation.

    :arg implementation: (Currently applies to the "etree" and "dom" tree
        types). A module implementing the tree type e.g. xml.etree.ElementTree
        or xml.etree.cElementTree.

    :arg kwargs: Any additional options to pass to the TreeBuilder when
        creating it.

    Example:

    >>> from html5lib.treebuilders import getTreeBuilder
    >>> builder = getTreeBuilder('etree')
html5lib.getTreeWalker
Python Library Documentation: function getTreeWalker in module html5lib.treewalkers

getTreeWalker(treeType, implementation=None, **kwargs)
    Get a TreeWalker class for various types of tree with built-in support

    :arg str treeType: the name of the tree type required (case-insensitive).
        Supported values are:

        * "dom": The xml.dom.minidom DOM implementation
        * "etree": A generic walker for tree implementations exposing an
          elementtree-like interface (known to work with ElementTree,
          cElementTree and lxml.etree).
        * "lxml": Optimized walker for lxml.etree
        * "genshi": a Genshi stream

    :arg implementation: A module implementing the tree type e.g.
        xml.etree.ElementTree or cElementTree (Currently applies to the "etree"
        tree type only).

    :arg kwargs: keyword arguments passed to the etree walker--for other
        walkers, this has no effect

    :returns: a TreeWalker class
html5lib.html5parser
Python Library Documentation: module html5lib.html5parser in html5lib

NAME
    html5lib.html5parser

CLASSES
    builtins.Exception(builtins.BaseException)
        ParseError
    builtins.object
        HTMLParser

    class HTMLParser(builtins.object)
     |  HTMLParser(tree=None, strict=False, namespaceHTMLElements=True, debug=False)
     |
     |  HTML parser
     |
     |  Generates a tree structure from a stream of (possibly malformed) HTML.
     |
     |  Methods defined here:
     |
     |  __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False)
     |      :arg tree: a treebuilder class controlling the type of tree that will be
     |          returned. Built in treebuilders can be accessed through
     |          html5lib.treebuilders.getTreeBuilder(treeType)
     |
     |      :arg strict: raise an exception when a parse error is encountered
     |
     |      :arg namespaceHTMLElements: whether or not to namespace HTML elements
     |
     |      :arg debug: whether or not to enable debug mode which logs things
     |
     |      Example:
     |
     |      >>> from html5lib.html5parser import HTMLParser
     |      >>> parser = HTMLParser()                     # generates parser with etree builder
     |      >>> parser = HTMLParser('lxml', strict=True)  # generates parser with lxml builder which is strict
     |
     |  adjustForeignAttributes(self, token)
     |
     |  adjustMathMLAttributes(self, token)
     |
     |  adjustSVGAttributes(self, token)
     |
     |  isHTMLIntegrationPoint(self, element)
     |
     |  isMathMLTextIntegrationPoint(self, element)
     |
     |  mainLoop(self)
     |
     |  parse(self, stream, *args, **kwargs)
     |      Parse a HTML document into a well-formed tree
     |
     |      :arg stream: a file-like object or string containing the HTML to be parsed
     |
     |          The optional encoding parameter must be a string that indicates
     |          the encoding.  If specified, that encoding will be used,
     |          regardless of any BOM or later declaration (such as in a meta
     |          element).
     |
     |      :arg scripting: treat noscript elements as if JavaScript was turned on
     |
     |      :returns: parsed tree
     |
     |      Example:
     |
     |      >>> from html5lib.html5parser import HTMLParser
     |      >>> parser = HTMLParser()
     |      >>> parser.parse('<html><body><p>This is a doc</p></body></html>')
     |      <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>
     |
     |  parseError(self, errorcode='XXX-undefined-error', datavars=None)
     |
     |  parseFragment(self, stream, *args, **kwargs)
     |      Parse a HTML fragment into a well-formed tree fragment
     |
     |      :arg container: name of the element we're setting the innerHTML
     |          property if set to None, default to 'div'
     |
     |      :arg stream: a file-like object or string containing the HTML to be parsed
     |
     |          The optional encoding parameter must be a string that indicates
     |          the encoding.  If specified, that encoding will be used,
     |          regardless of any BOM or later declaration (such as in a meta
     |          element)
     |
     |      :arg scripting: treat noscript elements as if JavaScript was turned on
     |
     |      :returns: parsed tree
     |
     |      Example:
     |
     |      >>> from html5lib.html5libparser import HTMLParser
     |      >>> parser = HTMLParser()
     |      >>> parser.parseFragment('<b>this is a fragment</b>')
     |      <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
     |
     |  parseRCDataRawtext(self, token, contentType)
     |
     |  reparseTokenNormal(self, token)
     |
     |  reset(self)
     |
     |  resetInsertionMode(self)
     |
     |  ----------------------------------------------------------------------
     |  Readonly properties defined here:
     |
     |  documentEncoding
     |      Name of the character encoding that was used to decode the input stream, or
     |      :obj:`None` if that is not determined yet
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

    class ParseError(builtins.Exception)
     |  Error in parsed document
     |
     |  Method resolution order:
     |      ParseError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) class method of builtins.Exception
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  add_note(...)
     |      Exception.add_note(note) --
     |      add a note to the exception
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

FUNCTIONS
    adjust_attributes(token, replacements)

    impliedTagToken(name, type='EndTag', attributes=None, selfClosing=False)

    method_decorator_metaclass(function)

    parse(doc, treebuilder='etree', namespaceHTMLElements=True, **kwargs)
        Parse an HTML document as a string or file-like object into a tree

        :arg doc: the document to parse as a string or file-like object

        :arg treebuilder: the treebuilder to use when parsing

        :arg namespaceHTMLElements: whether or not to namespace HTML elements

        :returns: parsed tree

        Example:

        >>> from html5lib.html5parser import parse
        >>> parse('<html><body><p>This is a doc</p></body></html>')
        <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>

    parseFragment(doc, container='div', treebuilder='etree', namespaceHTMLElements=True, **kwargs)
        Parse an HTML fragment as a string or file-like object into a tree

        :arg doc: the fragment to parse as a string or file-like object

        :arg container: the container context to parse the fragment in

        :arg treebuilder: the treebuilder to use when parsing

        :arg namespaceHTMLElements: whether or not to namespace HTML elements

        :returns: parsed tree

        Example:

        >>> from html5lib.html5libparser import parseFragment
        >>> parseFragment('<b>this is a fragment</b>')
        <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>

DATA
    E = {'XXX-undefined-error': 'Undefined error (this sucks and should be...
    Marker = None
    adjustForeignAttributesMap = {'xlink:actuate': ('xlink', 'actuate', 'h...
    adjustMathMLAttributes = {'definitionurl': 'definitionURL'}
    adjustSVGAttributes = {'attributename': 'attributeName', 'attributetyp...
    asciiUpper2Lower = {65: 97, 66: 98, 67: 99, 68: 100, 69: 101, 70: 102,...
    cdataElements = frozenset({'textarea', 'title'})
    headingElements = ('h1', 'h2', 'h3', 'h4', 'h5', 'h6')
    htmlIntegrationPointElements = frozenset({('http://www.w3.org/1998/Mat...
    mathmlTextIntegrationPointElements = frozenset({('http://www.w3.org/19...
    namespaces = {'html': 'http://www.w3.org/1999/xhtml', 'mathml': 'http:...
    rcdataElements = frozenset({'iframe', 'noembed', 'noframes', 'noscript...
    spaceCharacters = frozenset({'\t', '\n', '\x0c', '\r', ' '})
    specialElements = frozenset({('http://www.w3.org/1999/xhtml', 'address...
    tagTokenTypes = frozenset({3, 4, 5})
    tokenTypes = {'Characters': 1, 'Comment': 6, 'Doctype': 0, 'EmptyTag':...
    viewkeys = operator.methodcaller('keys')

FILE
    c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\html5lib\html5parser.py

html5lib.parse
Python Library Documentation: function parse in module html5lib.html5parser

parse(doc, treebuilder='etree', namespaceHTMLElements=True, **kwargs)
    Parse an HTML document as a string or file-like object into a tree

    :arg doc: the document to parse as a string or file-like object

    :arg treebuilder: the treebuilder to use when parsing

    :arg namespaceHTMLElements: whether or not to namespace HTML elements

    :returns: parsed tree

    Example:

    >>> from html5lib.html5parser import parse
    >>> parse('<html><body><p>This is a doc</p></body></html>')
    <Element u'{http://www.w3.org/1999/xhtml}html' at 0x7feac4909db0>
html5lib.parseFragment
Python Library Documentation: function parseFragment in module html5lib.html5parser

parseFragment(doc, container='div', treebuilder='etree', namespaceHTMLElements=True, **kwargs)
    Parse an HTML fragment as a string or file-like object into a tree

    :arg doc: the fragment to parse as a string or file-like object

    :arg container: the container context to parse the fragment in

    :arg treebuilder: the treebuilder to use when parsing

    :arg namespaceHTMLElements: whether or not to namespace HTML elements

    :returns: parsed tree

    Example:

    >>> from html5lib.html5libparser import parseFragment
    >>> parseFragment('<b>this is a fragment</b>')
    <Element u'DOCUMENT_FRAGMENT' at 0x7feac484b090>
html5lib.serialize
Python Library Documentation: function serialize in module html5lib.serializer

serialize(input, tree='etree', encoding=None, **serializer_opts)
    Serializes the input token stream using the specified treewalker

    :arg input: the token stream to serialize

    :arg tree: the treewalker to use

    :arg encoding: the encoding to use

    :arg serializer_opts: any options to pass to the
        :py:class:`html5lib.serializer.HTMLSerializer` that gets created

    :returns: the tree serialized as a string

    Example:

    >>> from html5lib.html5parser import parse
    >>> from html5lib.serializer import serialize
    >>> token_stream = parse('<html><body><p>Hi!</p></body></html>')
    >>> serialize(token_stream, omit_optional_tags=False)
    '<html><head></head><body><p>Hi!</p></body></html>'
html5lib.serializer
Python Library Documentation: module html5lib.serializer in html5lib

NAME
    html5lib.serializer

CLASSES
    builtins.Exception(builtins.BaseException)
        SerializeError
    builtins.object
        HTMLSerializer

    class HTMLSerializer(builtins.object)
     |  HTMLSerializer(**kwargs)
     |
     |  Methods defined here:
     |
     |  __init__(self, **kwargs)
     |      Initialize HTMLSerializer
     |
     |      :arg inject_meta_charset: Whether or not to inject the meta charset.
     |
     |          Defaults to ``True``.
     |
     |      :arg quote_attr_values: Whether to quote attribute values that don't
     |          require quoting per legacy browser behavior (``"legacy"``), when
     |          required by the standard (``"spec"``), or always (``"always"``).
     |
     |          Defaults to ``"legacy"``.
     |
     |      :arg quote_char: Use given quote character for attribute quoting.
     |
     |          Defaults to ``"`` which will use double quotes unless attribute
     |          value contains a double quote, in which case single quotes are
     |          used.
     |
     |      :arg escape_lt_in_attrs: Whether or not to escape ``<`` in attribute
     |          values.
     |
     |          Defaults to ``False``.
     |
     |      :arg escape_rcdata: Whether to escape characters that need to be
     |          escaped within normal elements within rcdata elements such as
     |          style.
     |
     |          Defaults to ``False``.
     |
     |      :arg resolve_entities: Whether to resolve named character entities that
     |          appear in the source tree. The XML predefined entities &lt; &gt;
     |          &amp; &quot; &apos; are unaffected by this setting.
     |
     |          Defaults to ``True``.
     |
     |      :arg strip_whitespace: Whether to remove semantically meaningless
     |          whitespace. (This compresses all whitespace to a single space
     |          except within ``pre``.)
     |
     |          Defaults to ``False``.
     |
     |      :arg minimize_boolean_attributes: Shortens boolean attributes to give
     |          just the attribute value, for example::
     |
     |            <input disabled="disabled">
     |
     |          becomes::
     |
     |            <input disabled>
     |
     |          Defaults to ``True``.
     |
     |      :arg use_trailing_solidus: Includes a close-tag slash at the end of the
     |          start tag of void elements (empty elements whose end tag is
     |          forbidden). E.g. ``<hr/>``.
     |
     |          Defaults to ``False``.
     |
     |      :arg space_before_trailing_solidus: Places a space immediately before
     |          the closing slash in a tag using a trailing solidus. E.g.
     |          ``<hr />``. Requires ``use_trailing_solidus=True``.
     |
     |          Defaults to ``True``.
     |
     |      :arg sanitize: Strip all unsafe or unknown constructs from output.
     |          See :py:class:`html5lib.filters.sanitizer.Filter`.
     |
     |          Defaults to ``False``.
     |
     |      :arg omit_optional_tags: Omit start/end tags that are optional.
     |
     |          Defaults to ``True``.
     |
     |      :arg alphabetical_attributes: Reorder attributes to be in alphabetical order.
     |
     |          Defaults to ``False``.
     |
     |  encode(self, string)
     |
     |  encodeStrict(self, string)
     |
     |  render(self, treewalker, encoding=None)
     |      Serializes the stream from the treewalker into a string
     |
     |      :arg treewalker: the treewalker to serialize
     |
     |      :arg encoding: the string encoding to use
     |
     |      :returns: the serialized tree
     |
     |      Example:
     |
     |      >>> from html5lib import parse, getTreeWalker
     |      >>> from html5lib.serializer import HTMLSerializer
     |      >>> token_stream = parse('<html><body>Hi!</body></html>')
     |      >>> walker = getTreeWalker('etree')
     |      >>> serializer = HTMLSerializer(omit_optional_tags=False)
     |      >>> serializer.render(walker(token_stream))
     |      '<html><head></head><body>Hi!</body></html>'
     |
     |  serialize(self, treewalker, encoding=None)
     |
     |  serializeError(self, data='XXX ERROR MESSAGE NEEDED')
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  alphabetical_attributes = False
     |
     |  escape_lt_in_attrs = False
     |
     |  escape_rcdata = False
     |
     |  inject_meta_charset = True
     |
     |  minimize_boolean_attributes = True
     |
     |  omit_optional_tags = True
     |
     |  options = ('quote_attr_values', 'quote_char', 'use_best_quote_char', '...
     |
     |  quote_attr_values = 'legacy'
     |
     |  quote_char = '"'
     |
     |  resolve_entities = True
     |
     |  sanitize = False
     |
     |  space_before_trailing_solidus = True
     |
     |  strip_whitespace = False
     |
     |  use_best_quote_char = True
     |
     |  use_trailing_solidus = False

    class SerializeError(builtins.Exception)
     |  Error in serialized tree
     |
     |  Method resolution order:
     |      SerializeError
     |      builtins.Exception
     |      builtins.BaseException
     |      builtins.object
     |
     |  Data descriptors defined here:
     |
     |  __weakref__
     |      list of weak references to the object
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.Exception:
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.Exception:
     |
     |  __new__(*args, **kwargs) class method of builtins.Exception
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.BaseException:
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __reduce__(...)
     |      Helper for pickle.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __setstate__(...)
     |
     |  __str__(self, /)
     |      Return str(self).
     |
     |  add_note(...)
     |      Exception.add_note(note) --
     |      add a note to the exception
     |
     |  with_traceback(...)
     |      Exception.with_traceback(tb) --
     |      set self.__traceback__ to tb and return self.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from builtins.BaseException:
     |
     |  __cause__
     |      exception cause
     |
     |  __context__
     |      exception context
     |
     |  __dict__
     |
     |  __suppress_context__
     |
     |  __traceback__
     |
     |  args

FUNCTIONS
    htmlentityreplace_errors(exc)

    register_error(errors, handler, /)
        Register the specified error handler under the name errors.

        handler must be a callable object, that will be called with an exception
        instance containing information about the location of the encoding/decoding
        error and must return a (replacement, new position) tuple.

    serialize(input, tree='etree', encoding=None, **serializer_opts)
        Serializes the input token stream using the specified treewalker

        :arg input: the token stream to serialize

        :arg tree: the treewalker to use

        :arg encoding: the encoding to use

        :arg serializer_opts: any options to pass to the
            :py:class:`html5lib.serializer.HTMLSerializer` that gets created

        :returns: the tree serialized as a string

        Example:

        >>> from html5lib.html5parser import parse
        >>> from html5lib.serializer import serialize
        >>> token_stream = parse('<html><body><p>Hi!</p></body></html>')
        >>> serialize(token_stream, omit_optional_tags=False)
        '<html><head></head><body><p>Hi!</p></body></html>'

    xmlcharrefreplace_errors(...)
        Implements the 'xmlcharrefreplace' error handling, which replaces an unencodable character with the appropriate XML character reference.

DATA
    booleanAttributes = {'': frozenset({'irrelevant', 'itemscope'}), 'audi...
    entities = {'AElig': 'Æ', 'AElig;': 'Æ', 'AMP': '&', 'AMP;': '&', 'Aac...
    k = 'zwnj;'
    rcdataElements = frozenset({'iframe', 'noembed', 'noframes', 'noscript...
    spaceCharacters = frozenset({'\t', '\n', '\x0c', '\r', ' '})
    v = 8204
    voidElements = frozenset({'area', 'base', 'br', 'col', 'command', 'emb...
    xmlEntities = frozenset({'amp;', 'apos;', 'gt;', 'lt;', 'quot;'})

FILE
    c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\html5lib\serializer.py

html5lib.treebuilders
Python Library Documentation: package html5lib.treebuilders in html5lib

NAME
    html5lib.treebuilders

DESCRIPTION
    A collection of modules for building different kinds of trees from HTML
    documents.

    To create a treebuilder for a new type of tree, you need to do
    implement several things:

    1. A set of classes for various types of elements: Document, Doctype, Comment,
       Element. These must implement the interface of ``base.treebuilders.Node``
       (although comment nodes have a different signature for their constructor,
       see ``treebuilders.etree.Comment``) Textual content may also be implemented
       as another node type, or not, as your tree implementation requires.

    2. A treebuilder object (called ``TreeBuilder`` by convention) that inherits
       from ``treebuilders.base.TreeBuilder``. This has 4 required attributes:

       * ``documentClass`` - the class to use for the bottommost node of a document
       * ``elementClass`` - the class to use for HTML Elements
       * ``commentClass`` - the class to use for comments
       * ``doctypeClass`` - the class to use for doctypes

       It also has one required method:

       * ``getDocument`` - Returns the root node of the complete document tree

    3. If you wish to run the unit tests, you must also create a ``testSerializer``
       method on your treebuilder which accepts a node and returns a string
       containing Node and its children serialized according to the format used in
       the unittests

PACKAGE CONTENTS
    base
    dom
    etree
    etree_lxml

FUNCTIONS
    getTreeBuilder(treeType, implementation=None, **kwargs)
        Get a TreeBuilder class for various types of trees with built-in support

        :arg treeType: the name of the tree type required (case-insensitive). Supported
            values are:

            * "dom" - A generic builder for DOM implementations, defaulting to a
              xml.dom.minidom based implementation.
            * "etree" - A generic builder for tree implementations exposing an
              ElementTree-like interface, defaulting to xml.etree.cElementTree if
              available and xml.etree.ElementTree if not.
            * "lxml" - A etree-based builder for lxml.etree, handling limitations
              of lxml's implementation.

        :arg implementation: (Currently applies to the "etree" and "dom" tree
            types). A module implementing the tree type e.g. xml.etree.ElementTree
            or xml.etree.cElementTree.

        :arg kwargs: Any additional options to pass to the TreeBuilder when
            creating it.

        Example:

        >>> from html5lib.treebuilders import getTreeBuilder
        >>> builder = getTreeBuilder('etree')

DATA
    treeBuilderCache = {}

FILE
    c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\html5lib\treebuilders\__init__.py

html5lib.treewalkers
Python Library Documentation: package html5lib.treewalkers in html5lib

NAME
    html5lib.treewalkers

DESCRIPTION
    A collection of modules for iterating through different kinds of
    tree, generating tokens identical to those produced by the tokenizer
    module.

    To create a tree walker for a new type of tree, you need to
    implement a tree walker object (called TreeWalker by convention) that
    implements a 'serialize' method which takes a tree as sole argument and
    returns an iterator which generates tokens.

PACKAGE CONTENTS
    base
    dom
    etree
    etree_lxml
    genshi

FUNCTIONS
    getTreeWalker(treeType, implementation=None, **kwargs)
        Get a TreeWalker class for various types of tree with built-in support

        :arg str treeType: the name of the tree type required (case-insensitive).
            Supported values are:

            * "dom": The xml.dom.minidom DOM implementation
            * "etree": A generic walker for tree implementations exposing an
              elementtree-like interface (known to work with ElementTree,
              cElementTree and lxml.etree).
            * "lxml": Optimized walker for lxml.etree
            * "genshi": a Genshi stream

        :arg implementation: A module implementing the tree type e.g.
            xml.etree.ElementTree or cElementTree (Currently applies to the "etree"
            tree type only).

        :arg kwargs: keyword arguments passed to the etree walker--for other
            walkers, this has no effect

        :returns: a TreeWalker class

    pprint(walker)
        Pretty printer for tree walkers

        Takes a TreeWalker instance and pretty prints the output of walking the tree.

        :arg walker: a TreeWalker instance

DATA
    __all__ = ['getTreeWalker', 'pprint']

FILE
    c:\users\youse\appdata\local\programs\python\python312\lib\site-packages\html5lib\treewalkers\__init__.py

html5lib.unicode_literals
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object