diff --git a/requirements.txt b/requirements.txt index 379fcd2..8c2c46c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,8 @@ pytest-cov -e ./zulip_bots -e ./zulip_botserver -e git+https://github.com/zulip/zulint@14e3974001bf8442a6a3486125865660f1f2eb68#egg=zulint==1.0.0 -mypy==0.812 +mypy==0.910 +types-python-dateutil +types-pytz +types-requests gitlint>=0.13.0 diff --git a/zulip/tests/__init__.py b/zulip/tests/__init__.py index f1e69a3..84a60e8 100644 --- a/zulip/tests/__init__.py +++ b/zulip/tests/__init__.py @@ -1,4 +1,4 @@ import pkgutil -from typing import Iterable +from typing import List -__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[str] +__path__ = pkgutil.extend_path(__path__, __name__) # type: List[str] diff --git a/zulip_bots/zulip_bots/bots/witai/witai.py b/zulip_bots/zulip_bots/bots/witai/witai.py index 1adb950..46de582 100644 --- a/zulip_bots/zulip_bots/bots/witai/witai.py +++ b/zulip_bots/zulip_bots/bots/witai/witai.py @@ -80,6 +80,8 @@ def get_handle(location: str) -> Optional[Callable[[Dict[str, Any]], Optional[st """ try: spec = importlib.util.spec_from_file_location("module.name", location) + if spec is None: + return None handler = importlib.util.module_from_spec(spec) loader = spec.loader if not isinstance(loader, importlib.abc.Loader): diff --git a/zulip_bots/zulip_bots/finder.py b/zulip_bots/zulip_bots/finder.py index 0f8ee88..8462a1c 100644 --- a/zulip_bots/zulip_bots/finder.py +++ b/zulip_bots/zulip_bots/finder.py @@ -13,6 +13,8 @@ import importlib_metadata as metadata def import_module_from_source(path: str, name: str) -> Any: spec = importlib.util.spec_from_file_location(name, path) + if spec is None: + return None module = importlib.util.module_from_spec(spec) loader = spec.loader if not isinstance(loader, importlib.abc.Loader): diff --git a/zulip_botserver/tests/__init__.py b/zulip_botserver/tests/__init__.py index f1e69a3..84a60e8 100644 --- a/zulip_botserver/tests/__init__.py +++ b/zulip_botserver/tests/__init__.py @@ -1,4 +1,4 @@ import pkgutil -from typing import Iterable +from typing import List -__path__ = pkgutil.extend_path(__path__, __name__) # type: Iterable[str] +__path__ = pkgutil.extend_path(__path__, __name__) # type: List[str]