This file is indexed.

/usr/share/pyshared/Pyste/FunctionExporter.py is in libboost-python1.55-dev 1.55.0+dfsg-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
89
90
91
92
# Copyright Bruno da Silva de Oliveira 2003. Use, modification and 
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at 
# http://www.boost.org/LICENSE_1_0.txt)

from Exporter import Exporter
from policies import *
from declarations import *
from settings import *
import utils
import exporterutils


#==============================================================================
# FunctionExporter
#==============================================================================
class FunctionExporter(Exporter):
    'Generates boost.python code to export the given function.'
    
    def __init__(self, info, tail=None):
        Exporter.__init__(self, info, tail)
        

    def Export(self, codeunit, exported_names):
        if not self.info.exclude:
            decls = self.GetDeclarations(self.info.name)
            for decl in decls:
                self.info.policy = exporterutils.HandlePolicy(decl, self.info.policy)
                self.ExportDeclaration(decl, len(decls) == 1, codeunit)
                self.ExportOpaquePointer(decl, codeunit)
            self.GenerateOverloads(decls, codeunit)  
            exported_names[self.Name()] = 1


    def ExportDeclaration(self, decl, unique, codeunit):
        name = self.info.rename or decl.name
        defs = namespaces.python + 'def("%s", ' % name
        wrapper = self.info.wrapper
        if wrapper:
            pointer = '&' + wrapper.FullName()
        else:
            pointer = decl.PointerDeclaration()
        defs += pointer            
        defs += self.PolicyCode()                            
        overload = self.OverloadName(decl)
        if overload:
            defs += ', %s()' % (namespaces.pyste + overload)
        defs += ');'
        codeunit.Write('module', self.INDENT + defs + '\n')  
        # add the code of the wrapper
        if wrapper and wrapper.code:
            codeunit.Write('declaration', wrapper.code + '\n')
            

    def OverloadName(self, decl):
        if decl.minArgs != decl.maxArgs:
            return '%s_overloads_%i_%i' % \
                (decl.name, decl.minArgs, decl.maxArgs)
        else:
            return ''

        
    def GenerateOverloads(self, declarations, codeunit):
        codes = {}
        for decl in declarations:
            overload = self.OverloadName(decl)
            if overload and overload not in codes:
                code = 'BOOST_PYTHON_FUNCTION_OVERLOADS(%s, %s, %i, %i)' %\
                    (overload, decl.FullName(), decl.minArgs, decl.maxArgs)
                codeunit.Write('declaration', code + '\n')
                codes[overload] = None
        

    def PolicyCode(self):
        policy = self.info.policy
        if policy is not None:
            assert isinstance(policy, Policy)
            return ', %s()' % policy.Code() 
        else:
            return ''


    def ExportOpaquePointer(self, function, codeunit):
        if self.info.policy == return_value_policy(return_opaque_pointer):
            typename = function.result.name
            macro = exporterutils.EspecializeTypeID(typename)  
            if macro:
                codeunit.Write('declaration-outside', macro)


    def Name(self):
        return self.info.name