Skip to content

Commit 4bb553d

Browse files
style: Apply lint fixes from pre-commit hooks
1 parent 3b5a55b commit 4bb553d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

cartography/intel/aws/guardduty.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
from cartography.client.core.tx import load
1111
from cartography.graph.job import GraphJob
12-
from cartography.models.aws.guardduty.findings import GuardDutyFindingSchema
1312
from cartography.models.aws.guardduty.detector import GuardDutyDetectorSchema
13+
from cartography.models.aws.guardduty.findings import GuardDutyFindingSchema
1414
from cartography.stats import get_stats_client
1515
from cartography.util import aws_handle_regions
1616
from cartography.util import aws_paginate
@@ -230,12 +230,14 @@ def get_detector_details(
230230
return detector_details
231231

232232

233-
def transform_detector_details(detector_details: List[Dict[str, Any]], region: str) -> List[Dict[str, Any]]:
233+
def transform_detector_details(
234+
detector_details: List[Dict[str, Any]], region: str
235+
) -> List[Dict[str, Any]]:
234236
"""
235237
Transform GuardDuty detector details from API response to schema format.
236238
"""
237239
transformed_detectors = []
238-
240+
239241
for detector in detector_details:
240242
# Extract detector ID from the response
241243
detector_id = detector.get("DetectorId")
@@ -252,9 +254,9 @@ def transform_detector_details(detector_details: List[Dict[str, Any]], region: s
252254
"UpdatedAt": detector.get("UpdatedAt"),
253255
"Region": region,
254256
}
255-
257+
256258
transformed_detectors.append(transformed_detector)
257-
259+
258260
return transformed_detectors
259261

260262

@@ -273,7 +275,9 @@ def load_guardduty_detectors(
273275
for detector in data:
274276
detector_id = detector.get("DetectorId")
275277
if detector_id:
276-
detector["Arn"] = f"arn:aws:guardduty:{region}:{aws_account_id}:detector/{detector_id}"
278+
detector["Arn"] = (
279+
f"arn:aws:guardduty:{region}:{aws_account_id}:detector/{detector_id}"
280+
)
277281

278282
load(
279283
neo4j_session,
@@ -298,7 +302,7 @@ def cleanup_guardduty(
298302
GuardDutyFindingSchema(), common_job_parameters
299303
)
300304
cleanup_job.run(neo4j_session)
301-
305+
302306
# Cleanup detectors
303307
detector_cleanup_job = GraphJob.from_node_schema(
304308
GuardDutyDetectorSchema(), common_job_parameters

cartography/models/aws/guardduty/detector.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ class GuardDutyDetectorNodeProperties(CartographyNodeProperties):
1717
detector_id: PropertyRef = PropertyRef("DetectorId")
1818
status: PropertyRef = PropertyRef("Status")
1919
service_role: PropertyRef = PropertyRef("ServiceRole")
20-
finding_publishing_frequency: PropertyRef = PropertyRef("FindingPublishingFrequency")
20+
finding_publishing_frequency: PropertyRef = PropertyRef(
21+
"FindingPublishingFrequency"
22+
)
2123
created_at: PropertyRef = PropertyRef("CreatedAt")
2224
updated_at: PropertyRef = PropertyRef("UpdatedAt")
2325
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)

tests/unit/cartography/intel/aws/test_guardduty.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from cartography.intel.aws.guardduty import transform_findings
21
from cartography.intel.aws.guardduty import transform_detector_details
3-
from tests.data.aws.guardduty import EXPECTED_TRANSFORM_RESULTS
2+
from cartography.intel.aws.guardduty import transform_findings
43
from tests.data.aws.guardduty import EXPECTED_DETECTOR_TRANSFORM_RESULTS
5-
from tests.data.aws.guardduty import GET_FINDINGS
4+
from tests.data.aws.guardduty import EXPECTED_TRANSFORM_RESULTS
65
from tests.data.aws.guardduty import GET_DETECTORS
6+
from tests.data.aws.guardduty import GET_FINDINGS
77

88
TEST_UPDATE_TAG = 123456789
99

0 commit comments

Comments
 (0)