Comments (5)
Maybe a better approach would be configuring the python version to target
That doesn't make sense for stubs because stubs are mostly independent of Python version. TypeAlias for example should work in all Python versions in stubs (assuming you import it from typing_extensions); the problem is that pytype doesn't support it yet.
from flake8-pyi.
https://flake8.pycqa.org/en/latest/plugin-development/index.html doesn't say anything about creating codes that are disabled by default, so probably there still isn't a native way to do this. In working on #86 I noticed that it's really easy to disable everything else while trying to turn on a disabled-by-default check, so I think it's going to be a better way forward to get rid of the disabled-by-default checks.
from flake8-pyi.
There's a comment that says the functionality is "Adapted from flake8-bugbear". We could look at how flake8-bugbear does this, and whether it has the same problems.
from flake8-pyi.
Their code is still basically the same: https://github.com/PyCQA/flake8-bugbear/blob/master/bugbear.py#L131.
from flake8-pyi.
Here's another idea: You typically want to use the most modern syntax that a specific Python version supports. For example, if you target 3.9+ you can use explicit type aliases, but if you target 3.8+ you can't. (Edit: I'm no longer sure if this makes sense. Doesn't typing_extensions
backport basically everything?)
Maybe a better approach would be configuring the python version to target, instead of enabling individual disabled-by-default error codes? Or if that isn't possible, enable everything by default (as if you targeted the latest Python version), and ask users to silence warnings if they support something older too?
from flake8-pyi.
Related Issues (20)
- Disallow `__all__.remove()` in a stub
- No tests fail if `PyiAwareFlakesChecker.ASSIGN` is deleted
- Y047 false negative for conditionally defined aliases
- Forbid using ByteString
- Add tests for stubs that use PEP-695 syntax
- Drop support for Python 3.7 HOT 1
- Should we flag "unused" PEP-695 TypeVars? HOT 3
- Flag forbidden imports on the line they occur (after dropping support for Python 3.9)
- Detect redundant unions with buffer/bytes types? HOT 3
- Rule: Prefer `Iterator` over simple `Generator` for `__iter__` return type
- Standardizing Union of `Literal` and `None` HOT 7
- Detect nested `Literal` HOT 3
- Ensure `Generic` is always the last base class
- Detect redundant `Generic` in a class's bases? HOT 1
- Arguments to protocol methods should never be positional-or-keyword HOT 1
- Y053 should allow long strings as argument to `@deprecated`
- Disallow old-style positional only args (starting with double underscore) HOT 3
- Y019 sensitive to PEP 570 syntax
- Support flake8==7.0.0 HOT 3
- Warn for IO types like io.BytesIO HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8-pyi.