Conversation
|
|
||
| class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): | ||
| def keys(self) -> Iterable[_KT]: ... # noqa: E704 | ||
| def keys(self) -> Iterable[_KT]: ... |
Check notice
Code scanning / CodeQL
Statement has no effect Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To address the issue, replace the ... in the method body of keys in SupportsKeysAndGetItem (line 26) with a pass statement. This fixes the "statement has no effect" warning and follows Python convention for abstract stub methods. Only change the method body; do not touch the method signature or docstring. No other changes or imports are necessary. Since this is a protocol intended for type-checking/interface definition, a pass statement is the clearest and standard way to indicate that the method has no runtime body.
| @@ -23,7 +23,7 @@ | ||
|
|
||
|
|
||
| class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]): | ||
| def keys(self) -> Iterable[_KT]: ... | ||
| def keys(self) -> Iterable[_KT]: pass | ||
|
|
||
| def __getitem__(self, __k: _KT, /) -> _VT_co: ... | ||
|
|
| def keys(self) -> Iterable[_KT]: ... | ||
|
|
||
| def __getitem__(self, __k: _KT) -> _VT_co: ... # noqa: E704 | ||
| def __getitem__(self, __k: _KT, /) -> _VT_co: ... |
Check notice
Code scanning / CodeQL
Statement has no effect Note
Copilot Autofix
AI 4 months ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| try: | ||
| import jupyter_client | ||
| import matplotlib # noqa: F401 | ||
| import matplotlib as mpl # noqa: F401 |
Check notice
Code scanning / CodeQL
Unused import Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
The best way to fix the problem is to remove the unused import statement import matplotlib as mpl # noqa: F401 on line 16 in linearmodels/tests/test_examples.py. This can be done by simply deleting line 16, taking care not to touch any surrounding lines or related imports for libraries that are indeed used (jupyter_client, ExecutePreprocessor, nbformat, etc.). This change does not affect any existing functionality, as mpl is not referenced elsewhere.
| @@ -13,7 +13,6 @@ | ||
|
|
||
| try: | ||
| import jupyter_client | ||
| import matplotlib as mpl # noqa: F401 | ||
| from nbconvert.preprocessors import ExecutePreprocessor | ||
| import nbformat | ||
| import seaborn as sns # noqa: F401 |
| from nbconvert.preprocessors import ExecutePreprocessor | ||
| import nbformat | ||
| import seaborn # noqa: F401 | ||
| import seaborn as sns # noqa: F401 |
Check notice
Code scanning / CodeQL
Unused import Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To resolve this issue, simply remove the unused import statement on line 19 (import seaborn as sns # noqa: F401). No other changes are needed since seaborn is not used in the code. Check that you only remove the specific line and do not affect any other logic or imports in the file. There’s no need to add, replace, or update any other code elsewhere.
| @@ -16,7 +16,6 @@ | ||
| import matplotlib as mpl # noqa: F401 | ||
| from nbconvert.preprocessors import ExecutePreprocessor | ||
| import nbformat | ||
| import seaborn as sns # noqa: F401 | ||
|
|
||
| kernels = jupyter_client.kernelspec.find_kernel_specs() | ||
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #661 +/- ##
==========================================
- Coverage 99.57% 99.57% -0.01%
==========================================
Files 99 99
Lines 17333 17278 -55
Branches 1444 1419 -25
==========================================
- Hits 17260 17205 -55
Misses 27 27
Partials 46 46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| distribution where df is the residual degree of freedom from the model. | ||
| """ | ||
| from linearmodels.panel.model import _deferred_f | ||
| from linearmodels.panel.model import _deferred_f # noqa: PLC0415 |
Check notice
Code scanning / CodeQL
Cyclic import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the cyclic import, we should avoid importing from linearmodels.panel.model inside linearmodels.panel.results. Since only _deferred_f is needed, and only within the f_statistic_robust method, we can move _deferred_f out of linearmodels.panel.model and into a new module (e.g., linearmodels.panel._shared_fstat.py). Then, both results.py and model.py can import it without creating a cycle. In this fix, since we can only edit the contents of results.py, the best approach is to move the local import to the top of the file (module-level import), but change the import path to a completely new module—assuming _deferred_f has been moved there. We will update the local import in f_statistic_robust to a top-level import from linearmodels.panel._shared_fstat, and replace
from linearmodels.panel.model import _deferred_f # noqa: PLC0415with
from linearmodels.panel._shared_fstat import _deferred_fand add this import at the top of the file to fully break the cycle.
All usages of _deferred_f will continue working as before, but now without the cyclic dependency.
| @@ -19,6 +19,7 @@ | ||
| from linearmodels.shared.io import _str, add_star, pval_format | ||
| from linearmodels.shared.utility import AttrDict | ||
| import linearmodels.typing.data | ||
| from linearmodels.panel._shared_fstat import _deferred_f | ||
|
|
||
| __all__ = [ | ||
| "FamaMacBethResults", | ||
| @@ -625,7 +626,6 @@ | ||
| number of restrictions and inference is made using an :math:`F_{k,df}` | ||
| distribution where df is the residual degree of freedom from the model. | ||
| """ | ||
| from linearmodels.panel.model import _deferred_f # noqa: PLC0415 | ||
|
|
||
| return _deferred_f( | ||
| self.params, self.cov, self._debiased, self.df_resid, self._f_info |
| @@ -1,5 +1,7 @@ | |||
| import linearmodels.compat.statsmodels | |||
Check notice
Code scanning / CodeQL
Module is imported with 'import' and 'import from' Note test
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
The fix is to remove the from linearmodels.compat.statsmodels import Summary statement from the file, as the module is already imported with import linearmodels.compat.statsmodels. In any place where the code uses Summary directly (i.e., as Summary(...)), we should instead use linearmodels.compat.statsmodels.Summary(...). The imports at the top of the file should be edited to delete the from ... import Summary line. Search through the file for usages of Summary and update them to fully reference linearmodels.compat.statsmodels.Summary. No additional imports are needed.
| @@ -1,6 +1,6 @@ | ||
| import linearmodels.compat.statsmodels | ||
| from linearmodels.compat.statsmodels import Summary | ||
|
|
||
|
|
||
| import copy | ||
| import warnings | ||
|
|
No description provided.