Skip to content

Commit dba378a

Browse files
committed
Remove outdated annotation
syntax. Bump bugfix release in pyproject. Remove pandas requirement, which is not used, from pyproject.toml
1 parent 3669ca5 commit dba378a

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

contentctl/enrichments/attack_enrichment.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from dataclasses import field
55
from pathlib import Path
6-
from typing import Any, Dict, List, TypedDict, cast
6+
from typing import Any, TypedDict, cast
77

88
from attackcti import attack_client # type: ignore[reportMissingTypeStubs]
99
from pydantic import BaseModel
@@ -24,7 +24,7 @@ class AttackPattern(TypedDict):
2424
id: str
2525
technique_id: str
2626
technique: str
27-
tactic: List[str]
27+
tactic: list[str]
2828

2929

3030
class IntrusionSet(TypedDict):
@@ -38,7 +38,7 @@ class Relationship(TypedDict):
3838

3939

4040
class AttackEnrichment(BaseModel):
41-
data: Dict[str, MitreAttackEnrichment] = field(default_factory=dict)
41+
data: dict[str, MitreAttackEnrichment] = field(default_factory=dict)
4242
use_enrichment: bool = True
4343

4444
@staticmethod
@@ -64,7 +64,7 @@ def getEnrichmentByMitreID(
6464
)
6565

6666
def addMitreIDViaGroupNames(
67-
self, technique: Dict[str, Any], tactics: List[str], groupNames: List[str]
67+
self, technique: dict[str, Any], tactics: list[str], groupNames: list[str]
6868
) -> None:
6969
technique_id = technique["technique_id"]
7070
technique_obj = technique["technique"]
@@ -84,15 +84,15 @@ def addMitreIDViaGroupNames(
8484

8585
def addMitreIDViaGroupObjects(
8686
self,
87-
technique: Dict[str, Any],
88-
tactics: List[MitreTactics],
89-
groupDicts: List[Dict[str, Any]],
87+
technique: dict[str, Any],
88+
tactics: list[MitreTactics],
89+
groupDicts: list[dict[str, Any]],
9090
) -> None:
9191
technique_id = technique["technique_id"]
9292
technique_obj = technique["technique"]
9393
tactics.sort()
9494

95-
groupNames: List[str] = sorted([group["group"] for group in groupDicts])
95+
groupNames: list[str] = sorted([group["group"] for group in groupDicts])
9696

9797
if technique_id in self.data:
9898
raise Exception(f"Error, trying to redefine MITRE ID '{technique_id}'")
@@ -109,8 +109,8 @@ def addMitreIDViaGroupObjects(
109109

110110
def get_attack_lookup(
111111
self, input_path: Path, enrichments: bool = False
112-
) -> Dict[str, MitreAttackEnrichment]:
113-
attack_lookup: Dict[str, MitreAttackEnrichment] = {}
112+
) -> dict[str, MitreAttackEnrichment]:
113+
attack_lookup: dict[str, MitreAttackEnrichment] = {}
114114
if not enrichments:
115115
return attack_lookup
116116

@@ -141,17 +141,17 @@ def get_attack_lookup(
141141
)
142142

143143
all_enterprise_techniques = cast(
144-
List[AttackPattern], lift.get_enterprise_techniques(stix_format=False)
144+
list[AttackPattern], lift.get_enterprise_techniques(stix_format=False)
145145
)
146146
enterprise_relationships = cast(
147-
List[Relationship], lift.get_enterprise_relationships(stix_format=False)
147+
list[Relationship], lift.get_enterprise_relationships(stix_format=False)
148148
)
149149
enterprise_groups = cast(
150-
List[IntrusionSet], lift.get_enterprise_groups(stix_format=False)
150+
list[IntrusionSet], lift.get_enterprise_groups(stix_format=False)
151151
)
152152

153153
for technique in all_enterprise_techniques:
154-
apt_groups: List[Dict[str, Any]] = []
154+
apt_groups: list[dict[str, Any]] = []
155155
for relationship in enterprise_relationships:
156156
if relationship["target_object"] == technique[
157157
"id"
@@ -160,7 +160,7 @@ def get_attack_lookup(
160160
if relationship["source_object"] == group["id"]:
161161
apt_groups.append(dict(group))
162162

163-
tactics: List[MitreTactics] = []
163+
tactics: list[MitreTactics] = []
164164
if "tactic" in technique:
165165
for tactic in technique["tactic"]:
166166
tactics.append(

contentctl/output/attack_nav_output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import pathlib
44
from datetime import datetime
5-
from typing import Any, TypedDict, Union
5+
from typing import Any, TypedDict
66

77
# Third-party imports
88
from contentctl.objects.detection import Detection
@@ -21,10 +21,10 @@ class LayerData(TypedDict):
2121
description: str
2222
filters: dict[str, list[str]]
2323
sorting: int
24-
layout: dict[str, Union[str, bool]]
24+
layout: dict[str, str | bool]
2525
hideDisabled: bool
2626
techniques: list[dict[str, Any]]
27-
gradient: dict[str, Union[list[str], int]]
27+
gradient: dict[str, list[str] | int]
2828
legendItems: list[dict[str, str]]
2929
showTacticRowBackground: bool
3030
tacticRowBackground: str

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "contentctl"
33

4-
version = "5.5.3"
4+
version = "5.5.4"
55

66
description = "Splunk Content Control Tool"
77
authors = ["STRT <[email protected]>"]
@@ -30,7 +30,6 @@ tqdm = "^4.66.5"
3030
pygit2 = "^1.15.1"
3131
tyro = "^0.9.2"
3232
gitpython = "^3.1.43"
33-
pandas = "^2.3.0"
3433
setuptools = ">=69.5.1,<81.0.0"
3534
rich = "^14.0.0"
3635

0 commit comments

Comments
 (0)