Add @overload type signatures for series2seq and seq2series - #3178
Draft
authierj wants to merge 1 commit into
Draft
Add @overload type signatures for series2seq and seq2series#3178authierj wants to merge 1 commit into
@overload type signatures for series2seq and seq2series#3178authierj wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3178 +/- ##
==========================================
- Coverage 97.03% 96.96% -0.07%
==========================================
Files 165 165
Lines 17951 17952 +1
==========================================
- Hits 17418 17408 -10
- Misses 533 544 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist before merging this PR:
Summary
Improves static type inference for the two
TimeSeriessequence-conversion helpers indarts/utils/ts_utils.py:@overloadsignatures toseries2seq()so the return type is narrowed based onseq_type_out(SeriesType.SEQ→Sequence[TimeSeries],SeriesType.SEQ_SEQ→Sequence[Sequence[TimeSeries]]) and on whethertsisNone.@overloadsignatures toseq2series(), and corrected its implementation return annotation fromTimeSeries | NonetoTimeSeriesLike | None(it returns the sequence unchanged when it holds more than one element).Returnsdocstring sections of both functions to document theNonecase and the fact that down-conversions only unwrap single-element sequences.No runtime behavior changes — annotations and docstrings only.
Other Information
The overloads are currently grouped by confidence (
GOOD ONES/OKAY/TO BE IMPROVED)via inline comments. The broad catch-all overloads are needed until callers get their own
overloads, and can be narrowed in follow-up work.