]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/plugins/pluggy.py
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / plugins / pluggy.py
index 7517e6d65829cfc991bc646009c19d0bf3d6d3ba..0a1765f1f7f541cbdcb75c4368471ced3357dc71 100644 (file)
@@ -21,8 +21,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
-"""
-
+"""\
 """
 CAVEAT:
 This is a minimal implementation of python-pluggy (based on 0.8.0 interface:
@@ -41,6 +40,10 @@ distros and releases currently targeted for Ceph Nautilus:
 TODO: Once this becomes available in the above distros, this file should be
 REMOVED, and the fully featured python-pluggy should be used instead.
 """
+try:
+    from typing import DefaultDict
+except ImportError:
+    pass  # For typing only
 
 
 class HookspecMarker(object):
@@ -76,7 +79,7 @@ class _HookRelay(object):
     """
     def __init__(self):
         from collections import defaultdict
-        self._registry = defaultdict(list)
+        self._registry = defaultdict(list)  # type: DefaultDict[str, list]
 
     def __getattr__(self, hook_name):
         return lambda *args, **kwargs: [
@@ -103,9 +106,9 @@ class PluginManager(object):
 
     def add_hookspecs(self, module_or_class):
         """ Dummy method"""
-        pass
 
-    def register(self, plugin, name=None):
+    def register(self, plugin, name=None):  # pylint: disable=unused-argument
         for attr in dir(plugin):
             if self.parse_hookimpl_opts(plugin, attr) is not None:
+                # pylint: disable=protected-access
                 self.hook._add_hookimpl(attr, getattr(plugin, attr))