Skip to content

CI: Uprade mypy min version #52512

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

Merged
merged 2 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v2.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ If installed, we now require:
+-----------------+-----------------+----------+---------+
| Package | Minimum Version | Required | Changed |
+=================+=================+==========+=========+
| | | X | X |
| mypy (dev) | 1.2 | | X |
+-----------------+-----------------+----------+---------+

For `optional libraries <https://pandas.pydata.org/docs/getting_started/install.html>`_ the general recommendation is to use the latest version.
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ dependencies:
- cpplint
- flake8=6.0.0
- isort>=5.2.1 # check that imports are in the right order
- mypy=1.0
- mypy=1.2
- pre-commit>=2.15.0
- pyupgrade
- ruff=0.0.215
Expand Down
6 changes: 5 additions & 1 deletion pandas/_libs/tslibs/timestamps.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ class Timestamp(datetime):
def astimezone(self, tz: _tzinfo | None) -> Self: ... # type: ignore[override]
def ctime(self) -> str: ...
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
# Return type "datetime" of "strptime" incompatible with return type "Timestamp"
# in supertype "datetime"
@classmethod
def strptime(cls, date_string: str, format: str) -> datetime: ...
def strptime( # type: ignore[override]
cls, date_string: str, format: str
) -> datetime: ...
def utcoffset(self) -> timedelta | None: ...
def tzname(self) -> str | None: ...
def dst(self) -> timedelta | None: ...
Expand Down
4 changes: 1 addition & 3 deletions pandas/core/arrays/masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,7 @@ def factorize(
if na_index == 0:
na_code = np.intp(0)
else:
# mypy error: Slice index must be an integer or None
# https://github.com/python/mypy/issues/2410
na_code = codes[:na_index].max() + 1 # type: ignore[misc]
na_code = codes[:na_index].max() + 1
codes[codes >= na_code] += 1
codes[codes == -1] = na_code
# dummy value for uniques; not used since uniques_mask will be True
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4120,7 +4120,7 @@ class animal locomotion
if not drop_level:
if lib.is_integer(loc):
# Slice index must be an integer or None
new_index = index[loc : loc + 1] # type: ignore[misc]
new_index = index[loc : loc + 1]
else:
new_index = index[loc]
else:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2942,7 +2942,7 @@ def get_loc_level(self, key, level: IndexLabel = 0, drop_level: bool = True):
if not drop_level:
if lib.is_integer(loc):
# Slice index must be an integer or None
mi = self[loc : loc + 1] # type: ignore[misc]
mi = self[loc : loc + 1]
else:
mi = self[loc]
return loc, mi
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ black==23.1.0
cpplint
flake8==6.0.0
isort>=5.2.1
mypy==1.0
mypy==1.2
pre-commit>=2.15.0
pyupgrade
ruff==0.0.215
Expand Down