Skip to content
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

CLN: typing/mypy cleanup: Small fixes to make stubgen happy #25576

Merged
merged 1 commit into from Mar 8, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/arrays/period.py
Expand Up @@ -710,7 +710,7 @@ def _raise_on_incompatible(left, right):
# Constructor Helpers

def period_array(data, freq=None, copy=False):
# type: (Sequence[Optional[Period]], Optional[Tick]) -> PeriodArray
# type: (Sequence[Optional[Period]], Optional[Tick], bool) -> PeriodArray
"""
Construct a new PeriodArray from a sequence of Period scalars.

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/sparse.py
Expand Up @@ -397,6 +397,7 @@ def _get_fill(arr):


def _sparse_array_op(left, right, op, name):
# type: (SparseArray, SparseArray, Callable, str) -> Any
"""
Perform a binary operation between two arrays.

Expand All @@ -413,7 +414,6 @@ def _sparse_array_op(left, right, op, name):
-------
SparseArray
"""
# type: (SparseArray, SparseArray, Callable, str) -> Any
if name.startswith('__'):
# For lookups in _libs.sparse we need non-dunder op name
name = name[2:-2]
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/groupby/groupby.py
Expand Up @@ -1041,7 +1041,7 @@ def _bool_agg(self, val_test, skipna):
"""

def objs_to_bool(vals):
# type: np.ndarray -> (np.ndarray, typing.Type)
# type: (np.ndarray) -> (np.ndarray, typing.Type)
if is_object_dtype(vals):
vals = np.array([bool(x) for x in vals])
else:
Expand Down Expand Up @@ -1743,7 +1743,7 @@ def quantile(self, q=0.5, interpolation='linear'):
"""

def pre_processor(vals):
# type: np.ndarray -> (np.ndarray, Optional[typing.Type])
# type: (np.ndarray) -> (np.ndarray, Optional[typing.Type])
if is_object_dtype(vals):
raise TypeError("'quantile' cannot be performed against "
"'object' dtypes!")
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/blocks.py
Expand Up @@ -1827,13 +1827,13 @@ def interpolate(self, method='pad', axis=0, inplace=False, limit=None,
placement=self.mgr_locs)

def shift(self, periods, axis=0, fill_value=None):
# type: (int, Optional[BlockPlacement], Any) -> List[ExtensionBlock]
"""
Shift the block by `periods`.

Dispatches to underlying ExtensionArray and re-boxes in an
ExtensionBlock.
"""
# type: (int, Optional[BlockPlacement]) -> List[ExtensionBlock]
return [
self.make_block_same_class(
self.values.shift(periods=periods, fill_value=fill_value),
Expand Down