From 7435342e38c91b406db812882649ee5a12e2215b Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <23113631+pixeebot@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:10:03 +0000 Subject: [PATCH 1/2] Use Assignment Expression (Walrus) In Conditional --- src/core_codemods/flask_json_response_type.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core_codemods/flask_json_response_type.py b/src/core_codemods/flask_json_response_type.py index 571d0e70..f71723f0 100644 --- a/src/core_codemods/flask_json_response_type.py +++ b/src/core_codemods/flask_json_response_type.py @@ -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( From 2902fe197787f470c23f9a6c09819f275496ed95 Mon Sep 17 00:00:00 2001 From: clavedeluna Date: Thu, 15 Feb 2024 15:27:32 -0300 Subject: [PATCH 2/2] remove unused var --- src/core_codemods/flask_json_response_type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_codemods/flask_json_response_type.py b/src/core_codemods/flask_json_response_type.py index f71723f0..7e1b5aa0 100644 --- a/src/core_codemods/flask_json_response_type.py +++ b/src/core_codemods/flask_json_response_type.py @@ -182,7 +182,7 @@ def _has_content_type_set(self, node: cst.BaseExpression) -> bool: maybe_subscript = ( self.is_subscript_value(maybe_attr) if maybe_attr else None ) - if maybe_assignment := ( + if ( self.is_target_of_assignment(maybe_subscript) if maybe_subscript else None