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 #332

Merged
merged 1 commit into from
Aug 29, 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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ readme = 'README.md'
requires-python = '>=3.9'
dependencies = [
'exceptiongroup>=1.1.3; python_version<"3.11"',
'astunparse>=1.6.3; python_version<="3.8"',
]

classifiers = [
Expand Down
8 changes: 0 additions & 8 deletions src/adaptix/_internal/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,3 @@
from exceptiongroup import ExceptionGroup # type: ignore[no-redef]

CompatExceptionGroup = ExceptionGroup


try:
from ast import unparse
except ImportError:
from astunparse import unparse # type: ignore[no-redef]

compat_ast_unparse = unparse
3 changes: 1 addition & 2 deletions src/adaptix/_internal/conversion/broaching/code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ...code_tools.code_builder import CodeBuilder
from ...code_tools.name_sanitizer import NameSanitizer
from ...code_tools.utils import get_literal_expr, get_literal_from_factory
from ...compat import compat_ast_unparse
from ...model_tools.definitions import DescriptorAccessor, ItemAccessor
from ...special_cases_optimization import as_is_stub, as_is_stub_with_ctx
from .definitions import (
Expand Down Expand Up @@ -87,7 +86,7 @@ def produce_code(self, signature: Signature, closure_name: str) -> tuple[str, Ma
)
with builder(f"def {closure_name}{no_types_signature}:"):
body = self._gen_plan_element_dispatch(state, self._plan)
builder += "return " + compat_ast_unparse(body)
builder += "return " + ast.unparse(body)

builder += f"{closure_name}.__signature__ = _closure_signature"
builder += f"{closure_name}.__name__ = {closure_name!r}"
Expand Down
Loading