Fix mypy update problems

This commit is contained in:
Matthias 2021-06-14 19:18:42 +02:00
parent 3f1d6d453c
commit 4ba7a2bbd2
3 changed files with 16 additions and 8 deletions

View File

@ -58,6 +58,9 @@ class IResolver:
# Generate spec based on absolute path
# Pass object_name as first argument to have logging print a reasonable name.
spec = importlib.util.spec_from_file_location(object_name or "", str(module_path))
if not spec:
return iter([None])
module = importlib.util.module_from_spec(spec)
try:
spec.loader.exec_module(module) # type: ignore # importlib does not use typehints

View File

@ -77,14 +77,13 @@ class Webhook(RPCHandler):
def _send_msg(self, payload: dict) -> None:
"""do the actual call to the webhook"""
if self._format == 'form':
kwargs = {'data': payload}
elif self._format == 'json':
kwargs = {'json': payload}
else:
raise NotImplementedError('Unknown format: {}'.format(self._format))
try:
post(self._url, **kwargs)
if self._format == 'form':
post(self._url, data=payload)
elif self._format == 'json':
post(self._url, json=payload)
else:
raise NotImplementedError('Unknown format: {}'.format(self._format))
except RequestException as exc:
logger.warning("Could not call webhook url. Exception: %s", exc)

View File

@ -17,3 +17,9 @@ isort==5.8.0
# Convert jupyter notebooks to markdown documents
nbconvert==6.0.7
# mypy types
types-cachetools==0.1.7
types-filelock==0.1.3
types-requests==0.1.11
types-tabulate==0.1.0