-
Notifications
You must be signed in to change notification settings - Fork 122
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
Use type alias for temporal intervals #744
Use type alias for temporal intervals #744
Conversation
cc: @cuttlefish |
Codecov Report
@@ Coverage Diff @@
## main #744 +/- ##
=======================================
Coverage 94.33% 94.34%
=======================================
Files 77 77
Lines 11285 11291 +6
Branches 1347 1347
=======================================
+ Hits 10646 10652 +6
Misses 459 459
Partials 180 180
Continue to review full report at Codecov.
|
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 did have one question about the type union but I'm probably not understanding it correctly so approving so I don't block if I'm wrong :-).
0a026b4
to
696cfc4
Compare
Related Issue(s):
Description:
Adds 2 type variables that are used in the
TemporalExtent
class:TemporalIntervals
- This is used for properly formatted STAC temporal intervals (i.e. a list of lists)TemporalIntervalsLike
- This is used for theintervals
argument toTemporalExtent
where we allow either a list of lists or a list of optional datetimes and convert it into a list of lists.I tried using a covariant
TypeVar
as I had initially suggested in #586 (comment), but that did not fix the type errors. Using aUnion
type of all the possible combinations seemed to be the only way to makemypy
happy.Also note that this adds a test whose only purpose is type checking when we run
mypy
. If there are suggestions on a better place to put this kind of check I'm happy to change that.PR Checklist:
pre-commit run --all-files
)scripts/test
)