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 threading
|
||||
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Optional, cast
|
||||
from sqlalchemy.sql import and_
|
||||
from pymisp import PyMISP
|
||||
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]:
|
||||
if p_time is None:
|
||||
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.
|
||||
# noinspection PyTypeChecker
|
||||
data: dict[str, Any] = self.pymisp.search(
|
||||
data = self.pymisp.search(
|
||||
controller="attributes",
|
||||
type_attribute=type_,
|
||||
page=page,
|
||||
|
|
@ -143,6 +141,7 @@ class MISPHandler:
|
|||
deleted="0",
|
||||
include_event_tags=True
|
||||
)
|
||||
data = cast(dict[str, Any], data)
|
||||
|
||||
if self.dev_dump:
|
||||
with open("data_dump.json", "w", encoding="utf-8") as dump_file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue