Skip to content

Commit

Permalink
Specify explicit signature for __dataframe__. Remove DataFrame.versio…
Browse files Browse the repository at this point in the history
…n as Pyright doesn't like that in Polars it is specified as a property which is semantically not the same as an attribute (the later can be set, properties are read-only by default)
  • Loading branch information
binste committed Dec 23, 2023
1 parent 4eab849 commit 217939c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions altair/utils/_dfi_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# These classes are only for use in type signatures
import enum
from typing import Any, Iterable, Optional, Tuple, Protocol
from typing import Any, Iterable, Optional, Tuple, Protocol, Literal


class DtypeKind(enum.IntEnum):
Expand Down Expand Up @@ -121,8 +121,6 @@ class DataFrame(Protocol):
to the dataframe interchange protocol specification.
"""

version: int = 0 # version of the protocol

def __dataframe__(
self, nan_as_null: bool = False, allow_copy: bool = True
) -> "DataFrame":
Expand Down
4 changes: 3 additions & 1 deletion altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@


class DataFrameLike(Protocol):
def __dataframe__(self, *args, **kwargs) -> DfiDataFrame:
def __dataframe__(
self, nan_as_null: bool = False, allow_copy: bool = True
) -> DfiDataFrame:
...


Expand Down

0 comments on commit 217939c

Please sign in to comment.