Skip to content
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

Reduce the amount of monkeypatching we do #183

Open
AlexWaygood opened this issue Feb 11, 2022 · 1 comment
Open

Reduce the amount of monkeypatching we do #183

AlexWaygood opened this issue Feb 11, 2022 · 1 comment

Comments

@AlexWaygood
Copy link
Collaborator

I have been explicitly warned that the next release of flake8 is likely to break flake8-pyi, due to the amount of monkeypatching we do in this plugin, and a refactoring of flake8 internals that's currently underway. We should probably do something about that.

Ideally, I think we'd file PRs to flake8 and pyflakes so that they become pyi-compatible out of the box, rendering some of the crazy hacks in our code base unnecessary. I'm not really sure where to start, though.

@JelleZijlstra
Copy link
Collaborator

Yes, ideally flake8 should have native support for linting pyi files, and then this plugin can focus just on providing pyi-specific error codes, instead of the crazy monkeypatching we do right now.

@AlexWaygood AlexWaygood mentioned this issue Apr 8, 2022
2 tasks
AlexWaygood pushed a commit that referenced this issue May 3, 2023
Chipping away at #183 

Got rid of the monkeypatched `LAMBDA`.

What's changed ->
- Default argument values cannot be forward references anymore:

```python
def bar(x: type = SomeClass) -> None: ...  # F821 undefined name 'SomeClass'
class SomeClass: ...
```
I think it makes sense to not allow this anyway - it's similar to what
we did with classes previously.
AlexWaygood added a commit that referenced this issue May 3, 2023
Following #364, this method is now only called in one location in our
code (and it doesn't exist on the superclass). We can just inline it.

Refs #183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants