text_prompt
stringlengths 100
17.7k
⌀ | code_prompt
stringlengths 7
9.86k
⌀ |
---|---|
<SYSTEM_TASK:>
Creation of a new node containing a comment.
<END_TASK>
<USER_TASK:>
Description:
def newComment(content):
"""Creation of a new node containing a comment. """ |
ret = libxml2mod.xmlNewComment(content)
if ret is None:raise treeError('xmlNewComment() failed')
return xmlNode(_obj=ret) |
<SYSTEM_TASK:>
Creation of a processing instruction element. Use
<END_TASK>
<USER_TASK:>
Description:
def newPI(name, content):
"""Creation of a processing instruction element. Use
xmlDocNewPI preferably to get string interning """ |
ret = libxml2mod.xmlNewPI(name, content)
if ret is None:raise treeError('xmlNewPI() failed')
return xmlNode(_obj=ret) |
<SYSTEM_TASK:>
Create an xmltextReader for an XML from a file descriptor.
<END_TASK>
<USER_TASK:>
Description:
def readerForFd(fd, URL, encoding, options):
"""Create an xmltextReader for an XML from a file descriptor.
The parsing flags @options are a combination of
xmlParserOption. NOTE that the file descriptor will not be
closed when the reader is closed or reset. """ |
ret = libxml2mod.xmlReaderForFd(fd, URL, encoding, options)
if ret is None:raise treeError('xmlReaderForFd() failed')
return xmlTextReader(_obj=ret) |
<SYSTEM_TASK:>
Parses a regular expression conforming to XML Schemas Part
<END_TASK>
<USER_TASK:>
Description:
def regexpCompile(regexp):
"""Parses a regular expression conforming to XML Schemas Part
2 Datatype Appendix F and builds an automata suitable for
testing strings against that regular expression """ |
ret = libxml2mod.xmlRegexpCompile(regexp)
if ret is None:raise treeError('xmlRegexpCompile() failed')
return xmlReg(_obj=ret) |
<SYSTEM_TASK:>
Create an XML Schemas parse context for that memory buffer
<END_TASK>
<USER_TASK:>
Description:
def schemaNewMemParserCtxt(buffer, size):
"""Create an XML Schemas parse context for that memory buffer
expected to contain an XML Schemas file. """ |
ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
return SchemaParserCtxt(_obj=ret) |
<SYSTEM_TASK:>
Pops the top XPath object from the value stack
<END_TASK>
<USER_TASK:>
Description:
def valuePop(ctxt):
"""Pops the top XPath object from the value stack """ |
if ctxt is None: ctxt__o = None
else: ctxt__o = ctxt._o
ret = libxml2mod.valuePop(ctxt__o)
return ret |
<SYSTEM_TASK:>
Remove a namespace definition from a node. If href is None,
<END_TASK>
<USER_TASK:>
Description:
def removeNsDef(self, href):
"""
Remove a namespace definition from a node. If href is None,
remove all of the ns definitions on that node. The removed
namespaces are returned as a linked list.
Note: If any child nodes referred to the removed namespaces,
they will be left with dangling links. You should call
renconciliateNs() to fix those pointers.
Note: This method does not free memory taken by the ns
definitions. You will need to free it manually with the
freeNsList() method on the returns xmlNs object.
""" |
ret = libxml2mod.xmlNodeRemoveNsDef(self._o, href)
if ret is None:return None
__tmp = xmlNs(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Dumps debug information for the element node, it is
<END_TASK>
<USER_TASK:>
Description:
def debugDumpNode(self, output, depth):
"""Dumps debug information for the element node, it is
recursive """ |
libxml2mod.xmlDebugDumpNode(output, self._o, depth) |
<SYSTEM_TASK:>
Dumps debug information for the list of element node, it is
<END_TASK>
<USER_TASK:>
Description:
def debugDumpNodeList(self, output, depth):
"""Dumps debug information for the list of element node, it is
recursive """ |
libxml2mod.xmlDebugDumpNodeList(output, self._o, depth) |
<SYSTEM_TASK:>
Dumps debug information for the element node, it is not
<END_TASK>
<USER_TASK:>
Description:
def debugDumpOneNode(self, output, depth):
"""Dumps debug information for the element node, it is not
recursive """ |
libxml2mod.xmlDebugDumpOneNode(output, self._o, depth) |
<SYSTEM_TASK:>
Add a new node to @parent, at the end of the child (or
<END_TASK>
<USER_TASK:>
Description:
def addChild(self, cur):
"""Add a new node to @parent, at the end of the child (or
property) list merging adjacent TEXT nodes (in which case
@cur is freed) If the new node is ATTRIBUTE, it is added
into properties instead of children. If there is an
attribute with equal name, it is first destroyed. """ |
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlAddChild(self._o, cur__o)
if ret is None:raise treeError('xmlAddChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Add a list of node at the end of the child list of the
<END_TASK>
<USER_TASK:>
Description:
def addChildList(self, cur):
"""Add a list of node at the end of the child list of the
parent merging adjacent TEXT nodes (@cur may be freed) """ |
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlAddChildList(self._o, cur__o)
if ret is None:raise treeError('xmlAddChildList() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Add a new element @elem to the list of siblings of @cur
<END_TASK>
<USER_TASK:>
Description:
def addSibling(self, elem):
"""Add a new element @elem to the list of siblings of @cur
merging adjacent TEXT nodes (@elem may be freed) If the new
element was already inserted in a document it is first
unlinked from its existing context. """ |
if elem is None: elem__o = None
else: elem__o = elem._o
ret = libxml2mod.xmlAddSibling(self._o, elem__o)
if ret is None:raise treeError('xmlAddSibling() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Finds the first child node of that element which is a
<END_TASK>
<USER_TASK:>
Description:
def firstElementChild(self):
"""Finds the first child node of that element which is a
Element node Note the handling of entities references is
different than in the W3C DOM element traversal spec since
we don't have back reference from entities content to
entities references. """ |
ret = libxml2mod.xmlFirstElementChild(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Search the last child of a node.
<END_TASK>
<USER_TASK:>
Description:
def lastChild(self):
"""Search the last child of a node. """ |
ret = libxml2mod.xmlGetLastChild(self._o)
if ret is None:raise treeError('xmlGetLastChild() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Finds the last child node of that element which is a
<END_TASK>
<USER_TASK:>
Description:
def lastElementChild(self):
"""Finds the last child node of that element which is a
Element node Note the handling of entities references is
different than in the W3C DOM element traversal spec since
we don't have back reference from entities content to
entities references. """ |
ret = libxml2mod.xmlLastElementChild(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a new Namespace. This function will refuse to
<END_TASK>
<USER_TASK:>
Description:
def newNs(self, href, prefix):
"""Creation of a new Namespace. This function will refuse to
create a namespace with a similar prefix than an existing
one present on this node. We use href==None in the case of
an element creation where the namespace was not defined. """ |
ret = libxml2mod.xmlNewNs(self._o, href, prefix)
if ret is None:raise treeError('xmlNewNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Create a new property carried by a node.
<END_TASK>
<USER_TASK:>
Description:
def newProp(self, name, value):
"""Create a new property carried by a node. """ |
ret = libxml2mod.xmlNewProp(self._o, name, value)
if ret is None:raise treeError('xmlNewProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Finds the first closest next sibling of the node which is
<END_TASK>
<USER_TASK:>
Description:
def nextElementSibling(self):
"""Finds the first closest next sibling of the node which is
an element node. Note the handling of entities references
is different than in the W3C DOM element traversal spec
since we don't have back reference from entities content to
entities references. """ |
ret = libxml2mod.xmlNextElementSibling(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Finds the first closest previous sibling of the node which
<END_TASK>
<USER_TASK:>
Description:
def previousElementSibling(self):
"""Finds the first closest previous sibling of the node which
is an element node. Note the handling of entities
references is different than in the W3C DOM element
traversal spec since we don't have back reference from
entities content to entities references. """ |
ret = libxml2mod.xmlPreviousElementSibling(self._o)
if ret is None:return None
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Unlink the old node from its current context, prune the new
<END_TASK>
<USER_TASK:>
Description:
def replaceNode(self, cur):
"""Unlink the old node from its current context, prune the new
one at the same place. If @cur was already inserted in a
document it is first unlinked from its existing context. """ |
if cur is None: cur__o = None
else: cur__o = cur._o
ret = libxml2mod.xmlReplaceNode(self._o, cur__o)
if ret is None:raise treeError('xmlReplaceNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Concat the given string at the end of the existing node
<END_TASK>
<USER_TASK:>
Description:
def textConcat(self, content, len):
"""Concat the given string at the end of the existing node
content """ |
ret = libxml2mod.xmlTextConcat(self._o, content, len)
return ret |
<SYSTEM_TASK:>
Merge two text nodes into one
<END_TASK>
<USER_TASK:>
Description:
def textMerge(self, second):
"""Merge two text nodes into one """ |
if second is None: second__o = None
else: second__o = second._o
ret = libxml2mod.xmlTextMerge(self._o, second__o)
if ret is None:raise treeError('xmlTextMerge() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Remove an attribute carried by a node. This handles only
<END_TASK>
<USER_TASK:>
Description:
def unsetProp(self, name):
"""Remove an attribute carried by a node. This handles only
attributes in no namespace. """ |
ret = libxml2mod.xmlUnsetProp(self._o, name)
return ret |
<SYSTEM_TASK:>
Implement the XInclude substitution for the given subtree
<END_TASK>
<USER_TASK:>
Description:
def xincludeProcessTreeFlags(self, flags):
"""Implement the XInclude substitution for the given subtree """ |
ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags)
return ret |
<SYSTEM_TASK:>
Evaluate the XPath Location Path in the given context. The
<END_TASK>
<USER_TASK:>
Description:
def xpathNodeEval(self, str, ctx):
"""Evaluate the XPath Location Path in the given context. The
node 'node' is set as the context node. The context node is
not restored. """ |
if ctx is None: ctx__o = None
else: ctx__o = ctx._o
ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
if ret is None:raise xpathError('xmlXPathNodeEval() failed')
return xpathObjectRet(ret) |
<SYSTEM_TASK:>
Create a new xmlXPathObjectPtr of type LocationSet and
<END_TASK>
<USER_TASK:>
Description:
def xpointerNewLocationSetNodes(self, end):
"""Create a new xmlXPathObjectPtr of type LocationSet and
initialize it with the single range made of the two nodes
@start and @end """ |
if end is None: end__o = None
else: end__o = end._o
ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
return xpathObjectRet(ret) |
<SYSTEM_TASK:>
The HTML DTD allows a tag to implicitly close other tags.
<END_TASK>
<USER_TASK:>
Description:
def htmlAutoCloseTag(self, name, elem):
"""The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if the element or one of it's children would
autoclose the given tag. """ |
ret = libxml2mod.htmlAutoCloseTag(self._o, name, elem)
return ret |
<SYSTEM_TASK:>
The HTML DTD allows a tag to implicitly close other tags.
<END_TASK>
<USER_TASK:>
Description:
def htmlIsAutoClosed(self, elem):
"""The HTML DTD allows a tag to implicitly close other tags.
The list is kept in htmlStartClose array. This function
checks if a tag is autoclosed by one of it's child """ |
ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
return ret |
<SYSTEM_TASK:>
Dump an HTML node, recursive behaviour,children are printed
<END_TASK>
<USER_TASK:>
Description:
def htmlNodeDumpFile(self, out, cur):
"""Dump an HTML node, recursive behaviour,children are printed
too, and formatting returns are added. """ |
if cur is None: cur__o = None
else: cur__o = cur._o
libxml2mod.htmlNodeDumpFile(out, self._o, cur__o) |
<SYSTEM_TASK:>
Dump an HTML document to a file. If @filename is "-" the
<END_TASK>
<USER_TASK:>
Description:
def htmlSaveFile(self, filename):
"""Dump an HTML document to a file. If @filename is "-" the
stdout file is used. """ |
ret = libxml2mod.htmlSaveFile(filename, self._o)
return ret |
<SYSTEM_TASK:>
Dump an HTML document to a file using a given encoding.
<END_TASK>
<USER_TASK:>
Description:
def htmlSaveFileFormat(self, filename, encoding, format):
"""Dump an HTML document to a file using a given encoding. """ |
ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
return ret |
<SYSTEM_TASK:>
Check the document for potential content problems, and
<END_TASK>
<USER_TASK:>
Description:
def debugCheckDocument(self, output):
"""Check the document for potential content problems, and
output the errors to @output """ |
ret = libxml2mod.xmlDebugCheckDocument(output, self._o)
return ret |
<SYSTEM_TASK:>
Register a new entity for this document DTD external subset.
<END_TASK>
<USER_TASK:>
Description:
def addDtdEntity(self, name, type, ExternalID, SystemID, content):
"""Register a new entity for this document DTD external subset. """ |
ret = libxml2mod.xmlAddDtdEntity(self._o, name, type, ExternalID, SystemID, content)
if ret is None:raise treeError('xmlAddDtdEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Do an entity lookup in the document entity hash table and
<END_TASK>
<USER_TASK:>
Description:
def docEntity(self, name):
"""Do an entity lookup in the document entity hash table and """ |
ret = libxml2mod.xmlGetDocEntity(self._o, name)
if ret is None:raise treeError('xmlGetDocEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Do an entity lookup in the DTD entity hash table and
<END_TASK>
<USER_TASK:>
Description:
def dtdEntity(self, name):
"""Do an entity lookup in the DTD entity hash table and """ |
ret = libxml2mod.xmlGetDtdEntity(self._o, name)
if ret is None:raise treeError('xmlGetDtdEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Do a global encoding of a string, replacing the predefined
<END_TASK>
<USER_TASK:>
Description:
def encodeEntitiesReentrant(self, input):
"""Do a global encoding of a string, replacing the predefined
entities and non ASCII values with their entities and
CharRef counterparts. Contrary to xmlEncodeEntities, this
routine is reentrant, and result must be deallocated. """ |
ret = libxml2mod.xmlEncodeEntitiesReentrant(self._o, input)
return ret |
<SYSTEM_TASK:>
Do a global encoding of a string, replacing the predefined
<END_TASK>
<USER_TASK:>
Description:
def encodeSpecialChars(self, input):
"""Do a global encoding of a string, replacing the predefined
entities this routine is reentrant, and result must be
deallocated. """ |
ret = libxml2mod.xmlEncodeSpecialChars(self._o, input)
return ret |
<SYSTEM_TASK:>
Do an entity lookup in the internal and external subsets and
<END_TASK>
<USER_TASK:>
Description:
def parameterEntity(self, name):
"""Do an entity lookup in the internal and external subsets and """ |
ret = libxml2mod.xmlGetParameterEntity(self._o, name)
if ret is None:raise treeError('xmlGetParameterEntity() failed')
__tmp = xmlEntity(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Do a copy of the document info. If recursive, the content
<END_TASK>
<USER_TASK:>
Description:
def copyDoc(self, recursive):
"""Do a copy of the document info. If recursive, the content
tree will be copied too as well as DTD, namespaces and
entities. """ |
ret = libxml2mod.xmlCopyDoc(self._o, recursive)
if ret is None:raise treeError('xmlCopyDoc() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Get the internal subset of a document
<END_TASK>
<USER_TASK:>
Description:
def intSubset(self):
"""Get the internal subset of a document """ |
ret = libxml2mod.xmlGetIntSubset(self._o)
if ret is None:raise treeError('xmlGetIntSubset() failed')
__tmp = xmlDtd(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a new character reference node.
<END_TASK>
<USER_TASK:>
Description:
def newCharRef(self, name):
"""Creation of a new character reference node. """ |
ret = libxml2mod.xmlNewCharRef(self._o, name)
if ret is None:raise treeError('xmlNewCharRef() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a new node containing a comment within a
<END_TASK>
<USER_TASK:>
Description:
def newDocComment(self, content):
"""Creation of a new node containing a comment within a
document. """ |
ret = libxml2mod.xmlNewDocComment(self._o, content)
if ret is None:raise treeError('xmlNewDocComment() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Create a new property carried by a document.
<END_TASK>
<USER_TASK:>
Description:
def newDocProp(self, name, value):
"""Create a new property carried by a document. """ |
ret = libxml2mod.xmlNewDocProp(self._o, name, value)
if ret is None:raise treeError('xmlNewDocProp() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a new text node with an extra content length
<END_TASK>
<USER_TASK:>
Description:
def newDocTextLen(self, content, len):
"""Creation of a new text node with an extra content length
parameter. The text node pertain to a given document. """ |
ret = libxml2mod.xmlNewDocTextLen(self._o, content, len)
if ret is None:raise treeError('xmlNewDocTextLen() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a Namespace, the old way using PI and without
<END_TASK>
<USER_TASK:>
Description:
def newGlobalNs(self, href, prefix):
"""Creation of a Namespace, the old way using PI and without
scoping DEPRECATED !!! """ |
ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
if ret is None:raise treeError('xmlNewGlobalNs() failed')
__tmp = xmlNs(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Dump an XML document, converting it to the given encoding
<END_TASK>
<USER_TASK:>
Description:
def saveFileEnc(self, filename, encoding):
"""Dump an XML document, converting it to the given encoding """ |
ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
return ret |
<SYSTEM_TASK:>
Dump an XML document to a file or an URL.
<END_TASK>
<USER_TASK:>
Description:
def saveFormatFileEnc(self, filename, encoding, format):
"""Dump an XML document to a file or an URL. """ |
ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
return ret |
<SYSTEM_TASK:>
Search the attribute declaring the given ID
<END_TASK>
<USER_TASK:>
Description:
def ID(self, ID):
"""Search the attribute declaring the given ID """ |
ret = libxml2mod.xmlGetID(self._o, ID)
if ret is None:raise treeError('xmlGetID() failed')
__tmp = xmlAttr(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Implement the XInclude substitution on the XML document @doc
<END_TASK>
<USER_TASK:>
Description:
def xincludeProcessFlags(self, flags):
"""Implement the XInclude substitution on the XML document @doc """ |
ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
return ret |
<SYSTEM_TASK:>
Create an XML Schemas parse context for that document. NB.
<END_TASK>
<USER_TASK:>
Description:
def schemaNewDocParserCtxt(self):
"""Create an XML Schemas parse context for that document. NB.
The document may be modified during the parsing process. """ |
ret = libxml2mod.xmlSchemaNewDocParserCtxt(self._o)
if ret is None:raise parserError('xmlSchemaNewDocParserCtxt() failed')
__tmp = SchemaParserCtxt(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
parse an XML from a file descriptor and build a tree. This
<END_TASK>
<USER_TASK:>
Description:
def htmlCtxtReadFd(self, fd, URL, encoding, options):
"""parse an XML from a file descriptor and build a tree. This
reuses the existing @ctxt parser context """ |
ret = libxml2mod.htmlCtxtReadFd(self._o, fd, URL, encoding, options)
if ret is None:raise treeError('htmlCtxtReadFd() failed')
__tmp = xmlDoc(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Setup the parser context to parse a new buffer; Clears any
<END_TASK>
<USER_TASK:>
Description:
def setupParserForBuffer(self, buffer, filename):
"""Setup the parser context to parse a new buffer; Clears any
prior contents from the parser context. The buffer
parameter must not be None, but the filename parameter can
be """ |
libxml2mod.xmlSetupParserForBuffer(self._o, buffer, filename) |
<SYSTEM_TASK:>
Dumps debug information for the attribute
<END_TASK>
<USER_TASK:>
Description:
def debugDumpAttr(self, output, depth):
"""Dumps debug information for the attribute """ |
libxml2mod.xmlDebugDumpAttr(output, self._o, depth) |
<SYSTEM_TASK:>
Dumps debug information for the attribute list
<END_TASK>
<USER_TASK:>
Description:
def debugDumpAttrList(self, output, depth):
"""Dumps debug information for the attribute list """ |
libxml2mod.xmlDebugDumpAttrList(output, self._o, depth) |
<SYSTEM_TASK:>
Add an entry in the catalog, it may overwrite existing but
<END_TASK>
<USER_TASK:>
Description:
def add(self, type, orig, replace):
"""Add an entry in the catalog, it may overwrite existing but
different entries. """ |
ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
return ret |
<SYSTEM_TASK:>
Remove an entry from the catalog
<END_TASK>
<USER_TASK:>
Description:
def remove(self, value):
"""Remove an entry from the catalog """ |
ret = libxml2mod.xmlACatalogRemove(self._o, value)
return ret |
<SYSTEM_TASK:>
Do a complete resolution lookup of an External Identifier
<END_TASK>
<USER_TASK:>
Description:
def resolve(self, pubID, sysID):
"""Do a complete resolution lookup of an External Identifier """ |
ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
return ret |
<SYSTEM_TASK:>
Try to lookup the catalog local reference associated to a
<END_TASK>
<USER_TASK:>
Description:
def resolvePublic(self, pubID):
"""Try to lookup the catalog local reference associated to a
public ID in that catalog """ |
ret = libxml2mod.xmlACatalogResolvePublic(self._o, pubID)
return ret |
<SYSTEM_TASK:>
Do a complete resolution lookup of an URI
<END_TASK>
<USER_TASK:>
Description:
def resolveURI(self, URI):
"""Do a complete resolution lookup of an URI """ |
ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
return ret |
<SYSTEM_TASK:>
Search the DTD for the description of this attribute on
<END_TASK>
<USER_TASK:>
Description:
def dtdAttrDesc(self, elem, name):
"""Search the DTD for the description of this attribute on
this element. """ |
ret = libxml2mod.xmlGetDtdAttrDesc(self._o, elem, name)
if ret is None:raise treeError('xmlGetDtdAttrDesc() failed')
__tmp = xmlAttribute(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Search the DTD for the description of this qualified
<END_TASK>
<USER_TASK:>
Description:
def dtdQAttrDesc(self, elem, name, prefix):
"""Search the DTD for the description of this qualified
attribute on this element. """ |
ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
__tmp = xmlAttribute(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Save the original error to the new place.
<END_TASK>
<USER_TASK:>
Description:
def copyError(self, to):
"""Save the original error to the new place. """ |
if to is None: to__o = None
else: to__o = to._o
ret = libxml2mod.xmlCopyError(self._o, to__o)
return ret |
<SYSTEM_TASK:>
Do a copy of an namespace list.
<END_TASK>
<USER_TASK:>
Description:
def copyNamespaceList(self):
"""Do a copy of an namespace list. """ |
ret = libxml2mod.xmlCopyNamespaceList(self._o)
if ret is None:raise treeError('xmlCopyNamespaceList() failed')
__tmp = xmlNs(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Creation of a new node element. @ns is optional (None).
<END_TASK>
<USER_TASK:>
Description:
def newNodeEatName(self, name):
"""Creation of a new node element. @ns is optional (None). """ |
ret = libxml2mod.xmlNewNodeEatName(self._o, name)
if ret is None:raise treeError('xmlNewNodeEatName() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Refresh the content of the input buffer, the old data are
<END_TASK>
<USER_TASK:>
Description:
def read(self, len):
"""Refresh the content of the input buffer, the old data are
considered consumed This routine handle the I18N
transcoding to internal UTF-8 """ |
ret = libxml2mod.xmlParserInputBufferRead(self._o, len)
return ret |
<SYSTEM_TASK:>
Check if the regular expression generates the value
<END_TASK>
<USER_TASK:>
Description:
def regexpExec(self, content):
"""Check if the regular expression generates the value """ |
ret = libxml2mod.xmlRegexpExec(self._o, content)
return ret |
<SYSTEM_TASK:>
Semi private function used to pass informations to a parser
<END_TASK>
<USER_TASK:>
Description:
def relaxParserSetFlag(self, flags):
"""Semi private function used to pass informations to a parser
context which are a combination of xmlRelaxNGParserFlag . """ |
ret = libxml2mod.xmlRelaxParserSetFlag(self._o, flags)
return ret |
<SYSTEM_TASK:>
Create an XML RelaxNGs validation context based on the
<END_TASK>
<USER_TASK:>
Description:
def relaxNGNewValidCtxt(self):
"""Create an XML RelaxNGs validation context based on the
given schema """ |
ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
__tmp = relaxNgValidCtxt(_obj=ret)
__tmp.schema = self
return __tmp |
<SYSTEM_TASK:>
Create an XML Schemas validation context based on the given
<END_TASK>
<USER_TASK:>
Description:
def schemaNewValidCtxt(self):
"""Create an XML Schemas validation context based on the given
schema. """ |
ret = libxml2mod.xmlSchemaNewValidCtxt(self._o)
if ret is None:raise treeError('xmlSchemaNewValidCtxt() failed')
__tmp = SchemaValidCtxt(_obj=ret)
__tmp.schema = self
return __tmp |
<SYSTEM_TASK:>
Sets the options to be used during the validation.
<END_TASK>
<USER_TASK:>
Description:
def schemaSetValidOptions(self, options):
"""Sets the options to be used during the validation. """ |
ret = libxml2mod.xmlSchemaSetValidOptions(self._o, options)
return ret |
<SYSTEM_TASK:>
Do a schemas validation of the given resource, it will use
<END_TASK>
<USER_TASK:>
Description:
def schemaValidateFile(self, filename, options):
"""Do a schemas validation of the given resource, it will use
the SAX streamable validation internally. """ |
ret = libxml2mod.xmlSchemaValidateFile(self._o, filename, options)
return ret |
<SYSTEM_TASK:>
Hacking interface allowing to get the xmlNodePtr
<END_TASK>
<USER_TASK:>
Description:
def CurrentNode(self):
"""Hacking interface allowing to get the xmlNodePtr
correponding to the current node being accessed by the
xmlTextReader. This is dangerous because the underlying
node may be destroyed on the next Reads. """ |
ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Provides the value of the attribute with the specified
<END_TASK>
<USER_TASK:>
Description:
def GetAttribute(self, name):
"""Provides the value of the attribute with the specified
qualified name. """ |
ret = libxml2mod.xmlTextReaderGetAttribute(self._o, name)
return ret |
<SYSTEM_TASK:>
Provides the value of the attribute with the specified
<END_TASK>
<USER_TASK:>
Description:
def GetAttributeNo(self, no):
"""Provides the value of the attribute with the specified
index relative to the containing element. """ |
ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
return ret |
<SYSTEM_TASK:>
Provides the value of the specified attribute
<END_TASK>
<USER_TASK:>
Description:
def GetAttributeNs(self, localName, namespaceURI):
"""Provides the value of the specified attribute """ |
ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI)
return ret |
<SYSTEM_TASK:>
Read the parser internal property.
<END_TASK>
<USER_TASK:>
Description:
def GetParserProp(self, prop):
"""Read the parser internal property. """ |
ret = libxml2mod.xmlTextReaderGetParserProp(self._o, prop)
return ret |
<SYSTEM_TASK:>
Method to get the remainder of the buffered XML. this
<END_TASK>
<USER_TASK:>
Description:
def GetRemainder(self):
"""Method to get the remainder of the buffered XML. this
method stops the parser, set its state to End Of File and
return the input stream with what is left that the parser
did not use. The implementation is not good, the parser
certainly procgressed past what's left in reader->input,
and there is an allocation problem. Best would be to
rewrite it differently. """ |
ret = libxml2mod.xmlTextReaderGetRemainder(self._o)
if ret is None:raise treeError('xmlTextReaderGetRemainder() failed')
__tmp = inputBuffer(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Resolves a namespace prefix in the scope of the current
<END_TASK>
<USER_TASK:>
Description:
def LookupNamespace(self, prefix):
"""Resolves a namespace prefix in the scope of the current
element. """ |
ret = libxml2mod.xmlTextReaderLookupNamespace(self._o, prefix)
return ret |
<SYSTEM_TASK:>
Moves the position of the current instance to the attribute
<END_TASK>
<USER_TASK:>
Description:
def MoveToAttribute(self, name):
"""Moves the position of the current instance to the attribute
with the specified qualified name. """ |
ret = libxml2mod.xmlTextReaderMoveToAttribute(self._o, name)
return ret |
<SYSTEM_TASK:>
Moves the position of the current instance to the attribute
<END_TASK>
<USER_TASK:>
Description:
def MoveToAttributeNo(self, no):
"""Moves the position of the current instance to the attribute
with the specified index relative to the containing element. """ |
ret = libxml2mod.xmlTextReaderMoveToAttributeNo(self._o, no)
return ret |
<SYSTEM_TASK:>
Moves the position of the current instance to the attribute
<END_TASK>
<USER_TASK:>
Description:
def MoveToAttributeNs(self, localName, namespaceURI):
"""Moves the position of the current instance to the attribute
with the specified local name and namespace URI. """ |
ret = libxml2mod.xmlTextReaderMoveToAttributeNs(self._o, localName, namespaceURI)
return ret |
<SYSTEM_TASK:>
Setup an xmltextReader to parse an XML from a file
<END_TASK>
<USER_TASK:>
Description:
def NewFd(self, fd, URL, encoding, options):
"""Setup an xmltextReader to parse an XML from a file
descriptor. NOTE that the file descriptor will not be
closed when the reader is closed or reset. The parsing
flags @options are a combination of xmlParserOption. This
reuses the existing @reader xmlTextReader. """ |
ret = libxml2mod.xmlReaderNewFd(self._o, fd, URL, encoding, options)
return ret |
<SYSTEM_TASK:>
Change the parser processing behaviour by changing some of
<END_TASK>
<USER_TASK:>
Description:
def SetParserProp(self, prop, value):
"""Change the parser processing behaviour by changing some of
its internal properties. Note that some properties can only
be changed before any read has been done. """ |
ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value)
return ret |
<SYSTEM_TASK:>
Get an interned string from the reader, allows for example
<END_TASK>
<USER_TASK:>
Description:
def String(self, str):
"""Get an interned string from the reader, allows for example
to speedup string name comparisons """ |
ret = libxml2mod.xmlTextReaderConstString(self._o, str)
return ret |
<SYSTEM_TASK:>
Parse an URI reference string based on RFC 3986 and fills
<END_TASK>
<USER_TASK:>
Description:
def parseURIReference(self, str):
"""Parse an URI reference string based on RFC 3986 and fills
in the appropriate fields of the @uri structure
URI-reference = URI / relative-ref """ |
ret = libxml2mod.xmlParseURIReference(self._o, str)
return ret |
<SYSTEM_TASK:>
Get the current node from an xpathContext
<END_TASK>
<USER_TASK:>
Description:
def contextNode(self):
"""Get the current node from an xpathContext """ |
ret = libxml2mod.xmlXPathGetContextNode(self._o)
if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
__tmp = xmlNode(_obj=ret)
return __tmp |
<SYSTEM_TASK:>
Register a Python written function to the XPath interpreter
<END_TASK>
<USER_TASK:>
Description:
def registerXPathFunction(self, name, ns_uri, f):
"""Register a Python written function to the XPath interpreter """ |
ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
return ret |
<SYSTEM_TASK:>
Register a variable with the XPath context
<END_TASK>
<USER_TASK:>
Description:
def xpathRegisterVariable(self, name, ns_uri, value):
"""Register a variable with the XPath context """ |
ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
return ret |
<SYSTEM_TASK:>
Evaluate the XPath expression in the given context.
<END_TASK>
<USER_TASK:>
Description:
def xpathEvalExpression(self, str):
"""Evaluate the XPath expression in the given context. """ |
ret = libxml2mod.xmlXPathEvalExpression(str, self._o)
if ret is None:raise xpathError('xmlXPathEvalExpression() failed')
return xpathObjectRet(ret) |
<SYSTEM_TASK:>
Search in the namespace declaration array of the context
<END_TASK>
<USER_TASK:>
Description:
def xpathNsLookup(self, prefix):
"""Search in the namespace declaration array of the context
for the given namespace name associated to the given prefix """ |
ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
return ret |
<SYSTEM_TASK:>
Register a new namespace. If @ns_uri is None it unregisters
<END_TASK>
<USER_TASK:>
Description:
def xpathRegisterNs(self, prefix, ns_uri):
"""Register a new namespace. If @ns_uri is None it unregisters
the namespace """ |
ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
return ret |
<SYSTEM_TASK:>
Formats an error message.
<END_TASK>
<USER_TASK:>
Description:
def xpatherror(self, file, line, no):
"""Formats an error message. """ |
libxml2mod.xmlXPatherror(self._o, file, line, no) |
<SYSTEM_TASK:>
Traverses the dependency graph of 'target' and return all targets that will
<END_TASK>
<USER_TASK:>
Description:
def traverse (target, include_roots = False, include_sources = False):
""" Traverses the dependency graph of 'target' and return all targets that will
be created before this one is created. If root of some dependency graph is
found during traversal, it's either included or not, dependencing of the
value of 'include_roots'. In either case, sources of root are not traversed.
""" |
assert isinstance(target, VirtualTarget)
assert isinstance(include_roots, (int, bool))
assert isinstance(include_sources, (int, bool))
result = []
if target.action ():
action = target.action ()
# This includes 'target' as well
result += action.targets ()
for t in action.sources ():
# FIXME:
# TODO: see comment in Manager.register_object ()
#if not isinstance (t, VirtualTarget):
# t = target.project_.manager_.get_object (t)
if not t.root ():
result += traverse (t, include_roots, include_sources)
elif include_roots:
result.append (t)
elif include_sources:
result.append (target)
return result |
<SYSTEM_TASK:>
Takes an 'action' instances and creates new instance of it
<END_TASK>
<USER_TASK:>
Description:
def clone_action (action, new_project, new_action_name, new_properties):
"""Takes an 'action' instances and creates new instance of it
and all produced target. The rule-name and properties are set
to 'new-rule-name' and 'new-properties', if those are specified.
Returns the cloned action.""" |
if __debug__:
from .targets import ProjectTarget
assert isinstance(action, Action)
assert isinstance(new_project, ProjectTarget)
assert isinstance(new_action_name, basestring)
assert isinstance(new_properties, property_set.PropertySet)
if not new_action_name:
new_action_name = action.action_name()
if not new_properties:
new_properties = action.properties()
cloned_action = action.__class__(action.manager_, action.sources(), new_action_name,
new_properties)
cloned_targets = []
for target in action.targets():
n = target.name()
# Don't modify the name of the produced targets. Strip the directory f
cloned_target = FileTarget(n, target.type(), new_project,
cloned_action, exact=True)
d = target.dependencies()
if d:
cloned_target.depends(d)
cloned_target.root(target.root())
cloned_target.creating_subvariant(target.creating_subvariant())
cloned_targets.append(cloned_target)
return cloned_action |
<SYSTEM_TASK:>
Registers a new virtual target. Checks if there's already registered target, with the same
<END_TASK>
<USER_TASK:>
Description:
def register (self, target):
""" Registers a new virtual target. Checks if there's already registered target, with the same
name, type, project and subvariant properties, and also with the same sources
and equal action. If such target is found it is retured and 'target' is not registered.
Otherwise, 'target' is registered and returned.
""" |
assert isinstance(target, VirtualTarget)
if target.path():
signature = target.path() + "-" + target.name()
else:
signature = "-" + target.name()
result = None
if signature not in self.cache_:
self.cache_ [signature] = []
for t in self.cache_ [signature]:
a1 = t.action ()
a2 = target.action ()
# TODO: why are we checking for not result?
if not result:
if not a1 and not a2:
result = t
else:
if a1 and a2 and a1.action_name () == a2.action_name () and a1.sources () == a2.sources ():
ps1 = a1.properties ()
ps2 = a2.properties ()
p1 = ps1.base () + ps1.free () +\
b2.util.set.difference(ps1.dependency(), ps1.incidental())
p2 = ps2.base () + ps2.free () +\
b2.util.set.difference(ps2.dependency(), ps2.incidental())
if p1 == p2:
result = t
if not result:
self.cache_ [signature].append (target)
result = target
# TODO: Don't append if we found pre-existing target?
self.recent_targets_.append(result)
self.all_targets_.append(result)
return result |
<SYSTEM_TASK:>
Adds additional instances of 'VirtualTarget' that this
<END_TASK>
<USER_TASK:>
Description:
def depends (self, d):
""" Adds additional instances of 'VirtualTarget' that this
one depends on.
""" |
self.dependencies_ = unique (self.dependencies_ + d).sort () |
<SYSTEM_TASK:>
Generates all the actual targets and sets up build actions for
<END_TASK>
<USER_TASK:>
Description:
def actualize (self, scanner = None):
""" Generates all the actual targets and sets up build actions for
this target.
If 'scanner' is specified, creates an additional target
with the same location as actual target, which will depend on the
actual target and be associated with 'scanner'. That additional
target is returned. See the docs (#dependency_scanning) for rationale.
Target must correspond to a file if 'scanner' is specified.
If scanner is not specified, then actual target is returned.
""" |
if __debug__:
from .scanner import Scanner
assert scanner is None or isinstance(scanner, Scanner)
actual_name = self.actualize_no_scanner ()
if self.always_:
bjam.call("ALWAYS", actual_name)
if not scanner:
return actual_name
else:
# Add the scanner instance to the grist for name.
g = '-'.join ([ungrist(get_grist(actual_name)), str(id(scanner))])
name = replace_grist (actual_name, '<' + g + '>')
if name not in self.made_:
self.made_ [name] = True
self.project_.manager ().engine ().add_dependency (name, actual_name)
self.actualize_location (name)
self.project_.manager ().scanners ().install (scanner, name, str (self))
return name |
<SYSTEM_TASK:>
Sets the path. When generating target name, it will override any path
<END_TASK>
<USER_TASK:>
Description:
def set_path (self, path):
""" Sets the path. When generating target name, it will override any path
computation from properties.
""" |
assert isinstance(path, basestring)
self.path_ = os.path.normpath(path) |
<SYSTEM_TASK:>
Helper to 'actual_name', above. Compute unique prefix used to distinguish
<END_TASK>
<USER_TASK:>
Description:
def grist (self):
"""Helper to 'actual_name', above. Compute unique prefix used to distinguish
this target from other targets with the same name which create different
file.
""" |
# Depending on target, there may be different approaches to generating
# unique prefixes. We'll generate prefixes in the form
# <one letter approach code> <the actual prefix>
path = self.path ()
if path:
# The target will be generated to a known path. Just use the path
# for identification, since path is as unique as it can get.
return 'p' + path
else:
# File is either source, which will be searched for, or is not a file at
# all. Use the location of project for distinguishing.
project_location = self.project_.get ('location')
path_components = b2.util.path.split(project_location)
location_grist = '!'.join (path_components)
if self.action_:
ps = self.action_.properties ()
property_grist = ps.as_path ()
# 'property_grist' can be empty when 'ps' is an empty
# property set.
if property_grist:
location_grist = location_grist + '/' + property_grist
return 'l' + location_grist |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.