This file is indexed.

/usr/lib/python2.7/dist-packages/flickrapi/xmlnode.py is in python-flickrapi 2.1.2-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'''FlickrAPI uses its own in-memory XML representation, to be able to easily
use the info returned from Flickr.

There is no need to use this module directly, you'll get XMLNode instances
from the FlickrAPI method calls.
'''

import xml.dom.minidom

__all__ = ('XMLNode', )

class XMLNode:
    """XMLNode -- generic class for holding an XML node"""

    def __init__(self):
        """Construct an empty XML node."""
        self.name = ""
        self.text = ""
        self.attrib = {}
        self.xml = None

    def __setitem__(self, key, item):
        """Store a node's attribute in the attrib hash."""
        self.attrib[key] = item

    def __getitem__(self, key):
        """Retrieve a node's attribute from the attrib hash."""
        return self.attrib[key]

    @classmethod
    def __parse_element(cls, element, this_node):
        """Recursive call to process this XMLNode."""

        this_node.name = element.nodeName

        # add element attributes as attributes to this node
        for i in range(element.attributes.length):
            an = element.attributes.item(i)
            this_node[an.name] = an.nodeValue

        for a in element.childNodes:
            if a.nodeType == xml.dom.Node.ELEMENT_NODE:

                child = XMLNode()
                # Ugly fix for an ugly bug. If an XML element <name />
                # exists, it now overwrites the 'name' attribute
                # storing the XML element name.
                if not hasattr(this_node, a.nodeName) or a.nodeName == 'name':
                    setattr(this_node, a.nodeName, [])

                # add the child node as an attrib to this node
                children = getattr(this_node, a.nodeName)
                children.append(child)

                cls.__parse_element(a, child)

            elif a.nodeType == xml.dom.Node.TEXT_NODE:
                this_node.text += a.nodeValue
        
        return this_node

    @classmethod
    def parse(cls, xml_str, store_xml=False):
        """Convert an XML string into a nice instance tree of XMLNodes.

        xml_str -- the XML to parse
        store_xml -- if True, stores the XML string in the root XMLNode.xml

        """

        dom = xml.dom.minidom.parseString(xml_str)

        # get the root
        root_node = XMLNode()
        if store_xml: root_node.xml = xml_str

        return cls.__parse_element(dom.firstChild, root_node)