Skip to content

Prevent autoflake to clean imports in module init files #223

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

Closed
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
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
""" A client library for accessing My Test API """
from .client import AuthenticatedClient, Client
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
""" Contains all the data models used in inputs/outputs """

from .a_model import AModel
from .an_enum import AnEnum
from .an_int_enum import AnIntEnum
from .body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost
from .different_enum import DifferentEnum
from .http_validation_error import HTTPValidationError
from .validation_error import ValidationError
2 changes: 1 addition & 1 deletion openapi_python_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def update(self) -> Sequence[GeneratorError]:

def _reformat(self) -> None:
subprocess.run(
"autoflake -i -r --remove-all-unused-imports --remove-unused-variables .",
"autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .",
cwd=self.package_dir,
shell=True,
stdout=subprocess.PIPE,
Expand Down
2 changes: 1 addition & 1 deletion tests/test___init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def test__reformat(mocker):
sub_run.assert_has_calls(
[
mocker.call(
"autoflake -i -r --remove-all-unused-imports --remove-unused-variables .",
"autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports .",
cwd=project.package_dir,
shell=True,
stdout=subprocess.PIPE,
Expand Down