Skip to content

Commit

Permalink
deleted dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Aug 11, 2012
1 parent ab74532 commit ec95879
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 86 deletions.
45 changes: 0 additions & 45 deletions src/lxml/apihelpers.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,6 @@ cdef _Element _rootNodeOrRaise(object input):
_assertValidNode(node)
return node

cdef _Document _documentOf(object input):
# call this to get the document of a
# _Document, _ElementTree or _Element object
# may return None!
cdef _Element element
cdef _Document doc = None
if isinstance(input, _ElementTree):
element = (<_ElementTree>input)._context_node
if element is not None:
doc = element._doc
elif isinstance(input, _Element):
doc = (<_Element>input)._doc
elif isinstance(input, _Document):
doc = <_Document>input
if doc is not None:
_assertValidDoc(doc)
return doc

cdef _Element _rootNodeOf(object input):
# call this to get the root node of a
# _Document, _ElementTree or _Element object
# may return None!
cdef _Element element = None
if isinstance(input, _ElementTree):
element = (<_ElementTree>input)._context_node
elif isinstance(input, _Element):
element = <_Element>input
elif isinstance(input, _Document):
element = (<_Document>input).getroot()
if element is not None:
_assertValidNode(element)
return element

cdef _Element _makeElement(tag, xmlDoc* c_doc, _Document doc,
_BaseParser parser, text, tail, attrib, nsmap,
extra_attrs):
Expand Down Expand Up @@ -626,18 +593,6 @@ cdef bint _hasEncodingDeclaration(object xml_string):
# check if a (unicode) string has an XML encoding declaration
return __HAS_XML_ENCODING(xml_string) is not None

cdef object _stripDeclaration(object xml_string):
# this is a hack to remove the XML declaration when we encode to UTF-8
xml_string = xml_string.strip()
if xml_string[:5] == '<?xml':
i = xml_string.find('?>')
if i != -1:
i = i + 2
while xml_string[i:i+1] in '\n\r ':
i = i+1
xml_string = xml_string[i:]
return xml_string

cdef inline bint _hasText(xmlNode* c_node):
return c_node is not NULL and _textNodeOrSkip(c_node.children) is not NULL

Expand Down
13 changes: 0 additions & 13 deletions src/lxml/nsclasses.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,3 @@ cdef list _find_all_extension_prefixes():
ns_prefixes.append(
(registry._prefix_utf, registry._ns_uri_utf))
return ns_prefixes

cdef object _find_extension(ns_uri_utf, name_utf):
cdef python.PyObject* dict_result
dict_result = python.PyDict_GetItem(
__FUNCTION_NAMESPACE_REGISTRIES, ns_uri_utf)
if dict_result is NULL:
return None
extensions = (<_NamespaceRegistry>dict_result)._entries
dict_result = python.PyDict_GetItem(extensions, name_utf)
if dict_result is NULL:
return None
else:
return <object>dict_result
10 changes: 0 additions & 10 deletions src/lxml/parser.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,6 @@ cdef _ParserDictionaryContext __GLOBAL_PARSER_CONTEXT
__GLOBAL_PARSER_CONTEXT = _ParserDictionaryContext()
__GLOBAL_PARSER_CONTEXT.initMainParserContext()

cdef int _checkThreadDict(tree.xmlDict* c_dict):
u"""Check that c_dict is either the local thread dictionary or the global
parent dictionary.
"""
#if __GLOBAL_PARSER_CONTEXT._c_dict is c_dict:
# return 1 # main thread
if __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL) is c_dict:
return 1 # local thread dict
return 0

############################################################
## support for Python unicode I/O
############################################################
Expand Down
10 changes: 0 additions & 10 deletions src/lxml/xmlid.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,6 @@ cdef class _IDDict:
<tree.xmlHashScanner>_collectIdHashItemList, <python.PyObject*>context)
return items

cdef void _collectIdHashItemDict(void* payload, void* context, const_xmlChar* name):
# collect elements from ID attribute hash table
cdef tree.xmlID* c_id
c_id = <tree.xmlID*>payload
if c_id is NULL or c_id.attr is NULL or c_id.attr.parent is NULL:
return
dic, doc = <tuple>context
element = _elementFactory(doc, c_id.attr.parent)
dic[funicode(name)] = element

cdef void _collectIdHashItemList(void* payload, void* context, const_xmlChar* name):
# collect elements from ID attribute hash table
cdef tree.xmlID* c_id
Expand Down
8 changes: 0 additions & 8 deletions src/lxml/xslt.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,6 @@ cdef int _register_xslt_function(void* ctxt, name_utf, ns_utf):
<xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
<xslt.xmlXPathFunction>_xpath_function_call)

cdef int _unregister_xslt_function(void* ctxt, name_utf, ns_utf):
if ns_utf is None:
return 0
# libxml2 internalises the strings if ctxt has a dict
return xslt.xsltRegisterExtFunction(
<xslt.xsltTransformContext*>ctxt, _cstr(name_utf), _cstr(ns_utf),
NULL)

cdef dict EMPTY_DICT = {}

@cython.final
Expand Down

0 comments on commit ec95879

Please sign in to comment.