Skip to content

Commit

Permalink
Use Assignment Expression (Walrus) In Conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeebot authored and drdavella committed Feb 13, 2024
1 parent 74eb8ef commit 9912747
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core_codemods/flask_json_response_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ def _has_content_type_set(self, node: cst.BaseExpression) -> bool:
maybe_subscript = (
self.is_subscript_value(maybe_attr) if maybe_attr else None
)
maybe_assignment = (
if maybe_assignment := (
self.is_target_of_assignment(maybe_subscript)
if maybe_subscript
else None
)
if maybe_assignment:
):
# is subscript content-type?
match maybe_subscript:
case cst.Subscript(
Expand Down

0 comments on commit 9912747

Please sign in to comment.