forked from p34709852/monkey
Fix typing in factory method
This commit is contained in:
parent
e9538e9a42
commit
31a60b12ff
|
@ -4,7 +4,7 @@ import logging
|
|||
from abc import ABCMeta, abstractmethod
|
||||
from os.path import dirname, basename, isfile, join
|
||||
import glob
|
||||
from typing import Sequence
|
||||
from typing import Sequence, TypeVar, Type
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -14,6 +14,9 @@ def _get_candidate_files(base_package_file):
|
|||
return [basename(f)[:-3] for f in files if isfile(f) and not f.endswith('__init__.py')]
|
||||
|
||||
|
||||
Plugin_type = TypeVar('Plugin_type', bound='Plugin')
|
||||
|
||||
|
||||
class Plugin(metaclass=ABCMeta):
|
||||
|
||||
@staticmethod
|
||||
|
@ -22,7 +25,7 @@ class Plugin(metaclass=ABCMeta):
|
|||
raise NotImplementedError()
|
||||
|
||||
@classmethod
|
||||
def get_instances(cls) -> Sequence[object]:
|
||||
def get_instances(cls) -> Sequence[Type[Plugin_type]]:
|
||||
"""
|
||||
Returns the type objects from base_package_spec.
|
||||
base_package name and file must refer to the same package otherwise bad results
|
||||
|
|
Loading…
Reference in New Issue