-
-
Notifications
You must be signed in to change notification settings - Fork 145
Add some missing Optional type annotations to interval_range
and read_sql
#1315
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,59 +310,17 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin): | |
# int gets hit first and so the correct type is returned | ||
@overload | ||
def interval_range( # pyright: ignore[reportOverlappingOverload] | ||
start: int = ..., | ||
end: int = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[int]]: ... | ||
|
||
# Overlaps since int is a subclass of float | ||
@overload | ||
def interval_range( # pyright: ignore[reportOverlappingOverload] | ||
start: int, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[int]]: ... | ||
@overload | ||
def interval_range( # pyright: ignore[reportOverlappingOverload] | ||
*, | ||
start: None = ..., | ||
end: int, | ||
start: int | None = ..., | ||
end: int | None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[int]]: ... | ||
@overload | ||
def interval_range( | ||
start: float = ..., | ||
end: float = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[float]]: ... | ||
@overload | ||
def interval_range( | ||
start: float, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[float]]: ... | ||
Comment on lines
-351
to
-360
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
@overload | ||
def interval_range( | ||
*, | ||
start: None = ..., | ||
end: float, | ||
start: float | None = ..., | ||
end: float | None = ..., | ||
periods: int | None = ..., | ||
freq: int | None = ..., | ||
name: Hashable = ..., | ||
|
@@ -371,7 +329,7 @@ def interval_range( | |
@overload | ||
def interval_range( | ||
start: _TimestampLike, | ||
end: _TimestampLike = ..., | ||
end: _TimestampLike | None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
|
@@ -388,19 +346,9 @@ def interval_range( | |
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timestamp]]: ... | ||
@overload | ||
def interval_range( | ||
start: _TimestampLike, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timestamp]]: ... | ||
Comment on lines
-391
to
-399
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
@overload | ||
def interval_range( | ||
start: _TimedeltaLike, | ||
end: _TimedeltaLike = ..., | ||
end: _TimedeltaLike | None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
|
@@ -416,13 +364,3 @@ def interval_range( | |
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timedelta]]: ... | ||
@overload | ||
def interval_range( | ||
start: _TimedeltaLike, | ||
*, | ||
end: None = ..., | ||
periods: int | None = ..., | ||
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., | ||
name: Hashable = ..., | ||
closed: IntervalClosedType = ..., | ||
) -> IntervalIndex[Interval[pd.Timedelta]]: ... | ||
Comment on lines
-419
to
-428
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,7 @@ def read_sql( | |
| None | ||
) = ..., | ||
parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., | ||
columns: list[str] = ..., | ||
columns: list[str] | None = ..., | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like #1293 missed the defaults for |
||
*, | ||
chunksize: int, | ||
dtype: DtypeArg | None = ..., | ||
|
@@ -136,7 +136,7 @@ def read_sql( | |
| None | ||
) = ..., | ||
parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., | ||
columns: list[str] = ..., | ||
columns: list[str] | None = ..., | ||
chunksize: None = ..., | ||
dtype: DtypeArg | None = ..., | ||
dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., | ||
|
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.
having corrected the first overload, this one would never be matched, so it can be removed