Skip to content

Commit

Permalink
Remove astunparse dependency (#43560)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil authored Oct 31, 2024
1 parent fe41e15 commit 3d36dc6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@
"blinker>=1.7.0",
],
"devel-static-checks": [
"astunparse>=1.6.3; python_version < '3.9'",
"black>=23.12.0",
"pre-commit>=3.5.0",
"ruff==0.7.1",
Expand Down
8 changes: 1 addition & 7 deletions scripts/ci/pre_commit/check_deferrable_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
import sys
from typing import Iterator

if hasattr(ast, "unparse"):
# Py 3.9+
unparse = ast.unparse
else:
from astunparse import unparse # type: ignore[no-redef]

import libcst as cst
from libcst.codemod import CodemodContext
from libcst.codemod.visitors import AddImportsVisitor
Expand Down Expand Up @@ -84,7 +78,7 @@ def leave_Param(self, original_node: cst.Param, updated_node: cst.Param) -> cst.

def _is_valid_deferrable_default(default: ast.AST) -> bool:
"""Check whether default is 'conf.getboolean("operators", "default_deferrable", fallback=False)'"""
return unparse(default) == "conf.getboolean('operators', 'default_deferrable', fallback=False)"
return ast.unparse(default) == "conf.getboolean('operators', 'default_deferrable', fallback=False)"


def iter_check_deferrable_default_errors(module_filename: str) -> Iterator[str]:
Expand Down

0 comments on commit 3d36dc6

Please sign in to comment.