From 720022570e5490da9daed27f1ff77156de9c7036 Mon Sep 17 00:00:00 2001 From: Benjamin Rahn <235302+brahn@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:27:28 -0700 Subject: [PATCH 1/4] add typehint Any to Undefined object --- altair/utils/schemapi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index 2dfdc8ee1..bba65ab92 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -4,6 +4,7 @@ import contextlib import inspect import json +from typing import Any import jsonschema import numpy as np @@ -137,7 +138,7 @@ def __repr__(self): return "Undefined" -Undefined = UndefinedType() +Undefined: Any = UndefinedType() class SchemaBase(object): From c4248a953c8518efb3cf5bef8d9755bd0fc7391e Mon Sep 17 00:00:00 2001 From: Benjamin Rahn <235302+brahn@users.noreply.github.com> Date: Tue, 20 Sep 2022 07:44:51 -0700 Subject: [PATCH 2/4] use 'UndefinedLike = Any' as the type hint --- altair/utils/schemapi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index bba65ab92..c6d37c096 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -138,7 +138,14 @@ def __repr__(self): return "Undefined" -Undefined: Any = UndefinedType() +# In the future Altair may implement a more complete set of type hints. +# But for now, we'll add an annotation to indicate that the type checker +# should permit any value passed to a function argument whose default +# value is Undefined. +UndefinedLike = Any + + +Undefined: UndefinedLike = UndefinedType() class SchemaBase(object): From 60c0fce6896781e41395f16b71c1bed69e4f38d7 Mon Sep 17 00:00:00 2001 From: Benjamin Rahn <235302+brahn@users.noreply.github.com> Date: Tue, 20 Sep 2022 22:18:14 -0700 Subject: [PATCH 3/4] apply changes to tools/schemapi/schemapi.py, not the generated file --- altair/utils/schemapi.py | 10 +--------- tools/schemapi/schemapi.py | 10 +++++++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index c6d37c096..2dfdc8ee1 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -4,7 +4,6 @@ import contextlib import inspect import json -from typing import Any import jsonschema import numpy as np @@ -138,14 +137,7 @@ def __repr__(self): return "Undefined" -# In the future Altair may implement a more complete set of type hints. -# But for now, we'll add an annotation to indicate that the type checker -# should permit any value passed to a function argument whose default -# value is Undefined. -UndefinedLike = Any - - -Undefined: UndefinedLike = UndefinedType() +Undefined = UndefinedType() class SchemaBase(object): diff --git a/tools/schemapi/schemapi.py b/tools/schemapi/schemapi.py index 3ca87b991..e078f7881 100644 --- a/tools/schemapi/schemapi.py +++ b/tools/schemapi/schemapi.py @@ -2,6 +2,7 @@ import contextlib import inspect import json +from typing import Any import jsonschema import numpy as np @@ -135,7 +136,14 @@ def __repr__(self): return "Undefined" -Undefined = UndefinedType() +# In the future Altair may implement a more complete set of type hints. +# But for now, we'll add an annotation to indicate that the type checker +# should permit any value passed to a function argument whose default +# value is Undefined. +UndefinedLike = Any + + +Undefined: UndefinedLike = UndefinedType() class SchemaBase(object): From b5dcd6841765809a87e064e0d59faee724f28b05 Mon Sep 17 00:00:00 2001 From: Benjamin Rahn <235302+brahn@users.noreply.github.com> Date: Tue, 20 Sep 2022 22:18:47 -0700 Subject: [PATCH 4/4] run generate_schema_wrapper.py --- altair/utils/schemapi.py | 10 +++++++++- doc/user_guide/API.rst | 11 +++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index 2dfdc8ee1..c6d37c096 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -4,6 +4,7 @@ import contextlib import inspect import json +from typing import Any import jsonschema import numpy as np @@ -137,7 +138,14 @@ def __repr__(self): return "Undefined" -Undefined = UndefinedType() +# In the future Altair may implement a more complete set of type hints. +# But for now, we'll add an annotation to indicate that the type checker +# should permit any value passed to a function argument whose default +# value is Undefined. +UndefinedLike = Any + + +Undefined: UndefinedLike = UndefinedType() class SchemaBase(object): diff --git a/doc/user_guide/API.rst b/doc/user_guide/API.rst index fcddd7f93..573a1f697 100644 --- a/doc/user_guide/API.rst +++ b/doc/user_guide/API.rst @@ -15,7 +15,6 @@ Top-Level Objects .. autosummary:: :toctree: generated/toplevel/ - :caption: Top-Level Objects :nosignatures: Chart @@ -33,7 +32,6 @@ Encoding Channels .. autosummary:: :toctree: generated/channels/ - :caption: Encoding Channels :nosignatures: Angle @@ -142,7 +140,6 @@ API Functions .. autosummary:: :toctree: generated/api/ - :caption: API Functions :nosignatures: binding @@ -150,16 +147,18 @@ API Functions binding_radio binding_range binding_select + check_fields_and_encodings concat condition graticule hconcat layer - parameter + param repeat selection selection_interval selection_multi + selection_point selection_single sequence sphere @@ -173,7 +172,6 @@ Low-Level Schema Wrappers .. autosummary:: :toctree: generated/core/ - :caption: Low-Level Schema Wrappers :nosignatures: Aggregate @@ -286,6 +284,7 @@ Low-Level Schema Wrappers Day DensityTransform DerivedStream + Dict DictInlineDataset DictSelectionInit DictSelectionInitInterval @@ -332,6 +331,7 @@ Low-Level Schema Wrappers FieldOrDatumDefWithConditionStringDatumDefText FieldOrDatumDefWithConditionStringFieldDefText FieldOrDatumDefWithConditionStringFieldDefstring + FieldRange FieldRangePredicate FieldValidPredicate FilterTransform @@ -414,7 +414,6 @@ Low-Level Schema Wrappers Orientation OverlayMarkDef Padding - Parameter ParameterExtent ParameterName ParameterPredicate