Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #791 will not alter performanceComparing Summary
|
|
|
||
| from pipefunc._utils import clip | ||
| from pipefunc._utils import at_least_tuple, clip | ||
| from pipefunc.map._progress import Status |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 months ago
To resolve the cyclic import issue, we can break the dependency by deferring the import of Status until it is actually needed. This can be achieved by moving the import of Status inside the relevant method or function where it is used. This approach ensures that the import is resolved at runtime, after all modules have been fully initialized, thereby avoiding the cyclic import problem.
In this case, the Status class is used in type annotations for the progress_dict parameter and the combined_progress method. To fix the issue:
- Remove the module-level import of
Statuson line 11. - Use a string literal for the type annotation of
progress_dictandcombined_progressto avoid runtime evaluation of theStatustype. - If
Statusis used elsewhere in the code (e.g., for logic or instantiation), import it locally within the relevant method or function.
| @@ -10,3 +10,2 @@ | ||
| from pipefunc._utils import at_least_tuple, clip | ||
| from pipefunc.map._progress import Status | ||
|
|
||
| @@ -28,3 +27,3 @@ | ||
| self, | ||
| progress_dict: dict[OUTPUT_TYPE, Status], | ||
| progress_dict: dict[OUTPUT_TYPE, "Status"], | ||
| task: asyncio.Task[Any] | None = None, | ||
| @@ -140,3 +139,3 @@ | ||
|
|
||
| def combined_progress(self) -> dict[OUTPUT_TYPE, Status]: | ||
| def combined_progress(self) -> dict[OUTPUT_TYPE, "Status"]: | ||
| """Calculate combined progress for each scope.""" |
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match the correct format. Thank you! |
#488