Conversation
|
|
||
| @functools.cached_property | ||
| def func(self) -> Callable[..., tuple[Any, ...]]: # type: ignore[override] | ||
| def func(self) -> Callable[..., Any]: # type: ignore[override] |
Check failure
Code scanning / CodeQL
Superclass attribute shadows subclass method Error
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
To resolve the shadowing, we should rename either the instance attribute self.func in the superclass (PipeFunc.__init__) or the method/property func in the subclass (the @functools.cached_property at line 1500). The best way, to preserve the standard functional APIs and existing code stability, is to rename the cached property in the subclass: change its name to something descriptive but not in conflict (for example, _computed_func). This will allow both attributes to coexist, and downstream code which expects self.func as the attribute will continue to work, while code wanting the rich/derived version will use the new method/property name.
Required changes:
- In the subclass, rename the
@functools.cached_propertynamedfunc(line 1500+) to e.g._computed_func— that is, change both the decorator line and thedef func(...line and all references within this subclass to use the new property name. - If the subclass (or nearby code) refers to
self.funcand intends to use the cached property, update those references to useself._computed_func. - No imports/additional methods are required for Python built-in
cached_property.
| @@ -1497,7 +1497,7 @@ | ||
| return tuple(sorted(inputs)) | ||
|
|
||
| @functools.cached_property | ||
| def func(self) -> Callable[..., Any]: # type: ignore[override] | ||
| def _computed_func(self) -> Callable[..., Any]: | ||
| outputs = [f.output_name for f in self.pipeline.leaf_nodes] | ||
| if self._is_async_func: | ||
|
|
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match the correct format. Thank you! |
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
CodSpeed Instrumentation Performance ReportMerging #878 will degrade performances by 5.01%Comparing Summary
Benchmarks breakdown
|
No description provided.