Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaDaniel committed Aug 5, 2024
1 parent e21d366 commit 6d37082
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/bo4e_generator/sqlparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ def format_code(code: str) -> str:


def remove_unused_imports(code):
"""
Removes unused imports from the given code using autoflake.
"""
# Create a temporary file
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as tmp_file:
tmp_file_name = tmp_file.name
Expand All @@ -395,7 +398,7 @@ def remove_unused_imports(code):
subprocess.run(["autoflake", "--remove-all-unused-imports", "--in-place", tmp_file_name], check=True)

# Read the cleaned code from the temporary file
with open(tmp_file_name, "r") as tmp_file:
with open(tmp_file_name, "r", encoding="utf-8") as tmp_file:
cleaned_code = tmp_file.read()

# Clean up the temporary file
Expand Down
1 change: 0 additions & 1 deletion unittests/test_sqlparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from bo4e_generator.sqlparser import (
adapt_parse_for_sql,
create_sql_field,
format_code,
remove_pydantic_field_import,
return_ref,
write_many_many_links,
Expand Down

0 comments on commit 6d37082

Please sign in to comment.