mirror of https://github.com/MISP/PyMISP
fix: Typing on recent mypy
parent
d06313a653
commit
f254e15bd4
|
@ -60,9 +60,10 @@ def get_uuid_or_id_from_abstract_misp(obj: Union[AbstractMISP, int, str, UUID])
|
|||
if isinstance(obj, MISPOrganisationBlocklist):
|
||||
return obj.org_uuid
|
||||
|
||||
if 'uuid' in obj:
|
||||
return obj['uuid']
|
||||
return obj['id']
|
||||
# at this point, we must have an AbstractMISP
|
||||
if 'uuid' in obj: # type: ignore
|
||||
return obj['uuid'] # type: ignore
|
||||
return obj['id'] # type: ignore
|
||||
|
||||
|
||||
def register_user(misp_url: str, email: str,
|
||||
|
|
|
@ -6,7 +6,7 @@ import json
|
|||
import os
|
||||
import base64
|
||||
import sys
|
||||
from io import BytesIO, IOBase
|
||||
from io import BytesIO, RawIOBase
|
||||
from zipfile import ZipFile
|
||||
import uuid
|
||||
from collections import defaultdict
|
||||
|
@ -1150,9 +1150,9 @@ class MISPEvent(AbstractMISP):
|
|||
|
||||
def load(self, json_event: Union[IO, str, bytes, dict], validate: bool = False, metadata_only: bool = False):
|
||||
"""Load a JSON dump from a pseudo file or a JSON string"""
|
||||
if isinstance(json_event, IOBase):
|
||||
# python2 and python3 compatible to find if we have a file
|
||||
json_event = json_event.read()
|
||||
if isinstance(json_event, RawIOBase):
|
||||
json_event = json_event.read() # type: ignore
|
||||
|
||||
if isinstance(json_event, (str, bytes)):
|
||||
json_event = json.loads(json_event)
|
||||
|
||||
|
|
Loading…
Reference in New Issue