Comments (8)
would you mind updating the snippet to include imports and assignments of P and T?
Sure! Well, you already figured it out but for the sake of completeness I edited my post.
Thanks!
from pylint.
@DanielNoord it's actually not as bad as the collections issue.
I looked into the reason that I stubbed out the typing module. It turns out it was really just to pass about a dozen or so cases in astroid that depend on being able to infer the bases of a class using subscript syntax. It doesn't yet work with the new PEP 695 syntax. We should fix it in a minor release when someone volunteers. In the meantime, I think my stopgap is good for a patch release.
I'll open an astroid issue with my finding.
from pylint.
Hi @lord-haffi, would you mind updating the snippet to include imports and assignments of P and T? Thanks!
from pylint.
Thanks for the report!
This diff to astroid should fix it:
diff --git a/astroid/brain/brain_typing.py b/astroid/brain/brain_typing.py
index ea496440..20276b6c 100644
--- a/astroid/brain/brain_typing.py
+++ b/astroid/brain/brain_typing.py
@@ -437,7 +437,13 @@ def _typing_transform():
class Generic:
@classmethod
def __class_getitem__(cls, item): return cls
- class ParamSpec: ...
+ class ParamSpec:
+ @property
+ def args(self):
+ return ParamSpecArgs(self)
+ @property
+ def kwargs(self):
+ return ParamSpecKwargs(self)
class ParamSpecArgs: ...
class ParamSpecKwargs: ...
class TypeAlias: ...
I took a quick look at the typing package in 3.12 and couldn't find any declaration of ParamSpec
This is exactly pylint's issue. In 3.12 CPython decided to C-accelerate the typing module, and that hosed a lot of pylint's ability to inspect typing classes. I stubbed out the bare minimum in pylint-dev/astroid@f2120db, but there's a lot missing.
from pylint.
@jacobtylerwalls Is this the same issue as with collections
? I thought we fixed that by making our import resolved accept the frozen modules?
from pylint.
I don't know what happened with collections. I'd love to know of a better solution for this, and this sounds like it.
from pylint.
See pylint-dev/astroid#1512 and related PRs. We might be able to come up with a similar fix here.
from pylint.
Opened pylint-dev/astroid#2370 for the real fix. Will prepare a patch with the band-aid.
from pylint.
Related Issues (20)
- Suggestion conflicting with black 2024 style for inlined semantic / empty classes HOT 6
- [unknown-option-value] False negative after `--disable=all` HOT 1
- False negative: no-member in conditional branch HOT 2
- [unsubscriptable-object] FP for generic classes (PEP 695) HOT 2
- pyreverse working with attrs.org
- [duplicate-code] unclear how to disable the message for select occurrences, while keeping the option enabled in general
- Feature Request: Naming Convention Enforcement for Boolean Values & Functions HOT 8
- Pylint incorrectly resolving type vs instances
- astroid.node Attribute Error HOT 1
- protected-access false positive in class method of child class HOT 1
- unused-argument in .pyi stub file HOT 1
- too-many-try-statements should exclude `pass` statements if required by Python HOT 2
- `too-few-public-methods` counts dunder methods as private HOT 2
- `unexpected-keyword-arg` (E1123) and `missing-kwoa` (E1125) false positives with changing dict
- [Enhancement] `newline` argument for `csv.reader()`
- pylint's type checker ignores type interface files HOT 6
- False positive: overriding a generic `ParamSpec` method triggers `arguments-differ` (W0221)
- false positive: no-member when importing from matplotlib.cm
- False positive: import-error and no-name-in-module when importing from python-docx HOT 2
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 pylint.