Skip to content

Commit

Permalink
Hardening suggestions for codemodder-python / sonar-timezone (#803)
Browse files Browse the repository at this point in the history
Use Assignment Expression (Walrus) In Conditional

Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
  • Loading branch information
pixeebot[bot] authored Aug 19, 2024
1 parent 91bfc93 commit 409d4ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/core_codemods/timezone_aware_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ def leave_Call(self, original_node: cst.Call, updated_node: cst.Call):
return updated_node

def _determine_module_and_kwarg(self, original_node: cst.Call):
maybe_name = self.get_aliased_prefix_name(original_node, self._module_name)

if maybe_name:
if maybe_name := self.get_aliased_prefix_name(original_node, self._module_name):
# it's a regular import OR alias import
if maybe_name == self._module_name:
module = "datetime.datetime"
Expand Down

0 comments on commit 409d4ad

Please sign in to comment.