Skip to content

Commit 3a53954

Browse files
WillAydjreback
authored andcommitted
Enabled stricter type checking (pandas-dev#27097)
1 parent b618eb6 commit 3a53954

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

mypy.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[mypy]
22
ignore_missing_imports=True
3+
no_implicit_optional=True
34

45
[mypy-pandas.conftest,pandas.tests.*]
56
ignore_errors=True

pandas/core/arrays/period.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _simple_new(cls, values, freq=None, **kwargs):
195195
def _from_sequence(
196196
cls,
197197
scalars: Sequence[Optional[Period]],
198-
dtype: PeriodDtype = None,
198+
dtype: Optional[PeriodDtype] = None,
199199
copy: bool = False,
200200
) -> ABCPeriodArray:
201201
if dtype:

pandas/core/dtypes/dtypes.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
214214
_metadata = ('categories', 'ordered')
215215
_cache = {} # type: Dict[str_type, PandasExtensionDtype]
216216

217-
def __init__(self, categories=None, ordered: bool = None):
217+
def __init__(self, categories=None, ordered: Optional[bool] = None):
218218
self._finalize(categories, ordered, fastpath=False)
219219

220220
@classmethod
221221
def _from_fastpath(cls,
222222
categories=None,
223-
ordered: bool = None
223+
ordered: Optional[bool] = None
224224
) -> 'CategoricalDtype':
225225
self = cls.__new__(cls)
226226
self._finalize(categories, ordered, fastpath=True)
@@ -230,7 +230,7 @@ def _from_fastpath(cls,
230230
def _from_categorical_dtype(cls,
231231
dtype: 'CategoricalDtype',
232232
categories=None,
233-
ordered: bool = None,
233+
ordered: Optional[bool] = None,
234234
) -> 'CategoricalDtype':
235235
if categories is ordered is None:
236236
return dtype
@@ -244,8 +244,8 @@ def _from_categorical_dtype(cls,
244244
def _from_values_or_dtype(cls,
245245
values=None,
246246
categories=None,
247-
ordered: bool = None,
248-
dtype: 'CategoricalDtype' = None,
247+
ordered: Optional[bool] = None,
248+
dtype: Optional['CategoricalDtype'] = None,
249249
) -> 'CategoricalDtype':
250250
"""
251251
Construct dtype from the input parameters used in :class:`Categorical`.

pandas/core/nanops.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ def _maybe_get_mask(values: np.ndarray, skipna: bool,
228228

229229

230230
def _get_values(values: np.ndarray, skipna: bool, fill_value: Any = None,
231-
fill_value_typ: str = None, mask: Optional[np.ndarray] = None
231+
fill_value_typ: Optional[str] = None,
232+
mask: Optional[np.ndarray] = None
232233
) -> Tuple[np.ndarray, Optional[np.ndarray], np.dtype,
233234
np.dtype, Any]:
234235
""" Utility to get the values view, mask, dtype, dtype_max, and fill_value.

0 commit comments

Comments
 (0)