-
Notifications
You must be signed in to change notification settings - Fork 648
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
[nnx] flaglib add get overloads #3582
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3582 +/- ##
==========================================
+ Coverage 56.32% 56.33% +0.01%
==========================================
Files 100 100
Lines 11951 11959 +8
==========================================
+ Hits 6731 6737 +6
- Misses 5220 5222 +2 ☔ View full report in Codecov by Sentry. |
... | ||
|
||
@tp.overload | ||
def get(self, name: str, default: A) -> A: |
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.
I think the right return type is A | Any
, because the value stored in the context is not guaranteed to be of type A
.
def get(self, name: str, default: A) -> A: | ||
... | ||
|
||
def get(self, name: str, default: A = None) -> A | None: |
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.
do you need a separate overload
if the method signatures are the same?
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.
The last non-@overload
ed definition is not used by type checkers, so this LGTM.
What does this PR do?
Adds typing overloads for
flagslib.get
.