Skip to content

Commit

Permalink
Implement_add_hookspec_dict in add_hookspecs (#34)
Browse files Browse the repository at this point in the history
* Implement_add_hookspec_dict in add_hookspecs

Currently, register calls _register_dict if namespace is a dict. It seems like this functionality was also intended for add_hookspecs, but _add_hookspec_dict is never called anywhere in either napari or napari_plugin_engine. The four functions' git blame patterns lead me to believe this was an accident.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
QuaternionsRock and pre-commit-ci[bot] committed Aug 11, 2021
1 parent 8647976 commit 6126fb4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions napari_plugin_engine/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ def add_hookspecs(self, namespace: Any):
Functions are recognized if they have been decorated accordingly.
"""

if isinstance(namespace, dict):
return self._add_hookspec_dict(namespace)

names = []
for name in dir(namespace):
method = getattr(namespace, name)
Expand Down

0 comments on commit 6126fb4

Please sign in to comment.