This file is indexed.

/usr/share/pyshared/collada/asset.py is in python-collada 0.4-2.

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
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
####################################################################
#                                                                  #
# THIS FILE IS PART OF THE pycollada LIBRARY SOURCE CODE.          #
# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     #
# GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE #
# IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       #
#                                                                  #
# THE pycollada SOURCE CODE IS (C) COPYRIGHT 2011                  #
# by Jeff Terrace and contributors                                 #
#                                                                  #
####################################################################

"""Contains COLLADA asset information."""

import numpy
import datetime
import dateutil.parser

from collada.common import DaeObject, E, tag
from collada.common import DaeIncompleteError, DaeBrokenRefError, \
        DaeMalformedError, DaeUnsupportedError
from collada.util import _correctValInNode
from collada.xmlutil import etree as ElementTree


class UP_AXIS:
    """The up-axis of the collada document."""
    X_UP = 'X_UP'
    """Indicates X direction is up"""
    Y_UP = 'Y_UP'
    """Indicates Y direction is up"""
    Z_UP = 'Z_UP'
    """Indicates Z direction is up"""

class Contributor(DaeObject):
    """Defines authoring information for asset management"""

    def __init__(self, author=None, authoring_tool=None, comments=None, copyright=None, source_data=None, xmlnode=None):
        """Create a new contributor

        :param str author:
          The author's name
        :param str authoring_tool:
          Name of the authoring tool
        :param str comments:
          Comments from the contributor
        :param str copyright:
          Copyright information
        :param str source_data:
          URI referencing the source data
        :param xmlnode:
          If loaded from xml, the xml node

        """
        self.author = author
        """Contains a string with the author's name."""
        self.authoring_tool = authoring_tool
        """Contains a string with the name of the authoring tool."""
        self.comments = comments
        """Contains a string with comments from this contributor."""
        self.copyright = copyright
        """Contains a string with copyright information."""
        self.source_data = source_data
        """Contains a string with a URI referencing the source data for this asset."""

        if xmlnode is not None:
            self.xmlnode = xmlnode
            """ElementTree representation of the contributor."""
        else:
            self.xmlnode = E.contributor()
            if author is not None:
                self.xmlnode.append(E.author(str(author)))
            if authoring_tool is not None:
                self.xmlnode.append(E.authoring_tool(str(authoring_tool)))
            if comments is not None:
                self.xmlnode.append(E.comments(str(comments)))
            if copyright is not None:
                self.xmlnode.append(E.copyright(str(copyright)))
            if source_data is not None:
                self.xmlnode.append(E.source_data(str(source_data)))

    @staticmethod
    def load(collada, localscope, node):
        author = node.find( tag('author') )
        authoring_tool = node.find( tag('authoring_tool') )
        comments = node.find( tag('comments') )
        copyright = node.find( tag('copyright') )
        source_data = node.find( tag('source_data') )
        if author is not None: author = author.text
        if authoring_tool is not None: authoring_tool = authoring_tool.text
        if comments is not None: comments = comments.text
        if copyright is not None: copyright = copyright.text
        if source_data is not None: source_data = source_data.text
        return Contributor(author=author, authoring_tool=authoring_tool,
                           comments=comments, copyright=copyright, source_data=source_data, xmlnode=node)

    def save(self):
        """Saves the contributor info back to :attr:`xmlnode`"""
        _correctValInNode(self.xmlnode, 'author', self.author)
        _correctValInNode(self.xmlnode, 'authoring_tool', self.authoring_tool)
        _correctValInNode(self.xmlnode, 'comments', self.comments)
        _correctValInNode(self.xmlnode, 'copyright', self.copyright)
        _correctValInNode(self.xmlnode, 'source_data', self.source_data)

    def __str__(self): return '<Contributor author=%s>' % (str(self.author),)
    def __repr__(self): return str(self)

