Skip to content

Commit 67333da

Browse files
style: apply ruff format to cloudformation_parser.py
1 parent d87698f commit 67333da

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

src/deploydiff/cloudformation_parser.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,10 @@ def parse_cloudformation_changeset(changeset_json: str | dict[str, Any]) -> Depl
6363
for index, change_entry in enumerate(changes_list):
6464
if not isinstance(change_entry, dict):
6565
raise ValueError(f"CloudFormation Changes[{index}] must be a JSON object")
66-
resource_change_data = change_entry.get(
67-
"ResourceChange", change_entry.get("resource_change", {})
68-
)
66+
resource_change_data = change_entry.get("ResourceChange", change_entry.get("resource_change", {}))
6967
if not isinstance(resource_change_data, dict):
70-
raise ValueError(
71-
f"CloudFormation Changes[{index}].ResourceChange must be a JSON object"
72-
)
73-
action_str = change_entry.get(
74-
"Action", resource_change_data.get("Action", "Modify")
75-
)
68+
raise ValueError(f"CloudFormation Changes[{index}].ResourceChange must be a JSON object")
69+
action_str = change_entry.get("Action", resource_change_data.get("Action", "Modify"))
7670

7771
action = CFN_ACTION_MAP.get(action_str, ChangeAction.UPDATE)
7872

@@ -81,16 +75,12 @@ def parse_cloudformation_changeset(changeset_json: str | dict[str, Any]) -> Depl
8175
if CFN_REPLACEMENT_MAP.get(str(replacement), False):
8276
action = ChangeAction.REPLACE
8377

84-
resource_type = resource_change_data.get(
85-
"Type", resource_change_data.get("ResourceType", "unknown")
86-
)
78+
resource_type = resource_change_data.get("Type", resource_change_data.get("ResourceType", "unknown"))
8779
resource_name = resource_change_data.get(
8880
"LogicalResourceId",
8981
resource_change_data.get("PhysicalResourceId", "unknown"),
9082
)
91-
address = resource_change_data.get(
92-
"LogicalResourceId", f"{resource_type}.{resource_name}"
93-
)
83+
address = resource_change_data.get("LogicalResourceId", f"{resource_type}.{resource_name}")
9484

9585
# Scope details for update changes
9686
details = resource_change_data.get("Details", [])

0 commit comments

Comments
 (0)