This file is indexed.

/usr/lib/python2.7/dist-packages/zope/configuration/name.py is in python-zope.configuration 4.0.3-3.

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
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Provide configuration object name resolution
"""

import os
from types import ModuleType

def resolve(name, package='zopeproducts', _silly=('__doc__',), _globals={}):
    name = name.strip()

    if name.startswith('.'):
        name = package + name

    if name.endswith('.') or name.endswith('+'):
        name = name[:-1]
        repeat = True
    else:
        repeat = False

    names = name.split('.')
    last = names[-1]
    mod = '.'.join(names[:-1])

    if not mod:
        return __import__(name, _globals, _globals, _silly)

    while 1:
        m = __import__(mod, _globals, _globals, _silly)
        try:
            a = getattr(m, last)
        except AttributeError:
            if not repeat:
                return __import__(name, _globals, _globals, _silly)

        else:
            if not repeat or (not isinstance(a, ModuleType)):
                return a
        mod += '.' + last


def getNormalizedName(name, package):
    name = name.strip()
    if name.startswith('.'):
        name = package + name

    if name.endswith('.') or name.endswith('+'):
        name = name[:-1]
        repeat = True
    else:
        repeat = False
    name = name.split(".")
    while len(name) > 1 and name[-1] == name[-2]:
        name.pop()
        repeat = 1
    name = ".".join(name)
    if repeat:
        name += "+"
    return name

def path(file='', package='zopeproducts', _silly=('__doc__',), _globals={}):
    # XXX WTF? why not look for abspath before importing?
    try:
        package = __import__(package, _globals, _globals, _silly)
    except ImportError:
        norm = os.path.normpath(file)
        if file and os.path.abspath(norm) == norm:
            # The package didn't matter
            return norm
        raise

    path = os.path.dirname(package.__file__)

    if file:
        path = os.path.join(path, file)

    return path