-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
CI: enable a few more mypy checks #60
Changes from 1 commit
10b2a16
b39b21f
54e39a1
eeb0ffa
0515650
38e4737
fc6f603
3a73fd4
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# flake8: noqa: F841 | ||
# pyright: reportUnusedExpression = false | ||
from typing import TYPE_CHECKING | ||
|
||
import pandas as pd | ||
|
@@ -47,10 +48,10 @@ def test_interval_length() -> None: | |
|
||
assert_type(idres, "pd.Interval[pd.Timestamp]") | ||
if TYPE_CHECKING: | ||
20 in i1 # type: ignore | ||
i1 + pd.Timestamp("2000-03-03") # type: ignore | ||
i1 * 3 # type: ignore | ||
i1 * pd.Timedelta(seconds=20) # type: ignore | ||
20 in i1 | ||
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. Removing this I'm hesitant to make this change unless we can fix the stub to error out on this line. I'm pretty sure at one point it did used to pick that up - not sure what changed. 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. I think it will take quite some effort to remove annotations like these def __add__(self, other: TimestampSeries) -> TimestampSeries: ...
def __add__(self, other: Timestamp) -> TimestampSeries: .. but also allow legit combinations. |
||
i1 + pd.Timestamp("2000-03-03") # type: ignore[operator] | ||
i1 * 3 # type: ignore[operator] | ||
i1 * pd.Timedelta(seconds=20) # type: ignore[operator] | ||
|
||
i2 = pd.Interval(10, 20) | ||
assert_type(i2.length, "int") | ||
|
@@ -66,8 +67,8 @@ def test_interval_length() -> None: | |
assert_type(i2 * 4.2, "pd.Interval[float]") | ||
|
||
if TYPE_CHECKING: | ||
pd.Timestamp("2001-01-02") in i2 # type: ignore | ||
i2 + pd.Timedelta(seconds=20) # type: ignore | ||
pd.Timestamp("2001-01-02") in i2 # pyright: ignore[reportGeneralTypeIssues] | ||
i2 + pd.Timedelta(seconds=20) # pyright: ignore[reportGeneralTypeIssues] | ||
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. This is one of these cases where |
||
|
||
i3 = pd.Interval(13.2, 19.5) | ||
assert_type(i3.length, "float") | ||
|
@@ -80,5 +81,5 @@ def test_interval_length() -> None: | |
assert_type(i3 + 3, "pd.Interval[float]") | ||
assert_type(i3 * 3, "pd.Interval[float]") | ||
if TYPE_CHECKING: | ||
pd.Timestamp("2001-01-02") in i3 # type: ignore | ||
i3 + pd.Timedelta(seconds=20) # type: ignore | ||
pd.Timestamp("2001-01-02") in i3 # pyright: ignore[reportGeneralTypeIssues] | ||
i3 + pd.Timedelta(seconds=20) # pyright: ignore[reportGeneralTypeIssues] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,6 @@ def fail_on_adding_two_timestamps() -> None: | |
s1 = pd.Series(pd.to_datetime(["2022-05-01", "2022-06-01"])) | ||
s2 = pd.Series(pd.to_datetime(["2022-05-15", "2022-06-15"])) | ||
if TYPE_CHECKING: | ||
ssum: pd.Series = s1 + s2 # type: ignore | ||
ssum: pd.Series = s1 + s2 | ||
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. So this should have a |
||
ts = pd.Timestamp("2022-06-30") | ||
tsum: pd.Series = s1 + ts # type: ignore | ||
tsum: pd.Series = s1 + ts |
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.
Can you add comment here and with
enable_error_code
that these are changes from pandas?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.
implicit_reexport
is still true in pandas