Skip to content

Commit 37ac1f0

Browse files
authored
type DataFrame, Column, and GroupBy as Protocol (#291)
1 parent b54bb26 commit 37ac1f0

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

spec/API_specification/.mypy.ini

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
[mypy]
22
strict=True
3-
4-
[mypy-dataframe_api.*]
5-
disable_error_code=empty-body

spec/API_specification/dataframe_api/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# mypy: disable-error-code="empty-body"
12
"""
23
Function stubs and API documentation for the DataFrame API standard.
34
"""

spec/API_specification/dataframe_api/column_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any,NoReturn, TYPE_CHECKING, Literal, Generic
3+
from typing import Any,NoReturn, TYPE_CHECKING, Literal, Protocol
44

55
if TYPE_CHECKING:
66
from .typing import NullType, Scalar, DType, Namespace
@@ -10,7 +10,7 @@
1010
__all__ = ['Column']
1111

1212

13-
class Column:
13+
class Column(Protocol):
1414
"""
1515
Column object
1616

spec/API_specification/dataframe_api/dataframe_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, Literal, Mapping, Sequence, Union, TYPE_CHECKING, NoReturn
3+
from typing import Any, Literal, Mapping, Sequence, TYPE_CHECKING, NoReturn, Protocol
44

55

66
if TYPE_CHECKING:
@@ -13,7 +13,7 @@
1313
__all__ = ["DataFrame"]
1414

1515

16-
class DataFrame:
16+
class DataFrame(Protocol):
1717
"""
1818
DataFrame object
1919

spec/API_specification/dataframe_api/groupby_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING
3+
from typing import TYPE_CHECKING, Protocol
44

55
if TYPE_CHECKING:
66
from .dataframe_object import DataFrame
@@ -9,7 +9,7 @@
99
__all__ = ['GroupBy']
1010

1111

12-
class GroupBy:
12+
class GroupBy(Protocol):
1313
"""
1414
GroupBy object.
1515

0 commit comments

Comments
 (0)