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

Type aiocoap api #444

Merged
merged 3 commits into from
Mar 5, 2022
Merged

Type aiocoap api #444

merged 3 commits into from
Mar 5, 2022

Conversation

MartinHjelmare
Copy link
Contributor

  • See Type aiocoap api #388 for the previous attempt.
  • I've corrected the type for the Command.result as that depends on the return value of the process_result callback.
  • I'm planning to continue working on the command typing to make it more useful in follow up PRs.

_singleton = 0


_SENTINEL = UndefinedType._singleton # pylint: disable=protected-access
Copy link
Member

Choose a reason for hiding this comment

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

I have never seen this type of code before. What does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's to type the singleton that is used to mark empty value.

https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@ggravlingen ggravlingen left a comment

Choose a reason for hiding this comment

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

Sweet!

@MartinHjelmare MartinHjelmare merged commit 8295e49 into master Mar 5, 2022
@MartinHjelmare MartinHjelmare deleted the type-aiocoap-api branch March 5, 2022 16:54
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.

2 participants