Skip to content

Commit c8d34f6

Browse files
committed
Fix isort action: pass serializable data between processes
1 parent e6d42f2 commit c8d34f6

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

  • extensions/fine_python_isort/fine_python_isort

extensions/fine_python_isort/fine_python_isort/action.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def run(
5050
file_content, file_version = run_context.file_info_by_path[file_path]
5151

5252
new_file_content, file_changed = await self.process_executor.submit(
53-
format_one, file_content, self.config
53+
format_one, file_content, dataclasses.asdict(self.config)
5454
)
5555

5656
# save for next handlers
@@ -68,23 +68,11 @@ async def run(
6868

6969

7070
def format_one(
71-
file_content: str, handler_config: IsortFormatFilesHandlerConfig
71+
file_content: str, handler_config: dict[str, object]
7272
) -> tuple[str, bool]:
73-
isort_config_overrides = {}
74-
for param in [
75-
"profile",
76-
"line_length",
77-
"multi_line_output",
78-
"include_trailing_comma",
79-
"force_grid_wrap",
80-
"use_parentheses",
81-
"ensure_newline_before_comments",
82-
"line_length",
83-
"split_on_trailing_comma",
84-
]:
85-
handler_config_value = getattr(handler_config, param)
86-
if handler_config_value is not None:
87-
isort_config_overrides[param] = handler_config_value
73+
isort_config_overrides = {
74+
k: v for k, v in handler_config.items() if v is not None
75+
}
8876

8977
input_stream = StringIO(file_content)
9078
output_stream_context = isort_api._in_memory_output_stream_context()

0 commit comments

Comments
 (0)