Skip to content

Commit ed879f4

Browse files
committed
pyright @ py310
1 parent 1850e17 commit ed879f4

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,
@@ -157,4 +158,11 @@ from pandas.io.json._normalize import (
157158
from pandas.tseries import offsets as offsets
158159
from pandas.tseries.api import infer_freq as infer_freq
159160

161+
if sys.version_info >= (3, 11):
162+
from pandas.core.construction import array as array
163+
else:
164+
from pandas.core.construction import (
165+
array as array, # pyright: ignore[reportUnknownVariableType]
166+
)
167+
160168
__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,
@@ -23,7 +25,6 @@ from pandas.core.arrays.integer import (
2325
UInt64Dtype as UInt64Dtype,
2426
)
2527
from pandas.core.arrays.string_ import StringDtype as StringDtype
26-
from pandas.core.construction import array as array
2728
from pandas.core.frame import DataFrame as DataFrame
2829
from pandas.core.groupby import (
2930
Grouper as Grouper,
@@ -80,3 +81,10 @@ from pandas.core.dtypes.missing import (
8081

8182
from pandas.io.formats.format import set_eng_float_format as set_eng_float_format
8283
from pandas.tseries.offsets import DateOffset as DateOffset
84+
85+
if sys.version_info >= (3, 11):
86+
from pandas.core.construction import array as array
87+
else:
88+
from pandas.core.construction import (
89+
array as array, # pyright: ignore[reportUnknownVariableType]
90+
)

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)