-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generic typing to Arrowbic extension type and array classes.
- Loading branch information
Showing
6 changed files
with
68 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
"""Implementation of base extension array class used in Arrowbic. | ||
""" | ||
from typing import Optional, Sequence, TypeVar | ||
|
||
import pyarrow as pa | ||
|
||
TItem = TypeVar("TItem") | ||
|
||
|
||
class BaseExtensionArray(pa.ExtensionArray): | ||
class BaseExtensionArray(pa.ExtensionArray, Sequence[Optional[TItem]]): | ||
"""Base extension array, adding interface to make simple operations easier.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
from enum import IntEnum | ||
from typing import TypeVar | ||
|
||
from arrowbic.core.base_extension_array import BaseExtensionArray | ||
|
||
TItem = TypeVar("TItem", bound=IntEnum) | ||
|
||
|
||
class IntEnumArray(BaseExtensionArray): | ||
class IntEnumArray(BaseExtensionArray[TItem]): | ||
"""IntEnum extension array.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters