Skip to content

CLN: add typing to dtype arg in core/common.py (GH38808) #39018

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 1 commit into from
Jan 7, 2021
Merged
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
8 changes: 4 additions & 4 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import contextlib
from functools import partial
import inspect
from typing import Any, Collection, Iterable, Iterator, List, Union, cast
from typing import Any, Collection, Iterable, Iterator, List, Optional, Union, cast
import warnings

import numpy as np

from pandas._libs import lib
from pandas._typing import AnyArrayLike, Scalar, T
from pandas._typing import AnyArrayLike, NpDtype, Scalar, T
from pandas.compat.numpy import np_version_under1p18

from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
Expand Down Expand Up @@ -195,7 +195,7 @@ def count_not_none(*args) -> int:
return sum(x is not None for x in args)


def asarray_tuplesafe(values, dtype=None):
def asarray_tuplesafe(values, dtype: Optional[NpDtype] = None) -> np.ndarray:

if not (isinstance(values, (list, tuple)) or hasattr(values, "__array__")):
values = list(values)
Expand All @@ -218,7 +218,7 @@ def asarray_tuplesafe(values, dtype=None):
return result


def index_labels_to_array(labels, dtype=None):
def index_labels_to_array(labels, dtype: Optional[NpDtype] = None) -> np.ndarray:
"""
Transform label or iterable of labels to array, for use in Index.

Expand Down