-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: libinterval #41059
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
Closed
Closed
TYP: libinterval #41059
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f936c85
TYP: libinterval
jbrockmendel 5f00eff
future import
jbrockmendel 0ab1d32
Merge remote-tracking branch 'upstream/master' into typ-interval
simonjayhawkins f31dab5
remove repr from pyi
jbrockmendel 07f94e1
typevar
jbrockmendel 210fde4
delayed evaluation
jbrockmendel 05e4cf8
Merge branch 'master' into typ-interval
jbrockmendel cecdecb
mypy following timestamps.pyi
jbrockmendel 71bfd24
Merge branch 'master' into typ-interval
jbrockmendel d806625
merge master
jbrockmendel 1d5e9d8
Merge branch 'master' into typ-interval
jbrockmendel 9c09b59
Merge branch 'master' into typ-interval
jbrockmendel 04b1a94
mypy fixup
jbrockmendel 6bc8788
mypy fixup
jbrockmendel 9904a42
revert experiment
jbrockmendel 1107a1b
Merge branch 'master' into typ-interval
jbrockmendel 0c59f13
Merge branch 'master' into typ-interval
jbrockmendel 8cce385
Merge branch 'master' into typ-interval
jbrockmendel eafd33a
Merge branch 'master' into typ-interval
jbrockmendel 34edd64
Merge branch 'master' into typ-interval
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import numpy as np | ||
|
||
from pandas import ( | ||
Timedelta, | ||
Timestamp, | ||
) | ||
|
||
VALID_CLOSED: frozenset[str] | ||
|
||
|
||
class IntervalMixin: | ||
closed: str | ||
|
||
@property | ||
def closed_left(self) -> bool: ... | ||
|
||
@property | ||
def closed_right(self) -> bool: ... | ||
|
||
@property | ||
def open_left(self) -> bool: ... | ||
|
||
@property | ||
def open_right(self) -> bool: ... | ||
|
||
@property | ||
def mid(self): ... | ||
|
||
@property | ||
def length(self): ... | ||
|
||
@property | ||
def is_empty(self): ... | ||
|
||
def _check_closed_matches(self, other, name: str = ...) -> None: ... | ||
|
||
|
||
class Interval(IntervalMixin): | ||
left: int | float | Timestamp | Timedelta | ||
right: int | float | Timestamp | Timedelta | ||
|
||
def __init__(self, left, right, closed: str = ...): ... | ||
|
||
def __contains__(self, key) -> bool: ... | ||
def __str__(self) -> str: ... | ||
def __add__(self, y): ... | ||
def __sub__(self, y): ... | ||
def __mul__(self, y): ... | ||
def __truediv__(self, y): ... | ||
def __floordiv__(self, y): ... | ||
|
||
def overlaps(self, other: Interval) -> bool: ... | ||
|
||
|
||
def intervals_to_interval_bounds( | ||
intervals: np.ndarray, | ||
validate_closed: bool = ..., | ||
) -> tuple[np.ndarray, np.ndarray, str]: ... | ||
|
||
|
||
class IntervalTree(IntervalMixin): | ||
def __init__(self, left, right, closed=..., leaf_size=...): ... | ||
|
||
@property | ||
def left_sorter(self) -> np.ndarray: ... # np.ndarray[np.intp] | ||
|
||
@property | ||
def right_sorter(self) -> np.ndarray: ... # np.ndarray[np.intp] | ||
|
||
@property | ||
def is_overlapping(self) -> bool: ... | ||
|
||
@property | ||
def is_monotonic_increasing(self) -> bool: ... | ||
|
||
def get_indexer( | ||
self, | ||
target: np.ndarray, # scalar_t[:] | ||
) -> np.ndarray: ... # np.ndarray[np.intp] | ||
|
||
def get_indexer_non_unique( | ||
self, | ||
target: np.ndarray, # scalar_t[:] | ||
) -> tuple[ | ||
np.ndarray, # np.ndarray[np.intp] | ||
np.ndarray, # np.ndarray[np.intp] | ||
]: ... | ||
|
||
def clear_mapping(self) -> None: ... |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
instead of Optional, can you use type(None) to be more explict?
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.
should just do a pass to modernize this entire file