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

Improve typing #746

Merged
merged 1 commit into from
Oct 4, 2023
Merged

Improve typing #746

merged 1 commit into from
Oct 4, 2023

Conversation

kellerza
Copy link
Contributor

@kellerza kellerza commented Oct 4, 2023

Description

Improve typing, especially for EntityCollection, as a Generic[T]

This uses comments for types as per PEP484 and likely the best we can do while keeping support for Python 2.7, even if Python 2 support has been removed from mypy ref

Using the type parameters in the docstrings has a mixed effect:

  1. when specifying a type the type is used
  2. when specifying a param the type is never used

While 1 has the drawback of not adding any text description

Example

image

Even members are typed

image

@vgrem
Copy link
Owner

vgrem commented Oct 4, 2023

This is huge improvement in terms of typing and the the option to keep support with Python 2.7
Much appreciated!

@vgrem vgrem merged commit eb3c45e into vgrem:master Oct 4, 2023
1 check failed
@kellerza kellerza mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants