Skip to content

Commit 67890ef

Browse files
mypy-0.730
1 parent 563a37d commit 67890ef

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222
- flake8-comprehensions # used by flake8, linting of unnecessary comprehensions
2323
- flake8-rst>=0.6.0,<=0.7.0 # linting of code blocks in rst files
2424
- isort # check that imports are in the right order
25-
- mypy=0.720
25+
- mypy=0.730
2626
- pycodestyle # used by flake8
2727

2828
# documentation

pandas/_libs/tslibs/offsets.pyi

+3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ def get_lastbday(year: int, month: int) -> int: ...
2020
def get_firstbday(year: int, month: int) -> int: ...
2121
def _get_calendar(weekmask, holidays, calendar): ...
2222
def _to_dt64(dt, dtype=...): ...
23+
def _validate_business_time(t_input): ...
2324

2425
# ---------------------------------------------------------------------
2526
# Constructor Helpers
2627

2728
relativedelta_kwds: Set[str]
2829

30+
def _determine_offset(kwds): ...
31+
2932
# ---------------------------------------------------------------------
3033
# Mixins & Singletons
3134

pandas/compat/pickle_compat.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ def load_reduce(self):
6868

6969
class _LoadSparseSeries:
7070
# To load a SparseSeries as a Series[Sparse]
71-
def __new__(cls) -> "Series":
71+
72+
# https://github.com/python/mypy/issues/1020
73+
# error: Incompatible return type for "__new__" (returns "Series", but must return
74+
# a subtype of "_LoadSparseSeries")
75+
def __new__(cls) -> "Series": # type: ignore
7276
from pandas import Series
7377

7478
warnings.warn(
@@ -82,7 +86,11 @@ def __new__(cls) -> "Series":
8286

8387
class _LoadSparseFrame:
8488
# To load a SparseDataFrame as a DataFrame[Sparse]
85-
def __new__(cls) -> "DataFrame":
89+
90+
# https://github.com/python/mypy/issues/1020
91+
# error: Incompatible return type for "__new__" (returns "DataFrame", but must
92+
# return a subtype of "_LoadSparseFrame")
93+
def __new__(cls) -> "DataFrame": # type: ignore
8694
from pandas import DataFrame
8795

8896
warnings.warn(
@@ -191,10 +199,10 @@ def __new__(cls) -> "DataFrame":
191199

192200

193201
# our Unpickler sub-class to override methods and some dispatcher
194-
# functions for compat
195-
202+
# functions for compat and uses a non-public class of the pickle module.
196203

197-
class Unpickler(pkl._Unpickler):
204+
# error: Name 'pkl._Unpickler' is not defined
205+
class Unpickler(pkl._Unpickler): # type: ignore
198206
def find_class(self, module, name):
199207
# override superclass
200208
key = (module, name)

pandas/core/indexing.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1763,12 +1763,7 @@ def _get_partial_string_timestamp_match_key(self, key, labels):
17631763
isinstance(component, str)
17641764
and labels.levels[i]._supports_partial_string_indexing
17651765
):
1766-
new_key.append(
1767-
# https://github.com/python/mypy/issues/2410
1768-
# # No overload variant of "slice" matches argument types
1769-
# "str", "str", "None"
1770-
slice(component, component, None) # type: ignore
1771-
)
1766+
new_key.append(slice(component, component, None))
17721767
else:
17731768
new_key.append(component)
17741769
key = tuple(new_key)

pandas/util/_print_versions.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import struct
66
import subprocess
77
import sys
8-
from typing import Optional
8+
from typing import List, Optional, Tuple, Union
99

1010
from pandas.compat._optional import VERSIONS, _get_version, import_optional_dependency
1111

1212

13-
def get_sys_info():
14-
"Returns system information as a dict"
13+
def get_sys_info() -> List[Tuple[str, Optional[Union[str, int]]]]:
14+
"Returns system information as a list"
1515

16-
blob = []
16+
blob: List[Tuple[str, Optional[Union[str, int]]]] = []
1717

1818
# get full commit hash
1919
commit = None
@@ -29,12 +29,7 @@ def get_sys_info():
2929
pass
3030
else:
3131
if pipe.returncode == 0:
32-
commit = so
33-
try:
34-
commit = so.decode("utf-8")
35-
except ValueError:
36-
pass
37-
commit = commit.strip().strip('"')
32+
commit = so.decode("utf-8").strip().strip('"')
3833

3934
blob.append(("commit", commit))
4035

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ flake8
99
flake8-comprehensions
1010
flake8-rst>=0.6.0,<=0.7.0
1111
isort
12-
mypy==0.720
12+
mypy==0.730
1313
pycodestyle
1414
gitpython
1515
sphinx==1.8.5

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ check_untyped_defs=False
206206
[mypy-pandas.core.indexes.multi]
207207
check_untyped_defs=False
208208

209+
[mypy-pandas.core.indexes.timedeltas]
210+
check_untyped_defs=False
211+
209212
[mypy-pandas.core.internals.blocks]
210213
check_untyped_defs=False
211214

0 commit comments

Comments
 (0)