-
Notifications
You must be signed in to change notification settings - Fork 134
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
Feature type hinting #190
Feature type hinting #190
Conversation
You can't replace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert changes on no_wrap cf previous comment
I am not sure I see the issue. None and False for all intents and purposes would amount to the same response when passed through a conditional. Like None, if it is false it should still default to |
make max_repr_items optional Co-authored-by: Mathis Chenuet <[email protected]>
make max_repr_items optional Co-authored-by: Mathis Chenuet <[email protected]>
…nal into feature-type-hinting
But no_wrap parameter is not a bool, it's an |
Okay, that's fair enough @artemisart |
Thanks for the update @maestro-1, I agree with @artemisart that the behavior is slightly different. In general, I really like PRs that have single purpose changes, in this case only adding incremental typing information (versus also semantically changing code). The typing info at least to me looks obviously correct, so this LGTM to merge if you're done with changes. I'd certainly welcome a followup PR to add some type checking to the build pipeline (e.g., something like |
@EntilZha sounds good, glad to support. There's really no way to add all the typing at once, because the code base is pretty big and generally it takes a while to wrap your mind around everything that is going on. The |
hey @artemisart something wrong with the pipeline? |
@EntilZha has to allow actions to runs |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #190 +/- ##
=======================================
Coverage 98.10% 98.10%
=======================================
Files 12 12
Lines 2377 2380 +3
=======================================
+ Hits 2332 2335 +3
Misses 45 45
☔ View full report in Codecov by Sentry. |
Ya, its annoying, I understand why it doesn't auto-run for first time contributors, but you'd think if I allow it once it would allow all future builds too... FWIW, the difference on the None/False/True, is indicating whether its explicitly set to False/True rather than being unset (None), at least that is my recollection, its been a while since I've looked at that code. |
Initial add of types to the sequence class and the functions of transformation module
This is an initial commit for #118
The
Sequence
class has a parameter ofno_wraps
which is a keyword argument. By all indications, this is a boolean but the default parameter used was None. This can lead to confusion if not properly understood, so type hints have been included to specify it as a boolean, and the default parameter has been changed from None to False. They would run the same way, but False is more semantically accurate in this context.The typing module is deprecated in more recent versions of python, but generics still need to be carried out using
TypeVar
until python 3.12. For backward compatibility usingTypeVar
is preferable.