Skip to content

Commit

Permalink
docs: explain the global "set_element_class_lookup()" function better (
Browse files Browse the repository at this point in the history
…GH-341)

Also set "inherited-members" in the autodoc config to make the methods of internal classes visible, e.g. of "_BaseParser".
  • Loading branch information
xmo-odoo committed Mar 13, 2022
1 parent 3bd8db7 commit e983807
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/api/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
autodoc_default_options = {
'ignore-module-all': True,
'private-members': True,
'inherited-members': True,
}

autodoc_member_order = 'groupwise'
Expand Down
19 changes: 18 additions & 1 deletion src/lxml/classlookup.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,24 @@ cdef void _setElementClassLookupFunction(
def set_element_class_lookup(ElementClassLookup lookup = None):
u"""set_element_class_lookup(lookup = None)
Set the global default element class lookup method.
Set the global element class lookup method.
This defines the main entry point for looking up element implementations.
The standard implementation uses the :class:`ParserBasedElementClassLookup`
to delegate to different lookup schemes for each parser.
.. warning::
This should only be changed by applications, not by library packages.
In most cases, parser specific lookups should be preferred,
which can be configured via
:meth:`~lxml.etree.XMLParser.set_element_class_lookup`
(and the same for HTML parsers).
Globally replacing the element class lookup by something other than a
:class:`ParserBasedElementClassLookup` will prevent parser specific lookup
schemes from working. Several tools rely on parser specific lookups,
including :mod:`lxml.html` and :mod:`lxml.objectify`.
"""
if lookup is None or lookup._lookup_function is NULL:
_setElementClassLookupFunction(NULL, None)
Expand Down

0 comments on commit e983807

Please sign in to comment.