This file is indexed.

/usr/share/pyshared/ninja_ide/core/plugin_interfaces.py is in ninja-ide 2.3-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
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# any later version.
#
# NINJA-IDE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NINJA-IDE; If not, see <http://www.gnu.org/licenses/>.


###############################################################################
# ABSTRACT CLASSES (This file contains useful interfaces for plugins)

#We know, Python does not need interfaces, but this file is useful as
#documentation. Is not mandatory inherit from these interfaces but you SHOULD
#implement the methods inside them.
###############################################################################


class MethodNotImplemented(Exception):
    pass


def implements(iface):
    """
    A decorator to check if interfaces are correctly implmented
    #TODO: check if functions parameters are correct
    """

    def implementsIA(cls, *args, **kwargs):
        """
        Find out which methods should be and are not in the implementation
        of the interface, raise errors if class is not correctly implementing.
        """
        should_implement = set(dir(iface)).difference(set(dir(object)))
        should_implement = set(should for should in should_implement if
                               not should.startswith("_"))
        not_implemented = should_implement.difference(set(dir(cls)))
        if len(not_implemented) > 0:
            raise MethodNotImplemented("Methods %s not implemented" %
                                       ", ".join(not_implemented))
        if cls.__name__ not in globals():
            #if decorated a class is not in globals
            globals()[cls.__name__] = cls
        return cls
    return implementsIA


class IProjectTypeHandler(object):

    """
    Interface to create a Project type handler
    """

    #mandatory
    def get_pages(self):
        """
        Returns a collection of QWizardPage
        """
        pass

    #mandatory
    def on_wizard_finish(self, wizard):
        """
        Called when the user finish the wizard
        @wizard: QWizard instance
        """
        pass

    def get_context_menus(self):
        """"
        Returns a iterable of QMenu
        """
        pass


class ISymbolsHandler:
    """
    Interface to create a symbol handler
    EXAMPLE:
    {
     'attributes':
         {name: line, name: line},
     'functions':
         {name: line, name: line},
     'classes':
         {
         name: (line, {
                     'attributes': {name: line},
                     'function': {name: line}}
             )
         }
     }
    """

    #mandatory
    def obtain_symbols(self, source):
        """
        Returns the dict needed by the tree
        @source: Source code in plain text
        """
        pass


class IPluginPreferences:
    """
    Interface for plugin preferences widget
    """
    #mandatory
    def save(self):
        """
        Save the plugin data as NINJA-IDE settings
        """
        pass