class Asset(DaeObject):
    """Defines asset-management information"""

    def __init__(self, created=None, modified=None, title=None, subject=None, revision=None,
               keywords=None, unitname=None, unitmeter=None, upaxis=None, contributors=None, xmlnode=None):
        """Create a new set of information about an asset

        :param datetime.datetime created:
          When the asset was created. If None, this will be set to the current date and time.
        :param datetime.datetime modified:
          When the asset was modified. If None, this will be set to the current date and time.
        :param str title:
          The title of the asset
        :param str subject:
          The description of the topical subject of the asset
        :param str revision:
          Revision information about the asset
        :param str keywords:
          A list of words used for search criteria for the asset
        :param str unitname:
          The name of the unit of distance for this asset
        :param float unitmeter:
          How many real-world meters are in one distance unit
        :param `collada.asset.UP_AXIS` upaxis:
          The up-axis of the asset. If None, this will be set to Y_UP
        :param list contributors:
          The list of contributors for the asset
        :param xmlnode:
          If loaded from xml, the xml node

        """

        if created is None:
            created = datetime.datetime.now()
        self.created = created
        """Instance of :class:`datetime.datetime` indicating when the asset was created"""

        if modified is None:
            modified = datetime.datetime.now()
        self.modified = modified
        """Instance of :class:`datetime.datetime` indicating when the asset was modified"""

        self.title = title
        """String containing the title of the asset"""
        self.subject = subject
        """String containing the description of the topical subject of the asset"""
        self.revision = revision
        """String containing revision information about the asset"""
        self.keywords = keywords
        """String containing a list of words used for search criteria for the asset"""
        self.unitname = unitname
        """String containing the name of the unit of distance for this asset"""
        self.unitmeter = unitmeter
        """Float containing how many real-world meters are in one distance unit"""

        if upaxis is None:
            upaxis = UP_AXIS.Y_UP
        self.upaxis = upaxis
        """Instance of type :class:`collada.asset.UP_AXIS` indicating the up-axis of the asset"""

        if contributors is None:
            contributors = []
        self.contributors = contributors
        """A list of instances of :class:`collada.asset.Contributor`"""

        if xmlnode is not None:
            self.xmlnode = xmlnode
            """ElementTree representation of the asset."""
        else:
            self._recreateXmlNode()

    def _recreateXmlNode(self):
        self.xmlnode = E.asset()
        for contributor in self.contributors:
            self.xmlnode.append(contributor.xmlnode)
        self.xmlnode.append(E.created(self.created.isoformat()))
        if self.keywords is not None:
            self.xmlnode.append(E.keywords(self.keywords))
        self.xmlnode.append(E.modified(self.modified.isoformat()))
        if self.revision is not None:
            self.xmlnode.append(E.revision(self.revision))
        if self.subject is not None:
            self.xmlnode.append(E.subject(self.subject))
        if self.title is not None:
            self.xmlnode.append(E.title(self.title))
        if self.unitmeter is not None and self.unitname is not None:
            self.xmlnode.append(E.unit(name=self.unitname, meter=str(self.unitmeter)))
        self.xmlnode.append(E.up_axis(self.upaxis))

    def save(self):
        """Saves the asset info back to :attr:`xmlnode`"""
        self._recreateXmlNode()

    @staticmethod
    def load(collada, localscope, node):
        contributornodes = node.findall( tag('contributor') )
        contributors = []
        for contributornode in contributornodes:
            contributors.append(Contributor.load(collada, localscope, contributornode))

        created = node.find( tag('created') )
        if created is not None:
            try: created = dateutil.parser.parse(created.text)
            except: created = None

        keywords = node.find( tag('keywords') )
        if keywords is not None: keywords = keywords.text

        modified = node.find( tag('modified') )
        if modified is not None:
            try: modified = dateutil.parser.parse(modified.text)
            except: modified = None

        revision = node.find( tag('revision') )
        if revision is not None: revision = revision.text

        subject = node.find( tag('subject') )
        if subject is not None: subject = subject.text

        title = node.find( tag('title') )
        if title is not None: title = title.text

        unitnode = node.find( tag('unit') )
        if unitnode is not None:
            unitname = unitnode.get('name')
            try: unitmeter = float(unitnode.get('meter'))
            except:
                unitname = None
                unitmeter = None
        else:
            unitname = None
            unitmeter = None

        upaxis = node.find( tag('up_axis') )
        if upaxis is not None:
            upaxis = upaxis.text
            if not(upaxis == UP_AXIS.X_UP or upaxis == UP_AXIS.Y_UP or \
                    upaxis == UP_AXIS.Z_UP):
                upaxis = None

        return Asset(created=created, modified=modified, title=title,
                subject=subject, revision=revision, keywords=keywords,
                unitname=unitname, unitmeter=unitmeter, upaxis=upaxis,
                contributors=contributors, xmlnode=node)

    def __str__(self):
        return '<Asset title=%s>' % (str(self.title),)

    def __repr__(self):
        return str(self)