Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 0 additions & 1 deletion pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ from pandas._config import (
)

from pandas.util._print_versions import show_versions as show_versions
from pandas.util._tester import test as test

from pandas.io.api import (
ExcelFile as ExcelFile,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/arrays/arrow/dtype.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pyarrow as pa
import pyarrow as pa # pyright: ignore[reportMissingTypeStubs]

from pandas._libs.missing import NAType

Expand Down
2 changes: 2 additions & 0 deletions pandas-stubs/core/indexers/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from pandas.core.indexers.objects import BaseIndexer as BaseIndexer
from pandas.core.indexers.utils import check_array_indexer as check_array_indexer
31 changes: 31 additions & 0 deletions pandas-stubs/core/indexers/objects.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Any

import numpy as np
from pandas import DatetimeIndex

from pandas._libs.tslibs import BaseOffset

class BaseIndexer:
def __init__(
self, index_array: np.ndarray | None = None, window_size: int = 0, **kwargs: Any
) -> None: ...
def get_window_bounds(
self,
num_values: int,
min_periods: int | None,
center: bool | None,
closed: str | None = None,
step: int | None = None,
) -> tuple[np.ndarray, np.ndarray]: ...

class FixedForwardWindowIndexer(BaseIndexer): ...

class VariableOffsetWindowIndexer(BaseIndexer):
def __init__(
self,
index_array: np.ndarray | None = None,
window_size: int = 0,
index: DatetimeIndex | None = None,
offset: BaseOffset | None = None,
**kwargs: Any,
) -> None: ...
14 changes: 14 additions & 0 deletions pandas-stubs/core/indexers/utils.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import overload

from pandas._typing import (
AnyArrayLike,
ListLike,
np_ndarray_int,
)

@overload
def check_array_indexer(array: AnyArrayLike, indexer: int) -> int: ...
@overload
def check_array_indexer(array: AnyArrayLike, indexer: slice) -> slice: ...
@overload
def check_array_indexer(array: AnyArrayLike, indexer: ListLike) -> np_ndarray_int: ...
1 change: 0 additions & 1 deletion pandas-stubs/io/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from pandas.io.excel import (
read_excel as read_excel,
)
from pandas.io.feather_format import read_feather as read_feather
from pandas.io.gbq import read_gbq as read_gbq
from pandas.io.html import read_html as read_html
from pandas.io.json import read_json as read_json
from pandas.io.orc import read_orc as read_orc
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/io/excel/_base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ from typing import (
overload,
)

from odf.opendocument import OpenDocument
from odf.opendocument import OpenDocument # pyright: ignore[reportMissingTypeStubs]
from openpyxl.workbook.workbook import Workbook
from pandas.core.frame import DataFrame
import pyxlsb.workbook
import pyxlsb.workbook # pyright: ignore[reportMissingTypeStubs]
from typing_extensions import Self
from xlrd.book import Book

Expand Down
3 changes: 0 additions & 3 deletions pandas-stubs/io/parsers/readers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ from pandas._typing import (
UsecolsArgType,
)

from pandas.io.common import IOHandles

@overload
def read_csv(
filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str],
Expand Down Expand Up @@ -472,7 +470,6 @@ class TextFileReader(abc.Iterator):
chunksize: int | None
nrows: int | None
squeeze: bool
handles: IOHandles | None
def __init__(
self,
f: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str] | list,
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ enableTypeIgnoreComments = false # use pyright-specific ignores
# disable subset of strict
reportMissingParameterType = false
reportMissingTypeArgument = false
reportMissingTypeStubs = false
reportUnnecessaryTypeIgnoreComment = true
reportUnknownArgumentType = false
reportUnknownLambdaType = false
Expand Down
3 changes: 1 addition & 2 deletions tests/extension/decimal/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys

import numpy as np
import pandas as pd
from pandas.api.extensions import (
no_default,
register_extension_dtype,
Expand Down Expand Up @@ -165,7 +164,7 @@ def __getitem__(self, item):
return self._data[item]
else:
# array, slice.
item = pd.api.indexers.check_array_indexer(self, item)
item = check_array_indexer(self, item)
return type(self)(self._data[item])

def take(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
BooleanArray,
IntegerArray,
)
import pyarrow as pa
import pyarrow as pa # pyright: ignore[reportMissingTypeStubs]
from typing_extensions import assert_type

from pandas._typing import Scalar
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def test_crosstab() -> None:
def test_arrow_dtype() -> None:
pytest.importorskip("pyarrow")

import pyarrow as pa
import pyarrow as pa # pyright: ignore[reportMissingTypeStubs]

check(
assert_type(
Expand Down