Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove astunparse dependency #43560

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,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