Skip to content

Commit a332816

Browse files
authored
Merge pull request #35 from BruinGrowly/feat-config-file
fix(ci): Add Python 3.8 compatibility for ast.unparse
2 parents 5d090c5 + 98b48d2 commit a332816

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

harmonizer/refactorer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
import black
1717

18+
try:
19+
from ast import unparse
20+
except ImportError:
21+
from astunparse import unparse as unparse
22+
1823

1924
class Refactorer:
2025
"""
@@ -85,7 +90,7 @@ def suggest_dimensional_split(self) -> str:
8590

8691
# Fix missing location info and unparse the entire module
8792
ast.fix_missing_locations(new_module)
88-
unformatted_code = ast.unparse(new_module)
93+
unformatted_code = unparse(new_module)
8994

9095
# Format the generated code using black
9196
try:

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
pytest
22
black==24.4.2
3+
astunparse==1.6.3
4+
astunparse==1.6.3
35
flake8
46
isort
57
pre-commit

0 commit comments

Comments
 (0)