Skip to content

Commit

Permalink
Make mypy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
hroff-1902 committed Feb 15, 2020
1 parent 1cf1913 commit e8c0a0b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions freqtrade/resolvers/iresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import inspect
import logging
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

Expand Down Expand Up @@ -40,10 +40,8 @@ def build_search_paths(cls, config: Dict[str, Any], user_subdir: Optional[str] =
return abs_paths

@classmethod
def _get_valid_object(cls, module_path: Path,
object_name: Optional[str],
enum_failed: bool = False) -> Union[Generator[Any, None, None],
Tuple[None]]:
def _get_valid_object(cls, module_path: Path, object_name: Optional[str],
enum_failed: bool = False) -> Iterator[Any]:
"""
Generator returning objects with matching object_type and object_name in the path given.
:param module_path: absolute path to the module
Expand All @@ -63,7 +61,7 @@ def _get_valid_object(cls, module_path: Path,
# Catch errors in case a specific module is not installed
logger.warning(f"Could not import {module_path} due to '{err}'")
if enum_failed:
return (None, )
return iter([None])

valid_objects_gen = (
obj for name, obj in inspect.getmembers(module, inspect.isclass)
Expand Down

0 comments on commit e8c0a0b

Please sign in to comment.