Add strict typing to src/palace/manager/api/lanes.py#3023
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3023 +/- ##
=======================================
Coverage 93.02% 93.03%
=======================================
Files 479 479
Lines 43527 43539 +12
Branches 6041 6041
=======================================
+ Hits 40493 40505 +12
Misses 1965 1965
Partials 1069 1069 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tdilauro
left a comment
There was a problem hiding this comment.
This looks good! 🎸
This is approved, but the "No functional changes" statement in the PR description is not accurate right now (see comment below). Please resolve that comment one way or the other before merging.
src/palace/manager/api/lanes.py
Outdated
| else: | ||
| languages = list(languages) |
There was a problem hiding this comment.
After ll.846-849, languages is guaranteed to be a list[str], so it might make sense to use a new variable here with a name like languages_list:
if isinstance(languages, str):
languages_list = [languages]
else:
languages_list = list(languages)or just
languages_list = (
[languages]
if isinstance(languages, str)
else list(languages)
)and then be sure to use languages_list for the rest of the function.
Similar case in create_lane_for_tiny_collection below.
src/palace/manager/api/lanes.py
Outdated
| else: | ||
| languages = list(languages) |
There was a problem hiding this comment.
See comment above in create_lane_for_small_collection.
| """ | ||
| if not languages: | ||
| return None | ||
| return priority |
There was a problem hiding this comment.
The PR comment says that no functional changes were made, but this looks like a functional change. If you decide to leave this in, please update the PR description, so that it is accurate.
Also, we didn't make any changes to the tests in this PR, so that probably means that this case is not covered.
There was a problem hiding this comment.
The tests already cover checking for a priority = 0. I'll also correct the PR comment.
a77099e to
bdc530c
Compare
Description
Adds type hints to src/palace/manager/api/lanes.py
Motivation and Context
Ongoing effort to bring type hints to the entire code base.
How Has This Been Tested?
Unit tests. Mypy. Very very very minor functional changes that are covered by tests.
Checklist