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
[ENH] @lru_cache in ForecastingHorizon is an error for flake8-bugbear
#2338
Comments
@khrapovs, why does it raise the error? |
Is that a bug in |
Well, it's called bugbear, so might be plausible? |
I have asked the question about class methods in PyCQA/flake8-bugbear#218. Let's see what they answer. |
maybe better in an open issue, since closed PR are less well tracked? |
Opened the issue: PyCQA/flake8-bugbear#250 |
So, the question was answered. There is no error, no bug. It is only our (or rather my) lack of understanding how caching works in combination with classes and their methods. I see two ways to proceed:
|
The "simple" solution would be to move this to loose functions |
Is your feature request related to a problem? Please describe.
Starting from version 22.3.20 of
flake8-bugbear
(https://github.com/PyCQA/flake8-bugbear/releases/tag/22.3.20)@lru_cache
decorator insktime.forecasting.base._fh.ForecastingHorizon.to_relative
andsktime.forecasting.base._fh.ForecastingHorizon.to_absolute
raises a pre-commit error. Adding# noqa: B019
silences the warning, but I do not think this is a very sustainable solution.Describe the solution you'd like
Is
@lru_cache
strictly necessary? Is the speed gain so dramatic that it overweights the dangers suggested by flake8? I do not have much experience with caching, so I have no good solution to propose.The text was updated successfully, but these errors were encountered: