From bc74191f7d0fbfabd8b5d8f761b00ab1bdd83ed5 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli Date: Thu, 23 Nov 2023 11:05:50 +0000 Subject: [PATCH] add scalar.__scalar_namespace__ (#334) --- .../dataframe_api/scalar_object.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/scalar_object.py b/spec/API_specification/dataframe_api/scalar_object.py index 078cf2a4..55832182 100644 --- a/spec/API_specification/dataframe_api/scalar_object.py +++ b/spec/API_specification/dataframe_api/scalar_object.py @@ -5,7 +5,7 @@ if TYPE_CHECKING: from typing_extensions import Self - from dataframe_api.typing import AnyScalar, DType + from dataframe_api.typing import AnyScalar, DType, Namespace __all__ = ["Scalar"] @@ -26,6 +26,20 @@ class Scalar(Protocol): (even if it is backed by a null value). """ + def __scalar_namespace__(self) -> Namespace: + """Return an object that has all the Dataframe Standard API functions on it. + + Returns + ------- + namespace + An object representing the dataframe API namespace. It should have + every top-level function defined in the specification as an + attribute. It may contain other public names as well, but it is + recommended to only include those names that are part of the + specification. + """ + ... + def __lt__(self, other: AnyScalar) -> Scalar: ...