pygobject / pycairo

Python bindings for cairo
https://pycairo.readthedocs.io
Other
613 stars 83 forks source link

typing: Use Generic for Context #274

Closed lovetox closed 1 year ago

lovetox commented 1 year ago

Currently Context.get_target() returns the abstract base class Surface. Making Context a Generic allows the type checker to remember the type that was passed to the Context at creation.

lovetox commented 1 year ago

Hm, the doc build checks if the annotations are correct? and probably cant handle TypeVar?

Don’t know how to fix this, maybe there is a command for the doc builder to not do this check on these classes?

stuaxo commented 1 year ago

It may be worth opening an issue at https://github.com/sphinx-doc/sphinx/issues/ and see if they have any ideas.

lazka commented 1 year ago

as for sphinx, you just have to reference it like _FileLike in the docs for example, so sphinx can link it. I can continue here if wanted.

lovetox commented 1 year ago

@lazka if by continue you mean finishing whatever is missing so this can be merged, this would be appreciated. Thanks