|
4 | 4 |
|
5 | 5 | from abc import ABCMeta, abstractmethod as abstract_method |
6 | 6 | from importlib import import_module |
7 | | -from inspect import isabstract as is_abstract, isclass as is_class, \ |
8 | | - getmembers as get_members |
| 7 | +from inspect import getmembers as get_members, isabstract as is_abstract, \ |
| 8 | + isclass as is_class |
9 | 9 | from pkgutil import walk_packages |
10 | 10 | from types import ModuleType |
11 | | -from typing import Dict, Mapping, Optional, Text, Union |
| 11 | +from typing import Any, Dict, Mapping, Optional, Text, Union |
12 | 12 |
|
13 | 13 | import filters as f |
14 | | -from iota.exceptions import with_context |
15 | | -from six import with_metaclass, string_types |
| 14 | +from six import string_types, with_metaclass |
16 | 15 |
|
17 | 16 | from iota.adapter import BaseAdapter |
| 17 | +from iota.exceptions import with_context |
18 | 18 |
|
19 | 19 | __all__ = [ |
20 | 20 | 'BaseCommand', |
@@ -49,10 +49,14 @@ def discover_commands(package, recursively=True): |
49 | 49 |
|
50 | 50 | commands = {} |
51 | 51 |
|
52 | | - for _, name, is_package in walk_packages(package.__path__): |
| 52 | + for _, name, is_package in walk_packages(package.__path__, package.__name__ + '.'): |
53 | 53 | # Loading the module is good enough; the CommandMeta metaclass will |
54 | 54 | # ensure that any commands in the module get registered. |
55 | | - sub_package = import_module(package.__name__ + '.' + name) |
| 55 | + |
| 56 | + # Prefix in name module move to function "walk_packages" for fix |
| 57 | + # conflict with names importing packages |
| 58 | + # Bug https://github.com/iotaledger/iota.lib.py/issues/63 |
| 59 | + sub_package = import_module(name) |
56 | 60 |
|
57 | 61 | # Index any command classes that we find. |
58 | 62 | for (_, obj) in get_members(sub_package): |
@@ -99,7 +103,7 @@ def __init__(self, adapter): |
99 | 103 | self.response = None # type: dict |
100 | 104 |
|
101 | 105 | def __call__(self, **kwargs): |
102 | | - # type: (dict) -> dict |
| 106 | + # type: (**Any) -> dict |
103 | 107 | """ |
104 | 108 | Sends the command to the node. |
105 | 109 | """ |
|
0 commit comments