Skip to content

Add Missing Type Annotations #40

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

Merged
merged 3 commits into from
Oct 24, 2022
Merged

Add Missing Type Annotations #40

merged 3 commits into from
Oct 24, 2022

Conversation

tcfranks
Copy link
Contributor

resolves #34
submitted for review / comment

@@ -185,7 +193,7 @@ def set_iaq_relative_humidity(self, celsius, relative_humidity):

# Low level command functions

def _run_profile(self, profile):
def _run_profile(self, profile: Tuple[str, List[int], int, float]) -> List[int]:
Copy link
Member

Choose a reason for hiding this comment

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

I didn't review everything but thought it would be helpful to mention this first - technically this library uses lists for profile instead of tuple so it's not correct. However, the way that this function unpacks the argument, I think tuples are a much better fit, and we should change all uses of this function to use tuples instead of lists. Is that something you would be interesting in help with? It'll make the type annotations much smoother and sensible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, based on a comment to another pr, wouldn't we fix this to be lists for annotations and do the change to tuple in another pr? I think I used tuple here because of hints pycharm was giving me and also the fact I was having problems wrapping my head around the structure of the profile being a list. which says more about me and my understanding of lists, I suppose. so yes, I should dig a bit and do that. not before next week, tho. In here or a different PR?

Copy link
Member

Choose a reason for hiding this comment

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

I would do it here, unlike the other PR, changing those lists to tuples wouldn't be API-breaking, just minor modifications to aid in type annotations. I agree with you that that it just doesn't make sense for it to be a list, since we're unpacking it to a fixed set of variables anyway.

@tcfranks
Copy link
Contributor Author

submitted for review, changing passed lists to tuples

@tekktrik tekktrik self-requested a review October 18, 2022 00:35
Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thanks for knocking out another libraries typing, and the change to tuple

@FoamyGuy FoamyGuy merged commit a09d8bb into adafruit:main Oct 24, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Oct 25, 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.

Missing Type Annotations
3 participants