Make mypy happy
This commit is contained in:
parent
1cf19133f4
commit
e8c0a0bcd3
@ -7,7 +7,7 @@ import importlib.util
|
|||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Generator, List, Optional, Tuple, Type, Union
|
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||||
|
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
|
|
||||||
@ -40,10 +40,8 @@ class IResolver:
|
|||||||
return abs_paths
|
return abs_paths
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_valid_object(cls, module_path: Path,
|
def _get_valid_object(cls, module_path: Path, object_name: Optional[str],
|
||||||
object_name: Optional[str],
|
enum_failed: bool = False) -> Iterator[Any]:
|
||||||
enum_failed: bool = False) -> Union[Generator[Any, None, None],
|
|
||||||
Tuple[None]]:
|
|
||||||
"""
|
"""
|
||||||
Generator returning objects with matching object_type and object_name in the path given.
|
Generator returning objects with matching object_type and object_name in the path given.
|
||||||
:param module_path: absolute path to the module
|
:param module_path: absolute path to the module
|
||||||
@ -63,7 +61,7 @@ class IResolver:
|
|||||||
# Catch errors in case a specific module is not installed
|
# Catch errors in case a specific module is not installed
|
||||||
logger.warning(f"Could not import {module_path} due to '{err}'")
|
logger.warning(f"Could not import {module_path} due to '{err}'")
|
||||||
if enum_failed:
|
if enum_failed:
|
||||||
return (None, )
|
return iter([None])
|
||||||
|
|
||||||
valid_objects_gen = (
|
valid_objects_gen = (
|
||||||
obj for name, obj in inspect.getmembers(module, inspect.isclass)
|
obj for name, obj in inspect.getmembers(module, inspect.isclass)
|
||||||
|
Loading…
Reference in New Issue
Block a user