From 0792087093a4e2707e18809e3dc1e06a56360f0c Mon Sep 17 00:00:00 2001 From: U039b Date: Sun, 22 Sep 2024 18:04:46 +0200 Subject: [PATCH] Flake 8 --- threatr/core/api/generic.py | 1 - threatr/core/utils.py | 1 - threatr/modules/scarletshark_module.py | 8 ++++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/threatr/core/api/generic.py b/threatr/core/api/generic.py index cb67142..3fa1b65 100644 --- a/threatr/core/api/generic.py +++ b/threatr/core/api/generic.py @@ -1,4 +1,3 @@ -import datetime from datetime import timedelta, datetime import pytz diff --git a/threatr/core/utils.py b/threatr/core/utils.py index 900f977..67b12a4 100644 --- a/threatr/core/utils.py +++ b/threatr/core/utils.py @@ -11,7 +11,6 @@ def merge_events(event_list: list[Event]): if not merged or event.first_seen.date() > merged[-1].last_seen.date(): merged.append(event) else: - # If the current interval overlaps with the previous one, merge them by updating the end value of the last interval merged[-1].last_seen = max(merged[-1].last_seen, event.last_seen) merged[-1].count += event.count dropped.append(event) diff --git a/threatr/modules/scarletshark_module.py b/threatr/modules/scarletshark_module.py index b27d162..4683777 100644 --- a/threatr/modules/scarletshark_module.py +++ b/threatr/modules/scarletshark_module.py @@ -83,12 +83,12 @@ def execute_request(self) -> dict: return self.vendor_response def __process_threat_actor(self, actor_id): - if actor_id < 1: return None + if actor_id < 1: return None # noqa: E701 result = self.client.search_threat_actors(threat_actor_id=actor_id) print(result) - if not result: return None + if not result: return None # noqa: E701 aliases = result.get('aliases', []) - if not aliases: return None + if not aliases: return None # noqa: E701 name = aliases.pop(0).get('alias_name') description = result.get('description', '') actor, _ = Entity.objects.update_or_create( @@ -104,7 +104,7 @@ def __process_threat_actor(self, actor_id): actor.save() for alias in aliases: alias_name = alias.get('alias_name', '') - if not alias_name: continue + if not alias_name: continue # noqa: E701 a, _ = Entity.objects.update_or_create( name=alias_name.strip(), super_type=EntitySuperType.get_types().get("ACTOR"),