Skip to content

Enabled stricter type checking #27097

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 3 commits into from
Jun 28, 2019
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
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[mypy]
ignore_missing_imports=True
no_implicit_optional=True

[mypy-pandas.conftest,pandas.tests.*]
ignore_errors=True
2 changes: 1 addition & 1 deletion pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _simple_new(cls, values, freq=None, **kwargs):
def _from_sequence(
cls,
scalars: Sequence[Optional[Period]],
dtype: PeriodDtype = None,
dtype: Optional[PeriodDtype] = None,
copy: bool = False,
) -> ABCPeriodArray:
if dtype:
Expand Down
10 changes: 5 additions & 5 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
_metadata = ('categories', 'ordered')
_cache = {} # type: Dict[str_type, PandasExtensionDtype]

def __init__(self, categories=None, ordered: bool = None):
def __init__(self, categories=None, ordered: Optional[bool] = None):
self._finalize(categories, ordered, fastpath=False)

@classmethod
def _from_fastpath(cls,
categories=None,
ordered: bool = None
ordered: Optional[bool] = None
) -> 'CategoricalDtype':
self = cls.__new__(cls)
self._finalize(categories, ordered, fastpath=True)
Expand All @@ -230,7 +230,7 @@ def _from_fastpath(cls,
def _from_categorical_dtype(cls,
dtype: 'CategoricalDtype',
categories=None,
ordered: bool = None,
ordered: Optional[bool] = None,
) -> 'CategoricalDtype':
if categories is ordered is None:
return dtype
Expand All @@ -244,8 +244,8 @@ def _from_categorical_dtype(cls,
def _from_values_or_dtype(cls,
values=None,
categories=None,
ordered: bool = None,
dtype: 'CategoricalDtype' = None,
ordered: Optional[bool] = None,
dtype: Optional['CategoricalDtype'] = None,
) -> 'CategoricalDtype':
"""
Construct dtype from the input parameters used in :class:`Categorical`.
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ def _maybe_get_mask(values: np.ndarray, skipna: bool,


def _get_values(values: np.ndarray, skipna: bool, fill_value: Any = None,
fill_value_typ: str = None, mask: Optional[np.ndarray] = None
fill_value_typ: Optional[str] = None,
mask: Optional[np.ndarray] = None
) -> Tuple[np.ndarray, Optional[np.ndarray], np.dtype,
np.dtype, Any]:
""" Utility to get the values view, mask, dtype, dtype_max, and fill_value.
Expand Down