Fix mypy update problems
This commit is contained in:
parent
3f1d6d453c
commit
4ba7a2bbd2
@ -58,6 +58,9 @@ class IResolver:
|
|||||||
# Generate spec based on absolute path
|
# Generate spec based on absolute path
|
||||||
# Pass object_name as first argument to have logging print a reasonable name.
|
# 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))
|
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)
|
module = importlib.util.module_from_spec(spec)
|
||||||
try:
|
try:
|
||||||
spec.loader.exec_module(module) # type: ignore # importlib does not use typehints
|
spec.loader.exec_module(module) # type: ignore # importlib does not use typehints
|
||||||
|
@ -77,14 +77,13 @@ class Webhook(RPCHandler):
|
|||||||
def _send_msg(self, payload: dict) -> None:
|
def _send_msg(self, payload: dict) -> None:
|
||||||
"""do the actual call to the webhook"""
|
"""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:
|
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:
|
except RequestException as exc:
|
||||||
logger.warning("Could not call webhook url. Exception: %s", exc)
|
logger.warning("Could not call webhook url. Exception: %s", exc)
|
||||||
|
@ -17,3 +17,9 @@ isort==5.8.0
|
|||||||
|
|
||||||
# Convert jupyter notebooks to markdown documents
|
# Convert jupyter notebooks to markdown documents
|
||||||
nbconvert==6.0.7
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user