Skip to content

Commit

Permalink
Merge pull request #4430 from opsmill/pog-ruf031
Browse files Browse the repository at this point in the history
Avoid parentheses for tuples in subscripts. (RUF031)
  • Loading branch information
ogenstad authored Sep 24, 2024
2 parents b2f52fc + 90038f3 commit 1fc8408
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions backend/infrahub/api/diff/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def get_diff_artifacts(
if not target:
continue
definition_id = node.elements["definition"].peer.new.id
artifacts_in_main[(target.id, definition_id)] = node
artifacts_in_main[target.id, definition_id] = node

for node in payload[branch.name]:
if "storage_id" not in node.elements or "checksum" not in node.elements:
Expand Down Expand Up @@ -231,7 +231,7 @@ async def get_diff_artifacts(
and (target.id, node.elements["definition"].peer.new.id) in artifacts_in_main
):
diff_artifact.action = DiffAction.UPDATED
node_in_main = artifacts_in_main[(target.id, node.elements["definition"].peer.new.id)]
node_in_main = artifacts_in_main[target.id, node.elements["definition"].peer.new.id]
diff_artifact.item_previous = BranchDiffArtifactStorage(
storage_id=node_in_main.elements["storage_id"].value.value.new,
checksum=node_in_main.elements["checksum"].value.value.new,
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/diff/combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _combine_actions(self, earlier: DiffAction, later: DiffAction) -> DiffAction
(DiffAction.REMOVED, DiffAction.ADDED): DiffAction.UPDATED,
(DiffAction.REMOVED, DiffAction.UPDATED): DiffAction.UPDATED,
}
return actions_map[(earlier, later)]
return actions_map[earlier, later]

@staticmethod
def combine_conflicts(
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def _organize_sub_items(items: list[HashableModel], shared_ids: set[str]) -> dic
sub_items = {}
for item in items:
if item.id and item.id in shared_ids:
sub_items[(item.id,)] = item
sub_items[item.id,] = item
continue
sub_items[item._sorting_id] = item

Expand Down
4 changes: 2 additions & 2 deletions backend/infrahub/core/query/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ def _get_field_requirements(self) -> list[FieldAttributeRequirement]:
continue
field = self.schema.get_field(field_name, raise_on_error=False)
for field_attr_name, field_attr_value in attr_filters.items():
field_requirements_map[(field_name, field_attr_name)] = FieldAttributeRequirement(
field_requirements_map[field_name, field_attr_name] = FieldAttributeRequirement(
field_name=field_name,
field=field,
field_attr_name=field_attr_name,
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def _get_field_requirements(self) -> list[FieldAttributeRequirement]:
),
)
field_req.types.append(FieldAttributeRequirementType.ORDER)
field_requirements_map[(order_by_field_name, order_by_attr_property_name)] = field_req
field_requirements_map[order_by_field_name, order_by_attr_property_name] = field_req
index += 1

return list(field_requirements_map.values())
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ ignore = [
"RUF021", # Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
"RUF027", # Possible f-string without an `f` prefix
"RUF029", # Function is declared `async`, but doesn't `await` or use `async` features.
"RUF031", # [*] Avoid parentheses for tuples in subscripts.
"S101", # Use of `assert` detected
"S105", # Possible hardcoded password assigned to: "REGEX_PASSWORD"
"S108", # Probable insecure usage of temporary file or directory
Expand Down

0 comments on commit 1fc8408

Please sign in to comment.