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

Expected type arguments for generic class "StreamHandler" #8840

Closed
GabrielCappelli opened this issue Oct 4, 2022 · 3 comments
Closed

Expected type arguments for generic class "StreamHandler" #8840

GabrielCappelli opened this issue Oct 4, 2022 · 3 comments

Comments

@GabrielCappelli
Copy link

Hello,

I'm inheriting from logging.StreamHandler and getting this error on Pyright

class MyStreamHandler(StreamHandler):

Expected type arguments for generic class "StreamHandler"

If I try to add an argument then I get code that doesn't work:

class MyStreamHandler(StreamHandler[TextIO]):
    class MyStreamHandler(StreamHandler[TextIO]):
TypeError: 'type' object is not subscriptable

I believe this is due to this class being generic on typeshed, but not in stdlib. Now I'm not really sure how to inherit from it and make the typechecker happy

@AlexWaygood
Copy link
Member

See also the discussion in #5954 (comment), and the following comments

@GabrielCappelli
Copy link
Author

Thank you! was a bit tunnel visioned on StreamHandler and didn't search properly

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

No branches or pull requests

3 participants