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

refactor: validate parameters and the returns of functions #640

Merged
merged 2 commits into from
Sep 17, 2022
Merged

refactor: validate parameters and the returns of functions #640

merged 2 commits into from
Sep 17, 2022

Conversation

stefanycoimbra
Copy link
Contributor

Imports additions to validate the types of functions' parameters and its returns using mypy:
Line 4: from typing import List, Callable, TypeVar, cast, Any
Line 5: from typing import NoReturn

Initialize the generic type to use with decorators:
Line 8: F = TypeVar('F', bound=Callable[..., Any])

Other changes:
Line 11: add the "NoReturn" for the function warn_missing_module()
Lines 30 and 41: add the return type as F (generic type)
Lines 55 and 57: add the cast to using decorators with wrappers (see in https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators)

@CLAassistant
Copy link

CLAassistant commented Sep 16, 2022

CLA assistant check
All committers have signed the CLA.

@JGSweets JGSweets enabled auto-merge (squash) September 16, 2022 23:00
JGSweets
JGSweets previously approved these changes Sep 16, 2022
Copy link
Collaborator

@JGSweets JGSweets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! LGTM

auto-merge was automatically disabled September 17, 2022 00:17

Head branch was pushed to by a user without write access

@JGSweets JGSweets enabled auto-merge (squash) September 17, 2022 00:18
Copy link
Contributor

@taylorfturner taylorfturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic 🚀

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

Successfully merging this pull request may close these issues.

None yet

4 participants