44
55These should not depend on core.internals.
66"""
7- from typing import Optional , Sequence , Union , cast
7+ from typing import TYPE_CHECKING , Any , Optional , Sequence , Union , cast
88
99import numpy as np
1010import numpy .ma as ma
4444)
4545from pandas .core .dtypes .missing import isna
4646
47+ from pandas ._typing import ArrayLike , Dtype
4748import pandas .core .common as com
4849
50+ if TYPE_CHECKING :
51+ from pandas .core .series import Series
52+ from pandas .core .index import Index
53+
4954
5055def array (
5156 data : Sequence [object ],
@@ -567,8 +572,7 @@ def _try_cast(
567572 return subarr
568573
569574
570- # see gh-17261
571- def is_empty_data (data ):
575+ def is_empty_data (data : Any ) -> bool :
572576 """
573577 Utility to check if a Series is instantiated with empty data,
574578 which does not contain dtype information.
@@ -589,19 +593,18 @@ def is_empty_data(data):
589593
590594
591595def create_series_with_explicit_dtype (
592- data = None ,
593- index = None ,
594- dtype = None ,
595- name = None ,
596- copy = False ,
597- fastpath = False ,
598- dtype_if_empty = object ,
599- ):
596+ data : Any = None ,
597+ index : Optional [ Union [ ArrayLike , Index ]] = None ,
598+ dtype : Optional [ Dtype ] = None ,
599+ name : Optional [ str ] = None ,
600+ copy : bool = False ,
601+ fastpath : bool = False ,
602+ dtype_if_empty : Dtype = object ,
603+ ) -> Series :
600604 """
601605 Helper to pass an explicit dtype when instantiating an empty Series.
602606
603- This silences a DeprecationWarning described in the GitHub issue
604- mentioned above.
607+ This silences a DeprecationWarning described in GitHub-17261.
605608
606609 Parameters
607610 ----------
0 commit comments