From 8003971ec9d5e0a5b59b622befefcd5d4823d34c Mon Sep 17 00:00:00 2001 From: Christopher Ariza Date: Sat, 24 Sep 2022 11:11:03 -0700 Subject: [PATCH 1/3] clarify ColumnBuffers.validity dtype type --- protocol/dataframe_protocol.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/protocol/dataframe_protocol.py b/protocol/dataframe_protocol.py index 4d9e6c19..f939d010 100644 --- a/protocol/dataframe_protocol.py +++ b/protocol/dataframe_protocol.py @@ -58,6 +58,9 @@ class DtypeKind(enum.IntEnum): CATEGORICAL = 23 +Dtype = Tuple[DtypeKind, int, str, str] + + class ColumnNullType(enum.IntEnum): """ Integer enum for null type representation. @@ -91,7 +94,7 @@ class ColumnBuffers(TypedDict): # first element is a buffer containing mask values indicating missing data; # second element is the mask value buffer's associated dtype. # None if the null representation is not a bit or byte mask - validity: Optional[Tuple["Buffer", Any]] + validity: Optional[Tuple["Buffer", Dtype]] # first element is a buffer containing the offset values for # variable-size binary data (e.g., variable-length strings); @@ -237,7 +240,7 @@ def offset(self) -> int: @property @abstractmethod - def dtype(self) -> Tuple[DtypeKind, int, str, str]: + def dtype(self) -> Dtype: """ Dtype description as a tuple ``(kind, bit-width, format string, endianness)``. From cb391f705e3101d0f71dccecc4c059a59fb98347 Mon Sep 17 00:00:00 2001 From: Christopher Ariza Date: Sat, 24 Sep 2022 11:19:14 -0700 Subject: [PATCH 2/3] clarify ColumnBuffers.validity dtype type --- protocol/dataframe_protocol.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/dataframe_protocol.py b/protocol/dataframe_protocol.py index f939d010..6dd28004 100644 --- a/protocol/dataframe_protocol.py +++ b/protocol/dataframe_protocol.py @@ -89,7 +89,7 @@ class ColumnNullType(enum.IntEnum): class ColumnBuffers(TypedDict): # first element is a buffer containing the column data; # second element is the data buffer's associated dtype - data: Tuple["Buffer", Any] + data: Tuple["Buffer", Dtype] # first element is a buffer containing mask values indicating missing data; # second element is the mask value buffer's associated dtype. @@ -100,7 +100,7 @@ class ColumnBuffers(TypedDict): # variable-size binary data (e.g., variable-length strings); # second element is the offsets buffer's associated dtype. # None if the data buffer does not have an associated offsets buffer - offsets: Optional[Tuple["Buffer", Any]] + offsets: Optional[Tuple["Buffer", Dtype]] class CategoricalDescription(TypedDict): From f44615616509a7086d8372d451876b73fb5e4800 Mon Sep 17 00:00:00 2001 From: Christopher Ariza Date: Mon, 26 Sep 2022 08:56:33 -0700 Subject: [PATCH 3/3] Update protocol/dataframe_protocol.py Co-authored-by: Matthew Barber --- protocol/dataframe_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/dataframe_protocol.py b/protocol/dataframe_protocol.py index 6dd28004..209072be 100644 --- a/protocol/dataframe_protocol.py +++ b/protocol/dataframe_protocol.py @@ -58,7 +58,7 @@ class DtypeKind(enum.IntEnum): CATEGORICAL = 23 -Dtype = Tuple[DtypeKind, int, str, str] +Dtype = Tuple[DtypeKind, int, str, str] # see Column.dtype class ColumnNullType(enum.IntEnum):