fix: Make mypy happy

pull/210/head
Raphaël Vinot 2021-06-01 16:06:24 -07:00
parent a1bbffd4ad
commit 8c62a597e7
2 changed files with 6 additions and 4 deletions

View File

@ -58,7 +58,7 @@ class MISP():
def get_fav_tags(self):
return self.client.tags(pythonify=True, favouritesOnly=1)
def _prepare_push(self, to_push: Union[List[MISPEvent], MISPEvent], allow_duplicates: bool=False, auto_publish: bool=False) -> Union[List[MISPEvent], Dict]:
def _prepare_push(self, to_push: Union[List[MISPEvent], MISPEvent], allow_duplicates: bool=False, auto_publish: Optional[bool]=False) -> Union[List[MISPEvent], Dict]:
'''Adds the pre-configured information as required by the instance.
If duplicates aren't allowed, they will be automatically skiped and the
extends_uuid key in the next element in the list updated'''
@ -128,9 +128,11 @@ class MISP():
to_lookup += hostnode.cnames
if attributes := self.client.search(controller='attributes', value=to_lookup, pythonify=True):
if isinstance(attributes, list):
return list(set(attribute.event_id for attribute in attributes))
# NOTE: We have MISPAttributes in that list
return list(set(attribute.event_id for attribute in attributes)) # type: ignore
else:
return attributes
# The request returned an error
return attributes # type: ignore
return []
else:
return {'error': 'Module not available or lookup not enabled.'}

View File

@ -345,7 +345,7 @@ def web_misp_lookup_view(tree_uuid: str):
if hits:
misp_root_url = lookyloo.misp.client.root_url
else:
misp_root_url = None
misp_root_url = ''
return render_template('misp_lookup.html', uuid=tree_uuid, hits=hits, misp_root_url=misp_root_url)