This file is indexed.

/usr/share/pyshared/grokcore/component/zcml.py is in python-grokcore.component 2.5-0ubuntu1.

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
##############################################################################
#
# Copyright (c) 2006-2007 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.
#
##############################################################################
"""Grok ZCML directives."""

from zope.interface import Interface
from zope.configuration.fields import GlobalObject
from zope.schema import TextLine

import martian


class IGrokDirective(Interface):
    """Grok a package or module."""

    package = GlobalObject(
        title=u"Package",
        description=u"The package or module to be analyzed by grok.",
        required=False)

    exclude = TextLine(
        title=u"Exclude",
        description=u"Name to exclude in the grokking process.",
        required=False)


# add a cleanup hook so that grok will bootstrap itself again whenever
# the Component Architecture is torn down.
def resetBootstrap():
    # we need to make sure that the grokker registry is clean again
    the_module_grokker.clear()

from zope.testing.cleanup import addCleanUp
addCleanUp(resetBootstrap)

the_multi_grokker = martian.MetaMultiGrokker()
the_module_grokker = martian.ModuleGrokker(the_multi_grokker)


def skip_tests(name):
    return name in ['tests', 'ftests', 'testing']


def grokDirective(_context, package, exclude=None):
    if not exclude:
        exclude = None
    do_grok(package.__name__, _context, extra_exclude=exclude)


def do_grok(dotted_name, config, extra_exclude=None):
    if extra_exclude is not None:

        def exclude_filter(name):
            return skip_tests(name) or extra_exclude == name

    else:
        exclude_filter = skip_tests

    martian.grok_dotted_name(
        dotted_name, the_module_grokker, exclude_filter=exclude_filter,
        config=config)