Git Product home page Git Product logo

Comments (8)

lord-haffi avatar lord-haffi commented on July 3, 2024 1

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.

jacobtylerwalls avatar jacobtylerwalls commented on July 3, 2024 1

@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.

jacobtylerwalls avatar jacobtylerwalls commented on July 3, 2024

Hi @lord-haffi, would you mind updating the snippet to include imports and assignments of P and T? Thanks!

from pylint.

jacobtylerwalls avatar jacobtylerwalls commented on July 3, 2024

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.

DanielNoord avatar DanielNoord commented on July 3, 2024

@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.

jacobtylerwalls avatar jacobtylerwalls commented on July 3, 2024

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.

DanielNoord avatar DanielNoord commented on July 3, 2024

See pylint-dev/astroid#1512 and related PRs. We might be able to come up with a similar fix here.

from pylint.

jacobtylerwalls avatar jacobtylerwalls commented on July 3, 2024

Opened pylint-dev/astroid#2370 for the real fix. Will prepare a patch with the band-aid.

from pylint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.