Skip to content

Commit

Permalink
Update enums to reflect typing spec changes
Browse files Browse the repository at this point in the history
See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members

python/typing-council#11

The next version of mypy will obey the spec change:
python/mypy#18068

pyright already requires this
  • Loading branch information
hauntsaninja committed Oct 30, 2024
1 parent f71224c commit 1b109c9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
21 changes: 11 additions & 10 deletions pandas-stubs/_libs/tslibs/dtypes.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from enum import Enum
from typing import cast

from .offsets import BaseOffset

Expand Down Expand Up @@ -29,16 +30,16 @@ class FreqGroup:
def get_freq_group(code: int) -> int: ...

class Resolution(Enum):
RESO_NS: int
RESO_US: int
RESO_MS: int
RESO_SEC: int
RESO_MIN: int
RESO_HR: int
RESO_DAY: int
RESO_MTH: int
RESO_QTR: int
RESO_YR: int
RESO_NS = cast(int, ...)
RESO_US = cast(int, ...)
RESO_MS = cast(int, ...)
RESO_SEC = cast(int, ...)
RESO_MIN = cast(int, ...)
RESO_HR = cast(int, ...)
RESO_DAY = cast(int, ...)
RESO_MTH = cast(int, ...)
RESO_QTR = cast(int, ...)
RESO_YR = cast(int, ...)

def __lt__(self, other) -> bool: ...
def __ge__(self, other) -> bool: ...
Expand Down
41 changes: 21 additions & 20 deletions pandas-stubs/core/interchange/dataframe_protocol.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,34 @@ import enum
from typing import (
Any,
TypedDict,
cast
)

class DlpackDeviceType(enum.IntEnum):
CPU: int
CUDA: int
CPU_PINNED: int
OPENCL: int
VULKAN: int
METAL: int
VPI: int
ROCM: int
CPU = cast(int, ...)
CUDA = cast(int, ...)
CPU_PINNED = cast(int, ...)
OPENCL = cast(int, ...)
VULKAN = cast(int, ...)
METAL = cast(int, ...)
VPI = cast(int, ...)
ROCM = cast(int, ...)

class DtypeKind(enum.IntEnum):
INT: int
UINT: int
FLOAT: int
BOOL: int
STRING: int
DATETIME: int
CATEGORICAL: int
INT = cast(int, ...)
UINT = cast(int, ...)
FLOAT = cast(int, ...)
BOOL = cast(int, ...)
STRING = cast(int, ...)
DATETIME = cast(int, ...)
CATEGORICAL = cast(int, ...)

class ColumnNullType(enum.IntEnum):
NON_NULLABLE: int
USE_NAN: int
USE_SENTINEL: int
USE_BITMASK: int
USE_BYTEMASK: int
NON_NULLABLE = cast(int, ...)
USE_NAN = cast(int, ...)
USE_SENTINEL = cast(int, ...)
USE_BITMASK = cast(int, ...)
USE_BYTEMASK = cast(int, ...)

class ColumnBuffers(TypedDict):
data: tuple[Buffer, Any]
Expand Down

0 comments on commit 1b109c9

Please sign in to comment.