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

Add type hints to __main__.py #463

Merged
merged 5 commits into from
Mar 19, 2022
Merged

Conversation

ggravlingen
Copy link
Member

This PR adds type hints to __main__.py.

def main(org_args):
"""Run main."""
global devices, homekit_id, light, api, lights, gateway, groups, moods, tasks, dump_devices, dump_all # pylint: disable=global-variable-undefined, invalid-name
if __name__ == "__main__":
Copy link
Member Author

Choose a reason for hiding this comment

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

By putting all the code here instead of in a function, we don't need the global definition, which was messing up the type hints.

@ggravlingen

This comment was marked as resolved.

@ggravlingen
Copy link
Member Author

I believe this concludes the task of adding type hints to the library? I remember you did a breaking change in one of the pull requests, albeit a small one. Should I bump to 10.0.0 or is this 9.1.0? If we're going for 10 we might as well drop the methods discussed in #457.

Copy link
Contributor

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

In a follow up, we can make _model_class non optional and remove the cases for it in resource.py.

We can also now mark the library as typed with a file py.typed.

@MartinHjelmare
Copy link
Contributor

I think we can make a major bump after removing the stale methods.

@ggravlingen ggravlingen merged commit 9e37a9b into master Mar 19, 2022
@ggravlingen ggravlingen deleted the finalise-adding-type-hint branch March 19, 2022 07:46
@ggravlingen ggravlingen mentioned this pull request Mar 19, 2022
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