Skip to content

Commit

Permalink
Remove pandas.core.index.datetimelike from MyPy Blacklist (#26280)
Browse files Browse the repository at this point in the history
  • Loading branch information
makbigc authored and WillAyd committed Jun 25, 2019
1 parent 2da4599 commit 606178a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
5 changes: 1 addition & 4 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ ignore_missing_imports=True
follow_imports=silent

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

[mypy-pandas.core.indexes.datetimelike]
ignore_errors=True
ignore_errors=True
3 changes: 2 additions & 1 deletion pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
intended for public consumption
"""
from textwrap import dedent
from typing import Dict
from warnings import catch_warnings, simplefilter, warn

import numpy as np
Expand All @@ -27,7 +28,7 @@

from pandas.core import common as com

_shared_docs = {}
_shared_docs = {} # type: Dict[str, str]


# --------------- #
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
without warning.
"""
import operator
from typing import Any, Callable, Optional, Sequence, Tuple, Union
from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union

import numpy as np

Expand All @@ -26,7 +26,7 @@

_not_implemented_message = "{} does not implement {}."

_extension_array_shared_docs = dict()
_extension_array_shared_docs = dict() # type: Dict[str, str]


class ExtensionArray:
Expand Down
24 changes: 14 additions & 10 deletions pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Base and utility classes for tseries type pandas objects.
"""
import operator
from typing import Set
import warnings

import numpy as np
Expand Down Expand Up @@ -62,14 +63,17 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
# DatetimeLikeArrayMixin assumes subclasses are mutable, so these are
# properties there. They can be made into cache_readonly for Index
# subclasses bc they are immutable
inferred_freq = cache_readonly(DatetimeLikeArrayMixin.inferred_freq.fget)
_isnan = cache_readonly(DatetimeLikeArrayMixin._isnan.fget)
hasnans = cache_readonly(DatetimeLikeArrayMixin._hasnans.fget)
inferred_freq = cache_readonly(
DatetimeLikeArrayMixin.inferred_freq.fget) # type: ignore
_isnan = cache_readonly(DatetimeLikeArrayMixin._isnan.fget) # type: ignore
hasnans = cache_readonly(
DatetimeLikeArrayMixin._hasnans.fget) # type: ignore
_hasnans = hasnans # for index / array -agnostic code
_resolution = cache_readonly(DatetimeLikeArrayMixin._resolution.fget)
resolution = cache_readonly(DatetimeLikeArrayMixin.resolution.fget)
_resolution = cache_readonly(
DatetimeLikeArrayMixin._resolution.fget) # type: ignore
resolution = cache_readonly(
DatetimeLikeArrayMixin.resolution.fget) # type: ignore

_box_values = ea_passthrough(DatetimeLikeArrayMixin._box_values)
_maybe_mask_results = ea_passthrough(
DatetimeLikeArrayMixin._maybe_mask_results)
__iter__ = ea_passthrough(DatetimeLikeArrayMixin.__iter__)
Expand Down Expand Up @@ -131,11 +135,11 @@ def _ndarray_values(self):
# Abstract data attributes

@property
def values(self) -> np.ndarray:
def values(self):
# Note: PeriodArray overrides this to return an ndarray of objects.
return self._data._data

@property
@property # type: ignore # https://github.com/python/mypy/issues/1362
@Appender(DatetimeLikeArrayMixin.asi8.__doc__)
def asi8(self):
return self._data.asi8
Expand Down Expand Up @@ -762,9 +766,9 @@ class DatetimelikeDelegateMixin(PandasDelegate):
boxed in an index, after being returned from the array
"""
# raw_methods : dispatch methods that shouldn't be boxed in an Index
_raw_methods = set()
_raw_methods = set() # type: Set[str]
# raw_properties : dispatch properties that shouldn't be boxed in an Index
_raw_properties = set()
_raw_properties = set() # type: Set[str]
name = None
_data = None

Expand Down

0 comments on commit 606178a

Please sign in to comment.