Skip to content

Commit e851837

Browse files
committed
pyright @ py310
1 parent 03a4f49 commit e851837

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

pandas-stubs/__init__.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from pandas import (
24
api as api,
35
arrays as arrays,
@@ -47,7 +49,6 @@ from pandas.core.api import (
4749
UInt16Dtype as UInt16Dtype,
4850
UInt32Dtype as UInt32Dtype,
4951
UInt64Dtype as UInt64Dtype,
50-
array as array,
5152
bdate_range as bdate_range,
5253
date_range as date_range,
5354
factorize as factorize,
@@ -154,4 +155,11 @@ from pandas.io.json._normalize import (
154155
from pandas.tseries import offsets as offsets
155156
from pandas.tseries.api import infer_freq as infer_freq
156157

158+
if sys.version_info >= (3, 11):
159+
from pandas.core.construction import array as array
160+
else:
161+
from pandas.core.construction import (
162+
array as array, # pyright: ignore[reportUnknownVariableType]
163+
)
164+
157165
__version__: str

pandas-stubs/core/api.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from pandas.core.algorithms import (
24
factorize as factorize,
35
unique as unique,
@@ -20,7 +22,6 @@ from pandas.core.arrays.integer import (
2022
UInt64Dtype as UInt64Dtype,
2123
)
2224
from pandas.core.arrays.string_ import StringDtype as StringDtype
23-
from pandas.core.construction import array as array
2425
from pandas.core.frame import DataFrame as DataFrame
2526
from pandas.core.groupby import (
2627
Grouper as Grouper,
@@ -77,3 +78,10 @@ from pandas.core.dtypes.missing import (
7778

7879
from pandas.io.formats.format import set_eng_float_format as set_eng_float_format
7980
from pandas.tseries.offsets import DateOffset as DateOffset
81+
82+
if sys.version_info >= (3, 11):
83+
from pandas.core.construction import array as array
84+
else:
85+
from pandas.core.construction import (
86+
array as array, # pyright: ignore[reportUnknownVariableType]
87+
)

tests/arrays/test_arrays.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import sys
2+
13
from pandas.core.arrays.integer import IntegerArray
2-
from pandas.core.construction import array
34
from typing_extensions import assert_type
45

56
from pandas._libs.missing import NA
67

78
from tests import check
89

10+
if sys.version_info >= (3, 11):
11+
from pandas.core.construction import array
12+
else:
13+
from pandas.core.construction import (
14+
array, # pyright: ignore[reportUnknownVariableType]
15+
)
16+
917

1018
def test_construction() -> None:
1119
check(assert_type(array([1]), IntegerArray), IntegerArray)

tests/arrays/test_cumul.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import sys
2+
13
from pandas.core.arrays.integer import IntegerArray
2-
from pandas.core.construction import array
34
from typing_extensions import assert_type
45

56
from pandas._libs.missing import NA
67

78
from tests import check
89

10+
if sys.version_info >= (3, 11):
11+
from pandas.core.construction import array
12+
else:
13+
from pandas.core.construction import (
14+
array, # pyright: ignore[reportUnknownVariableType]
15+
)
16+
917

1018
def test_cumul_int64dtype() -> None:
1119
arr = array([1, NA, 2])

tests/arrays/test_extension_array.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Test common ExtensionArray methods
2+
import sys
3+
24
import numpy as np
35
import pandas as pd
46
from pandas.core.arrays import ExtensionArray
57
from pandas.core.arrays.integer import (
68
Int32Dtype,
79
IntegerArray,
810
)
9-
from pandas.core.construction import array
1011
from typing_extensions import assert_type
1112

1213
from pandas._typing import ArrayLike
@@ -17,6 +18,13 @@
1718
np_1darray_intp,
1819
)
1920

21+
if sys.version_info >= (3, 11):
22+
from pandas.core.construction import array
23+
else:
24+
from pandas.core.construction import (
25+
array, # pyright: ignore[reportUnknownVariableType]
26+
)
27+
2028

2129
def test_ea_common() -> None:
2230
# Note: `ExtensionArray` is abstract, so we use `IntegerArray` for the tests.

0 commit comments

Comments
 (0)