The module begins with a comment pointing back to this documentation, and acknowledging Fredrik Lundh's work.
"""etbuilder.py: An element builder for lxml.etree
================================================================
$Revision: 1.28 $ $Date: 2009/01/23 03:50:52 $
================================================================
For documentation, see:
http://www.nmt.edu/tcc/help/pubs/pylxml/
Borrows heavily from the work of Fredrik Lundh; see:
http://effbot.org/
"""
The et module is lxml.etree.
#================================================================ # Imports #---------------------------------------------------------------- from lxml import etree as et
The functools.partial() function is
used to curry a function call in Section 12.7, “ElementMaker.__getattr__(): Handle
arbitrary method calls”.
However, the functools module is new in
Python 2.5. In order to make this module work in a
Python 2.4 install, we will anticipate a possible failure
to import functools, providing that
functionality with a substitute partial()
function. This function is stolen directly from the
Python Library Reference.
try:
from functools import partial
except ImportError:
def partial(func, *args, **keywords):
def newfunc(*fargs, **fkeywords):
newkeywords = keywords.copy()
newkeywords.update(fkeywords)
return func(*(args + fargs), **newkeywords)
newfunc.func = func
newfunc.args = args
newfunc.keywords = keywords
return newfunc