~zyga/checkbox/cep-7

« back to all changes in this revision

Viewing changes to plainbox/plainbox/impl/secure/plugins.py

  • Committer: Daniel Manrique
  • Author(s): Zygmunt Krynicki
  • Date: 2014-12-18 14:47:13 UTC
  • mfrom: (3498.1.15 launchpad/lazy-commands)
  • Revision ID: daniel_manrique-20141218144713-ab09fi371kko07o4
"automatic merge of lp:~zkrynicki/checkbox/lazy-commands/ by tarmac [r=sylvain-pineau][bug=][author=zkrynicki]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
    """
81
81
 
82
82
    @abc.abstractproperty
83
 
    def plugin_name(self):
 
83
    def plugin_name(self) -> str:
84
84
        """
85
85
        name of the plugin, may not be unique
86
86
        """
87
87
 
88
88
    @abc.abstractproperty
89
 
    def plugin_object(self):
 
89
    def plugin_object(self) -> object:
90
90
        """
91
91
        external object
92
92
        """
143
143
            type(self).__name__, self.plugin_name)
144
144
 
145
145
    @property
146
 
    def plugin_name(self):
 
146
    def plugin_name(self) -> str:
147
147
        """
148
148
        plugin name, arbitrary string
149
149
        """
150
150
        return self._name
151
151
 
152
152
    @property
153
 
    def plugin_object(self):
 
153
    def plugin_object(self) -> float:
154
154
        """
155
155
        plugin object, arbitrary object
156
156
        """
288
288
        self._wrapper = wrapper
289
289
        self._wrapper_args = wrapper_args
290
290
        self._wrapper_kwargs = wrapper_kwargs
291
 
        self._plugins = collections.OrderedDict()
 
291
        self._plugins = collections.OrderedDict()  # str -> IPlugIn instance
292
292
        self._loaded = False
293
293
        self._mocked_objects = None
294
294
        self._problem_list = []
672
672
            self.wrap_and_add_plugin(name, obj, now() - start_time)
673
673
 
674
674
    def do_discover(self):
675
 
        return sorted(self._mapping.items())
 
675
        return self._mapping.items()
676
676
 
677
677
    def do_load_one(self, name, discovery_data):
678
678
        if isinstance(discovery_data, tuple):
714
714
            discovery_data = self._mapping[name]
715
715
            self.load_one(name, discovery_data)
716
716
        return self._plugins[name]
 
717
 
 
718
    @property
 
719
    def discovery_time(self) -> float:
 
720
        """
 
721
        Time, in fractional seconds, that was required to discover all objects.
 
722
 
 
723
        This time is separate from the load and wrap time of all each
 
724
        individual plug-in. Typically this is either a fixed cost or a
 
725
        predictable cost related to traversing the file system.
 
726
 
 
727
        .. note::
 
728
            This overridden version can be called at any time, unlike the base
 
729
            class implementation. Before all discovery is done, it simply
 
730
            returns zero.
 
731
        """
 
732
        return self._discovery_time