Skip to content

Commit c774e4a

Browse files
committed
Updates to correct errors revealed by mypy
1 parent 3c07c5e commit c774e4a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pandas/core/dtypes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Extend pandas with custom array types"""
2-
from typing import List, Optional
2+
from typing import List, Optional, Type
33

44
import numpy as np
55

@@ -209,7 +209,7 @@ def __str__(self):
209209
return self.name
210210

211211
@property
212-
def type(self) -> type:
212+
def type(self) -> Type:
213213
"""
214214
The scalar type for the array, e.g. ``int``
215215

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import sys
2020
import warnings
2121
from textwrap import dedent
22-
from typing import List, Optional, Union
22+
from typing import List, Optional, Set, Union
2323

2424
import numpy as np
2525
import numpy.ma as ma
@@ -367,7 +367,7 @@ def _constructor(self):
367367
_constructor_sliced = Series
368368
_deprecations = NDFrame._deprecations | frozenset(
369369
['get_value', 'set_value', 'from_csv', 'from_items'])
370-
_accessors = set()
370+
_accessors = set() # type: Set
371371

372372
@property
373373
def _constructor_expanddim(self):

pandas/core/groupby/groupby.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class providing the base-class of operations.
1212
import datetime
1313
from functools import partial, wraps
1414
import types
15-
from typing import Optional, Tuple, Type
15+
from typing import Optional, Tuple, Type, Union
1616
import warnings
1717

1818
import numpy as np
@@ -1736,8 +1736,9 @@ def quantile(self, q=0.5, interpolation='linear'):
17361736
b 3.0
17371737
"""
17381738

1739-
def pre_processor(vals: np.ndarray) -> \
1740-
Tuple[np.ndarray, Optional[Type]]:
1739+
def pre_processor(
1740+
vals: np.ndarray
1741+
) -> Tuple[np.ndarray, Optional[Union[str, Type]]]:
17411742
if is_object_dtype(vals):
17421743
raise TypeError("'quantile' cannot be performed against "
17431744
"'object' dtypes!")

0 commit comments

Comments
 (0)