fix: typing cast instead of pycharm ignore comment
This commit is contained in:
parent
4a7b66b481
commit
f6a292f173
1 changed files with 3 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ import os
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional, cast
|
||||||
from sqlalchemy.sql import and_
|
from sqlalchemy.sql import and_
|
||||||
from pymisp import PyMISP
|
from pymisp import PyMISP
|
||||||
from unbound_console import RemoteControl
|
from unbound_console import RemoteControl
|
||||||
|
|
@ -130,9 +130,7 @@ class MISPHandler:
|
||||||
def get_domains(self, type_: str, page: int, p_time: Optional[str]) -> tuple[dict[str, set[int]], int]:
|
def get_domains(self, type_: str, page: int, p_time: Optional[str]) -> tuple[dict[str, set[int]], int]:
|
||||||
if p_time is None:
|
if p_time is None:
|
||||||
p_time = self.scheduled_published_timestamp
|
p_time = self.scheduled_published_timestamp
|
||||||
# pymisp.search with these parameters returns a dict. Other params may return a different structure so inspection flags a type error.
|
data = self.pymisp.search(
|
||||||
# noinspection PyTypeChecker
|
|
||||||
data: dict[str, Any] = self.pymisp.search(
|
|
||||||
controller="attributes",
|
controller="attributes",
|
||||||
type_attribute=type_,
|
type_attribute=type_,
|
||||||
page=page,
|
page=page,
|
||||||
|
|
@ -143,6 +141,7 @@ class MISPHandler:
|
||||||
deleted="0",
|
deleted="0",
|
||||||
include_event_tags=True
|
include_event_tags=True
|
||||||
)
|
)
|
||||||
|
data = cast(dict[str, Any], data)
|
||||||
|
|
||||||
if self.dev_dump:
|
if self.dev_dump:
|
||||||
with open("data_dump.json", "w", encoding="utf-8") as dump_file:
|
with open("data_dump.json", "w", encoding="utf-8") as dump_file:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue