From 7b324d69b7248921b4b6edd6ce3a3d68da4fb3b0 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:14:23 +0100 Subject: [PATCH 001/139] feat: Adds `SchemaInfo.is_format` --- tools/schemapi/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 17326a8a1..450d009c6 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -654,6 +654,18 @@ def is_union_enum(self) -> bool: """ return self.is_union() and all(el.is_enum() for el in self.anyOf) + def is_format(self) -> bool: + """ + Represents a string format specifier. + + These do not currently produce useful classes (e.g. ``HexColor``, ``URI``). + + See Also + -------- + [python-jsonschema](https://python-jsonschema.readthedocs.io/en/latest/faq/#my-schema-specifies-format-validation-why-do-invalid-instances-seem-valid) + """ + return (self.schema.keys() == {"format", "type"}) and self.type == "string" + class RSTRenderer(_RSTRenderer): def __init__(self) -> None: From 03256679564f2b9e43926d43abcbc927d8fe1a4f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:17:13 +0100 Subject: [PATCH 002/139] feat(typing): Annotate `SchemaProperties` --- tools/schemapi/utils.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 450d009c6..350f76f05 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -27,6 +27,7 @@ from tools.schemapi.schemapi import _resolve_references as resolve_references if TYPE_CHECKING: + from _collections_abc import dict_keys from pathlib import Path from typing_extensions import LiteralString @@ -298,12 +299,12 @@ class SchemaProperties: def __init__( self, properties: dict[str, Any], - schema: dict, - rootschema: dict | None = None, + schema: dict[str, Any], + rootschema: dict[str, Any] | None = None, ) -> None: - self._properties = properties - self._schema = schema - self._rootschema = rootschema or schema + self._properties: dict[str, Any] = properties + self._schema: dict[str, Any] = schema + self._rootschema: dict[str, Any] = rootschema or schema def __bool__(self) -> bool: return bool(self._properties) @@ -317,22 +318,22 @@ def __getattr__(self, attr): except KeyError: return super().__getattr__(attr) - def __getitem__(self, attr): + def __getitem__(self, attr) -> SchemaInfo: dct = self._properties[attr] if "definitions" in self._schema and "definitions" not in dct: dct = dict(definitions=self._schema["definitions"], **dct) return SchemaInfo(dct, self._rootschema) - def __iter__(self): + def __iter__(self) -> Iterator[str]: return iter(self._properties) - def items(self): + def items(self) -> Iterator[tuple[str, SchemaInfo]]: return ((key, self[key]) for key in self) - def keys(self): + def keys(self) -> dict_keys[str, Any]: return self._properties.keys() - def values(self): + def values(self) -> Iterator[SchemaInfo]: return (self[key] for key in self) From 832fd722626ca482f5bc295a0272383cb74bf1ca Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:09:53 +0100 Subject: [PATCH 003/139] perf: Use more appropriate data structures in `codegen` Mostly avoiding use `list` unless properties of it are needed. Also using `set` comprehensions --- tools/schemapi/codegen.py | 45 ++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 0533964b4..3a4e72906 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -5,7 +5,8 @@ import re import textwrap from dataclasses import dataclass -from typing import Final +from itertools import chain +from typing import Final, Iterator from .utils import ( SchemaInfo, @@ -13,6 +14,7 @@ indent_docstring, is_valid_identifier, jsonschema_to_python_types, + spell_literal, ) @@ -47,12 +49,12 @@ def get_args(info: SchemaInfo) -> ArgInfo: if info.is_allOf(): # recursively call function on all children - arginfo = [get_args(child) for child in info.allOf] + arginfo: list[ArgInfo] = [get_args(child) for child in info.allOf] nonkeyword = all(args.nonkeyword for args in arginfo) - required = set.union(set(), *(args.required for args in arginfo)) - kwds = set.union(set(), *(args.kwds for args in arginfo)) + required = {args.required for args in arginfo} + kwds = {args.kwds for args in arginfo} kwds -= required - invalid_kwds = set.union(set(), *(args.invalid_kwds for args in arginfo)) + invalid_kwds = {args.invalid_kwds for args in arginfo} additional = all(args.additional for args in arginfo) elif info.is_empty() or info.is_compound(): nonkeyword = True @@ -152,19 +154,16 @@ def __init__( self.haspropsetters = haspropsetters self.kwargs = kwargs - def subclasses(self) -> list[str]: - """Return a list of subclass names, if any.""" - info = SchemaInfo(self.schema, self.rootschema) - return [child.refname for child in info.anyOf if child.is_reference()] + def subclasses(self) -> Iterator[str]: + """Return an Iterator over subclass names, if any.""" + for child in SchemaInfo(self.schema, self.rootschema).anyOf: + if child.is_reference(): + yield child.refname def schema_class(self) -> str: """Generate code for a schema class.""" - rootschema: dict = ( - self.rootschema if self.rootschema is not None else self.schema - ) - schemarepr: object = ( - self.schemarepr if self.schemarepr is not None else self.schema - ) + rootschema: dict = self.rootschema or self.schema + schemarepr: object = self.schemarepr or self.schema rootschemarepr = self.rootschemarepr if rootschemarepr is None: if rootschema is self.schema: @@ -255,10 +254,12 @@ def init_args( args: list[str] = ["self"] super_args: list[str] = [] - self.init_kwds = sorted(arg_info.kwds) + self.init_kwds: list[str] = sorted(arg_info.kwds) + init_required: list[str] = sorted(arg_info.required) + _nodefault: list[str] = sorted(nodefault) if nodefault: - args.extend(sorted(nodefault)) + args.extend(_nodefault) elif arg_info.nonkeyword: args.append("*args") super_args.append("*args") @@ -277,10 +278,7 @@ def init_args( for p in sorted(arg_info.required) + sorted(arg_info.kwds) ) super_args.extend( - f"{p}={p}" - for p in sorted(nodefault) - + sorted(arg_info.required) - + sorted(arg_info.kwds) + f"{p}={p}" for p in chain(_nodefault, init_required, self.init_kwds) ) if arg_info.additional: @@ -326,8 +324,7 @@ def get_args(self, si: SchemaInfo) -> list[str]: elif si.is_enum(): # If it's an enum, we can type hint it as a Literal which tells # a type checker that only the values in enum are acceptable - enum_values = [f'"{v}"' for v in si.enum] - py_type = f"Literal[{', '.join(enum_values)}]" + py_type = spell_literal(si.enum) contents.append(f"_: {py_type}") contents.append("**kwds") @@ -372,6 +369,6 @@ def method_code(self, indent: int = 0) -> str | None: if not self.haspropsetters: return None args = self.init_kwds - type_hints = [hint for a in args for hint in self.setter_hint(a, indent)] + type_hints = (hint for a in args for hint in self.setter_hint(a, indent)) return ("\n" + indent * " ").join(type_hints) From 549f42c11a96e0321fa306cc6a79d0b4e905fe40 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:16:15 +0100 Subject: [PATCH 004/139] refactor: Reduce length and complexity of `get_python_type_representation` Provides all existing functionality. Adds `use_concrete`, for upcoming `TypedDict` changes --- tools/schemapi/utils.py | 247 +++++++++++++++++++++++++--------------- 1 file changed, 158 insertions(+), 89 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 350f76f05..f3320ceb5 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -29,10 +29,12 @@ if TYPE_CHECKING: from _collections_abc import dict_keys from pathlib import Path - from typing_extensions import LiteralString + from typing_extensions import LiteralString, TypeAlias from mistune import BlockState +TargetType: TypeAlias = Literal["annotation", "doc"] + EXCLUDE_KEYS: Final = ("definitions", "title", "description", "$schema", "id") jsonschema_to_python_types = { @@ -154,13 +156,15 @@ def generate_aliases(self) -> Iterator[str]: for name, statement in self._aliases.items(): yield f"{name}: TypeAlias = {statement}" - def is_cached(self, tp: str, /) -> bool: + def is_cached(self, tp: str, /, *, include_concrete: bool = False) -> bool: """ Applies to both docstring and type hints. Currently used as a sort key, to place literals/aliases last. """ - return tp in self._literals_invert or tp in self._literals + return (tp in self._literals_invert or tp in self._literals) or ( + include_concrete and self.fmt.format(tp) in self._literals + ) def write_module( self, fp: Path, *extra_all: str, header: LiteralString, extra: LiteralString @@ -376,68 +380,61 @@ def title(self) -> str: @overload def get_python_type_representation( self, - for_type_hints: bool = ..., - return_as_str: Literal[True] = ..., - additional_type_hints: list[str] | None = ..., + *, + as_str: Literal[True] = ..., + use_concrete: bool = False, + use_undefined: bool = False, + target: TargetType = "doc", ) -> str: ... @overload def get_python_type_representation( self, - for_type_hints: bool = ..., - return_as_str: Literal[False] = ..., - additional_type_hints: list[str] | None = ..., + *, + as_str: Literal[False], + use_concrete: bool = False, + use_undefined: bool = False, + target: TargetType = "doc", ) -> list[str]: ... def get_python_type_representation( self, - for_type_hints: bool = False, - return_as_str: bool = True, - additional_type_hints: list[str] | None = None, + *, + as_str: bool = True, + use_concrete: bool = False, + use_undefined: bool = False, + target: TargetType = "doc", ) -> str | list[str]: - type_representations: list[str] = [] + tps: set[str] = set() """ All types which can be used for the current `SchemaInfo`. Including `altair` classes, standard `python` types, etc. """ + for_type_hints = target == "annotation" if self.title: - if for_type_hints: - # To keep type hints simple, we only use the SchemaBase class - # as the type hint for all classes which inherit from it. - class_names = ["SchemaBase"] - if self.title in {"ExprRef", "ParameterExtent"}: - class_names.append("Parameter") - # In these cases, a value parameter is also always accepted. - # It would be quite complex to further differentiate - # between a value and a selection parameter based on - # the type system (one could - # try to check for the type of the Parameter.param attribute - # but then we would need to write some overload signatures for - # api.param). - - type_representations.extend(class_names) - else: - # use RST syntax for generated sphinx docs - type_representations.append(rst_syntax_for_class(self.title)) + if target == "annotation": + tps.update(types_from_title(self, use_concrete=use_concrete)) + elif target == "doc": + tps.add(rst_syntax_for_class(self.title)) if self.is_empty(): - type_representations.append("Any") + tps.add("Any") elif self.is_enum(): tp_str = spell_literal(self.enum) if for_type_hints: tp_str = TypeAliasTracer.add_literal(self, tp_str, replace=True) - type_representations.append(tp_str) + tps.add(tp_str) elif for_type_hints and self.is_union_enum(): it = chain.from_iterable(el.enum for el in self.anyOf) tp_str = TypeAliasTracer.add_literal(self, spell_literal(it), replace=True) - type_representations.append(tp_str) + tps.add(tp_str) elif self.is_anyOf(): it = ( s.get_python_type_representation( - for_type_hints=for_type_hints, return_as_str=False + target=target, as_str=False, use_concrete=use_concrete ) for s in self.anyOf ) - type_representations.extend(it) + tps.update(chain.from_iterable(it)) elif isinstance(self.type, list): options = [] subschema = SchemaInfo(dict(**self.schema)) @@ -446,68 +443,28 @@ def get_python_type_representation( # We always use title if possible for nested objects options.append( subschema.get_python_type_representation( - for_type_hints=for_type_hints + target=target, use_concrete=use_concrete ) ) - type_representations.extend(options) - elif self.is_object(): - type_representations.append("dict") + tps.update(options) + elif self.is_object() and not use_concrete: + tps.add("dict") elif self.is_array(): - # A list is invariant in its type parameter. This means that e.g. - # List[str] is not a subtype of List[Union[core.FieldName, str]] - # and hence we would need to explicitly write out the combinations, - # so in this case: - # List[core.FieldName], List[str], List[core.FieldName, str] - # However, this can easily explode to too many combinations. - # Furthermore, we would also need to add additional entries - # for e.g. int wherever a float is accepted which would lead to very - # long code. - # As suggested in the mypy docs, - # https://mypy.readthedocs.io/en/stable/common_issues.html#variance, - # we revert to using Sequence which works as well for lists and also - # includes tuples which are also supported by the SchemaBase.to_dict - # method. However, it is not entirely accurate as some sequences - # such as e.g. a range are not supported by SchemaBase.to_dict but - # this tradeoff seems worth it. - s = self.child(self.items).get_python_type_representation( - for_type_hints=for_type_hints + tps.add( + spell_nested_sequence(self, target=target, use_concrete=use_concrete) ) - type_representations.append(f"Sequence[{s}]") elif self.type in jsonschema_to_python_types: - type_representations.append(jsonschema_to_python_types[self.type]) + tps.add(jsonschema_to_python_types[self.type]) else: msg = "No Python type representation available for this schema" raise ValueError(msg) - # Shorter types are usually the more relevant ones, e.g. `str` instead - # of `SchemaBase`. Output order from set is non-deterministic -> If - # types have same length names, order would be non-deterministic as it is - # returned from sort. Hence, we sort as well by type name as a tie-breaker, - # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts - # for more infos. - # Using lower as we don't want to prefer uppercase such as "None" over - it = sorted(set(flatten(type_representations)), key=str.lower) # Tertiary sort - it = sorted(it, key=len) # Secondary sort - type_representations = sorted(it, key=TypeAliasTracer.is_cached) # Primary sort - if additional_type_hints: - type_representations.extend(additional_type_hints) - - if return_as_str: - type_representations_str = ", ".join(type_representations) - # If it's not for_type_hints but instead for the docstrings, we don't want - # to include Union as it just clutters the docstrings. - if len(type_representations) > 1 and for_type_hints: - # Use parameterised `TypeAlias` instead of exposing `UndefinedType` - # `Union` is collapsed by `ruff` later - if type_representations_str.endswith(", UndefinedType"): - s = type_representations_str.replace(", UndefinedType", "") - s = f"Optional[Union[{s}]]" - else: - s = f"Union[{type_representations_str}]" - return s - return type_representations_str - else: - return type_representations + type_reprs = sort_type_reprs(tps) + return ( + collapse_type_repr(type_reprs, target=target, use_undefined=use_undefined) + if as_str + else type_reprs + ) @property def properties(self) -> SchemaProperties: @@ -805,6 +762,118 @@ def flatten(container: Iterable) -> Iterable: yield i +def collapse_type_repr( + tps: Iterable[str], + /, + *, + target: TargetType, + use_undefined: bool = False, +) -> str: + """ + Returns collected types as `str`. + + Parameters + ---------- + tps + Unique, sorted, `type_representations` + target + Destination for the type. + `'doc'` skips `Union`, `Optional` parts. + use_undefined + Wrap the result in `altair.typing.Optional`. + Avoids exposing `UndefinedType`. + """ + tp_str = ", ".join(tps) + if target == "doc": + return tp_str + elif target == "annotation": + if "," in tp_str: + tp_str = f"Union[{tp_str}]" + return f"Optional[{tp_str}]" if use_undefined else tp_str + else: + msg = f"Unexpected {target=}.\nUse one of {['annotation', 'doc']!r}" + raise TypeError(msg) + + +def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: + tp_param: set[str] = {"ExprRef", "ParameterExtent"} + # In these cases, a value parameter is also always accepted. + # It would be quite complex to further differentiate + # between a value and a selection parameter based on + # the type system (one could + # try to check for the type of the Parameter.param attribute + # but then we would need to write some overload signatures for + # api.param). + title: str = info.title + tps: set[str] = set() + if not use_concrete: + tps.add("SchemaBase") + # To keep type hints simple, we only use the SchemaBase class + # as the type hint for all classes which inherit from it. + if title in tp_param: + tps.add("Parameter") + elif ( + (title not in tp_param) + and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) + and not info.is_union() + and not info.is_format() + ): + tps.add(title) + return tps + + +def spell_nested_sequence( + info: SchemaInfo, *, target: TargetType, use_concrete: bool +) -> str: + """ + Summary. + + Notes + ----- + A list is invariant in its type parameter. + + This means that ``list[str]`` is not a subtype of ``list[FieldName | str]`` + and hence we would need to explicitly write out the combinations, + so in this case: + + Accepted: list[FieldName] | list[str] | list[FieldName | str] + + However, this can easily explode to too many combinations. + + Furthermore, we would also need to add additional entries + for e.g. ``int`` wherever a ``float`` is accepted which would lead to very + long code. + + As suggested in the `mypy docs`_ we revert to using ``Sequence``. + + This includes ``list``, ``tuple`` and many others supported by ``SchemaBase.to_dict``. + + The original example becomes: + + Accepted: Sequence[FieldName | str] + + .. _mypy docs: + https://mypy.readthedocs.io/en/stable/common_issues.html#variance + + """ + child: SchemaInfo = info.child(info.items) + s = child.get_python_type_representation(target=target, use_concrete=use_concrete) + return f"Sequence[{s}]" + + +def sort_type_reprs(tps: Iterable[str], /) -> list[str]: + # Shorter types are usually the more relevant ones, e.g. `str` instead + # of `SchemaBase`. Output order from set is non-deterministic -> If + # types have same length names, order would be non-deterministic as it is + # returned from sort. Hence, we sort as well by type name as a tie-breaker, + # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts + # for more infos. + # Using lower as we don't want to prefer uppercase such as "None" over + it = sorted(tps, key=str.lower) # Tertiary sort + it = sorted(it, key=len) # Secondary sort + return sorted(it, key=TypeAliasTracer.is_cached) # Primary sort + + def spell_literal(it: Iterable[str], /) -> str: s = ", ".join(f"{s!r}" for s in it) return f"Literal[{s}]" From 1b6e00852376a4ab72b607bbbdf0492d3725a9e2 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:17:52 +0100 Subject: [PATCH 005/139] refactor: Update `codegen` to use new `get_python_type_representation` --- tools/schemapi/codegen.py | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 3a4e72906..64714c811 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -240,10 +240,7 @@ def init_code(self, indent: int = 0) -> str: initfunc = ("\n" + indent * " ").join(initfunc.splitlines()) return initfunc - def init_args( - self, additional_types: list[str] | None = None - ) -> tuple[list[str], list[str]]: - additional_types = additional_types or [] + def init_args(self) -> tuple[list[str], list[str]]: info = self.info arg_info = self.arg_info @@ -264,19 +261,11 @@ def init_args( args.append("*args") super_args.append("*args") - args.extend( - f"{p}: Optional[Union[" - + ", ".join( - [ - *additional_types, - *info.properties[p].get_python_type_representation( - for_type_hints=True, return_as_str=False - ), - ] - ) - + "]] = Undefined" - for p in sorted(arg_info.required) + sorted(arg_info.kwds) + it = ( + f"{p}: {info.properties[p].get_python_type_representation(target='annotation', use_undefined=True)} = Undefined" + for p in chain(init_required, self.init_kwds) ) + args.extend(it) super_args.extend( f"{p}={p}" for p in chain(_nodefault, init_required, self.init_kwds) ) @@ -298,14 +287,8 @@ def get_args(self, si: SchemaInfo) -> list[str]: if prop_infos: contents.extend( - [ - f"{p}: " - + info.get_python_type_representation( - for_type_hints=True, additional_type_hints=["UndefinedType"] - ) - + " = Undefined" - for p, info in prop_infos.items() - ] + f"{p}: {info.get_python_type_representation(target='annotation', use_undefined=True)} = Undefined" + for p, info in prop_infos.items() ) elif si.type: py_type = jsonschema_to_python_types[si.type] From 148c913e0e1065c58717fb9fa2cf7c22319d46a9 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:25:55 +0100 Subject: [PATCH 006/139] refactor(perf): Rewrite `generate_vegalite_mark_mixin` - Adapted to new `get_python_type_representation` - Avoid nested listcomp - Avoid repeated sorting - Moved the generic parts to `_generate_sig_args` --- tools/generate_schema_wrapper.py | 94 +++++++++++++++++--------------- 1 file changed, 51 insertions(+), 43 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index cdbfb0576..73547bfa3 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -11,7 +11,7 @@ from dataclasses import dataclass from itertools import chain from pathlib import Path -from typing import Final, Iterable, Iterator, Literal +from typing import Any, Final, Iterable, Iterator, Literal from urllib import request import vl_convert as vlc @@ -19,6 +19,7 @@ sys.path.insert(0, str(Path.cwd())) from tools.schemapi import CodeSnippet, SchemaInfo, codegen from tools.schemapi.utils import ( + SchemaProperties, TypeAliasTracer, get_valid_identifier, indent_docstring, @@ -180,11 +181,17 @@ def to_dict( ) """ +MARK_MIXIN: Final = ''' +class MarkMethodMixin: + """A mixin class that defines mark methods""" + +{methods} +''' + MARK_METHOD: Final = ''' -def mark_{mark}({def_arglist}) -> Self: - """Set the chart's mark to '{mark}' (see :class:`{mark_def}`) - """ - kwds = dict({dict_arglist}) +def mark_{mark}({method_args}) -> Self: + """Set the chart's mark to '{mark}' (see :class:`{mark_def}`).""" + kwds = dict({dict_args}) copy = self.copy(deep=False) # type: ignore[attr-defined] if any(val is not Undefined for val in kwds.values()): copy.mark = core.{mark_def}(type="{mark}", **kwds) @@ -707,60 +714,61 @@ def generate_vegalite_mark_mixin( with schemafile.open(encoding="utf8") as f: schema = json.load(f) - class_name = "MarkMethodMixin" - imports = [ "from typing import Any, Sequence, List, Literal, Union", "", - "from altair.utils.schemapi import Undefined, UndefinedType", + "from altair.utils.schemapi import Undefined", "from . import core", ] - code = [ - f"class {class_name}:", - ' """A mixin class that defines mark methods"""', - ] + code = [] for mark_enum, mark_def in markdefs.items(): - if "enum" in schema["definitions"][mark_enum]: - marks = schema["definitions"][mark_enum]["enum"] - else: - marks = [schema["definitions"][mark_enum]["const"]] + _def = schema["definitions"][mark_enum] + marks: list[Any] = _def["enum"] if "enum" in _def else [_def["const"]] info = SchemaInfo({"$ref": f"#/definitions/{mark_def}"}, rootschema=schema) # adapted from SchemaInfo.init_code - arg_info = codegen.get_args(info) - arg_info.required -= {"type"} - arg_info.kwds -= {"type"} - - def_args = ["self"] + [ - f"{p}: " - + info.properties[p].get_python_type_representation( - for_type_hints=True, - additional_type_hints=["UndefinedType"], - ) - + " = Undefined" - for p in (sorted(arg_info.required) + sorted(arg_info.kwds)) - ] - dict_args = [ - f"{p}={p}" for p in (sorted(arg_info.required) + sorted(arg_info.kwds)) - ] - - if arg_info.additional or arg_info.invalid_kwds: - def_args.append("**kwds") - dict_args.append("**kwds") + mark_args = generate_mark_args(info) for mark in marks: # TODO: only include args relevant to given type? - mark_method = MARK_METHOD.format( - mark=mark, - mark_def=mark_def, - def_arglist=", ".join(def_args), - dict_arglist=", ".join(dict_args), - ) + mark_method = MARK_METHOD.format(mark=mark, mark_def=mark_def, **mark_args) code.append("\n ".join(mark_method.splitlines())) - return imports, "\n".join(code) + return imports, MARK_MIXIN.format(methods="\n".join(code)) + + +def _generate_sig_args( + args: Iterable[str], + props: SchemaProperties, + *, + kind: Literal["method", "typed_dict"] = "method", +) -> Iterator[str]: + """Lazily build a typed argument list.""" + if kind == "method": + yield "self" + for p in args: + yield f"{p}: {props[p].get_python_type_representation(target="annotation", use_undefined=True)} = Undefined" + yield "**kwds" + elif kind == "typed_dict": + for p in args: + yield f"{p}: {props[p].get_python_type_representation(target="annotation", use_concrete=True)}" + else: + raise NotImplementedError + + +def generate_mark_args( + info: SchemaInfo, +) -> dict[Literal["method_args", "dict_args"], str]: + arg_info = codegen.get_args(info) + args = sorted((arg_info.required | arg_info.kwds) - {"type"}) + dict_args = (f"{p}={p}" for p in args) + return { + "method_args": ", ".join(_generate_sig_args(args, info.properties)), + "dict_args": ", ".join(chain(dict_args, ("**kwds",))), + } + def generate_vegalite_config_mixin(schemafile: Path) -> tuple[list[str], str]: From de66450935fee6b024db72960b882a784d790e17 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:27:03 +0100 Subject: [PATCH 007/139] perf: Iterate over `values()` when `keys()` are not needed --- tools/generate_schema_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 73547bfa3..586c87a82 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -400,7 +400,7 @@ def _add_shorthand_property_to_field_encodings(schema: dict) -> dict: encoding = SchemaInfo(schema["definitions"][encoding_def], rootschema=schema) - for _, propschema in encoding.properties.items(): + for propschema in encoding.properties.values(): def_dict = get_field_datum_value_defs(propschema, schema) field_ref = def_dict.get("field") From 8fa63de58c0e928def500526f4611854b7accbd8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:09:05 +0100 Subject: [PATCH 008/139] refactor: reorder `get_python_type_representation` kwargs --- tools/schemapi/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index f3320ceb5..cd44d79be 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -382,26 +382,26 @@ def get_python_type_representation( self, *, as_str: Literal[True] = ..., + target: TargetType = "doc", use_concrete: bool = False, use_undefined: bool = False, - target: TargetType = "doc", ) -> str: ... @overload def get_python_type_representation( self, *, as_str: Literal[False], + target: TargetType = "doc", use_concrete: bool = False, use_undefined: bool = False, - target: TargetType = "doc", ) -> list[str]: ... def get_python_type_representation( self, *, as_str: bool = True, + target: TargetType = "doc", use_concrete: bool = False, use_undefined: bool = False, - target: TargetType = "doc", ) -> str | list[str]: tps: set[str] = set() """ From ba082561904127c77adf5236ccb3aac1a097dcf9 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:13:36 +0100 Subject: [PATCH 009/139] feat(typing): Add missing annotations --- tools/schemapi/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index cd44d79be..45e7af97e 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -349,9 +349,9 @@ def __init__( ) -> None: if not rootschema: rootschema = schema - self.raw_schema = schema - self.rootschema = rootschema - self.schema = resolve_references(schema, rootschema) + self.raw_schema: dict[str, Any] = schema + self.rootschema: dict[str, Any] = rootschema + self.schema: dict[str, Any] = resolve_references(schema, rootschema) def child(self, schema: dict) -> SchemaInfo: return self.__class__(schema, rootschema=self.rootschema) From 5f357055db8ce5ac674feb30e35733623d039d7d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:19:17 +0100 Subject: [PATCH 010/139] refactor: Rename `get_python_type_representation` -> `to_type_repr` Will be adding a docstring with more detail --- tools/generate_schema_wrapper.py | 4 ++-- tools/schemapi/codegen.py | 6 +++--- tools/schemapi/utils.py | 16 ++++++---------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 586c87a82..8b44d223b 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -749,11 +749,11 @@ def _generate_sig_args( if kind == "method": yield "self" for p in args: - yield f"{p}: {props[p].get_python_type_representation(target="annotation", use_undefined=True)} = Undefined" + yield f"{p}: {props[p].to_type_repr(target="annotation", use_undefined=True)} = Undefined" yield "**kwds" elif kind == "typed_dict": for p in args: - yield f"{p}: {props[p].get_python_type_representation(target="annotation", use_concrete=True)}" + yield f"{p}: {props[p].to_type_repr(target="annotation", use_concrete=True)}" else: raise NotImplementedError diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 64714c811..c985fdf71 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -222,7 +222,7 @@ def docstring(self, indent: int = 0) -> str: ): propinfo = info.properties[prop] doc += [ - f"{prop} : {propinfo.get_python_type_representation()}", + f"{prop} : {propinfo.to_type_repr()}", f" {self._process_description(propinfo.deep_description)}", ] return indent_docstring(doc, indent_level=indent, width=100, lstrip=True) @@ -262,7 +262,7 @@ def init_args(self) -> tuple[list[str], list[str]]: super_args.append("*args") it = ( - f"{p}: {info.properties[p].get_python_type_representation(target='annotation', use_undefined=True)} = Undefined" + f"{p}: {info.properties[p].to_type_repr(target='annotation', use_undefined=True)} = Undefined" for p in chain(init_required, self.init_kwds) ) args.extend(it) @@ -287,7 +287,7 @@ def get_args(self, si: SchemaInfo) -> list[str]: if prop_infos: contents.extend( - f"{p}: {info.get_python_type_representation(target='annotation', use_undefined=True)} = Undefined" + f"{p}: {info.to_type_repr(target='annotation', use_undefined=True)} = Undefined" for p, info in prop_infos.items() ) elif si.type: diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 45e7af97e..87108926b 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -378,7 +378,7 @@ def title(self) -> str: return "" @overload - def get_python_type_representation( + def to_type_repr( self, *, as_str: Literal[True] = ..., @@ -387,7 +387,7 @@ def get_python_type_representation( use_undefined: bool = False, ) -> str: ... @overload - def get_python_type_representation( + def to_type_repr( self, *, as_str: Literal[False], @@ -395,7 +395,7 @@ def get_python_type_representation( use_concrete: bool = False, use_undefined: bool = False, ) -> list[str]: ... - def get_python_type_representation( + def to_type_repr( self, *, as_str: bool = True, @@ -429,9 +429,7 @@ def get_python_type_representation( tps.add(tp_str) elif self.is_anyOf(): it = ( - s.get_python_type_representation( - target=target, as_str=False, use_concrete=use_concrete - ) + s.to_type_repr(target=target, as_str=False, use_concrete=use_concrete) for s in self.anyOf ) tps.update(chain.from_iterable(it)) @@ -442,9 +440,7 @@ def get_python_type_representation( subschema.schema["type"] = typ_ # We always use title if possible for nested objects options.append( - subschema.get_python_type_representation( - target=target, use_concrete=use_concrete - ) + subschema.to_type_repr(target=target, use_concrete=use_concrete) ) tps.update(options) elif self.is_object() and not use_concrete: @@ -857,7 +853,7 @@ def spell_nested_sequence( """ child: SchemaInfo = info.child(info.items) - s = child.get_python_type_representation(target=target, use_concrete=use_concrete) + s = child.to_type_repr(target=target, use_concrete=use_concrete) return f"Sequence[{s}]" From cb8aefc7c591f447ecbfc519c4cfca5c11ed8a2a Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:58:04 +0100 Subject: [PATCH 011/139] refactor: Remove redundant `is_object` branch Handled by `jsonschema_to_python_types` --- tools/schemapi/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 87108926b..3492b83bd 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -408,7 +408,7 @@ def to_type_repr( All types which can be used for the current `SchemaInfo`. Including `altair` classes, standard `python` types, etc. """ - for_type_hints = target == "annotation" + for_type_hints: bool = target == "annotation" if self.title: if target == "annotation": @@ -443,8 +443,6 @@ def to_type_repr( subschema.to_type_repr(target=target, use_concrete=use_concrete) ) tps.update(options) - elif self.is_object() and not use_concrete: - tps.add("dict") elif self.is_array(): tps.add( spell_nested_sequence(self, target=target, use_concrete=use_concrete) From 193e493c1ebb0bdd56a84f62664151bc5edcac22 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 20:59:12 +0100 Subject: [PATCH 012/139] fix: Exclude array stub classes --- tools/schemapi/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 3492b83bd..5a403b42d 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -811,6 +811,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) and not info.is_union() and not info.is_format() + and not info.is_array() ): tps.add(title) return tps From b2db86c2c763fca520189bbb6afa02bb36004578 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:00:33 +0100 Subject: [PATCH 013/139] feat(typing): Temp solution for `dict` in `TypedDict` See comments --- tools/schemapi/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 5a403b42d..3c590bd0c 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -448,11 +448,18 @@ def to_type_repr( spell_nested_sequence(self, target=target, use_concrete=use_concrete) ) elif self.type in jsonschema_to_python_types: - tps.add(jsonschema_to_python_types[self.type]) + if self.is_object() and use_concrete: + ... # HACK: Fall-through case to avoid `dict` added to `TypedDict` + else: + tps.add(jsonschema_to_python_types[self.type]) else: msg = "No Python type representation available for this schema" raise ValueError(msg) + if use_concrete and len(tps) == 0 and as_str: + # HACK: There is a single case that ends up empty here + # (LegendConfig.layout) + tps = {"Map"} type_reprs = sort_type_reprs(tps) return ( collapse_type_repr(type_reprs, target=target, use_undefined=use_undefined) From 566cd05c7e7d1e71e7b34775ae75bd14c553d9b4 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:02:15 +0100 Subject: [PATCH 014/139] feat(typing): Add wip `ThemeConfig` implementation --- tools/generate_schema_wrapper.py | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 8b44d223b..804a5e08b 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -218,6 +218,21 @@ def configure_{prop}(self, *args, **kwargs) -> Self: return copy """ +CONFIG_TYPED_DICT: Final = ''' +class ThemeConfig(TypedDict, total=False): + """Placeholder doc.""" + {typed_dict_args} + +''' + +CONFIG_SUB_TYPED_DICT: Final = ''' +class {name}(TypedDict, total=False): + """Placeholder doc.""" + + {typed_dict_args} +''' + + ENCODE_METHOD: Final = ''' class _EncodingMixin: def encode({method_args}) -> Self: @@ -770,6 +785,50 @@ def generate_mark_args( } +def gen_config_typed_dict(prop_info: SchemaInfo) -> str: + arg_info = codegen.get_args(prop_info) + args = sorted(arg_info.kwds) + props = prop_info.properties + return "\n ".join(_generate_sig_args(args, props, kind="typed_dict")) + + +def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: + """TODO - Tidy up and use consistent naming.""" + with schemafile.open(encoding="utf8") as f: + schema = json.load(f) + config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) + top_dict_annotations: list[str] = [] + sub_dicts: dict[str, str] = {} + + for prop, prop_info in config.properties.items(): + if (classname := prop_info.refname) and classname.endswith("Config"): + name = f"{classname}Kwds" + top_dict_annotations.append(f"{prop}: {name}") + if name not in sub_dicts: + # Ensure no references to actual `...Config` classes exist + args = re.sub( + r"Config\b", r"ConfigKwds", gen_config_typed_dict(prop_info) + ) + sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( + name=name, typed_dict_args=args + ) + + else: + top_dict_annotations.append(f"{prop}: Any # TODO") + top_dict = CONFIG_TYPED_DICT.format( + typed_dict_args="\n ".join(top_dict_annotations) + ) + nested_config = SchemaInfo( + {"$ref": "#/definitions/ScaleInvalidDataConfig"}, rootschema=schema + ) + name = f"{nested_config.refname}Kwds" + sub_nested = CONFIG_SUB_TYPED_DICT.format( + name=name, typed_dict_args=gen_config_typed_dict(nested_config) + ) + sub_dicts[name] = f"# TODO: Non-`TypedDict` arg\n{sub_nested}" + yield "\n".join(sub_dicts.values()) + yield top_dict + def generate_vegalite_config_mixin(schemafile: Path) -> tuple[list[str], str]: imports = [ @@ -871,6 +930,23 @@ def vegalite_main(skip_download: bool = False) -> None: ] files[fp_mixins] = content_mixins + # Generate theme-related Config hierarchy of TypedDict + fp_theme_config: Path = schemapath / "_config.py" + content_theme_config = [ + HEADER, + "\n".join(stdlib_imports), + "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", + "\n\n", + _type_checking_only_imports( + "from ._typing import * # noqa: F403", + "from .core import Dict", + "from .core import * # noqa: F403", + ), + "\n\n", + *gen_each_config_typed_dict(schemafile), + ] + files[fp_theme_config] = content_theme_config + # Write `_typing.py` TypeAlias, for import in generated modules fp_typing = schemapath / "_typing.py" msg = ( From aafe73fe4b5e8df6ec1e073cd0329abf8477becd Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:02:40 +0100 Subject: [PATCH 015/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_config.py | 1054 ++++++++++++++++++++++++++ 1 file changed, 1054 insertions(+) create mode 100644 altair/vegalite/v5/schema/_config.py diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py new file mode 100644 index 000000000..c5bfebaea --- /dev/null +++ b/altair/vegalite/v5/schema/_config.py @@ -0,0 +1,1054 @@ +# The contents of this file are automatically written by +# tools/generate_schema_wrapper.py. Do not modify directly. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Literal, Sequence, TypedDict + +# ruff: noqa: F405 +if TYPE_CHECKING: + from ._typing import * # noqa: F403 + from .core import * # noqa: F403 + from .core import Dict + + +class RectConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + binSpacing: float + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + continuousBandSize: float + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + discreteBandSize: float | RelativeBandSize + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + minBandSize: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class AreaConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + line: bool | OverlayMarkDef + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + point: str | bool | OverlayMarkDef + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class AxisConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + aria: bool + bandPosition: float + description: str + disable: bool + domain: bool + domainCap: StrokeCap_T + domainColor: str | None | ColorName_T + domainDash: Sequence[float] + domainDashOffset: float + domainOpacity: float + domainWidth: float + format: str | Dict + formatType: str + grid: bool + gridCap: StrokeCap_T + gridColor: str | None | ColorName_T + gridDash: Sequence[float] + gridDashOffset: float + gridOpacity: float + gridWidth: float + labelAlign: Align_T + labelAngle: float + labelBaseline: str | Baseline_T + labelBound: bool | float + labelColor: str | None | ColorName_T + labelExpr: str + labelFlush: bool | float + labelFlushOffset: float + labelFont: str + labelFontSize: float + labelFontStyle: str | FontStyle + labelFontWeight: FontWeight_T + labelLimit: float + labelLineHeight: float + labelOffset: float + labelOpacity: float + labelOverlap: str | bool + labelPadding: float + labelSeparation: float + labels: bool + maxExtent: float + minExtent: float + offset: float + orient: AxisOrient_T + position: float + style: str | Sequence[str] + tickBand: Literal["center", "extent"] + tickCap: StrokeCap_T + tickColor: str | None | ColorName_T + tickCount: float | TimeIntervalStep | TimeInterval_T + tickDash: Sequence[float] + tickDashOffset: float + tickExtra: bool + tickMinStep: float + tickOffset: float + tickOpacity: float + tickRound: bool + tickSize: float + tickWidth: float + ticks: bool + title: str | None | Sequence[str] + titleAlign: Align_T + titleAnchor: TitleAnchor_T + titleAngle: float + titleBaseline: str | Baseline_T + titleColor: str | None | ColorName_T + titleFont: str + titleFontSize: float + titleFontStyle: str | FontStyle + titleFontWeight: FontWeight_T + titleLimit: float + titleLineHeight: float + titleOpacity: float + titlePadding: float + titleX: float + titleY: float + translate: float + values: Sequence[str] | Sequence[bool] | Sequence[float] | Sequence[DateTime] + zindex: float + + +class BarConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + binSpacing: float + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + continuousBandSize: float + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusEnd: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + discreteBandSize: float | RelativeBandSize + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + minBandSize: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class BoxPlotConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + box: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + extent: str | float + median: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + outliers: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + rule: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + size: float + ticks: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + + +class MarkConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class CompositionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + columns: float + spacing: float + + +class ErrorBandConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + band: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + borders: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + extent: ErrorBarExtent_T + interpolate: Interpolate_T + tension: float + + +class ErrorBarConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + extent: ErrorBarExtent_T + rule: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + size: float + thickness: float + ticks: ( + bool + | BarConfigKwds + | AreaConfigKwds + | LineConfigKwds + | MarkConfigKwds + | RectConfigKwds + | TickConfigKwds + ) + + +class HeaderConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + format: str | Dict + formatType: str + labelAlign: Align_T + labelAnchor: TitleAnchor_T + labelAngle: float + labelBaseline: str | Baseline_T + labelColor: str | ColorName_T + labelExpr: str + labelFont: str + labelFontSize: float + labelFontStyle: str | FontStyle + labelFontWeight: FontWeight_T + labelLimit: float + labelLineHeight: float + labelOrient: Orient_T + labelPadding: float + labels: bool + orient: Orient_T + title: None + titleAlign: Align_T + titleAnchor: TitleAnchor_T + titleAngle: float + titleBaseline: str | Baseline_T + titleColor: str | ColorName_T + titleFont: str + titleFontSize: float + titleFontStyle: str | FontStyle + titleFontWeight: FontWeight_T + titleLimit: float + titleLineHeight: float + titleOrient: Orient_T + titlePadding: float + + +class LegendConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + aria: bool + clipHeight: float + columnPadding: float + columns: float + cornerRadius: float + description: str + direction: Orientation_T + disable: bool + fillColor: str | None | ColorName_T + gradientDirection: Orientation_T + gradientHorizontalMaxLength: float + gradientHorizontalMinLength: float + gradientLabelLimit: float + gradientLabelOffset: float + gradientLength: float + gradientOpacity: float + gradientStrokeColor: str | None | ColorName_T + gradientStrokeWidth: float + gradientThickness: float + gradientVerticalMaxLength: float + gradientVerticalMinLength: float + gridAlign: LayoutAlign_T + labelAlign: Align_T + labelBaseline: str | Baseline_T + labelColor: str | None | ColorName_T + labelFont: str + labelFontSize: float + labelFontStyle: str | FontStyle + labelFontWeight: FontWeight_T + labelLimit: float + labelOffset: float + labelOpacity: float + labelOverlap: str | bool + labelPadding: float + labelSeparation: float + layout: Map + legendX: float + legendY: float + offset: float + orient: LegendOrient_T + padding: float + rowPadding: float + strokeColor: str | None | ColorName_T + strokeDash: Sequence[float] + strokeWidth: float + symbolBaseFillColor: str | None | ColorName_T + symbolBaseStrokeColor: str | None | ColorName_T + symbolDash: Sequence[float] + symbolDashOffset: float + symbolDirection: Orientation_T + symbolFillColor: str | None | ColorName_T + symbolLimit: float + symbolOffset: float + symbolOpacity: float + symbolSize: float + symbolStrokeColor: str | None | ColorName_T + symbolStrokeWidth: float + symbolType: str | SymbolShape + tickCount: float | TimeIntervalStep | TimeInterval_T + title: None + titleAlign: Align_T + titleAnchor: TitleAnchor_T + titleBaseline: str | Baseline_T + titleColor: str | None | ColorName_T + titleFont: str + titleFontSize: float + titleFontStyle: str | FontStyle + titleFontWeight: FontWeight_T + titleLimit: float + titleLineHeight: float + titleOpacity: float + titleOrient: Orient_T + titlePadding: float + unselectedOpacity: float + zindex: float + + +class LineConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + point: str | bool | OverlayMarkDef + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class ProjectionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + center: Sequence[float] + clipAngle: float + clipExtent: Sequence[Sequence[float]] + coefficient: float + distance: float + extent: Sequence[Sequence[float]] + fit: ( + GeoJsonFeature + | GeoJsonFeatureCollection + | Sequence[GeoJsonFeature] + | Sequence[GeoJsonFeature | GeoJsonFeatureCollection | Sequence[GeoJsonFeature]] + ) + fraction: float + lobes: float + parallel: float + parallels: Sequence[float] + pointRadius: float + precision: float + radius: float + ratio: float + reflectX: bool + reflectY: bool + rotate: Sequence[float] + scale: float + size: Sequence[float] + spacing: float + tilt: float + translate: Sequence[float] + type: ProjectionType_T + + +class RangeConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + category: ( + Sequence[str | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + diverging: ( + Sequence[str | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + heatmap: ( + Sequence[str | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + ordinal: ( + Sequence[str | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + ramp: ( + Sequence[str | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + symbol: Sequence[str | SymbolShape] + + +class ScaleConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + bandPaddingInner: float + bandPaddingOuter: float + bandWithNestedOffsetPaddingInner: float + bandWithNestedOffsetPaddingOuter: float + barBandPaddingInner: float + clamp: bool + continuousPadding: float + invalid: ScaleInvalidDataConfigKwds + maxBandSize: float + maxFontSize: float + maxOpacity: float + maxSize: float + maxStrokeWidth: float + minBandSize: float + minFontSize: float + minOpacity: float + minSize: float + minStrokeWidth: float + offsetBandPaddingInner: float + offsetBandPaddingOuter: float + pointPadding: float + quantileCount: float + quantizeCount: float + rectBandPaddingInner: float + round: bool + useUnaggregatedDomain: bool + xReverse: bool + zero: bool + + +class SelectionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + interval: IntervalSelectionConfigWithoutType + point: PointSelectionConfigWithoutType + + +class TickConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + bandSize: float + baseline: str | Baseline_T + blend: Blend_T + color: str | LinearGradient | RadialGradient | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: str | None | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str | SymbolShape + size: float + smooth: bool + startAngle: float + stroke: str | None | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + thickness: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + y: str | float + y2: str | float + + +class TitleConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + anchor: TitleAnchor_T + angle: float + aria: bool + baseline: str | Baseline_T + color: str | None | ColorName_T + dx: float + dy: float + font: str + fontSize: float + fontStyle: str | FontStyle + fontWeight: FontWeight_T + frame: str | TitleFrame_T + limit: float + lineHeight: float + offset: float + orient: TitleOrient_T + subtitleColor: str | None | ColorName_T + subtitleFont: str + subtitleFontSize: float + subtitleFontStyle: str | FontStyle + subtitleFontWeight: FontWeight_T + subtitleLineHeight: float + subtitlePadding: float + zindex: float + + +class FormatConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + normalizedNumberFormat: str + normalizedNumberFormatType: str + numberFormat: str + numberFormatType: str + timeFormat: str + timeFormatType: str + + +class ViewConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + clip: bool + continuousHeight: float + continuousWidth: float + cornerRadius: float + cursor: Cursor_T + discreteHeight: float + discreteWidth: float + fill: str | None | ColorName_T + fillOpacity: float + opacity: float + step: float + stroke: str | None | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOpacity: float + strokeWidth: float + + +# TODO: Non-`TypedDict` arg + + +class ScaleInvalidDataConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + angle: str | ScaleInvalidDataShowAsValueangle + color: str | ScaleInvalidDataShowAsValuecolor + fill: str | ScaleInvalidDataShowAsValuefill + fillOpacity: str | ScaleInvalidDataShowAsValuefillOpacity + opacity: str | ScaleInvalidDataShowAsValueopacity + radius: str | ScaleInvalidDataShowAsValueradius + shape: str | ScaleInvalidDataShowAsValueshape + size: str | ScaleInvalidDataShowAsValuesize + stroke: str | ScaleInvalidDataShowAsValuestroke + strokeDash: str | ScaleInvalidDataShowAsValuestrokeDash + strokeOpacity: str | ScaleInvalidDataShowAsValuestrokeOpacity + strokeWidth: str | ScaleInvalidDataShowAsValuestrokeWidth + theta: str | ScaleInvalidDataShowAsValuetheta + x: str | ScaleInvalidDataShowAsValuex + xOffset: str | ScaleInvalidDataShowAsValuexOffset + y: str | ScaleInvalidDataShowAsValuey + yOffset: str | ScaleInvalidDataShowAsValueyOffset + + +class ThemeConfig(TypedDict, total=False): + """Placeholder doc.""" + + arc: RectConfigKwds + area: AreaConfigKwds + aria: Any # TODO + autosize: Any # TODO + axis: AxisConfigKwds + axisBand: AxisConfigKwds + axisBottom: AxisConfigKwds + axisDiscrete: AxisConfigKwds + axisLeft: AxisConfigKwds + axisPoint: AxisConfigKwds + axisQuantitative: AxisConfigKwds + axisRight: AxisConfigKwds + axisTemporal: AxisConfigKwds + axisTop: AxisConfigKwds + axisX: AxisConfigKwds + axisXBand: AxisConfigKwds + axisXDiscrete: AxisConfigKwds + axisXPoint: AxisConfigKwds + axisXQuantitative: AxisConfigKwds + axisXTemporal: AxisConfigKwds + axisY: AxisConfigKwds + axisYBand: AxisConfigKwds + axisYDiscrete: AxisConfigKwds + axisYPoint: AxisConfigKwds + axisYQuantitative: AxisConfigKwds + axisYTemporal: AxisConfigKwds + background: Any # TODO + bar: BarConfigKwds + boxplot: BoxPlotConfigKwds + circle: MarkConfigKwds + concat: CompositionConfigKwds + countTitle: Any # TODO + customFormatTypes: Any # TODO + errorband: ErrorBandConfigKwds + errorbar: ErrorBarConfigKwds + facet: CompositionConfigKwds + fieldTitle: Any # TODO + font: Any # TODO + geoshape: MarkConfigKwds + header: HeaderConfigKwds + headerColumn: HeaderConfigKwds + headerFacet: HeaderConfigKwds + headerRow: HeaderConfigKwds + image: RectConfigKwds + legend: LegendConfigKwds + line: LineConfigKwds + lineBreak: Any # TODO + locale: Any # TODO + mark: MarkConfigKwds + normalizedNumberFormat: Any # TODO + normalizedNumberFormatType: Any # TODO + numberFormat: Any # TODO + numberFormatType: Any # TODO + padding: Any # TODO + params: Any # TODO + point: MarkConfigKwds + projection: ProjectionConfigKwds + range: RangeConfigKwds + rect: RectConfigKwds + rule: MarkConfigKwds + scale: ScaleConfigKwds + selection: SelectionConfigKwds + square: MarkConfigKwds + style: Any # TODO + text: MarkConfigKwds + tick: TickConfigKwds + timeFormat: Any # TODO + timeFormatType: Any # TODO + title: TitleConfigKwds + tooltipFormat: FormatConfigKwds + trail: LineConfigKwds + view: ViewConfigKwds From 5d1f2a5d2888b087234817c802c3e37bce98f51e Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:13:25 +0100 Subject: [PATCH 016/139] docs: Add doc for `SchemaInfo.to_type_repr` --- tools/schemapi/utils.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index be09803d8..ec8ab1308 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -403,11 +403,24 @@ def to_type_repr( # noqa: C901 use_concrete: bool = False, use_undefined: bool = False, ) -> str | list[str]: - tps: set[str] = set() """ - All types which can be used for the current `SchemaInfo`. - Including `altair` classes, standard `python` types, etc. + Return the python type representation of ``SchemaInfo``. + + Includes `altair` classes, standard `python` types, etc. + + Parameters + ---------- + as_str + Return as a string. + Should only be ``False`` during internal recursive calls. + target: {"annotation", "doc"} + Where the representation will be used. + use_concrete + Avoid base classes/wrappers that don't provide type info. + use_undefined + Wrap the result in ``altair.typing.Optional``. """ + tps: set[str] = set() for_type_hints: bool = target == "annotation" if self.title: From 40cd56667bcf6b18412cda085542656709f2c9e4 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:24:32 +0100 Subject: [PATCH 017/139] fix: Use pre `3.12` fstring syntax --- tools/generate_schema_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index b0dc893c7..74b2170c9 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -765,11 +765,11 @@ def _generate_sig_args( if kind == "method": yield "self" for p in args: - yield f"{p}: {props[p].to_type_repr(target="annotation", use_undefined=True)} = Undefined" + yield f"{p}: {props[p].to_type_repr(target='annotation', use_undefined=True)} = Undefined" yield "**kwds" elif kind == "typed_dict": for p in args: - yield f"{p}: {props[p].to_type_repr(target="annotation", use_concrete=True)}" + yield f"{p}: {props[p].to_type_repr(target='annotation', use_concrete=True)}" else: raise NotImplementedError From 49633be3ec3c7a9882476f595924063eac553046 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:27:47 +0100 Subject: [PATCH 018/139] fix: Rerun `generate-schema-wrapper` https://github.com/vega/altair/actions/runs/10358853071/job/28673966947?pr=3536 --- altair/vegalite/v5/schema/_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index c5bfebaea..6044dd4d9 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -799,6 +799,7 @@ class ScaleConfigKwds(TypedDict, total=False): quantizeCount: float rectBandPaddingInner: float round: bool + tickBandPaddingInner: float useUnaggregatedDomain: bool xReverse: bool zero: bool From b4f7ededff4c5f4f6371f6d0f049b4766e99c74b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:03:53 +0100 Subject: [PATCH 019/139] fix(typing): Exclude `core.Dict` from `format` https://github.com/vega/altair/pull/3536#discussion_r1714341728 --- altair/vegalite/v5/schema/_config.py | 5 ++--- tools/schemapi/utils.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 6044dd4d9..5485cd1b8 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -9,7 +9,6 @@ if TYPE_CHECKING: from ._typing import * # noqa: F403 from .core import * # noqa: F403 - from .core import Dict class RectConfigKwds(TypedDict, total=False): @@ -180,7 +179,7 @@ class AxisConfigKwds(TypedDict, total=False): domainDashOffset: float domainOpacity: float domainWidth: float - format: str | Dict + format: str formatType: str grid: bool gridCap: StrokeCap_T @@ -517,7 +516,7 @@ class ErrorBarConfigKwds(TypedDict, total=False): class HeaderConfigKwds(TypedDict, total=False): """Placeholder doc.""" - format: str | Dict + format: str formatType: str labelAlign: Align_T labelAnchor: TitleAnchor_T diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index ec8ab1308..f1da1f588 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -818,6 +818,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: # try to check for the type of the Parameter.param attribute # but then we would need to write some overload signatures for # api.param). + EXCLUDE_TITLE: set[str] = tp_param | {"Dict"} title: str = info.title tps: set[str] = set() if not use_concrete: @@ -827,7 +828,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: if title in tp_param: tps.add("Parameter") elif ( - (title not in tp_param) + (title not in EXCLUDE_TITLE) and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) and not info.is_union() and not info.is_format() From a8ac7ec647f1c27ffbffe9c3d1d7f5f866659835 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:46:19 +0100 Subject: [PATCH 020/139] refactor: Replace `is_value()` case in `codegen.get_args()` Was the only place `SchemaInfo.is_value` had been called. Planning to use that method to identify schemas with **only** 1 property, which is named *value*. This will be much more useful, in allowing generic `TypedDict`(s) like https://github.com/vega/altair/blob/b996fa45d66c94266b97475eab0723b1841436cf/altair/vegalite/v5/api.py#L644 --- tools/schemapi/codegen.py | 7 ++----- tools/schemapi/utils.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index c985fdf71..afcb1a13a 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -59,10 +59,10 @@ def get_args(info: SchemaInfo) -> ArgInfo: elif info.is_empty() or info.is_compound(): nonkeyword = True additional = True - elif info.is_value(): + elif not info.is_object(): nonkeyword = True additional = False - elif info.is_object(): + else: invalid_kwds = {p for p in info.required if not is_valid_identifier(p)} | { p for p in info.properties if not is_valid_identifier(p) } @@ -72,9 +72,6 @@ def get_args(info: SchemaInfo) -> ArgInfo: nonkeyword = False additional = True # additional = info.additionalProperties or info.patternProperties - else: - msg = "Schema object not understood" - raise ValueError(msg) return ArgInfo( nonkeyword=nonkeyword, diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index f1da1f588..7d2c0e76c 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -605,7 +605,7 @@ def is_object(self) -> bool: raise ValueError(msg) def is_value(self) -> bool: - return not self.is_object() + raise NotImplementedError def is_array(self) -> bool: return self.type == "array" From e4f62ec7951304a02e38f107736a9310375e65c6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:59:48 +0100 Subject: [PATCH 021/139] fix(typing): Exclude `RelativeBandSize` from `discreteBandSize` https://github.com/vega/altair/pull/3536#discussion_r1714339278 --- altair/vegalite/v5/schema/_config.py | 4 ++-- tools/schemapi/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 5485cd1b8..35d03ea8b 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -33,7 +33,7 @@ class RectConfigKwds(TypedDict, total=False): cursor: Cursor_T description: str dir: TextDirection_T - discreteBandSize: float | RelativeBandSize + discreteBandSize: float dx: float dy: float ellipsis: str @@ -272,7 +272,7 @@ class BarConfigKwds(TypedDict, total=False): cursor: Cursor_T description: str dir: TextDirection_T - discreteBandSize: float | RelativeBandSize + discreteBandSize: float dx: float dy: float ellipsis: str diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 7d2c0e76c..9f44a4a79 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -818,7 +818,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: # try to check for the type of the Parameter.param attribute # but then we would need to write some overload signatures for # api.param). - EXCLUDE_TITLE: set[str] = tp_param | {"Dict"} + EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} title: str = info.title tps: set[str] = set() if not use_concrete: From f23880fa9bf652d21d7a59032f74f763adec72cb Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:05:04 +0100 Subject: [PATCH 022/139] feat(typing): Adds `Value` (`TypedDict`) https://github.com/vega/altair/pull/3536#discussion_r1715471979 --- tools/generate_schema_wrapper.py | 18 +++++++++++++++++- tools/schemapi/utils.py | 13 ++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 74b2170c9..1804e67f5 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -286,6 +286,22 @@ def func( long: Union[str, bool, float, Sequence[Union[str, bool, float]], ): ... """ + +class Value(TypedDict, Generic[T]): + """ + A `Generic`_ single item ``dict``. + + Parameters + ---------- + value: T + Wrapped value. + + .. _Generic: + https://typing.readthedocs.io/en/latest/spec/generics.html#generics + + """ + + value: T ''' @@ -957,7 +973,7 @@ def vegalite_main(skip_download: bool = False) -> None: print(msg) TypeAliasTracer.update_aliases(("Map", "Mapping[str, Any]")) TypeAliasTracer.write_module( - fp_typing, "OneOrSeq", header=HEADER, extra=TYPING_EXTRA + fp_typing, "OneOrSeq", "Value", header=HEADER, extra=TYPING_EXTRA ) # Write the pre-generated modules for fp, contents in files.items(): diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 9f44a4a79..c270278c6 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -92,8 +92,11 @@ def __init__( self._aliases: dict[str, str] = {} self._imports: Sequence[str] = ( "from __future__ import annotations\n", - "from typing import Any, Literal, Mapping, TypeVar, Sequence, Union", - "from typing_extensions import TypeAlias, TypeAliasType", + "import sys", + "from typing import Any, Generic, Literal, Mapping, TypeVar, Sequence, Union", + "if sys.version_info >= (3, 13):\n from typing import TypedDict\nelse:\n from typing_extensions import TypedDict", + "if sys.version_info >= (3, 12):\n from typing import TypeAliasType\nelse:\n from typing_extensions import TypeAliasType", + "if sys.version_info >= (3, 10):\n from typing import TypeAlias\nelse:\n from typing_extensions import TypeAlias", ) self._cmd_check: list[str] = ["--fix"] self._cmd_format: Sequence[str] = ruff_format or () @@ -605,7 +608,7 @@ def is_object(self) -> bool: raise ValueError(msg) def is_value(self) -> bool: - raise NotImplementedError + return self.is_object() and self.properties.keys() == {"value"} def is_array(self) -> bool: return self.type == "array" @@ -827,6 +830,10 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: # as the type hint for all classes which inherit from it. if title in tp_param: tps.add("Parameter") + elif info.is_value(): + value = info.properties["value"] + t = value.to_type_repr(target="annotation", use_concrete=use_concrete) + tps.add(f"Value[{t}]") elif ( (title not in EXCLUDE_TITLE) and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) From a9c8b99cb09e64a81b18a833019d7b1fdde5465e Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:05:39 +0100 Subject: [PATCH 023/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_config.py | 34 ++++++++++++------------- altair/vegalite/v5/schema/_typing.py | 37 ++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 35d03ea8b..5f69f1d72 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -958,23 +958,23 @@ class ViewConfigKwds(TypedDict, total=False): class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" - angle: str | ScaleInvalidDataShowAsValueangle - color: str | ScaleInvalidDataShowAsValuecolor - fill: str | ScaleInvalidDataShowAsValuefill - fillOpacity: str | ScaleInvalidDataShowAsValuefillOpacity - opacity: str | ScaleInvalidDataShowAsValueopacity - radius: str | ScaleInvalidDataShowAsValueradius - shape: str | ScaleInvalidDataShowAsValueshape - size: str | ScaleInvalidDataShowAsValuesize - stroke: str | ScaleInvalidDataShowAsValuestroke - strokeDash: str | ScaleInvalidDataShowAsValuestrokeDash - strokeOpacity: str | ScaleInvalidDataShowAsValuestrokeOpacity - strokeWidth: str | ScaleInvalidDataShowAsValuestrokeWidth - theta: str | ScaleInvalidDataShowAsValuetheta - x: str | ScaleInvalidDataShowAsValuex - xOffset: str | ScaleInvalidDataShowAsValuexOffset - y: str | ScaleInvalidDataShowAsValuey - yOffset: str | ScaleInvalidDataShowAsValueyOffset + angle: str | Value[float] + color: str | Value[str | LinearGradient | RadialGradient | ColorName_T] + fill: str | Value[str | None | LinearGradient | RadialGradient | ColorName_T] + fillOpacity: str | Value[float] + opacity: str | Value[float] + radius: str | Value[float] + shape: str | Value[str | SymbolShape] + size: str | Value[float] + stroke: str | Value[str | None | LinearGradient | RadialGradient | ColorName_T] + strokeDash: str | Value[Sequence[float]] + strokeOpacity: str | Value[float] + strokeWidth: str | Value[float] + theta: str | Value[float] + x: str | Value[str | float] + xOffset: str | Value[float] + y: str | Value[str | float] + yOffset: str | Value[float] class ThemeConfig(TypedDict, total=False): diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index bcf6d5090..a31e64d03 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -4,8 +4,22 @@ from __future__ import annotations -from typing import Any, Literal, Mapping, Sequence, TypeVar, Union -from typing_extensions import TypeAlias, TypeAliasType +import sys +from typing import Any, Generic, Literal, Mapping, Sequence, TypeVar, Union + +if sys.version_info >= (3, 13): + from typing import TypedDict +else: + from typing_extensions import TypedDict +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType +if sys.version_info >= (3, 10): + from typing import TypeAlias +else: + from typing_extensions import TypeAlias + __all__ = [ "AggregateOp_T", @@ -56,6 +70,7 @@ "TitleOrient_T", "TypeForShape_T", "Type_T", + "Value", "VegaThemes", "WindowOnlyOp_T", ] @@ -77,6 +92,24 @@ def func( ): ... """ + +class Value(TypedDict, Generic[T]): + """ + A `Generic`_ single item ``dict``. + + Parameters + ---------- + value: T + Wrapped value. + + .. _Generic: + https://typing.readthedocs.io/en/latest/spec/generics.html#generics + + """ + + value: T + + VegaThemes: TypeAlias = Literal[ "carbong10", "carbong100", From 184f2b6c34ed3b793db014df28b7ddd8a6cce0b9 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:55:23 +0100 Subject: [PATCH 024/139] ci(ruff): Enable lint/format on notebooks --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index e2bdf7783..59f37e095 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -195,6 +195,7 @@ exclude = [ "tests/examples_methods_syntax", "tests/test_transformed_data.py", ] +extend-include = ["*.ipynb"] [tool.ruff.lint] # https://docs.astral.sh/ruff/preview/ From ecf7fd5f1dd45a68083c62b731f893c95e073519 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:42:36 +0100 Subject: [PATCH 025/139] feat: Adds `SchemaInfo.is_type_alias` See doc for examples https://github.com/vega/altair/pull/3536#discussion_r1716823374 --- tools/schemapi/utils.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index c270278c6..4e43d9436 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -641,6 +641,30 @@ def is_format(self) -> bool: """ return (self.schema.keys() == {"format", "type"}) and self.type == "string" + def is_type_alias(self) -> bool: + """ + Represents a name assigned to a literal type. + + At the time of writing, all of these are: + + SchemaInfo.schema = {"type": "string"} + + The resulting annotation then becomes, e.g. ``FieldName``: + + arg: str | FieldName + + Where both of the above represent: + + arg = "name 1" + arg = FieldName("name 1") + + The latter is not useful and adds noise. + """ + TP = "type" + return ( + self.schema.keys() == {TP} and self.schema[TP] in jsonschema_to_python_types + ) + class RSTRenderer(_RSTRenderer): def __init__(self) -> None: @@ -840,6 +864,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: and not info.is_union() and not info.is_format() and not info.is_array() + and not info.is_type_alias() ): tps.add(title) return tps From f4cb0d44aa7bfa7f3738472782a41edaaab6924b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:44:11 +0100 Subject: [PATCH 026/139] build: run `generate-schema-wrapper` Excludes `FontStyle`, `SymbolShape` aliases for `str` https://github.com/vega/altair/pull/3536#discussion_r1714339737, https://github.com/vega/altair/pull/3536#discussion_r1714339962 --- altair/vegalite/v5/schema/_config.py | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 5f69f1d72..fa495e4c4 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -43,7 +43,7 @@ class RectConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -61,7 +61,7 @@ class RectConfigKwds(TypedDict, total=False): padAngle: float radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -118,7 +118,7 @@ class AreaConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -137,7 +137,7 @@ class AreaConfigKwds(TypedDict, total=False): point: str | bool | OverlayMarkDef radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -198,7 +198,7 @@ class AxisConfigKwds(TypedDict, total=False): labelFlushOffset: float labelFont: str labelFontSize: float - labelFontStyle: str | FontStyle + labelFontStyle: str labelFontWeight: FontWeight_T labelLimit: float labelLineHeight: float @@ -236,7 +236,7 @@ class AxisConfigKwds(TypedDict, total=False): titleColor: str | None | ColorName_T titleFont: str titleFontSize: float - titleFontStyle: str | FontStyle + titleFontStyle: str titleFontWeight: FontWeight_T titleLimit: float titleLineHeight: float @@ -282,7 +282,7 @@ class BarConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -300,7 +300,7 @@ class BarConfigKwds(TypedDict, total=False): padAngle: float radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -409,7 +409,7 @@ class MarkConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -426,7 +426,7 @@ class MarkConfigKwds(TypedDict, total=False): padAngle: float radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -526,7 +526,7 @@ class HeaderConfigKwds(TypedDict, total=False): labelExpr: str labelFont: str labelFontSize: float - labelFontStyle: str | FontStyle + labelFontStyle: str labelFontWeight: FontWeight_T labelLimit: float labelLineHeight: float @@ -542,7 +542,7 @@ class HeaderConfigKwds(TypedDict, total=False): titleColor: str | ColorName_T titleFont: str titleFontSize: float - titleFontStyle: str | FontStyle + titleFontStyle: str titleFontWeight: FontWeight_T titleLimit: float titleLineHeight: float @@ -580,7 +580,7 @@ class LegendConfigKwds(TypedDict, total=False): labelColor: str | None | ColorName_T labelFont: str labelFontSize: float - labelFontStyle: str | FontStyle + labelFontStyle: str labelFontWeight: FontWeight_T labelLimit: float labelOffset: float @@ -610,7 +610,7 @@ class LegendConfigKwds(TypedDict, total=False): symbolSize: float symbolStrokeColor: str | None | ColorName_T symbolStrokeWidth: float - symbolType: str | SymbolShape + symbolType: str tickCount: float | TimeIntervalStep | TimeInterval_T title: None titleAlign: Align_T @@ -619,7 +619,7 @@ class LegendConfigKwds(TypedDict, total=False): titleColor: str | None | ColorName_T titleFont: str titleFontSize: float - titleFontStyle: str | FontStyle + titleFontStyle: str titleFontWeight: FontWeight_T titleLimit: float titleLineHeight: float @@ -659,7 +659,7 @@ class LineConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -677,7 +677,7 @@ class LineConfigKwds(TypedDict, total=False): point: str | bool | OverlayMarkDef radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -767,7 +767,7 @@ class RangeConfigKwds(TypedDict, total=False): | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) - symbol: Sequence[str | SymbolShape] + symbol: Sequence[str] class ScaleConfigKwds(TypedDict, total=False): @@ -841,7 +841,7 @@ class TickConfigKwds(TypedDict, total=False): filled: bool font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T height: float href: str @@ -858,7 +858,7 @@ class TickConfigKwds(TypedDict, total=False): padAngle: float radius: float radius2: float - shape: str | SymbolShape + shape: str size: float smooth: bool startAngle: float @@ -900,7 +900,7 @@ class TitleConfigKwds(TypedDict, total=False): dy: float font: str fontSize: float - fontStyle: str | FontStyle + fontStyle: str fontWeight: FontWeight_T frame: str | TitleFrame_T limit: float @@ -910,7 +910,7 @@ class TitleConfigKwds(TypedDict, total=False): subtitleColor: str | None | ColorName_T subtitleFont: str subtitleFontSize: float - subtitleFontStyle: str | FontStyle + subtitleFontStyle: str subtitleFontWeight: FontWeight_T subtitleLineHeight: float subtitlePadding: float @@ -964,7 +964,7 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): fillOpacity: str | Value[float] opacity: str | Value[float] radius: str | Value[float] - shape: str | Value[str | SymbolShape] + shape: str | Value[str] size: str | Value[float] stroke: str | Value[str | None | LinearGradient | RadialGradient | ColorName_T] strokeDash: str | Value[Sequence[float]] From a9a738e2ad6204aa4cfe54c0ec724e7da5571577 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:22:58 +0100 Subject: [PATCH 027/139] refactor: Move, rename `_type_checking_only_imports` -> `import_type_checking` --- tools/generate_schema_wrapper.py | 17 +++++------------ tools/schemapi/utils.py | 9 +++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 1804e67f5..c33cc9af5 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -22,6 +22,7 @@ SchemaProperties, TypeAliasTracer, get_valid_identifier, + import_type_checking, indent_docstring, resolve_references, rst_parse, @@ -587,7 +588,7 @@ def generate_vegalite_schema_wrapper(schema_file: Path) -> str: "import json\n", "from narwhals.dependencies import is_pandas_dataframe as _is_pandas_dataframe", "from altair.utils.schemapi import SchemaBase, Undefined, UndefinedType, _subclasses # noqa: F401\n", - _type_checking_only_imports( + import_type_checking( "from altair import Parameter", "from altair.typing import Optional", "from ._typing import * # noqa: F403", @@ -610,14 +611,6 @@ def generate_vegalite_schema_wrapper(schema_file: Path) -> str: return "\n".join(contents) -def _type_checking_only_imports(*imports: str) -> str: - return ( - "\n# ruff: noqa: F405\nif TYPE_CHECKING:\n" - + "\n".join(f" {s}" for s in imports) - + "\n" - ) - - @dataclass class ChannelInfo: supports_arrays: bool @@ -727,7 +720,7 @@ def generate_vegalite_channel_wrappers( HEADER, CHANNEL_MYPY_IGNORE_STATEMENTS, *imports, - _type_checking_only_imports( + import_type_checking( "from altair import Parameter, SchemaBase", "from altair.typing import Optional", "from typing_extensions import Self", @@ -935,7 +928,7 @@ def vegalite_main(skip_download: bool = False) -> None: "\n\n", "\n".join(try_except_imports), "\n\n", - _type_checking_only_imports( + import_type_checking( "from altair import Parameter, SchemaBase", "from altair.typing import Optional", "from ._typing import * # noqa: F403", @@ -954,7 +947,7 @@ def vegalite_main(skip_download: bool = False) -> None: "\n".join(stdlib_imports), "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", "\n\n", - _type_checking_only_imports( + import_type_checking( "from ._typing import * # noqa: F403", "from .core import Dict", "from .core import * # noqa: F403", diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 4e43d9436..6b9cb2241 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -982,3 +982,12 @@ def ruff_write_lint_format_str( r = subprocess.run(cmd, check=True) r.check_returncode() ruff_format_py(fp) + + +def import_type_checking(*imports: str) -> str: + """Write an `if TYPE_CHECKING` block.""" + return ( + "\n# ruff: noqa: F405\nif TYPE_CHECKING:\n" + + "\n".join(f" {s}" for s in imports) + + "\n" + ) From fcb94696958654c754696a155fc4b4d7ded71afe Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:45:31 +0100 Subject: [PATCH 028/139] feat: Adds `utils.import_typing_extensions` Standardising version-gated `typing` imports --- tools/schemapi/utils.py | 59 ++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 6b9cb2241..eaf3d06fa 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -94,9 +94,13 @@ def __init__( "from __future__ import annotations\n", "import sys", "from typing import Any, Generic, Literal, Mapping, TypeVar, Sequence, Union", - "if sys.version_info >= (3, 13):\n from typing import TypedDict\nelse:\n from typing_extensions import TypedDict", - "if sys.version_info >= (3, 12):\n from typing import TypeAliasType\nelse:\n from typing_extensions import TypeAliasType", - "if sys.version_info >= (3, 10):\n from typing import TypeAlias\nelse:\n from typing_extensions import TypeAlias", + import_typing_extensions( + (3, 13), "TypedDict", reason="`TypedDict` had multiple revisions." + ), + import_typing_extensions((3, 12), "TypeAliasType"), + import_typing_extensions((3, 11), "LiteralString"), + import_typing_extensions((3, 10), "TypeAlias"), + import_typing_extensions((3, 9), "Annotated"), ) self._cmd_check: list[str] = ["--fix"] self._cmd_format: Sequence[str] = ruff_format or () @@ -209,18 +213,6 @@ def n_entries(self) -> int: return len(self._literals) -TypeAliasTracer: _TypeAliasTracer = _TypeAliasTracer("{}_T", "I001", "I002") -"""An instance of `_TypeAliasTracer`. - -Collects a cache of unique `Literal` types used globally. - -These are then converted to `TypeAlias` statements, written to another module. - -Allows for a single definition to be reused multiple times, -rather than repeating long literals in every method definition. -""" - - def get_valid_identifier( prop: str, replacement_character: str = "", @@ -690,9 +682,6 @@ def __call__(self, s: str) -> str: return unescape(s).replace(r"\ ,", ",").replace(r"\ ", " ") -rst_parse: RSTParse = RSTParse(RSTRenderer()) - - def indent_docstring( # noqa: C901 lines: list[str], indent_level: int, width: int = 100, lstrip=True ) -> str: @@ -991,3 +980,37 @@ def import_type_checking(*imports: str) -> str: + "\n".join(f" {s}" for s in imports) + "\n" ) + + +def import_typing_extensions( + version_added: tuple[float, float], + /, + *symbol_names: str, + reason: str | None = None, + include_sys: bool = False, +) -> str: + major, minor = version_added + names = ", ".join(symbol_names) + line_1 = "import sys\n" if include_sys else "\n" + comment = f" # {reason}" if reason else "" + return ( + f"{line_1}" + f"if sys.version_info >= ({major}, {minor}):{comment}\n " + f"from typing import {names}\n" + f"else:\n " + f"from typing_extensions import {names}" + ) + + +TypeAliasTracer: _TypeAliasTracer = _TypeAliasTracer("{}_T", "I001", "I002") +"""An instance of `_TypeAliasTracer`. + +Collects a cache of unique `Literal` types used globally. + +These are then converted to `TypeAlias` statements, written to another module. + +Allows for a single definition to be reused multiple times, +rather than repeating long literals in every method definition. +""" + +rst_parse: RSTParse = RSTParse(RSTRenderer()) From 7eea2376474a699d382433d0ba074ccd65b5267d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:51:18 +0100 Subject: [PATCH 029/139] feat(typing): Adds `ColorHex`, `is_color_hex` See https://github.com/vega/altair/pull/3536/files#r1715713942 --- tools/generate_schema_wrapper.py | 43 +++++++++++++++++++++++++++++++- tools/schemapi/utils.py | 8 ++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index c33cc9af5..24df1d33f 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -303,6 +303,41 @@ class Value(TypedDict, Generic[T]): """ value: T + + +ColorHex = Annotated[ + LiteralString, + re.compile(r"#[0-9a-f]{{2}}[0-9a-f]{{2}}[0-9a-f]{{2}}([0-9a-f]{{2}})?", re.IGNORECASE), +] +""" +A `hexadecimal`_ color code. + +Corresponds to the ``json-schema`` string format: + + {"format": "color-hex", "type": "string"} + +Examples +-------- +: + + "#f0f8ff" + "#7fffd4" + "#000000" + "#0000FF" + +.. _hexadecimal: + https://www.w3schools.com/html/html_colors_hex.asp +""" + +def is_color_hex(obj: Any) -> TypeIs[ColorHex]: + """Return ``True`` if the object is a hexadecimal color code.""" + # NOTE: Extracts compiled pattern from metadata, + # to avoid defining in multiple places. + it = iter(get_args(ColorHex)) + next(it) + pattern: re.Pattern[str] = next(it) + return bool(pattern.match(obj)) + ''' @@ -966,7 +1001,13 @@ def vegalite_main(skip_download: bool = False) -> None: print(msg) TypeAliasTracer.update_aliases(("Map", "Mapping[str, Any]")) TypeAliasTracer.write_module( - fp_typing, "OneOrSeq", "Value", header=HEADER, extra=TYPING_EXTRA + fp_typing, + "OneOrSeq", + "Value", + "ColorHex", + "is_color_hex", + header=HEADER, + extra=TYPING_EXTRA, ) # Write the pre-generated modules for fp, contents in files.items(): diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index eaf3d06fa..f26d73e0a 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -94,13 +94,17 @@ def __init__( "from __future__ import annotations\n", "import sys", "from typing import Any, Generic, Literal, Mapping, TypeVar, Sequence, Union", + "import re", import_typing_extensions( - (3, 13), "TypedDict", reason="`TypedDict` had multiple revisions." + (3, 13), + "TypedDict", + "TypeIs", + reason="`TypedDict` had multiple revisions.", ), import_typing_extensions((3, 12), "TypeAliasType"), import_typing_extensions((3, 11), "LiteralString"), import_typing_extensions((3, 10), "TypeAlias"), - import_typing_extensions((3, 9), "Annotated"), + import_typing_extensions((3, 9), "Annotated", "get_args"), ) self._cmd_check: list[str] = ["--fix"] self._cmd_format: Sequence[str] = ruff_format or () From 3455fd71929d03b6c93c8a41a0b9968d36efd28a Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:54:14 +0100 Subject: [PATCH 030/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_typing.py | 61 ++++++++++++++++++++++++++-- tools/generate_schema_wrapper.py | 3 +- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 3a57d1e4e..52f770dcc 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -4,22 +4,35 @@ from __future__ import annotations +import re import sys from typing import Any, Generic, Literal, Mapping, Sequence, TypeVar, Union -if sys.version_info >= (3, 13): - from typing import TypedDict +if sys.version_info >= (3, 13): # `TypedDict` had multiple revisions. + from typing import TypedDict, TypeIs else: - from typing_extensions import TypedDict + from typing_extensions import TypedDict, TypeIs + if sys.version_info >= (3, 12): from typing import TypeAliasType else: from typing_extensions import TypeAliasType + +if sys.version_info >= (3, 11): + from typing import LiteralString +else: + from typing_extensions import LiteralString + if sys.version_info >= (3, 10): from typing import TypeAlias else: from typing_extensions import TypeAlias +if sys.version_info >= (3, 9): + from typing import Annotated, get_args +else: + from typing_extensions import Annotated, get_args + __all__ = [ "AggregateOp_T", @@ -30,6 +43,7 @@ "Baseline_T", "BinnedTimeUnit_T", "Blend_T", + "ColorHex", "ColorName_T", "ColorScheme_T", "Cursor_T", @@ -78,12 +92,14 @@ "Value", "VegaThemes", "WindowOnlyOp_T", + "is_color_hex", ] T = TypeVar("T") OneOrSeq = TypeAliasType("OneOrSeq", Union[T, Sequence[T]], type_params=(T,)) -"""One of ``T`` specified type(s), or a `Sequence` of such. +""" +One of ``T`` specified type(s), or a `Sequence` of such. Examples -------- @@ -115,6 +131,43 @@ class Value(TypedDict, Generic[T]): value: T +ColorHex = Annotated[ + LiteralString, + re.compile( + r"#[0-9a-f]{{2}}[0-9a-f]{{2}}[0-9a-f]{{2}}([0-9a-f]{{2}})?", re.IGNORECASE + ), +] +""" +A `hexadecimal`_ color code. + +Corresponds to the ``json-schema`` string format: + + {"format": "color-hex", "type": "string"} + +Examples +-------- +: + + "#f0f8ff" + "#7fffd4" + "#000000" + "#0000FF" + +.. _hexadecimal: + https://www.w3schools.com/html/html_colors_hex.asp +""" + + +def is_color_hex(obj: Any) -> TypeIs[ColorHex]: + """Return ``True`` if the object is a hexadecimal color code.""" + # NOTE: Extracts compiled pattern from metadata, + # to avoid defining in multiple places. + it = iter(get_args(ColorHex)) + next(it) + pattern: re.Pattern[str] = next(it) + return bool(pattern.match(obj)) + + VegaThemes: TypeAlias = Literal[ "carbong10", "carbong100", diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 24df1d33f..d765bbba4 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -274,7 +274,8 @@ class EncodeKwds(TypedDict, total=False): TYPING_EXTRA: Final = ''' T = TypeVar("T") OneOrSeq = TypeAliasType("OneOrSeq", Union[T, Sequence[T]], type_params=(T,)) -"""One of ``T`` specified type(s), or a `Sequence` of such. +""" +One of ``T`` specified type(s), or a `Sequence` of such. Examples -------- From 794e9d5b8114980c32d7698f16adc4340cb9fef8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 17:12:53 +0100 Subject: [PATCH 031/139] fix(typing): Exclude `str`, use `ColorHex | ColorName_T` https://github.com/vega/altair/pull/3536/files#r1715713942 --- altair/vegalite/v5/schema/_config.py | 92 ++++++++++++++-------------- tools/schemapi/utils.py | 15 +++-- 2 files changed, 57 insertions(+), 50 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index fa495e4c4..66e814b96 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -23,7 +23,7 @@ class RectConfigKwds(TypedDict, total=False): baseline: str | Baseline_T binSpacing: float blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T continuousBandSize: float cornerRadius: float cornerRadiusBottomLeft: float @@ -38,7 +38,7 @@ class RectConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -65,7 +65,7 @@ class RectConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -100,7 +100,7 @@ class AreaConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -113,7 +113,7 @@ class AreaConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -141,7 +141,7 @@ class AreaConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -174,7 +174,7 @@ class AxisConfigKwds(TypedDict, total=False): disable: bool domain: bool domainCap: StrokeCap_T - domainColor: str | None | ColorName_T + domainColor: None | ColorHex | ColorName_T domainDash: Sequence[float] domainDashOffset: float domainOpacity: float @@ -183,7 +183,7 @@ class AxisConfigKwds(TypedDict, total=False): formatType: str grid: bool gridCap: StrokeCap_T - gridColor: str | None | ColorName_T + gridColor: None | ColorHex | ColorName_T gridDash: Sequence[float] gridDashOffset: float gridOpacity: float @@ -192,7 +192,7 @@ class AxisConfigKwds(TypedDict, total=False): labelAngle: float labelBaseline: str | Baseline_T labelBound: bool | float - labelColor: str | None | ColorName_T + labelColor: None | ColorHex | ColorName_T labelExpr: str labelFlush: bool | float labelFlushOffset: float @@ -216,7 +216,7 @@ class AxisConfigKwds(TypedDict, total=False): style: str | Sequence[str] tickBand: Literal["center", "extent"] tickCap: StrokeCap_T - tickColor: str | None | ColorName_T + tickColor: None | ColorHex | ColorName_T tickCount: float | TimeIntervalStep | TimeInterval_T tickDash: Sequence[float] tickDashOffset: float @@ -233,7 +233,7 @@ class AxisConfigKwds(TypedDict, total=False): titleAnchor: TitleAnchor_T titleAngle: float titleBaseline: str | Baseline_T - titleColor: str | None | ColorName_T + titleColor: None | ColorHex | ColorName_T titleFont: str titleFontSize: float titleFontStyle: str @@ -261,7 +261,7 @@ class BarConfigKwds(TypedDict, total=False): baseline: str | Baseline_T binSpacing: float blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T continuousBandSize: float cornerRadius: float cornerRadiusBottomLeft: float @@ -277,7 +277,7 @@ class BarConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -304,7 +304,7 @@ class BarConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -391,7 +391,7 @@ class MarkConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -404,7 +404,7 @@ class MarkConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -430,7 +430,7 @@ class MarkConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -522,7 +522,7 @@ class HeaderConfigKwds(TypedDict, total=False): labelAnchor: TitleAnchor_T labelAngle: float labelBaseline: str | Baseline_T - labelColor: str | ColorName_T + labelColor: ColorHex | ColorName_T labelExpr: str labelFont: str labelFontSize: float @@ -539,7 +539,7 @@ class HeaderConfigKwds(TypedDict, total=False): titleAnchor: TitleAnchor_T titleAngle: float titleBaseline: str | Baseline_T - titleColor: str | ColorName_T + titleColor: ColorHex | ColorName_T titleFont: str titleFontSize: float titleFontStyle: str @@ -561,7 +561,7 @@ class LegendConfigKwds(TypedDict, total=False): description: str direction: Orientation_T disable: bool - fillColor: str | None | ColorName_T + fillColor: None | ColorHex | ColorName_T gradientDirection: Orientation_T gradientHorizontalMaxLength: float gradientHorizontalMinLength: float @@ -569,7 +569,7 @@ class LegendConfigKwds(TypedDict, total=False): gradientLabelOffset: float gradientLength: float gradientOpacity: float - gradientStrokeColor: str | None | ColorName_T + gradientStrokeColor: None | ColorHex | ColorName_T gradientStrokeWidth: float gradientThickness: float gradientVerticalMaxLength: float @@ -577,7 +577,7 @@ class LegendConfigKwds(TypedDict, total=False): gridAlign: LayoutAlign_T labelAlign: Align_T labelBaseline: str | Baseline_T - labelColor: str | None | ColorName_T + labelColor: None | ColorHex | ColorName_T labelFont: str labelFontSize: float labelFontStyle: str @@ -595,20 +595,20 @@ class LegendConfigKwds(TypedDict, total=False): orient: LegendOrient_T padding: float rowPadding: float - strokeColor: str | None | ColorName_T + strokeColor: None | ColorHex | ColorName_T strokeDash: Sequence[float] strokeWidth: float - symbolBaseFillColor: str | None | ColorName_T - symbolBaseStrokeColor: str | None | ColorName_T + symbolBaseFillColor: None | ColorHex | ColorName_T + symbolBaseStrokeColor: None | ColorHex | ColorName_T symbolDash: Sequence[float] symbolDashOffset: float symbolDirection: Orientation_T - symbolFillColor: str | None | ColorName_T + symbolFillColor: None | ColorHex | ColorName_T symbolLimit: float symbolOffset: float symbolOpacity: float symbolSize: float - symbolStrokeColor: str | None | ColorName_T + symbolStrokeColor: None | ColorHex | ColorName_T symbolStrokeWidth: float symbolType: str tickCount: float | TimeIntervalStep | TimeInterval_T @@ -616,7 +616,7 @@ class LegendConfigKwds(TypedDict, total=False): titleAlign: Align_T titleAnchor: TitleAnchor_T titleBaseline: str | Baseline_T - titleColor: str | None | ColorName_T + titleColor: None | ColorHex | ColorName_T titleFont: str titleFontSize: float titleFontStyle: str @@ -641,7 +641,7 @@ class LineConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -654,7 +654,7 @@ class LineConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -681,7 +681,7 @@ class LineConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -743,27 +743,27 @@ class RangeConfigKwds(TypedDict, total=False): """Placeholder doc.""" category: ( - Sequence[str | ColorName_T] + Sequence[ColorHex | ColorName_T] | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) diverging: ( - Sequence[str | ColorName_T] + Sequence[ColorHex | ColorName_T] | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) heatmap: ( - Sequence[str | ColorName_T] + Sequence[ColorHex | ColorName_T] | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) ordinal: ( - Sequence[str | ColorName_T] + Sequence[ColorHex | ColorName_T] | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) ramp: ( - Sequence[str | ColorName_T] + Sequence[ColorHex | ColorName_T] | Sequence[str | bool | None | float | Sequence[float]] | RangeEnum_T ) @@ -823,7 +823,7 @@ class TickConfigKwds(TypedDict, total=False): bandSize: float baseline: str | Baseline_T blend: Blend_T - color: str | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradient | RadialGradient | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -836,7 +836,7 @@ class TickConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: str | None | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T fillOpacity: float filled: bool font: str @@ -862,7 +862,7 @@ class TickConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: str | None | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -895,7 +895,7 @@ class TitleConfigKwds(TypedDict, total=False): angle: float aria: bool baseline: str | Baseline_T - color: str | None | ColorName_T + color: None | ColorHex | ColorName_T dx: float dy: float font: str @@ -907,7 +907,7 @@ class TitleConfigKwds(TypedDict, total=False): lineHeight: float offset: float orient: TitleOrient_T - subtitleColor: str | None | ColorName_T + subtitleColor: None | ColorHex | ColorName_T subtitleFont: str subtitleFontSize: float subtitleFontStyle: str @@ -938,11 +938,11 @@ class ViewConfigKwds(TypedDict, total=False): cursor: Cursor_T discreteHeight: float discreteWidth: float - fill: str | None | ColorName_T + fill: None | ColorHex | ColorName_T fillOpacity: float opacity: float step: float - stroke: str | None | ColorName_T + stroke: None | ColorHex | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -959,14 +959,14 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" angle: str | Value[float] - color: str | Value[str | LinearGradient | RadialGradient | ColorName_T] - fill: str | Value[str | None | LinearGradient | RadialGradient | ColorName_T] + color: str | Value[ColorHex | LinearGradient | RadialGradient | ColorName_T] + fill: str | Value[None | ColorHex | LinearGradient | RadialGradient | ColorName_T] fillOpacity: str | Value[float] opacity: str | Value[float] radius: str | Value[float] shape: str | Value[str] size: str | Value[float] - stroke: str | Value[str | None | LinearGradient | RadialGradient | ColorName_T] + stroke: str | Value[None | ColorHex | LinearGradient | RadialGradient | ColorName_T] strokeDash: str | Value[Sequence[float]] strokeOpacity: str | Value[float] strokeWidth: str | Value[float] diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index f26d73e0a..aae1c9573 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -468,10 +468,14 @@ def to_type_repr( # noqa: C901 msg = "No Python type representation available for this schema" raise ValueError(msg) - if use_concrete and len(tps) == 0 and as_str: - # HACK: There is a single case that ends up empty here - # (LegendConfig.layout) - tps = {"Map"} + if use_concrete: + if tps >= {"ColorHex", "ColorName_T", "str"}: + # HACK: Remove regular `str` if HEX & CSS color codes are present as well + tps.discard("str") + elif len(tps) == 0 and as_str: + # HACK: There is a single case that ends up empty here + # (LegendConfig.layout) + tps = {"Map"} type_reprs = sort_type_reprs(tps) return ( collapse_type_repr(type_reprs, target=target, use_undefined=use_undefined) @@ -839,6 +843,7 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: # but then we would need to write some overload signatures for # api.param). EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} + REMAP_TITLE: dict[str, str] = {"HexColor": "ColorHex"} title: str = info.title tps: set[str] = set() if not use_concrete: @@ -851,6 +856,8 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: value = info.properties["value"] t = value.to_type_repr(target="annotation", use_concrete=use_concrete) tps.add(f"Value[{t}]") + elif title in REMAP_TITLE: + tps.add(REMAP_TITLE[title]) elif ( (title not in EXCLUDE_TITLE) and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) From 859e998886080957014f68e1c4359977b2d633ba Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:04:26 +0100 Subject: [PATCH 032/139] fix: Move *TODO* location It is supposed to describe the top-level config --- altair/vegalite/v5/schema/_config.py | 6 +++--- tools/generate_schema_wrapper.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 66e814b96..872dfcb6d 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -952,9 +952,6 @@ class ViewConfigKwds(TypedDict, total=False): strokeWidth: float -# TODO: Non-`TypedDict` arg - - class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" @@ -977,6 +974,9 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): yOffset: str | Value[float] +# TODO: Non-`TypedDict` args + + class ThemeConfig(TypedDict, total=False): """Placeholder doc.""" diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index d765bbba4..fcb35906e 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -871,8 +871,9 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: sub_nested = CONFIG_SUB_TYPED_DICT.format( name=name, typed_dict_args=gen_config_typed_dict(nested_config) ) - sub_dicts[name] = f"# TODO: Non-`TypedDict` arg\n{sub_nested}" + sub_dicts[name] = sub_nested yield "\n".join(sub_dicts.values()) + yield "# TODO: Non-`TypedDict` args" yield top_dict From f09a14caa7e1efb005cd620a3b57a8bddc691ce8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:20:29 +0100 Subject: [PATCH 033/139] chore: Label a comment as a temp fix --- tools/generate_schema_wrapper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index fcb35906e..77fd92bd7 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -851,7 +851,8 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: name = f"{classname}Kwds" top_dict_annotations.append(f"{prop}: {name}") if name not in sub_dicts: - # Ensure no references to actual `...Config` classes exist + # HACK: Ensure no references to actual `...Config` classes exist + # - Using regex due to forward references args = re.sub( r"Config\b", r"ConfigKwds", gen_config_typed_dict(prop_info) ) From da516c1a6753b1fc3520d6d9b0dc689a2b22de00 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:27:27 +0100 Subject: [PATCH 034/139] feat(typing): Adds `OverlayMarkDefKwds` Sufficiently complex to require a `TypedDict` https://github.com/vega/altair/pull/3536#discussion_r1714340747 --- altair/vegalite/v5/schema/_config.py | 90 +++++++++++++++++++++++++++- tools/generate_schema_wrapper.py | 22 ++++--- tools/schemapi/utils.py | 5 +- 3 files changed, 101 insertions(+), 16 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 872dfcb6d..cd1aa7296 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -126,7 +126,7 @@ class AreaConfigKwds(TypedDict, total=False): interpolate: Interpolate_T invalid: None | MarkInvalidDataMode_T limit: float - line: bool | OverlayMarkDef + line: bool | OverlayMarkDefKwds lineBreak: str lineHeight: float opacity: float @@ -134,7 +134,7 @@ class AreaConfigKwds(TypedDict, total=False): orient: Orientation_T outerRadius: float padAngle: float - point: str | bool | OverlayMarkDef + point: str | bool | OverlayMarkDefKwds radius: float radius2: float shape: str @@ -674,7 +674,7 @@ class LineConfigKwds(TypedDict, total=False): orient: Orientation_T outerRadius: float padAngle: float - point: str | bool | OverlayMarkDef + point: str | bool | OverlayMarkDefKwds radius: float radius2: float shape: str @@ -974,6 +974,90 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): yOffset: str | Value[float] +class OverlayMarkDefKwds(TypedDict, total=False): + """Placeholder doc.""" + + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: str | Baseline_T + blend: Blend_T + clip: bool + color: ColorHex | LinearGradient | RadialGradient | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + radius2Offset: float + radiusOffset: float + shape: str + size: float + smooth: bool + startAngle: float + stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + style: str | Sequence[str] + tension: float + text: str | Sequence[str] + theta: float + theta2: float + theta2Offset: float + thetaOffset: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContent + url: str + width: float + x: str | float + x2: str | float + x2Offset: float + xOffset: float + y: str | float + y2: str | float + y2Offset: float + yOffset: float + + # TODO: Non-`TypedDict` args diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 77fd92bd7..10aa356aa 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -845,6 +845,7 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] sub_dicts: dict[str, str] = {} + MANUAL_DEFS = "ScaleInvalidDataConfig", "OverlayMarkDef" for prop, prop_info in config.properties.items(): if (classname := prop_info.refname) and classname.endswith("Config"): @@ -862,20 +863,17 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: else: top_dict_annotations.append(f"{prop}: Any # TODO") - top_dict = CONFIG_TYPED_DICT.format( - typed_dict_args="\n ".join(top_dict_annotations) - ) - nested_config = SchemaInfo( - {"$ref": "#/definitions/ScaleInvalidDataConfig"}, rootschema=schema - ) - name = f"{nested_config.refname}Kwds" - sub_nested = CONFIG_SUB_TYPED_DICT.format( - name=name, typed_dict_args=gen_config_typed_dict(nested_config) - ) - sub_dicts[name] = sub_nested + + for d_name in MANUAL_DEFS: + info = SchemaInfo({"$ref": f"#/definitions/{d_name}"}, rootschema=schema) + name = f"{info.refname}Kwds" + td = CONFIG_SUB_TYPED_DICT.format( + name=name, typed_dict_args=gen_config_typed_dict(info) + ) + sub_dicts[name] = td yield "\n".join(sub_dicts.values()) yield "# TODO: Non-`TypedDict` args" - yield top_dict + yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) def generate_vegalite_config_mixin(schemafile: Path) -> tuple[list[str], str]: diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index aae1c9573..82a08ffff 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -843,7 +843,10 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: # but then we would need to write some overload signatures for # api.param). EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} - REMAP_TITLE: dict[str, str] = {"HexColor": "ColorHex"} + REMAP_TITLE: dict[str, str] = { + "HexColor": "ColorHex", + "OverlayMarkDef": "OverlayMarkDefKwds", + } title: str = info.title tps: set[str] = set() if not use_concrete: From fc108167f47a2bb5ec1881cde4e1cfbdee5e54ae Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:38:41 +0100 Subject: [PATCH 035/139] refactor: Rename `types_from_title` -> `title_to_type_reprs` --- tools/schemapi/utils.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 82a08ffff..57d4f901e 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -424,7 +424,7 @@ def to_type_repr( # noqa: C901 if self.title: if target == "annotation": - tps.update(types_from_title(self, use_concrete=use_concrete)) + tps.update(title_to_type_reprs(self, use_concrete=use_concrete)) elif target == "doc": tps.add(rst_syntax_for_class(self.title)) @@ -833,7 +833,17 @@ def collapse_type_repr( raise TypeError(msg) -def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: +def title_to_type_reprs(info: SchemaInfo, *, use_concrete: bool) -> set[str]: + """ + Possibly use ``info.title`` as a type, or provide alternative(s). + + Parameters + ---------- + info + Target schema. + use_concrete + Avoid base classes/wrappers that don't provide type info. + """ tp_param: set[str] = {"ExprRef", "ParameterExtent"} # In these cases, a value parameter is also always accepted. # It would be quite complex to further differentiate @@ -873,6 +883,19 @@ def types_from_title(info: SchemaInfo, *, use_concrete: bool) -> set[str]: return tps +def sort_type_reprs(tps: Iterable[str], /) -> list[str]: + # Shorter types are usually the more relevant ones, e.g. `str` instead + # of `SchemaBase`. Output order from set is non-deterministic -> If + # types have same length names, order would be non-deterministic as it is + # returned from sort. Hence, we sort as well by type name as a tie-breaker, + # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts + # for more infos. + # Using lower as we don't want to prefer uppercase such as "None" over + it = sorted(tps, key=str.lower) # Tertiary sort + it = sorted(it, key=len) # Secondary sort + return sorted(it, key=TypeAliasTracer.is_cached) # Primary sort + + def spell_nested_sequence( info: SchemaInfo, *, target: TargetType, use_concrete: bool ) -> str: @@ -912,19 +935,6 @@ def spell_nested_sequence( return f"Sequence[{s}]" -def sort_type_reprs(tps: Iterable[str], /) -> list[str]: - # Shorter types are usually the more relevant ones, e.g. `str` instead - # of `SchemaBase`. Output order from set is non-deterministic -> If - # types have same length names, order would be non-deterministic as it is - # returned from sort. Hence, we sort as well by type name as a tie-breaker, - # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts - # for more infos. - # Using lower as we don't want to prefer uppercase such as "None" over - it = sorted(tps, key=str.lower) # Tertiary sort - it = sorted(it, key=len) # Secondary sort - return sorted(it, key=TypeAliasTracer.is_cached) # Primary sort - - def spell_literal(it: Iterable[str], /) -> str: s = ", ".join(f"{s!r}" for s in it) return f"Literal[{s}]" From ff1a3f5f9d572402d3a259fc1cf3466797a9bc0f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:13:49 +0100 Subject: [PATCH 036/139] fix: Don't escape braces, require full match for `ColorHex` --- altair/vegalite/v5/schema/_typing.py | 6 ++---- tools/generate_schema_wrapper.py | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 52f770dcc..7e32ce0d8 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -133,9 +133,7 @@ class Value(TypedDict, Generic[T]): ColorHex = Annotated[ LiteralString, - re.compile( - r"#[0-9a-f]{{2}}[0-9a-f]{{2}}[0-9a-f]{{2}}([0-9a-f]{{2}})?", re.IGNORECASE - ), + re.compile(r"#[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}([0-9a-f]{2})?", re.IGNORECASE), ] """ A `hexadecimal`_ color code. @@ -165,7 +163,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: it = iter(get_args(ColorHex)) next(it) pattern: re.Pattern[str] = next(it) - return bool(pattern.match(obj)) + return bool(pattern.fullmatch(obj)) VegaThemes: TypeAlias = Literal[ diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 10aa356aa..651175fee 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -308,7 +308,7 @@ class Value(TypedDict, Generic[T]): ColorHex = Annotated[ LiteralString, - re.compile(r"#[0-9a-f]{{2}}[0-9a-f]{{2}}[0-9a-f]{{2}}([0-9a-f]{{2}})?", re.IGNORECASE), + re.compile(r"#[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}([0-9a-f]{2})?", re.IGNORECASE), ] """ A `hexadecimal`_ color code. @@ -337,7 +337,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: it = iter(get_args(ColorHex)) next(it) pattern: re.Pattern[str] = next(it) - return bool(pattern.match(obj)) + return bool(pattern.fullmatch(obj)) ''' From 3b32cf7a70a3e17e100c4141cd045016b73f2725 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:19:48 +0100 Subject: [PATCH 037/139] docs: Add `ColorHex` example with transparency --- altair/vegalite/v5/schema/_typing.py | 1 + tools/generate_schema_wrapper.py | 1 + 2 files changed, 2 insertions(+) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 7e32ce0d8..724a8e1b1 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -150,6 +150,7 @@ class Value(TypedDict, Generic[T]): "#7fffd4" "#000000" "#0000FF" + "#0000ff80" .. _hexadecimal: https://www.w3schools.com/html/html_colors_hex.asp diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 651175fee..854075bba 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -325,6 +325,7 @@ class Value(TypedDict, Generic[T]): "#7fffd4" "#000000" "#0000FF" + "#0000ff80" .. _hexadecimal: https://www.w3schools.com/html/html_colors_hex.asp From 7b1875d711949c9c13be206f1ed867d079ebe819 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:21:53 +0100 Subject: [PATCH 038/139] test(typing): Adds `test_is_color_hex` --- tests/vegalite/v5/test_theme.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 0eab5546d..d3fff5e79 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -1,6 +1,9 @@ +from typing import Any + import pytest import altair.vegalite.v5 as alt +from altair.vegalite.v5.schema._typing import is_color_hex from altair.vegalite.v5.theme import VEGA_THEMES @@ -11,9 +14,28 @@ def chart(): def test_vega_themes(chart): for theme in VEGA_THEMES: - with alt.themes.enable(theme): + with alt.themes.enable(theme): # pyright: ignore dct = chart.to_dict() assert dct["usermeta"] == {"embedOptions": {"theme": theme}} assert dct["config"] == { "view": {"continuousWidth": 300, "continuousHeight": 300} } + + +@pytest.mark.parametrize( + ("color_code", "valid"), + [ + ("#FFFFFF", True), + ("##ff6347", False), + ("#EE82EE", True), + ("#1ec9a0", True), + ("#19B_71", False), + ("#00#761", False), + ("123455", False), + ("#6a5acd ", False), + ("#f8f8f899", True), + ("#6a5acd6E", True), + ], +) +def test_is_color_hex(color_code: Any, *, valid: bool) -> None: + assert is_color_hex(color_code) == valid From 8ff7b00602f57142fce5f9d82794ebf11fd6f465 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:05:25 +0100 Subject: [PATCH 039/139] refactor: Promote `title_to_type_reprs` to a `SchemaInfo` method --- tools/schemapi/utils.py | 99 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 57d4f901e..260bcba0d 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -424,7 +424,7 @@ def to_type_repr( # noqa: C901 if self.title: if target == "annotation": - tps.update(title_to_type_reprs(self, use_concrete=use_concrete)) + tps.update(self.title_to_type_reprs(use_concrete=use_concrete)) elif target == "doc": tps.add(rst_syntax_for_class(self.title)) @@ -483,6 +483,53 @@ def to_type_repr( # noqa: C901 else type_reprs ) + def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: + """ + Possibly use ``self.title`` as a type, or provide alternative(s). + + Parameters + ---------- + use_concrete + Avoid base classes/wrappers that don't provide type info. + """ + tp_param: set[str] = {"ExprRef", "ParameterExtent"} + # In these cases, a value parameter is also always accepted. + # It would be quite complex to further differentiate + # between a value and a selection parameter based on + # the type system (one could + # try to check for the type of the Parameter.param attribute + # but then we would need to write some overload signatures for + # api.param). + EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} + REMAP_TITLE: dict[str, str] = { + "HexColor": "ColorHex", + "OverlayMarkDef": "OverlayMarkDefKwds", + } + title: str = self.title + tps: set[str] = set() + if not use_concrete: + tps.add("SchemaBase") + # To keep type hints simple, we only use the SchemaBase class + # as the type hint for all classes which inherit from it. + if title in tp_param: + tps.add("Parameter") + elif self.is_value(): + value = self.properties["value"] + t = value.to_type_repr(target="annotation", use_concrete=use_concrete) + tps.add(f"Value[{t}]") + elif title in REMAP_TITLE: + tps.add(REMAP_TITLE[title]) + elif ( + (title not in EXCLUDE_TITLE) + and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) + and not self.is_union() + and not self.is_format() + and not self.is_array() + and not self.is_type_alias() + ): + tps.add(title) + return tps + @property def properties(self) -> SchemaProperties: return SchemaProperties( @@ -833,56 +880,6 @@ def collapse_type_repr( raise TypeError(msg) -def title_to_type_reprs(info: SchemaInfo, *, use_concrete: bool) -> set[str]: - """ - Possibly use ``info.title`` as a type, or provide alternative(s). - - Parameters - ---------- - info - Target schema. - use_concrete - Avoid base classes/wrappers that don't provide type info. - """ - tp_param: set[str] = {"ExprRef", "ParameterExtent"} - # In these cases, a value parameter is also always accepted. - # It would be quite complex to further differentiate - # between a value and a selection parameter based on - # the type system (one could - # try to check for the type of the Parameter.param attribute - # but then we would need to write some overload signatures for - # api.param). - EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} - REMAP_TITLE: dict[str, str] = { - "HexColor": "ColorHex", - "OverlayMarkDef": "OverlayMarkDefKwds", - } - title: str = info.title - tps: set[str] = set() - if not use_concrete: - tps.add("SchemaBase") - # To keep type hints simple, we only use the SchemaBase class - # as the type hint for all classes which inherit from it. - if title in tp_param: - tps.add("Parameter") - elif info.is_value(): - value = info.properties["value"] - t = value.to_type_repr(target="annotation", use_concrete=use_concrete) - tps.add(f"Value[{t}]") - elif title in REMAP_TITLE: - tps.add(REMAP_TITLE[title]) - elif ( - (title not in EXCLUDE_TITLE) - and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) - and not info.is_union() - and not info.is_format() - and not info.is_array() - and not info.is_type_alias() - ): - tps.add(title) - return tps - - def sort_type_reprs(tps: Iterable[str], /) -> list[str]: # Shorter types are usually the more relevant ones, e.g. `str` instead # of `SchemaBase`. Output order from set is non-deterministic -> If From a59a7bd3858ecdd7f9beaa001375a3207a4b0cfe Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:44:13 +0100 Subject: [PATCH 040/139] perf: Optimize some checks in `SchemaInfo` --- tools/schemapi/utils.py | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 260bcba0d..1e0493980 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -10,16 +10,7 @@ from html import unescape from itertools import chain from operator import itemgetter -from typing import ( - TYPE_CHECKING, - Any, - Final, - Iterable, - Iterator, - Literal, - Sequence, - overload, -) +from typing import TYPE_CHECKING, Any, Iterable, Iterator, Literal, Sequence, overload import mistune from mistune.renderers.rst import RSTRenderer as _RSTRenderer @@ -35,9 +26,15 @@ TargetType: TypeAlias = Literal["annotation", "doc"] -EXCLUDE_KEYS: Final = ("definitions", "title", "description", "$schema", "id") - -jsonschema_to_python_types = { +EXCLUDE_KEYS: frozenset[ + Literal["definitions", "title", "description", "$schema", "id"] +] = frozenset(("definitions", "title", "description", "$schema", "id")) +COMPOUND_KEYS: tuple[Literal["anyOf"], Literal["oneOf"], Literal["allOf"]] = ( + "anyOf", + "oneOf", + "allOf", +) +jsonschema_to_python_types: dict[str, str] = { "string": "str", "number": "float", "integer": "int", @@ -559,16 +556,19 @@ def type(self) -> str | list[Any] | None: return self.schema.get("type", None) @property - def anyOf(self) -> list[SchemaInfo]: - return [self.child(s) for s in self.schema.get("anyOf", [])] + def anyOf(self) -> Iterator[SchemaInfo]: + for s in self.schema.get("anyOf", []): + yield self.child(s) @property - def oneOf(self) -> list[SchemaInfo]: - return [self.child(s) for s in self.schema.get("oneOf", [])] + def oneOf(self) -> Iterator[SchemaInfo]: + for s in self.schema.get("oneOf", []): + yield self.child(s) @property - def allOf(self) -> list[SchemaInfo]: - return [self.child(s) for s in self.schema.get("allOf", [])] + def allOf(self) -> Iterator[SchemaInfo]: + for s in self.schema.get("allOf", []): + yield self.child(s) @property def not_(self) -> SchemaInfo: @@ -621,10 +621,10 @@ def is_enum(self) -> bool: return "enum" in self.schema def is_empty(self) -> bool: - return not (set(self.schema.keys()) - set(EXCLUDE_KEYS)) + return not (self.schema.keys() - EXCLUDE_KEYS) def is_compound(self) -> bool: - return any(key in self.schema for key in ["anyOf", "allOf", "oneOf"]) + return any(key in self.schema for key in COMPOUND_KEYS) def is_anyOf(self) -> bool: return "anyOf" in self.schema @@ -641,13 +641,13 @@ def is_not(self) -> bool: def is_object(self) -> bool: if self.type == "object": return True - elif self.type is not None: + elif self.type: return False elif ( self.properties or self.required - or self.patternProperties or self.additionalProperties + or self.patternProperties ): return True else: From d68fcdbc2e38cd4faaff49879e0ba706f9d0e082 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:56:30 +0100 Subject: [PATCH 041/139] feat: Use a dynamic `ClassVar` for remapping titles Previously required maintaining two sets of definitions --- tools/generate_schema_wrapper.py | 9 ++++++++- tools/schemapi/utils.py | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 854075bba..0314cefe4 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -846,7 +846,14 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] sub_dicts: dict[str, str] = {} - MANUAL_DEFS = "ScaleInvalidDataConfig", "OverlayMarkDef" + MANUAL_DEFS = ( + "ScaleInvalidDataConfig", + "OverlayMarkDef", + "LinearGradient", + "RadialGradient", + ) + SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) + SchemaInfo._remap_title.update((k, f"{k}Kwds") for k in MANUAL_DEFS) for prop, prop_info in config.properties.items(): if (classname := prop_info.refname) and classname.endswith("Config"): diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 1e0493980..e33536a29 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -10,7 +10,16 @@ from html import unescape from itertools import chain from operator import itemgetter -from typing import TYPE_CHECKING, Any, Iterable, Iterator, Literal, Sequence, overload +from typing import ( + TYPE_CHECKING, + Any, + ClassVar, + Iterable, + Iterator, + Literal, + Sequence, + overload, +) import mistune from mistune.renderers.rst import RSTRenderer as _RSTRenderer @@ -340,6 +349,8 @@ def values(self) -> Iterator[SchemaInfo]: class SchemaInfo: """A wrapper for inspecting a JSON schema.""" + _remap_title: ClassVar[dict[str, str]] = {} + def __init__( self, schema: dict[str, Any], rootschema: dict[str, Any] | None = None ) -> None: @@ -498,10 +509,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: # but then we would need to write some overload signatures for # api.param). EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} - REMAP_TITLE: dict[str, str] = { - "HexColor": "ColorHex", - "OverlayMarkDef": "OverlayMarkDefKwds", - } + REMAP_TITLE: dict[str, str] = SchemaInfo._remap_title title: str = self.title tps: set[str] = set() if not use_concrete: From e5c4b7fb4e9bb55d51dd047229cd0f098f744a54 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 14 Aug 2024 21:58:58 +0100 Subject: [PATCH 042/139] feat(typing): Adds `LinearGradientKwds`, `RadialGradientKwds` https://github.com/vega/altair/pull/3536#discussion_r1716906654 --- altair/vegalite/v5/schema/_config.py | 76 +++++++++++++++++++--------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index cd1aa7296..214664a50 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -23,7 +23,7 @@ class RectConfigKwds(TypedDict, total=False): baseline: str | Baseline_T binSpacing: float blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T continuousBandSize: float cornerRadius: float cornerRadiusBottomLeft: float @@ -38,7 +38,7 @@ class RectConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -65,7 +65,7 @@ class RectConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -100,7 +100,7 @@ class AreaConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -113,7 +113,7 @@ class AreaConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -141,7 +141,7 @@ class AreaConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -261,7 +261,7 @@ class BarConfigKwds(TypedDict, total=False): baseline: str | Baseline_T binSpacing: float blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T continuousBandSize: float cornerRadius: float cornerRadiusBottomLeft: float @@ -277,7 +277,7 @@ class BarConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -304,7 +304,7 @@ class BarConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -391,7 +391,7 @@ class MarkConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -404,7 +404,7 @@ class MarkConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -430,7 +430,7 @@ class MarkConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -641,7 +641,7 @@ class LineConfigKwds(TypedDict, total=False): aspect: bool baseline: str | Baseline_T blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -654,7 +654,7 @@ class LineConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -681,7 +681,7 @@ class LineConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -823,7 +823,7 @@ class TickConfigKwds(TypedDict, total=False): bandSize: float baseline: str | Baseline_T blend: Blend_T - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -836,7 +836,7 @@ class TickConfigKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -862,7 +862,7 @@ class TickConfigKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -956,14 +956,20 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" angle: str | Value[float] - color: str | Value[ColorHex | LinearGradient | RadialGradient | ColorName_T] - fill: str | Value[None | ColorHex | LinearGradient | RadialGradient | ColorName_T] + color: str | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + fill: ( + str + | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) fillOpacity: str | Value[float] opacity: str | Value[float] radius: str | Value[float] shape: str | Value[str] size: str | Value[float] - stroke: str | Value[None | ColorHex | LinearGradient | RadialGradient | ColorName_T] + stroke: ( + str + | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) strokeDash: str | Value[Sequence[float]] strokeOpacity: str | Value[float] strokeWidth: str | Value[float] @@ -986,7 +992,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): baseline: str | Baseline_T blend: Blend_T clip: bool - color: ColorHex | LinearGradient | RadialGradient | ColorName_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -999,7 +1005,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): dy: float ellipsis: str endAngle: float - fill: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float filled: bool font: str @@ -1027,7 +1033,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): size: float smooth: bool startAngle: float - stroke: None | ColorHex | LinearGradient | RadialGradient | ColorName_T + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float @@ -1058,6 +1064,28 @@ class OverlayMarkDefKwds(TypedDict, total=False): yOffset: float +class LinearGradientKwds(TypedDict, total=False): + """Placeholder doc.""" + + id: str + x1: float + x2: float + y1: float + y2: float + + +class RadialGradientKwds(TypedDict, total=False): + """Placeholder doc.""" + + id: str + r1: float + r2: float + x1: float + x2: float + y1: float + y2: float + + # TODO: Non-`TypedDict` args From 0c63dc7c0ae76c553f1b7bf595570ff3893d2682 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:35:01 +0100 Subject: [PATCH 043/139] fix: Include `ArgInfo.required` in `TypedDict`(s) Had not been needed so far, but `...GradientKwds` was missing `gradient`, `stops` --- altair/vegalite/v5/schema/_config.py | 4 ++++ tools/generate_schema_wrapper.py | 4 ++-- tools/schemapi/codegen.py | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 214664a50..0f2a65790 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -1067,6 +1067,8 @@ class OverlayMarkDefKwds(TypedDict, total=False): class LinearGradientKwds(TypedDict, total=False): """Placeholder doc.""" + gradient: str + stops: Sequence[GradientStop] id: str x1: float x2: float @@ -1077,6 +1079,8 @@ class LinearGradientKwds(TypedDict, total=False): class RadialGradientKwds(TypedDict, total=False): """Placeholder doc.""" + gradient: str + stops: Sequence[GradientStop] id: str r1: float r2: float diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 0314cefe4..80614ff71 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -834,9 +834,9 @@ def generate_mark_args( def gen_config_typed_dict(prop_info: SchemaInfo) -> str: arg_info = codegen.get_args(prop_info) - args = sorted(arg_info.kwds) props = prop_info.properties - return "\n ".join(_generate_sig_args(args, props, kind="typed_dict")) + it = _generate_sig_args(arg_info.required_kwds, props, kind="typed_dict") + return "\n ".join(it) def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index c7ca73a6d..b99261be7 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -37,6 +37,11 @@ class ArgInfo: invalid_kwds: set[str] additional: bool + @property + def required_kwds(self) -> tuple[str, ...]: + """Independently sort, then concat ``.required``, ``.kwds`` properties.""" + return *sorted(self.required), *sorted(self.kwds) + def get_args(info: SchemaInfo) -> ArgInfo: """Return the list of args & kwds for building the __init__ function.""" From 46fa848b459c2f407e864e59c9dd0bc8a0298354 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:40:50 +0100 Subject: [PATCH 044/139] feat(typing): Adds `GradientStopKwds` --- altair/vegalite/v5/schema/_config.py | 11 +++++++++-- tools/generate_schema_wrapper.py | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 0f2a65790..b8fc0f1e7 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -1068,7 +1068,7 @@ class LinearGradientKwds(TypedDict, total=False): """Placeholder doc.""" gradient: str - stops: Sequence[GradientStop] + stops: Sequence[GradientStopKwds] id: str x1: float x2: float @@ -1080,7 +1080,7 @@ class RadialGradientKwds(TypedDict, total=False): """Placeholder doc.""" gradient: str - stops: Sequence[GradientStop] + stops: Sequence[GradientStopKwds] id: str r1: float r2: float @@ -1090,6 +1090,13 @@ class RadialGradientKwds(TypedDict, total=False): y2: float +class GradientStopKwds(TypedDict, total=False): + """Placeholder doc.""" + + color: ColorHex | ColorName_T + offset: float + + # TODO: Non-`TypedDict` args diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 80614ff71..0fea9c8dc 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -851,6 +851,7 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: "OverlayMarkDef", "LinearGradient", "RadialGradient", + "GradientStop", ) SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) SchemaInfo._remap_title.update((k, f"{k}Kwds") for k in MANUAL_DEFS) From d3f2898c268528cdc3d3dcce96e7ce22d41e2770 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:28:14 +0100 Subject: [PATCH 045/139] ci: Remove old dependency `m2r` from `mypy` Not needed since #3506 --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e2bdf7783..92b7830d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -423,7 +423,6 @@ module = [ "nbformat.*", "ipykernel.*", "ibis.*", - "m2r.*", # This refers to schemapi in the tools folder which is imported # by the tools scripts such as generate_schema_wrapper.py "schemapi.*" From 7d3eac95e2e45a5757827f579215aa8f15ba9461 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:05:53 +0100 Subject: [PATCH 046/139] revert(ruff): Remove default `ruff` setting --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c88a47ec9..902196e3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -195,7 +195,6 @@ exclude = [ "tests/examples_methods_syntax", "tests/test_transformed_data.py", ] -extend-include = ["*.ipynb"] [tool.ruff.lint] # https://docs.astral.sh/ruff/preview/ From 4fd762856304d40a6ab1f9229be96fd22544a6cc Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:08:48 +0100 Subject: [PATCH 047/139] feat(typing): Temporarily duplicate (#3538) Still need the changes here prior to that merging. It solves issues in `_config.py` as well. https://github.com/vega/altair/pull/3538 --- altair/vegalite/v5/api.py | 8 +- altair/vegalite/v5/schema/_config.py | 135 ++--- altair/vegalite/v5/schema/_typing.py | 14 +- altair/vegalite/v5/schema/channels.py | 446 ++++++++------- altair/vegalite/v5/schema/core.py | 746 ++++++++++++++------------ altair/vegalite/v5/schema/mixins.py | 312 +++++++---- tools/schemapi/codegen.py | 4 +- tools/schemapi/utils.py | 74 ++- 8 files changed, 988 insertions(+), 751 deletions(-) diff --git a/altair/vegalite/v5/api.py b/altair/vegalite/v5/api.py index f050dd1d1..e77d62e00 100644 --- a/altair/vegalite/v5/api.py +++ b/altair/vegalite/v5/api.py @@ -77,8 +77,10 @@ AggregateOp_T, AutosizeType_T, ColorName_T, + CompositeMark_T, ImputeMethod_T, LayoutAlign_T, + Mark_T, MultiTimeUnit_T, OneOrSeq, ProjectionType_T, @@ -3662,9 +3664,9 @@ def __init__( self, data: Optional[ChartDataType] = Undefined, encoding: Optional[FacetedEncoding] = Undefined, - mark: Optional[str | AnyMark] = Undefined, - width: Optional[int | str | dict | Step] = Undefined, - height: Optional[int | str | dict | Step] = Undefined, + mark: Optional[AnyMark | Mark_T | CompositeMark_T] = Undefined, + width: Optional[int | dict | Step | Literal["container"]] = Undefined, + height: Optional[int | dict | Step | Literal["container"]] = Undefined, **kwargs: Any, ) -> None: # Data type hints won't match with what TopLevelUnitSpec expects diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index b8fc0f1e7..a330620cb 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -20,7 +20,7 @@ class RectConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T binSpacing: float blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T @@ -83,10 +83,10 @@ class RectConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class AreaConfigKwds(TypedDict, total=False): @@ -98,7 +98,7 @@ class AreaConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float @@ -134,7 +134,7 @@ class AreaConfigKwds(TypedDict, total=False): orient: Orientation_T outerRadius: float padAngle: float - point: str | bool | OverlayMarkDefKwds + point: bool | OverlayMarkDefKwds | Literal["transparent"] radius: float radius2: float shape: str @@ -159,10 +159,10 @@ class AreaConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class AxisConfigKwds(TypedDict, total=False): @@ -190,7 +190,7 @@ class AxisConfigKwds(TypedDict, total=False): gridWidth: float labelAlign: Align_T labelAngle: float - labelBaseline: str | Baseline_T + labelBaseline: TextBaseline_T labelBound: bool | float labelColor: None | ColorHex | ColorName_T labelExpr: str @@ -204,7 +204,7 @@ class AxisConfigKwds(TypedDict, total=False): labelLineHeight: float labelOffset: float labelOpacity: float - labelOverlap: str | bool + labelOverlap: bool | Literal["greedy", "parity"] labelPadding: float labelSeparation: float labels: bool @@ -232,7 +232,7 @@ class AxisConfigKwds(TypedDict, total=False): titleAlign: Align_T titleAnchor: TitleAnchor_T titleAngle: float - titleBaseline: str | Baseline_T + titleBaseline: TextBaseline_T titleColor: None | ColorHex | ColorName_T titleFont: str titleFontSize: float @@ -258,7 +258,7 @@ class BarConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T binSpacing: float blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T @@ -322,10 +322,10 @@ class BarConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class BoxPlotConfigKwds(TypedDict, total=False): @@ -340,7 +340,7 @@ class BoxPlotConfigKwds(TypedDict, total=False): | RectConfigKwds | TickConfigKwds ) - extent: str | float + extent: float | Literal["min-max"] median: ( bool | BarConfigKwds @@ -389,7 +389,7 @@ class MarkConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float @@ -448,10 +448,10 @@ class MarkConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class CompositionConfigKwds(TypedDict, total=False): @@ -521,7 +521,7 @@ class HeaderConfigKwds(TypedDict, total=False): labelAlign: Align_T labelAnchor: TitleAnchor_T labelAngle: float - labelBaseline: str | Baseline_T + labelBaseline: TextBaseline_T labelColor: ColorHex | ColorName_T labelExpr: str labelFont: str @@ -538,7 +538,7 @@ class HeaderConfigKwds(TypedDict, total=False): titleAlign: Align_T titleAnchor: TitleAnchor_T titleAngle: float - titleBaseline: str | Baseline_T + titleBaseline: TextBaseline_T titleColor: ColorHex | ColorName_T titleFont: str titleFontSize: float @@ -576,7 +576,7 @@ class LegendConfigKwds(TypedDict, total=False): gradientVerticalMinLength: float gridAlign: LayoutAlign_T labelAlign: Align_T - labelBaseline: str | Baseline_T + labelBaseline: TextBaseline_T labelColor: None | ColorHex | ColorName_T labelFont: str labelFontSize: float @@ -585,7 +585,7 @@ class LegendConfigKwds(TypedDict, total=False): labelLimit: float labelOffset: float labelOpacity: float - labelOverlap: str | bool + labelOverlap: bool | Literal["greedy", "parity"] labelPadding: float labelSeparation: float layout: Map @@ -615,7 +615,7 @@ class LegendConfigKwds(TypedDict, total=False): title: None titleAlign: Align_T titleAnchor: TitleAnchor_T - titleBaseline: str | Baseline_T + titleBaseline: TextBaseline_T titleColor: None | ColorHex | ColorName_T titleFont: str titleFontSize: float @@ -639,7 +639,7 @@ class LineConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float @@ -674,7 +674,7 @@ class LineConfigKwds(TypedDict, total=False): orient: Orientation_T outerRadius: float padAngle: float - point: str | bool | OverlayMarkDefKwds + point: bool | OverlayMarkDefKwds | Literal["transparent"] radius: float radius2: float shape: str @@ -699,10 +699,10 @@ class LineConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class ProjectionConfigKwds(TypedDict, total=False): @@ -821,7 +821,7 @@ class TickConfigKwds(TypedDict, total=False): ariaRoleDescription: str aspect: bool bandSize: float - baseline: str | Baseline_T + baseline: TextBaseline_T blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T cornerRadius: float @@ -881,10 +881,10 @@ class TickConfigKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float - y: str | float - y2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] class TitleConfigKwds(TypedDict, total=False): @@ -894,7 +894,7 @@ class TitleConfigKwds(TypedDict, total=False): anchor: TitleAnchor_T angle: float aria: bool - baseline: str | Baseline_T + baseline: TextBaseline_T color: None | ColorHex | ColorName_T dx: float dy: float @@ -955,29 +955,32 @@ class ViewConfigKwds(TypedDict, total=False): class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" - angle: str | Value[float] - color: str | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + angle: Value[float] | Literal["zero-or-min"] + color: ( + Literal["zero-or-min"] + | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) fill: ( - str + Literal["zero-or-min"] | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] ) - fillOpacity: str | Value[float] - opacity: str | Value[float] - radius: str | Value[float] - shape: str | Value[str] - size: str | Value[float] + fillOpacity: Value[float] | Literal["zero-or-min"] + opacity: Value[float] | Literal["zero-or-min"] + radius: Value[float] | Literal["zero-or-min"] + shape: Value[str] | Literal["zero-or-min"] + size: Value[float] | Literal["zero-or-min"] stroke: ( - str + Literal["zero-or-min"] | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] ) - strokeDash: str | Value[Sequence[float]] - strokeOpacity: str | Value[float] - strokeWidth: str | Value[float] - theta: str | Value[float] - x: str | Value[str | float] - xOffset: str | Value[float] - y: str | Value[str | float] - yOffset: str | Value[float] + strokeDash: Literal["zero-or-min"] | Value[Sequence[float]] + strokeOpacity: Value[float] | Literal["zero-or-min"] + strokeWidth: Value[float] | Literal["zero-or-min"] + theta: Value[float] | Literal["zero-or-min"] + x: Literal["zero-or-min"] | Value[float | Literal["width"]] + xOffset: Value[float] | Literal["zero-or-min"] + y: Literal["zero-or-min"] | Value[float | Literal["height"]] + yOffset: Value[float] | Literal["zero-or-min"] class OverlayMarkDefKwds(TypedDict, total=False): @@ -989,7 +992,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - baseline: str | Baseline_T + baseline: TextBaseline_T blend: Blend_T clip: bool color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T @@ -1054,12 +1057,12 @@ class OverlayMarkDefKwds(TypedDict, total=False): tooltip: str | bool | None | float | TooltipContent url: str width: float - x: str | float - x2: str | float + x: float | Literal["width"] + x2: float | Literal["width"] x2Offset: float xOffset: float - y: str | float - y2: str | float + y: float | Literal["height"] + y2: float | Literal["height"] y2Offset: float yOffset: float @@ -1067,7 +1070,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): class LinearGradientKwds(TypedDict, total=False): """Placeholder doc.""" - gradient: str + gradient: Literal["linear"] stops: Sequence[GradientStopKwds] id: str x1: float @@ -1079,7 +1082,7 @@ class LinearGradientKwds(TypedDict, total=False): class RadialGradientKwds(TypedDict, total=False): """Placeholder doc.""" - gradient: str + gradient: Literal["radial"] stops: Sequence[GradientStopKwds] id: str r1: float diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 724a8e1b1..b7bb309bc 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -40,14 +40,17 @@ "AllSortString_T", "AutosizeType_T", "AxisOrient_T", - "Baseline_T", "BinnedTimeUnit_T", "Blend_T", + "BoxPlot_T", "ColorHex", "ColorName_T", "ColorScheme_T", + "CompositeMark_T", "Cursor_T", + "ErrorBand_T", "ErrorBarExtent_T", + "ErrorBar_T", "FontWeight_T", "ImputeMethod_T", "Interpolate_T", @@ -80,6 +83,7 @@ "StandardType_T", "StrokeCap_T", "StrokeJoin_T", + "TextBaseline_T", "TextDirection_T", "TimeInterval_T", "TitleAnchor_T", @@ -242,7 +246,6 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: ] AutosizeType_T: TypeAlias = Literal["pad", "none", "fit", "fit-x", "fit-y"] AxisOrient_T: TypeAlias = Literal["top", "bottom", "left", "right"] -Baseline_T: TypeAlias = Literal["top", "middle", "bottom"] BinnedTimeUnit_T: TypeAlias = Literal[ "binnedyear", "binnedyearquarter", @@ -291,6 +294,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: "color", "luminosity", ] +BoxPlot_T: TypeAlias = Literal["boxplot"] ColorName_T: TypeAlias = Literal[ "black", "silver", @@ -775,6 +779,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: "rainbow", "sinebow", ] +CompositeMark_T: TypeAlias = Literal["boxplot", "errorbar", "errorband"] Cursor_T: TypeAlias = Literal[ "auto", "default", @@ -813,7 +818,9 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: "grab", "grabbing", ] +ErrorBand_T: TypeAlias = Literal["errorband"] ErrorBarExtent_T: TypeAlias = Literal["ci", "iqr", "stderr", "stdev"] +ErrorBar_T: TypeAlias = Literal["errorbar"] FontWeight_T: TypeAlias = Literal[ "normal", "bold", "lighter", "bolder", 100, 200, 300, 400, 500, 600, 700, 800, 900 ] @@ -1149,6 +1156,9 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: StandardType_T: TypeAlias = Literal["quantitative", "ordinal", "temporal", "nominal"] StrokeCap_T: TypeAlias = Literal["butt", "round", "square"] StrokeJoin_T: TypeAlias = Literal["miter", "round", "bevel"] +TextBaseline_T: TypeAlias = Literal[ + "alphabetic", "top", "middle", "bottom", "line-top", "line-bottom" +] TextDirection_T: TypeAlias = Literal["ltr", "rtl"] TimeInterval_T: TypeAlias = Literal[ "millisecond", "second", "minute", "hour", "day", "week", "month", "year" diff --git a/altair/vegalite/v5/schema/channels.py b/altair/vegalite/v5/schema/channels.py index 9f3a4300a..6e0ca993b 100644 --- a/altair/vegalite/v5/schema/channels.py +++ b/altair/vegalite/v5/schema/channels.py @@ -333,7 +333,7 @@ class Angle(FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDef **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -371,7 +371,7 @@ class Angle(FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDef **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -568,7 +568,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -583,7 +583,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -621,7 +623,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -663,10 +665,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1267,7 +1269,7 @@ class Color( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -1305,7 +1307,7 @@ class Color( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -1502,7 +1504,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -1517,7 +1519,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1555,7 +1559,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -1597,10 +1601,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -2224,7 +2228,7 @@ class Column(FieldChannelMixin, core.RowColumnEncodingFieldDef): **Default value**: Depends on ``"spacing"`` property of `the view composition configuration `__ (``20`` by default) - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -2387,7 +2391,7 @@ def header( labelAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, labelAngle: Optional[float] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -2410,7 +2414,7 @@ def header( titleAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, titleAngle: Optional[float] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -2607,7 +2611,7 @@ class Description(FieldChannelMixin, core.StringFieldDefWithCondition): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -2682,7 +2686,7 @@ class Description(FieldChannelMixin, core.StringFieldDefWithCondition): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -2818,7 +2822,7 @@ def bin( ) -> Description: ... @overload - def bin(self, _: str, **kwds) -> Description: ... + def bin(self, _: Literal["binned"], **kwds) -> Description: ... @overload def bin(self, _: None, **kwds) -> Description: ... @@ -2948,7 +2952,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -3140,7 +3144,7 @@ class Detail(FieldChannelMixin, core.FieldDefWithoutScale): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -3176,7 +3180,7 @@ class Detail(FieldChannelMixin, core.FieldDefWithoutScale): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -3312,7 +3316,7 @@ def bin( ) -> Detail: ... @overload - def bin(self, _: str, **kwds) -> Detail: ... + def bin(self, _: Literal["binned"], **kwds) -> Detail: ... @overload def bin(self, _: None, **kwds) -> Detail: ... @@ -3411,7 +3415,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, timeUnit: Optional[ dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T @@ -3578,7 +3582,7 @@ class Facet(FieldChannelMixin, core.FacetEncodingFieldDef): **Default value**: Depends on ``"spacing"`` property of `the view composition configuration `__ (``20`` by default) - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -3763,7 +3767,7 @@ def header( labelAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, labelAngle: Optional[float] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -3786,7 +3790,7 @@ def header( titleAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, titleAngle: Optional[float] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -4063,7 +4067,7 @@ class Fill( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -4101,7 +4105,7 @@ class Fill( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -4298,7 +4302,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -4313,7 +4317,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -4351,7 +4357,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -4393,10 +4399,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -4999,7 +5005,7 @@ class FillOpacity( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -5037,7 +5043,7 @@ class FillOpacity( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -5234,7 +5240,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -5249,7 +5255,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -5287,7 +5295,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -5329,10 +5337,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -5867,7 +5875,7 @@ class Href(FieldChannelMixin, core.StringFieldDefWithCondition): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -5942,7 +5950,7 @@ class Href(FieldChannelMixin, core.StringFieldDefWithCondition): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -6078,7 +6086,7 @@ def bin( ) -> Href: ... @overload - def bin(self, _: str, **kwds) -> Href: ... + def bin(self, _: Literal["binned"], **kwds) -> Href: ... @overload def bin(self, _: None, **kwds) -> Href: ... @@ -6208,7 +6216,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -6400,7 +6408,7 @@ class Key(FieldChannelMixin, core.FieldDefWithoutScale): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -6436,7 +6444,7 @@ class Key(FieldChannelMixin, core.FieldDefWithoutScale): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -6572,7 +6580,7 @@ def bin( ) -> Key: ... @overload - def bin(self, _: str, **kwds) -> Key: ... + def bin(self, _: Literal["binned"], **kwds) -> Key: ... @overload def bin(self, _: None, **kwds) -> Key: ... @@ -6671,7 +6679,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, timeUnit: Optional[ dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T @@ -6750,7 +6758,7 @@ class Latitude(FieldChannelMixin, core.LatLongFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -6779,7 +6787,7 @@ class Latitude(FieldChannelMixin, core.LatLongFieldDef): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. - type : str + type : Literal['quantitative'] The type of measurement (``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"``) for the encoded field or constant value (``datum``). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -6956,7 +6964,7 @@ def title(self, _: list[str], **kwds) -> Latitude: ... def title(self, _: None, **kwds) -> Latitude: ... @overload - def type(self, _: str, **kwds) -> Latitude: ... + def type(self, _: Literal["quantitative"], **kwds) -> Latitude: ... def __init__( self, @@ -6969,7 +6977,7 @@ def __init__( dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T ] = Undefined, title: Optional[str | None | SchemaBase | Sequence[str]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["quantitative"]] = Undefined, **kwds, ): super().__init__( @@ -7177,7 +7185,7 @@ class Latitude2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -7483,7 +7491,7 @@ class Latitude2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -7553,7 +7561,7 @@ class Longitude(FieldChannelMixin, core.LatLongFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -7582,7 +7590,7 @@ class Longitude(FieldChannelMixin, core.LatLongFieldDef): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. - type : str + type : Literal['quantitative'] The type of measurement (``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"``) for the encoded field or constant value (``datum``). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -7759,7 +7767,7 @@ def title(self, _: list[str], **kwds) -> Longitude: ... def title(self, _: None, **kwds) -> Longitude: ... @overload - def type(self, _: str, **kwds) -> Longitude: ... + def type(self, _: Literal["quantitative"], **kwds) -> Longitude: ... def __init__( self, @@ -7772,7 +7780,7 @@ def __init__( dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T ] = Undefined, title: Optional[str | None | SchemaBase | Sequence[str]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["quantitative"]] = Undefined, **kwds, ): super().__init__( @@ -7980,7 +7988,7 @@ class Longitude2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -8286,7 +8294,7 @@ class Longitude2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -8387,7 +8395,7 @@ class Opacity( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -8425,7 +8433,7 @@ class Opacity( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -8622,7 +8630,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -8637,7 +8645,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -8675,7 +8685,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -8717,10 +8727,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -9253,7 +9263,7 @@ class Order(FieldChannelMixin, core.OrderFieldDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -9291,7 +9301,7 @@ class Order(FieldChannelMixin, core.OrderFieldDef): if ``aggregate`` is ``count``. sort : :class:`SortOrder`, Literal['ascending', 'descending'] The sort order. One of ``"ascending"`` (default) or ``"descending"``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -9427,7 +9437,7 @@ def bin( ) -> Order: ... @overload - def bin(self, _: str, **kwds) -> Order: ... + def bin(self, _: Literal["binned"], **kwds) -> Order: ... @overload def bin(self, _: None, **kwds) -> Order: ... @@ -9529,7 +9539,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, sort: Optional[SchemaBase | SortOrder_T] = Undefined, timeUnit: Optional[ @@ -9630,7 +9640,7 @@ class Radius(FieldChannelMixin, core.PositionFieldDefBase): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -9679,7 +9689,7 @@ class Radius(FieldChannelMixin, core.PositionFieldDefBase): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -9747,7 +9757,7 @@ class Radius(FieldChannelMixin, core.PositionFieldDefBase): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -9883,7 +9893,7 @@ def bin( ) -> Radius: ... @overload - def bin(self, _: str, **kwds) -> Radius: ... + def bin(self, _: Literal["binned"], **kwds) -> Radius: ... @overload def bin(self, _: None, **kwds) -> Radius: ... @@ -9907,10 +9917,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -10080,7 +10090,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, sort: Optional[ @@ -10276,10 +10286,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -10367,7 +10377,7 @@ class RadiusValue(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -10440,7 +10450,7 @@ class Radius2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -10746,7 +10756,7 @@ class Radius2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -10868,7 +10878,7 @@ class Row(FieldChannelMixin, core.RowColumnEncodingFieldDef): **Default value**: Depends on ``"spacing"`` property of `the view composition configuration `__ (``20`` by default) - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -11031,7 +11041,7 @@ def header( labelAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, labelAngle: Optional[float] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -11054,7 +11064,7 @@ def header( titleAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, titleAngle: Optional[float] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -11319,7 +11329,7 @@ class Shape( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -11357,7 +11367,7 @@ class Shape( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -11554,7 +11564,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -11569,7 +11579,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -11607,7 +11619,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -11649,10 +11661,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -12253,7 +12265,7 @@ class Size(FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDefn **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -12291,7 +12303,7 @@ class Size(FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDefn **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -12488,7 +12500,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -12503,7 +12515,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -12541,7 +12555,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -12583,10 +12597,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -13187,7 +13201,7 @@ class Stroke( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -13225,7 +13239,7 @@ class Stroke( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -13422,7 +13436,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -13437,7 +13451,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -13475,7 +13491,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -13517,10 +13533,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -14123,7 +14139,7 @@ class StrokeDash( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -14161,7 +14177,7 @@ class StrokeDash( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -14358,7 +14374,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -14373,7 +14389,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -14411,7 +14429,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -14453,10 +14471,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -15058,7 +15076,7 @@ class StrokeOpacity( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -15096,7 +15114,7 @@ class StrokeOpacity( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -15293,7 +15311,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -15308,7 +15326,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -15346,7 +15366,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -15388,10 +15408,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -15993,7 +16013,7 @@ class StrokeWidth( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -16031,7 +16051,7 @@ class StrokeWidth( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -16228,7 +16248,7 @@ def legend( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -16243,7 +16263,9 @@ def legend( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -16281,7 +16303,7 @@ def legend( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -16323,10 +16345,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -16861,7 +16883,7 @@ class Text(FieldChannelMixin, core.FieldOrDatumDefWithConditionStringFieldDefTex Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -16936,7 +16958,7 @@ class Text(FieldChannelMixin, core.FieldOrDatumDefWithConditionStringFieldDefTex * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -17072,7 +17094,7 @@ def bin( ) -> Text: ... @overload - def bin(self, _: str, **kwds) -> Text: ... + def bin(self, _: Literal["binned"], **kwds) -> Text: ... @overload def bin(self, _: None, **kwds) -> Text: ... @@ -17206,7 +17228,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -17477,7 +17499,7 @@ def condition( self, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, format: Optional[str | dict | SchemaBase] = Undefined, formatType: Optional[str] = Undefined, @@ -17495,7 +17517,7 @@ def condition( self, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, empty: Optional[bool] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, format: Optional[str | dict | SchemaBase] = Undefined, @@ -17567,7 +17589,7 @@ class Theta(FieldChannelMixin, core.PositionFieldDefBase): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -17616,7 +17638,7 @@ class Theta(FieldChannelMixin, core.PositionFieldDefBase): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -17684,7 +17706,7 @@ class Theta(FieldChannelMixin, core.PositionFieldDefBase): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -17820,7 +17842,7 @@ def bin( ) -> Theta: ... @overload - def bin(self, _: str, **kwds) -> Theta: ... + def bin(self, _: Literal["binned"], **kwds) -> Theta: ... @overload def bin(self, _: None, **kwds) -> Theta: ... @@ -17844,10 +17866,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -18017,7 +18039,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, sort: Optional[ @@ -18213,10 +18235,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -18304,7 +18326,7 @@ class ThetaValue(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -18377,7 +18399,7 @@ class Theta2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -18683,7 +18705,7 @@ class Theta2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -18717,7 +18739,7 @@ class Tooltip(FieldChannelMixin, core.StringFieldDefWithCondition): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -18792,7 +18814,7 @@ class Tooltip(FieldChannelMixin, core.StringFieldDefWithCondition): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -18928,7 +18950,7 @@ def bin( ) -> Tooltip: ... @overload - def bin(self, _: str, **kwds) -> Tooltip: ... + def bin(self, _: Literal["binned"], **kwds) -> Tooltip: ... @overload def bin(self, _: None, **kwds) -> Tooltip: ... @@ -19058,7 +19080,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -19248,7 +19270,7 @@ class Url(FieldChannelMixin, core.StringFieldDefWithCondition): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -19323,7 +19345,7 @@ class Url(FieldChannelMixin, core.StringFieldDefWithCondition): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -19459,7 +19481,7 @@ def bin( ) -> Url: ... @overload - def bin(self, _: str, **kwds) -> Url: ... + def bin(self, _: Literal["binned"], **kwds) -> Url: ... @overload def bin(self, _: None, **kwds) -> Url: ... @@ -19589,7 +19611,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -19788,7 +19810,7 @@ class X(FieldChannelMixin, core.PositionFieldDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -19845,7 +19867,7 @@ class X(FieldChannelMixin, core.PositionFieldDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -19913,7 +19935,7 @@ class X(FieldChannelMixin, core.PositionFieldDef): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -20057,7 +20079,7 @@ def axis( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -20076,7 +20098,9 @@ def axis( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -20113,7 +20137,7 @@ def axis( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -20170,7 +20194,7 @@ def bin( ) -> X: ... @overload - def bin(self, _: str, **kwds) -> X: ... + def bin(self, _: Literal["binned"], **kwds) -> X: ... @overload def bin(self, _: None, **kwds) -> X: ... @@ -20207,10 +20231,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -20381,7 +20405,7 @@ def __init__( aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, axis: Optional[dict | None | SchemaBase] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, impute: Optional[dict | None | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, @@ -20616,7 +20640,7 @@ def axis( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -20635,7 +20659,9 @@ def axis( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -20672,7 +20698,7 @@ def axis( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -20731,10 +20757,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -20826,7 +20852,7 @@ class XValue(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -20899,7 +20925,7 @@ class X2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -21205,7 +21231,7 @@ class X2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -21278,7 +21304,7 @@ class XError(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -21525,7 +21551,7 @@ class XError2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -21782,7 +21808,7 @@ class XOffset(FieldChannelMixin, core.ScaleFieldDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -21820,7 +21846,7 @@ class XOffset(FieldChannelMixin, core.ScaleFieldDef): **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -21977,10 +22003,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -22305,10 +22331,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -22428,7 +22454,7 @@ class Y(FieldChannelMixin, core.PositionFieldDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -22485,7 +22511,7 @@ class Y(FieldChannelMixin, core.PositionFieldDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -22553,7 +22579,7 @@ class Y(FieldChannelMixin, core.PositionFieldDef): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -22697,7 +22723,7 @@ def axis( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -22716,7 +22742,9 @@ def axis( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -22753,7 +22781,7 @@ def axis( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -22810,7 +22838,7 @@ def bin( ) -> Y: ... @overload - def bin(self, _: str, **kwds) -> Y: ... + def bin(self, _: Literal["binned"], **kwds) -> Y: ... @overload def bin(self, _: None, **kwds) -> Y: ... @@ -22847,10 +22875,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -23021,7 +23049,7 @@ def __init__( aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, axis: Optional[dict | None | SchemaBase] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, impute: Optional[dict | None | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, @@ -23256,7 +23284,7 @@ def axis( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -23275,7 +23303,9 @@ def axis( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -23312,7 +23342,7 @@ def axis( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -23371,10 +23401,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -23466,7 +23496,7 @@ class YValue(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -23539,7 +23569,7 @@ class Y2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -23845,7 +23875,7 @@ class Y2Value(ValueChannelMixin, core.PositionValueDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -23918,7 +23948,7 @@ class YError(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -24165,7 +24195,7 @@ class YError2(FieldChannelMixin, core.SecondaryFieldDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -24422,7 +24452,7 @@ class YOffset(FieldChannelMixin, core.ScaleFieldDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['ascending', 'descending'], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -24460,7 +24490,7 @@ class YOffset(FieldChannelMixin, core.ScaleFieldDef): **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -24617,10 +24647,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -24945,10 +24975,10 @@ def scale( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, diff --git a/altair/vegalite/v5/schema/core.py b/altair/vegalite/v5/schema/core.py index 1de4c83de..0892e7214 100644 --- a/altair/vegalite/v5/schema/core.py +++ b/altair/vegalite/v5/schema/core.py @@ -612,7 +612,7 @@ class AreaConfig(AnyMarkConfig): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -826,7 +826,7 @@ class AreaConfig(AnyMarkConfig): **Default value:** ``0`` padAngle : dict, float, :class:`ExprRef` The angular padding applied to sides of the arc, in radians. - point : str, bool, dict, :class:`OverlayMarkDef` + point : bool, dict, Literal['transparent'], :class:`OverlayMarkDef` A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. @@ -958,24 +958,24 @@ class AreaConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -992,9 +992,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, cornerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1042,7 +1040,7 @@ def __init__( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, shape: Optional[str | dict | Parameter | SchemaBase] = Undefined, @@ -1073,10 +1071,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -1353,7 +1359,7 @@ class Axis(VegaLiteSchema): The rotation angle of the axis labels. **Default value:** ``-90`` for nominal and ordinal fields; ``0`` otherwise. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, :class:`ConditionalAxisLabelBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, :class:`ConditionalAxisLabelBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` @@ -1414,7 +1420,7 @@ class Axis(VegaLiteSchema): **Default value:** ``0`` labelOpacity : dict, float, :class:`ExprRef`, :class:`ConditionalAxisNumber` The opacity of the labels. - labelOverlap : str, bool, dict, :class:`ExprRef`, :class:`LabelOverlap` + labelOverlap : bool, dict, :class:`ExprRef`, :class:`LabelOverlap`, Literal['greedy', 'parity'] The strategy to use for resolving overlap of axis labels. If ``false`` (the default), no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a strategy of removing every other label is used (this works well for standard linear @@ -1561,7 +1567,7 @@ class Axis(VegaLiteSchema): Text anchor position for placing axis titles. titleAngle : dict, float, :class:`ExprRef` Angle in degrees of axis titles. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for axis titles. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -1642,7 +1648,7 @@ def __init__( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -1661,7 +1667,9 @@ def __init__( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -1698,7 +1706,7 @@ def __init__( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -1929,7 +1937,7 @@ class AxisConfig(VegaLiteSchema): The rotation angle of the axis labels. **Default value:** ``-90`` for nominal and ordinal fields; ``0`` otherwise. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, :class:`ConditionalAxisLabelBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, :class:`ConditionalAxisLabelBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` @@ -1990,7 +1998,7 @@ class AxisConfig(VegaLiteSchema): **Default value:** ``0`` labelOpacity : dict, float, :class:`ExprRef`, :class:`ConditionalAxisNumber` The opacity of the labels. - labelOverlap : str, bool, dict, :class:`ExprRef`, :class:`LabelOverlap` + labelOverlap : bool, dict, :class:`ExprRef`, :class:`LabelOverlap`, Literal['greedy', 'parity'] The strategy to use for resolving overlap of axis labels. If ``false`` (the default), no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a strategy of removing every other label is used (this works well for standard linear @@ -2137,7 +2145,7 @@ class AxisConfig(VegaLiteSchema): Text anchor position for placing axis titles. titleAngle : dict, float, :class:`ExprRef` Angle in degrees of axis titles. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for axis titles. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -2219,7 +2227,7 @@ def __init__( labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelBound: Optional[bool | dict | float | Parameter | SchemaBase] = Undefined, labelColor: Optional[ @@ -2238,7 +2246,9 @@ def __init__( labelLineHeight: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, labels: Optional[bool] = Undefined, @@ -2275,7 +2285,7 @@ def __init__( ] = Undefined, titleAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -2465,7 +2475,7 @@ class BarConfig(AnyMarkConfig): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -2805,24 +2815,24 @@ class BarConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -2839,9 +2849,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, @@ -2923,10 +2931,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -3030,7 +3046,7 @@ class BaseTitleNoValueRefs(VegaLiteSchema): the output SVG group, removing the title from the ARIA accessibility tree. **Default value:** ``true`` - baseline : str, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for title and subtitle text. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly @@ -3097,7 +3113,7 @@ def __init__( anchor: Optional[dict | Parameter | SchemaBase | TitleAnchor_T] = Undefined, angle: Optional[dict | float | Parameter | SchemaBase] = Undefined, aria: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[str | SchemaBase | Baseline_T] = Undefined, + baseline: Optional[SchemaBase | TextBaseline_T] = Undefined, color: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T ] = Undefined, @@ -3260,7 +3276,7 @@ class BindCheckbox(Binding): Parameters ---------- - input : str + input : Literal['checkbox'] debounce : float If defined, delays event handling until the specified milliseconds have elapsed @@ -3278,7 +3294,7 @@ class BindCheckbox(Binding): def __init__( self, - input: Optional[str] = Undefined, + input: Optional[Literal["checkbox"]] = Undefined, debounce: Optional[float] = Undefined, element: Optional[str | SchemaBase] = Undefined, name: Optional[str] = Undefined, @@ -3427,7 +3443,7 @@ class BindRange(Binding): Parameters ---------- - input : str + input : Literal['range'] debounce : float If defined, delays event handling until the specified milliseconds have elapsed @@ -3454,7 +3470,7 @@ class BindRange(Binding): def __init__( self, - input: Optional[str] = Undefined, + input: Optional[Literal["range"]] = Undefined, debounce: Optional[float] = Undefined, element: Optional[str | SchemaBase] = Undefined, max: Optional[float] = Undefined, @@ -3501,7 +3517,7 @@ class BoxPlotConfig(VegaLiteSchema): ---------- box : bool, dict, :class:`BarConfig`, :class:`AreaConfig`, :class:`LineConfig`, :class:`MarkConfig`, :class:`RectConfig`, :class:`TickConfig`, :class:`AnyMarkConfig` - extent : str, float + extent : float, Literal['min-max'] The extent of the whiskers. Available options include: * ``"min-max"``: min and max are the lower and upper whiskers respectively. @@ -3529,7 +3545,7 @@ class BoxPlotConfig(VegaLiteSchema): def __init__( self, box: Optional[bool | dict | SchemaBase] = Undefined, - extent: Optional[str | float] = Undefined, + extent: Optional[float | Literal["min-max"]] = Undefined, median: Optional[bool | dict | SchemaBase] = Undefined, outliers: Optional[bool | dict | SchemaBase] = Undefined, rule: Optional[bool | dict | SchemaBase] = Undefined, @@ -3686,7 +3702,7 @@ class BoxPlotDef(CompositeMarkDef): Parameters ---------- - type : str, :class:`BoxPlot` + type : :class:`BoxPlot`, Literal['boxplot'] The mark type. This could a primitive mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"``) or a composite mark type (``"boxplot"``, @@ -3707,7 +3723,7 @@ class BoxPlotDef(CompositeMarkDef): `__. * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and will override ``color``. - extent : str, float + extent : float, Literal['min-max'] The extent of the whiskers. Available options include: * ``"min-max"``: min and max are the lower and upper whiskers respectively. @@ -3773,11 +3789,11 @@ class BoxPlotDef(CompositeMarkDef): def __init__( self, - type: Optional[str | SchemaBase] = Undefined, + type: Optional[SchemaBase | BoxPlot_T] = Undefined, box: Optional[bool | dict | SchemaBase] = Undefined, clip: Optional[bool] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, - extent: Optional[str | float] = Undefined, + extent: Optional[float | Literal["min-max"]] = Undefined, invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined, median: Optional[bool | dict | SchemaBase] = Undefined, opacity: Optional[float] = Undefined, @@ -4158,7 +4174,7 @@ class ConditionalParameterStringFieldDef(ConditionalStringFieldDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -4229,7 +4245,7 @@ class ConditionalParameterStringFieldDef(ConditionalStringFieldDef): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -4333,7 +4349,7 @@ def __init__( param: Optional[str | SchemaBase] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, empty: Optional[bool] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, format: Optional[str | dict | SchemaBase] = Undefined, @@ -4381,7 +4397,7 @@ class ConditionalPredicateStringFieldDef(ConditionalStringFieldDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -4449,7 +4465,7 @@ class ConditionalPredicateStringFieldDef(ConditionalStringFieldDef): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -4553,7 +4569,7 @@ def __init__( test: Optional[str | dict | SchemaBase] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, format: Optional[str | dict | SchemaBase] = Undefined, formatType: Optional[str] = Undefined, @@ -5679,7 +5695,7 @@ class DsvDataFormat(DataFormat): UTC date format parsing is supported similarly (e.g., ``{foo: "utc:'%m%d%Y'"}``). See more about `UTC time `__ - type : str + type : Literal['dsv'] Type of input data: ``"json"``, ``"csv"``, ``"tsv"``, ``"dsv"``. **Default value:** The default format type is determined by the extension of the @@ -5692,7 +5708,7 @@ def __init__( self, delimiter: Optional[str] = Undefined, parse: Optional[dict | None | SchemaBase] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["dsv"]] = Undefined, **kwds, ): super().__init__(delimiter=delimiter, parse=parse, type=type, **kwds) @@ -6069,7 +6085,7 @@ class ErrorBandDef(CompositeMarkDef): Parameters ---------- - type : str, :class:`ErrorBand` + type : :class:`ErrorBand`, Literal['errorband'] The mark type. This could a primitive mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"``) or a composite mark type (``"boxplot"``, @@ -6138,7 +6154,7 @@ class ErrorBandDef(CompositeMarkDef): def __init__( self, - type: Optional[str | SchemaBase] = Undefined, + type: Optional[SchemaBase | ErrorBand_T] = Undefined, band: Optional[bool | dict | SchemaBase] = Undefined, borders: Optional[bool | dict | SchemaBase] = Undefined, clip: Optional[bool] = Undefined, @@ -6228,7 +6244,7 @@ class ErrorBarDef(CompositeMarkDef): Parameters ---------- - type : str, :class:`ErrorBar` + type : :class:`ErrorBar`, Literal['errorbar'] The mark type. This could a primitive mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"geoshape"``, ``"rule"``, and ``"text"``) or a composite mark type (``"boxplot"``, @@ -6277,7 +6293,7 @@ class ErrorBarDef(CompositeMarkDef): def __init__( self, - type: Optional[str | SchemaBase] = Undefined, + type: Optional[SchemaBase | ErrorBar_T] = Undefined, clip: Optional[bool] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, extent: Optional[SchemaBase | ErrorBarExtent_T] = Undefined, @@ -6482,7 +6498,7 @@ class FacetEncodingFieldDef(VegaLiteSchema): **Default value**: Depends on ``"spacing"`` property of `the view composition configuration `__ (``20`` by default) - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -6713,7 +6729,7 @@ class FacetFieldDef(VegaLiteSchema): **Default value:** ``"ascending"`` **Note:** ``null`` is not supported for ``row`` and ``column``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -7179,7 +7195,7 @@ class Feature(VegaLiteSchema): The feature's geometry properties : dict, None, :class:`GeoJsonProperties` Properties associated with this feature. - type : str + type : Literal['Feature'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -7195,7 +7211,7 @@ def __init__( self, geometry: Optional[dict | SchemaBase] = Undefined, properties: Optional[dict | None | SchemaBase] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["Feature"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, id: Optional[str | float] = Undefined, **kwds, @@ -7220,7 +7236,7 @@ class FeatureCollection(VegaLiteSchema): ---------- features : Sequence[dict, :class:`FeatureGeometryGeoJsonProperties`] - type : str + type : Literal['FeatureCollection'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -7232,7 +7248,7 @@ class FeatureCollection(VegaLiteSchema): def __init__( self, features: Optional[Sequence[dict | SchemaBase]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["FeatureCollection"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -7252,7 +7268,7 @@ class FeatureGeometryGeoJsonProperties(VegaLiteSchema): The feature's geometry properties : dict, None, :class:`GeoJsonProperties` Properties associated with this feature. - type : str + type : Literal['Feature'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -7268,7 +7284,7 @@ def __init__( self, geometry: Optional[dict | SchemaBase] = Undefined, properties: Optional[dict | None | SchemaBase] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["Feature"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, id: Optional[str | float] = Undefined, **kwds, @@ -7314,7 +7330,7 @@ class FieldDefWithoutScale(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -7350,7 +7366,7 @@ class FieldDefWithoutScale(VegaLiteSchema): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -7454,7 +7470,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, timeUnit: Optional[ dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T @@ -7503,7 +7519,7 @@ class FieldOrDatumDefWithConditionStringFieldDefstring(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -7578,7 +7594,7 @@ class FieldOrDatumDefWithConditionStringFieldDefstring(VegaLiteSchema): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -7683,7 +7699,7 @@ def __init__( self, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -7856,7 +7872,7 @@ class GenericUnitSpecEncodingAnyMark(VegaLiteSchema): Parameters ---------- - mark : str, dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape'] + mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape', 'boxplot', 'errorband', 'errorbar'] A string describing the mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"rule"``, ``"geoshape"``, and ``"text"``) or a `mark definition object @@ -7887,7 +7903,7 @@ class GenericUnitSpecEncodingAnyMark(VegaLiteSchema): def __init__( self, - mark: Optional[str | dict | SchemaBase | Mark_T] = Undefined, + mark: Optional[dict | SchemaBase | Mark_T | CompositeMark_T] = Undefined, data: Optional[dict | None | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, @@ -7925,7 +7941,7 @@ class GeoJsonFeature(Fit): The feature's geometry properties : dict, None, :class:`GeoJsonProperties` Properties associated with this feature. - type : str + type : Literal['Feature'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -7941,7 +7957,7 @@ def __init__( self, geometry: Optional[dict | SchemaBase] = Undefined, properties: Optional[dict | None | SchemaBase] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["Feature"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, id: Optional[str | float] = Undefined, **kwds, @@ -7966,7 +7982,7 @@ class GeoJsonFeatureCollection(Fit): ---------- features : Sequence[dict, :class:`FeatureGeometryGeoJsonProperties`] - type : str + type : Literal['FeatureCollection'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -7978,7 +7994,7 @@ class GeoJsonFeatureCollection(Fit): def __init__( self, features: Optional[Sequence[dict | SchemaBase]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["FeatureCollection"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -8017,7 +8033,7 @@ class GeometryCollection(Geometry): ---------- geometries : Sequence[dict, :class:`Point`, :class:`Polygon`, :class:`Geometry`, :class:`LineString`, :class:`MultiPoint`, :class:`MultiPolygon`, :class:`MultiLineString`, :class:`GeometryCollection`] - type : str + type : Literal['GeometryCollection'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -8029,7 +8045,7 @@ class GeometryCollection(Geometry): def __init__( self, geometries: Optional[Sequence[dict | SchemaBase]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["GeometryCollection"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -8074,7 +8090,7 @@ class GraticuleGenerator(Generator): Parameters ---------- - graticule : bool, dict, :class:`GraticuleParams` + graticule : dict, Literal[True], :class:`GraticuleParams` Generate graticule GeoJSON data for geographic reference lines. name : str Provide a placeholder name and bind data at runtime. @@ -8084,7 +8100,7 @@ class GraticuleGenerator(Generator): def __init__( self, - graticule: Optional[bool | dict | SchemaBase] = Undefined, + graticule: Optional[dict | SchemaBase | Literal[True]] = Undefined, name: Optional[str] = Undefined, **kwds, ): @@ -8201,7 +8217,7 @@ class Header(VegaLiteSchema): The rotation angle of the header labels. **Default value:** ``0`` for column header, ``-90`` for row header. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The vertical text baseline for the header labels. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -8274,7 +8290,7 @@ class Header(VegaLiteSchema): The rotation angle of the header title. **Default value:** ``0``. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The vertical text baseline for the header title. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -8321,7 +8337,7 @@ def __init__( labelAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, labelAngle: Optional[float] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -8344,7 +8360,7 @@ def __init__( titleAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, titleAngle: Optional[float] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -8447,7 +8463,7 @@ class HeaderConfig(VegaLiteSchema): The rotation angle of the header labels. **Default value:** ``0`` for column header, ``-90`` for row header. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The vertical text baseline for the header labels. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -8502,7 +8518,7 @@ class HeaderConfig(VegaLiteSchema): The rotation angle of the header title. **Default value:** ``0``. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The vertical text baseline for the header title. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -8549,7 +8565,7 @@ def __init__( labelAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, labelAngle: Optional[float] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -8572,7 +8588,7 @@ def __init__( titleAnchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, titleAngle: Optional[float] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | Parameter | SchemaBase | ColorName_T @@ -8782,7 +8798,7 @@ class IntervalSelectionConfig(VegaLiteSchema): Parameters ---------- - type : str + type : Literal['interval'] Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types: @@ -8879,7 +8895,7 @@ class IntervalSelectionConfig(VegaLiteSchema): def __init__( self, - type: Optional[str] = Undefined, + type: Optional[Literal["interval"]] = Undefined, clear: Optional[str | bool | dict | SchemaBase] = Undefined, encodings: Optional[Sequence[SchemaBase | SingleDefUnitChannel_T]] = Undefined, fields: Optional[Sequence[str | SchemaBase]] = Undefined, @@ -9078,7 +9094,7 @@ class JsonDataFormat(DataFormat): loaded JSON file may have surrounding structure or meta-data. For example ``"property": "values.features"`` is equivalent to retrieving ``json.values.features`` from the loaded JSON object. - type : str + type : Literal['json'] Type of input data: ``"json"``, ``"csv"``, ``"tsv"``, ``"dsv"``. **Default value:** The default format type is determined by the extension of the @@ -9091,7 +9107,7 @@ def __init__( self, parse: Optional[dict | None | SchemaBase] = Undefined, property: Optional[str] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["json"]] = Undefined, **kwds, ): super().__init__(parse=parse, property=property, type=type, **kwds) @@ -9171,7 +9187,7 @@ class LatLongFieldDef(LatLongDef): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -9200,7 +9216,7 @@ class LatLongFieldDef(LatLongDef): 2) If both field definition's ``title`` and axis, header, or legend ``title`` are defined, axis/header/legend title will be used. - type : str + type : Literal['quantitative'] The type of measurement (``"quantitative"``, ``"temporal"``, ``"ordinal"``, or ``"nominal"``) for the encoded field or constant value (``datum``). It can also be a ``"geojson"`` type for encoding `'geoshape' @@ -9281,7 +9297,7 @@ def __init__( dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T ] = Undefined, title: Optional[str | None | SchemaBase | Sequence[str]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["quantitative"]] = Undefined, **kwds, ): super().__init__( @@ -9436,7 +9452,7 @@ class Legend(VegaLiteSchema): **Default value:** ``"each"``. labelAlign : dict, :class:`Align`, :class:`ExprRef`, Literal['left', 'center', 'right'] The alignment of the legend label, can be left, center, or right. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The position of the baseline of legend label, can be ``"top"``, ``"middle"``, ``"bottom"``, or ``"alphabetic"``. @@ -9469,7 +9485,7 @@ class Legend(VegaLiteSchema): **Default value:** ``4``. labelOpacity : dict, float, :class:`ExprRef` Opacity of labels. - labelOverlap : str, bool, dict, :class:`ExprRef`, :class:`LabelOverlap` + labelOverlap : bool, dict, :class:`ExprRef`, :class:`LabelOverlap`, Literal['greedy', 'parity'] The strategy to use for resolving overlap of labels in gradient legends. If ``false``, no overlap reduction is attempted. If set to ``true`` (default) or ``"parity"``, a strategy of removing every other label is used. If set to @@ -9579,7 +9595,7 @@ class Legend(VegaLiteSchema): **Default value:** ``"left"``. titleAnchor : dict, :class:`ExprRef`, :class:`TitleAnchor`, Literal[None, 'start', 'middle', 'end'] Text anchor position for placing legend titles. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for legend titles. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -9655,7 +9671,7 @@ def __init__( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -9670,7 +9686,9 @@ def __init__( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, legendX: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -9708,7 +9726,7 @@ def __init__( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -9919,7 +9937,7 @@ class LegendConfig(VegaLiteSchema): **Default value:** ``"each"``. labelAlign : dict, :class:`Align`, :class:`ExprRef`, Literal['left', 'center', 'right'] The alignment of the legend label, can be left, center, or right. - labelBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + labelBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] The position of the baseline of legend label, can be ``"top"``, ``"middle"``, ``"bottom"``, or ``"alphabetic"``. @@ -9946,7 +9964,7 @@ class LegendConfig(VegaLiteSchema): **Default value:** ``4``. labelOpacity : dict, float, :class:`ExprRef` Opacity of labels. - labelOverlap : str, bool, dict, :class:`ExprRef`, :class:`LabelOverlap` + labelOverlap : bool, dict, :class:`ExprRef`, :class:`LabelOverlap`, Literal['greedy', 'parity'] The strategy to use for resolving overlap of labels in gradient legends. If ``false``, no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a strategy of removing every other label is used. If set to ``"greedy"``, a linear @@ -10051,7 +10069,7 @@ class LegendConfig(VegaLiteSchema): **Default value:** ``"left"``. titleAnchor : dict, :class:`ExprRef`, :class:`TitleAnchor`, Literal[None, 'start', 'middle', 'end'] Text anchor position for placing legend titles. - titleBaseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + titleBaseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for legend titles. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and @@ -10133,7 +10151,7 @@ def __init__( gridAlign: Optional[dict | Parameter | SchemaBase | LayoutAlign_T] = Undefined, labelAlign: Optional[dict | Parameter | SchemaBase | Align_T] = Undefined, labelBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, labelColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -10147,7 +10165,9 @@ def __init__( labelLimit: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelOpacity: Optional[dict | float | Parameter | SchemaBase] = Undefined, - labelOverlap: Optional[str | bool | dict | Parameter | SchemaBase] = Undefined, + labelOverlap: Optional[ + bool | dict | Parameter | SchemaBase | Literal["greedy", "parity"] + ] = Undefined, labelPadding: Optional[dict | float | Parameter | SchemaBase] = Undefined, labelSeparation: Optional[dict | float | Parameter | SchemaBase] = Undefined, layout: Optional[dict | Parameter | SchemaBase] = Undefined, @@ -10198,7 +10218,7 @@ def __init__( dict | Parameter | SchemaBase | TitleAnchor_T ] = Undefined, titleBaseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T + dict | Parameter | SchemaBase | TextBaseline_T ] = Undefined, titleColor: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T @@ -10417,7 +10437,7 @@ class LineConfig(AnyMarkConfig): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -10621,7 +10641,7 @@ class LineConfig(AnyMarkConfig): **Default value:** ``0`` padAngle : dict, float, :class:`ExprRef` The angular padding applied to sides of the arc, in radians. - point : str, bool, dict, :class:`OverlayMarkDef` + point : bool, dict, Literal['transparent'], :class:`OverlayMarkDef` A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. @@ -10753,24 +10773,24 @@ class LineConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -10787,9 +10807,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, cornerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -10836,7 +10854,7 @@ def __init__( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, shape: Optional[str | dict | Parameter | SchemaBase] = Undefined, @@ -10867,10 +10885,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -10958,7 +10984,7 @@ class LineString(Geometry): ---------- coordinates : Sequence[Sequence[float], :class:`Position`] - type : str + type : Literal['LineString'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -10970,7 +10996,7 @@ class LineString(Geometry): def __init__( self, coordinates: Optional[Sequence[SchemaBase | Sequence[float]]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["LineString"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -10983,7 +11009,7 @@ class LinearGradient(Gradient): Parameters ---------- - gradient : str + gradient : Literal['linear'] The type of gradient. Use ``"linear"`` for a linear gradient. stops : Sequence[dict, :class:`GradientStop`] An array of gradient stops defining the gradient color sequence. @@ -11011,7 +11037,7 @@ class LinearGradient(Gradient): def __init__( self, - gradient: Optional[str] = Undefined, + gradient: Optional[Literal["linear"]] = Undefined, stops: Optional[Sequence[dict | SchemaBase]] = Undefined, id: Optional[str] = Undefined, x1: Optional[float] = Undefined, @@ -11146,7 +11172,7 @@ class MarkConfig(AnyMarkConfig): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -11468,24 +11494,24 @@ class MarkConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -11502,9 +11528,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, cornerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -11581,10 +11605,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -11702,7 +11734,7 @@ class MarkDef(AnyMark): **Default value:** 3/4 of step (width step for horizontal ticks and height step for vertical ticks). - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -11938,7 +11970,7 @@ class MarkDef(AnyMark): **Default value:** ``0`` padAngle : dict, float, :class:`ExprRef` The angular padding applied to sides of the arc, in radians. - point : str, bool, dict, :class:`OverlayMarkDef` + point : bool, dict, Literal['transparent'], :class:`OverlayMarkDef` A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. @@ -12098,13 +12130,13 @@ class MarkDef(AnyMark): * A relative band size definition. For example, ``{band: 0.5}`` represents half of the band. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width @@ -12113,13 +12145,13 @@ class MarkDef(AnyMark): Offset for x2-position. xOffset : dict, float, :class:`ExprRef` Offset for x-position. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -12142,9 +12174,7 @@ def __init__( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -12197,7 +12227,7 @@ def __init__( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -12233,12 +12263,20 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -12576,7 +12614,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefGradientstringnull( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -12614,7 +12652,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefGradientstringnull( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -12816,7 +12854,7 @@ class MultiLineString(Geometry): ---------- coordinates : Sequence[Sequence[Sequence[float], :class:`Position`]] - type : str + type : Literal['MultiLineString'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -12830,7 +12868,7 @@ def __init__( coordinates: Optional[ Sequence[Sequence[SchemaBase | Sequence[float]]] ] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["MultiLineString"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -12847,7 +12885,7 @@ class MultiPoint(Geometry): ---------- coordinates : Sequence[Sequence[float], :class:`Position`] - type : str + type : Literal['MultiPoint'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -12859,7 +12897,7 @@ class MultiPoint(Geometry): def __init__( self, coordinates: Optional[Sequence[SchemaBase | Sequence[float]]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["MultiPoint"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -12876,7 +12914,7 @@ class MultiPolygon(Geometry): ---------- coordinates : Sequence[Sequence[Sequence[Sequence[float], :class:`Position`]]] - type : str + type : Literal['MultiPolygon'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -12890,7 +12928,7 @@ def __init__( coordinates: Optional[ Sequence[Sequence[Sequence[SchemaBase | Sequence[float]]]] ] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["MultiPolygon"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -13230,7 +13268,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefnumberArray( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -13268,7 +13306,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefnumberArray( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -13643,7 +13681,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefnumber( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -13681,7 +13719,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefnumber( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -13857,7 +13895,7 @@ class OrderFieldDef(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -13895,7 +13933,7 @@ class OrderFieldDef(VegaLiteSchema): if ``aggregate`` is ``count``. sort : :class:`SortOrder`, Literal['ascending', 'descending'] The sort order. One of ``"ascending"`` (default) or ``"descending"``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -13999,7 +14037,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, sort: Optional[SchemaBase | SortOrder_T] = Undefined, timeUnit: Optional[ @@ -14120,7 +14158,7 @@ class OverlayMarkDef(VegaLiteSchema): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -14466,13 +14504,13 @@ class OverlayMarkDef(VegaLiteSchema): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width @@ -14481,13 +14519,13 @@ class OverlayMarkDef(VegaLiteSchema): Offset for x2-position. xOffset : dict, float, :class:`ExprRef` Offset for x-position. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -14508,9 +14546,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, @@ -14593,12 +14629,20 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -14746,7 +14790,7 @@ class Point(Geometry): and three elements. The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values), but the current specification only allows X, Y, and (optionally) Z to be defined. - type : str + type : Literal['Point'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -14758,7 +14802,7 @@ class Point(Geometry): def __init__( self, coordinates: Optional[SchemaBase | Sequence[float]] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["Point"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -14771,7 +14815,7 @@ class PointSelectionConfig(VegaLiteSchema): Parameters ---------- - type : str + type : Literal['point'] Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types: @@ -14867,7 +14911,7 @@ class PointSelectionConfig(VegaLiteSchema): def __init__( self, - type: Optional[str] = Undefined, + type: Optional[Literal["point"]] = Undefined, clear: Optional[str | bool | dict | SchemaBase] = Undefined, encodings: Optional[Sequence[SchemaBase | SingleDefUnitChannel_T]] = Undefined, fields: Optional[Sequence[str | SchemaBase]] = Undefined, @@ -15025,7 +15069,7 @@ class Polygon(Geometry): ---------- coordinates : Sequence[Sequence[Sequence[float], :class:`Position`]] - type : str + type : Literal['Polygon'] Specifies the type of GeoJSON object. bbox : :class:`BBox`, Sequence[float] Bounding box of the coordinate range of the object's Geometries, Features, or @@ -15039,7 +15083,7 @@ def __init__( coordinates: Optional[ Sequence[Sequence[SchemaBase | Sequence[float]]] ] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["Polygon"]] = Undefined, bbox: Optional[SchemaBase | Sequence[float]] = Undefined, **kwds, ): @@ -15583,7 +15627,7 @@ class PositionFieldDef(PositionDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -15640,7 +15684,7 @@ class PositionFieldDef(PositionDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -15708,7 +15752,7 @@ class PositionFieldDef(PositionDef): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -15813,7 +15857,7 @@ def __init__( aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, axis: Optional[dict | None | SchemaBase] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, impute: Optional[dict | None | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, @@ -15873,7 +15917,7 @@ class PositionFieldDefBase(PolarDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -15922,7 +15966,7 @@ class PositionFieldDefBase(PolarDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -15990,7 +16034,7 @@ class PositionFieldDefBase(PolarDef): **See also:** `stack `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -16094,7 +16138,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, scale: Optional[dict | None | SchemaBase] = Undefined, sort: Optional[ @@ -16140,7 +16184,7 @@ class PositionValueDef(PolarDef, Position2Def, PositionDef): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -16150,7 +16194,9 @@ class PositionValueDef(PolarDef, Position2Def, PositionDef): def __init__( self, - value: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + value: Optional[ + dict | float | Parameter | SchemaBase | Literal["height", "width"] + ] = Undefined, **kwds, ): super().__init__(value=value, **kwds) @@ -16232,7 +16278,7 @@ class FieldEqualPredicate(Predicate): The value that the field should be equal to. field : str, :class:`FieldName` Field to be tested. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16260,7 +16306,7 @@ class FieldGTEPredicate(Predicate): Field to be tested. gte : str, dict, float, :class:`ExprRef`, :class:`DateTime` The value that the field should be greater than or equals to. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16288,7 +16334,7 @@ class FieldGTPredicate(Predicate): Field to be tested. gt : str, dict, float, :class:`ExprRef`, :class:`DateTime` The value that the field should be greater than. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16316,7 +16362,7 @@ class FieldLTEPredicate(Predicate): Field to be tested. lte : str, dict, float, :class:`ExprRef`, :class:`DateTime` The value that the field should be less than or equals to. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16344,7 +16390,7 @@ class FieldLTPredicate(Predicate): Field to be tested. lt : str, dict, float, :class:`ExprRef`, :class:`DateTime` The value that the field should be less than. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16373,7 +16419,7 @@ class FieldOneOfPredicate(Predicate): oneOf : Sequence[str], Sequence[bool], Sequence[float], Sequence[dict, :class:`DateTime`] A set of values that the ``field``'s value should be a member of, for a data item included in the filtered data. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16407,7 +16453,7 @@ class FieldRangePredicate(Predicate): range : dict, :class:`ExprRef`, Sequence[dict, None, float, :class:`ExprRef`, :class:`DateTime`] An array of inclusive minimum and maximum values for a field value of a data item to be included in the filtered data. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16442,7 +16488,7 @@ class FieldValidPredicate(Predicate): If set to true the field's value has to be valid, meaning both not ``null`` and not `NaN `__. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit for the field to be tested. """ @@ -16861,7 +16907,7 @@ class RadialGradient(Gradient): Parameters ---------- - gradient : str + gradient : Literal['radial'] The type of gradient. Use ``"radial"`` for a radial gradient. stops : Sequence[dict, :class:`GradientStop`] An array of gradient stops defining the gradient color sequence. @@ -16903,7 +16949,7 @@ class RadialGradient(Gradient): def __init__( self, - gradient: Optional[str] = Undefined, + gradient: Optional[Literal["radial"]] = Undefined, stops: Optional[Sequence[dict | SchemaBase]] = Undefined, id: Optional[str] = Undefined, r1: Optional[float] = Undefined, @@ -17074,7 +17120,7 @@ class RectConfig(AnyMarkConfig): Warning: this property is experimental and may be changed in the future. aspect : bool, dict, :class:`ExprRef` Whether to keep aspect ratio of image marks. - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -17410,24 +17456,24 @@ class RectConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -17444,9 +17490,7 @@ def __init__( ariaRole: Optional[str | dict | Parameter | SchemaBase] = Undefined, ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, @@ -17527,10 +17571,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -17889,7 +17941,7 @@ class RowColumnEncodingFieldDef(VegaLiteSchema): **Default value**: Depends on ``"spacing"`` property of `the view composition configuration `__ (``20`` by default) - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -18076,7 +18128,7 @@ class Scale(VegaLiteSchema): ``symlog`` scales. **Default value:** ``1`` - domain : str, dict, :class:`ExprRef`, :class:`DomainUnionWith`, :class:`ParameterExtent`, Sequence[str, bool, dict, None, float, :class:`ExprRef`, :class:`DateTime`] + domain : dict, :class:`ExprRef`, Literal['unaggregated'], :class:`DomainUnionWith`, :class:`ParameterExtent`, Sequence[str, bool, dict, None, float, :class:`ExprRef`, :class:`DateTime`] Customized domain values in the form of constant values or dynamic values driven by a parameter. @@ -18239,7 +18291,7 @@ class Scale(VegaLiteSchema): snapping to the pixel grid. **Default value:** ``false``. - scheme : dict, :class:`ExprRef`, :class:`Cyclical`, :class:`Diverging`, :class:`Categorical`, :class:`ColorScheme`, :class:`SchemeParams`, :class:`SequentialMultiHue`, :class:`SequentialSingleHue`, Literal['rainbow', 'sinebow'], Literal['blues', 'tealblues', 'teals', 'greens', 'browns', 'greys', 'purples', 'warmgreys', 'reds', 'oranges'], Literal['accent', 'category10', 'category20', 'category20b', 'category20c', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'tableau20'], Literal['blueorange', 'blueorange-3', 'blueorange-4', 'blueorange-5', 'blueorange-6', 'blueorange-7', 'blueorange-8', 'blueorange-9', 'blueorange-10', 'blueorange-11', 'brownbluegreen', 'brownbluegreen-3', 'brownbluegreen-4', 'brownbluegreen-5', 'brownbluegreen-6', 'brownbluegreen-7', 'brownbluegreen-8', 'brownbluegreen-9', 'brownbluegreen-10', 'brownbluegreen-11', 'purplegreen', 'purplegreen-3', 'purplegreen-4', 'purplegreen-5', 'purplegreen-6', 'purplegreen-7', 'purplegreen-8', 'purplegreen-9', 'purplegreen-10', 'purplegreen-11', 'pinkyellowgreen', 'pinkyellowgreen-3', 'pinkyellowgreen-4', 'pinkyellowgreen-5', 'pinkyellowgreen-6', 'pinkyellowgreen-7', 'pinkyellowgreen-8', 'pinkyellowgreen-9', 'pinkyellowgreen-10', 'pinkyellowgreen-11', 'purpleorange', 'purpleorange-3', 'purpleorange-4', 'purpleorange-5', 'purpleorange-6', 'purpleorange-7', 'purpleorange-8', 'purpleorange-9', 'purpleorange-10', 'purpleorange-11', 'redblue', 'redblue-3', 'redblue-4', 'redblue-5', 'redblue-6', 'redblue-7', 'redblue-8', 'redblue-9', 'redblue-10', 'redblue-11', 'redgrey', 'redgrey-3', 'redgrey-4', 'redgrey-5', 'redgrey-6', 'redgrey-7', 'redgrey-8', 'redgrey-9', 'redgrey-10', 'redgrey-11', 'redyellowblue', 'redyellowblue-3', 'redyellowblue-4', 'redyellowblue-5', 'redyellowblue-6', 'redyellowblue-7', 'redyellowblue-8', 'redyellowblue-9', 'redyellowblue-10', 'redyellowblue-11', 'redyellowgreen', 'redyellowgreen-3', 'redyellowgreen-4', 'redyellowgreen-5', 'redyellowgreen-6', 'redyellowgreen-7', 'redyellowgreen-8', 'redyellowgreen-9', 'redyellowgreen-10', 'redyellowgreen-11', 'spectral', 'spectral-3', 'spectral-4', 'spectral-5', 'spectral-6', 'spectral-7', 'spectral-8', 'spectral-9', 'spectral-10', 'spectral-11'], Literal['turbo', 'viridis', 'inferno', 'magma', 'plasma', 'cividis', 'bluegreen', 'bluegreen-3', 'bluegreen-4', 'bluegreen-5', 'bluegreen-6', 'bluegreen-7', 'bluegreen-8', 'bluegreen-9', 'bluepurple', 'bluepurple-3', 'bluepurple-4', 'bluepurple-5', 'bluepurple-6', 'bluepurple-7', 'bluepurple-8', 'bluepurple-9', 'goldgreen', 'goldgreen-3', 'goldgreen-4', 'goldgreen-5', 'goldgreen-6', 'goldgreen-7', 'goldgreen-8', 'goldgreen-9', 'goldorange', 'goldorange-3', 'goldorange-4', 'goldorange-5', 'goldorange-6', 'goldorange-7', 'goldorange-8', 'goldorange-9', 'goldred', 'goldred-3', 'goldred-4', 'goldred-5', 'goldred-6', 'goldred-7', 'goldred-8', 'goldred-9', 'greenblue', 'greenblue-3', 'greenblue-4', 'greenblue-5', 'greenblue-6', 'greenblue-7', 'greenblue-8', 'greenblue-9', 'orangered', 'orangered-3', 'orangered-4', 'orangered-5', 'orangered-6', 'orangered-7', 'orangered-8', 'orangered-9', 'purplebluegreen', 'purplebluegreen-3', 'purplebluegreen-4', 'purplebluegreen-5', 'purplebluegreen-6', 'purplebluegreen-7', 'purplebluegreen-8', 'purplebluegreen-9', 'purpleblue', 'purpleblue-3', 'purpleblue-4', 'purpleblue-5', 'purpleblue-6', 'purpleblue-7', 'purpleblue-8', 'purpleblue-9', 'purplered', 'purplered-3', 'purplered-4', 'purplered-5', 'purplered-6', 'purplered-7', 'purplered-8', 'purplered-9', 'redpurple', 'redpurple-3', 'redpurple-4', 'redpurple-5', 'redpurple-6', 'redpurple-7', 'redpurple-8', 'redpurple-9', 'yellowgreenblue', 'yellowgreenblue-3', 'yellowgreenblue-4', 'yellowgreenblue-5', 'yellowgreenblue-6', 'yellowgreenblue-7', 'yellowgreenblue-8', 'yellowgreenblue-9', 'yellowgreen', 'yellowgreen-3', 'yellowgreen-4', 'yellowgreen-5', 'yellowgreen-6', 'yellowgreen-7', 'yellowgreen-8', 'yellowgreen-9', 'yelloworangebrown', 'yelloworangebrown-3', 'yelloworangebrown-4', 'yelloworangebrown-5', 'yelloworangebrown-6', 'yelloworangebrown-7', 'yelloworangebrown-8', 'yelloworangebrown-9', 'yelloworangered', 'yelloworangered-3', 'yelloworangered-4', 'yelloworangered-5', 'yelloworangered-6', 'yelloworangered-7', 'yelloworangered-8', 'yelloworangered-9', 'darkblue', 'darkblue-3', 'darkblue-4', 'darkblue-5', 'darkblue-6', 'darkblue-7', 'darkblue-8', 'darkblue-9', 'darkgold', 'darkgold-3', 'darkgold-4', 'darkgold-5', 'darkgold-6', 'darkgold-7', 'darkgold-8', 'darkgold-9', 'darkgreen', 'darkgreen-3', 'darkgreen-4', 'darkgreen-5', 'darkgreen-6', 'darkgreen-7', 'darkgreen-8', 'darkgreen-9', 'darkmulti', 'darkmulti-3', 'darkmulti-4', 'darkmulti-5', 'darkmulti-6', 'darkmulti-7', 'darkmulti-8', 'darkmulti-9', 'darkred', 'darkred-3', 'darkred-4', 'darkred-5', 'darkred-6', 'darkred-7', 'darkred-8', 'darkred-9', 'lightgreyred', 'lightgreyred-3', 'lightgreyred-4', 'lightgreyred-5', 'lightgreyred-6', 'lightgreyred-7', 'lightgreyred-8', 'lightgreyred-9', 'lightgreyteal', 'lightgreyteal-3', 'lightgreyteal-4', 'lightgreyteal-5', 'lightgreyteal-6', 'lightgreyteal-7', 'lightgreyteal-8', 'lightgreyteal-9', 'lightmulti', 'lightmulti-3', 'lightmulti-4', 'lightmulti-5', 'lightmulti-6', 'lightmulti-7', 'lightmulti-8', 'lightmulti-9', 'lightorange', 'lightorange-3', 'lightorange-4', 'lightorange-5', 'lightorange-6', 'lightorange-7', 'lightorange-8', 'lightorange-9', 'lighttealblue', 'lighttealblue-3', 'lighttealblue-4', 'lighttealblue-5', 'lighttealblue-6', 'lighttealblue-7', 'lighttealblue-8', 'lighttealblue-9'] + scheme : dict, :class:`ExprRef`, :class:`Cyclical`, :class:`Diverging`, :class:`Categorical`, :class:`ColorScheme`, :class:`SchemeParams`, :class:`SequentialMultiHue`, :class:`SequentialSingleHue`, Literal['accent', 'category10', 'category20', 'category20b', 'category20c', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'tableau20', 'blueorange', 'blueorange-3', 'blueorange-4', 'blueorange-5', 'blueorange-6', 'blueorange-7', 'blueorange-8', 'blueorange-9', 'blueorange-10', 'blueorange-11', 'brownbluegreen', 'brownbluegreen-3', 'brownbluegreen-4', 'brownbluegreen-5', 'brownbluegreen-6', 'brownbluegreen-7', 'brownbluegreen-8', 'brownbluegreen-9', 'brownbluegreen-10', 'brownbluegreen-11', 'purplegreen', 'purplegreen-3', 'purplegreen-4', 'purplegreen-5', 'purplegreen-6', 'purplegreen-7', 'purplegreen-8', 'purplegreen-9', 'purplegreen-10', 'purplegreen-11', 'pinkyellowgreen', 'pinkyellowgreen-3', 'pinkyellowgreen-4', 'pinkyellowgreen-5', 'pinkyellowgreen-6', 'pinkyellowgreen-7', 'pinkyellowgreen-8', 'pinkyellowgreen-9', 'pinkyellowgreen-10', 'pinkyellowgreen-11', 'purpleorange', 'purpleorange-3', 'purpleorange-4', 'purpleorange-5', 'purpleorange-6', 'purpleorange-7', 'purpleorange-8', 'purpleorange-9', 'purpleorange-10', 'purpleorange-11', 'redblue', 'redblue-3', 'redblue-4', 'redblue-5', 'redblue-6', 'redblue-7', 'redblue-8', 'redblue-9', 'redblue-10', 'redblue-11', 'redgrey', 'redgrey-3', 'redgrey-4', 'redgrey-5', 'redgrey-6', 'redgrey-7', 'redgrey-8', 'redgrey-9', 'redgrey-10', 'redgrey-11', 'redyellowblue', 'redyellowblue-3', 'redyellowblue-4', 'redyellowblue-5', 'redyellowblue-6', 'redyellowblue-7', 'redyellowblue-8', 'redyellowblue-9', 'redyellowblue-10', 'redyellowblue-11', 'redyellowgreen', 'redyellowgreen-3', 'redyellowgreen-4', 'redyellowgreen-5', 'redyellowgreen-6', 'redyellowgreen-7', 'redyellowgreen-8', 'redyellowgreen-9', 'redyellowgreen-10', 'redyellowgreen-11', 'spectral', 'spectral-3', 'spectral-4', 'spectral-5', 'spectral-6', 'spectral-7', 'spectral-8', 'spectral-9', 'spectral-10', 'spectral-11', 'blues', 'tealblues', 'teals', 'greens', 'browns', 'greys', 'purples', 'warmgreys', 'reds', 'oranges', 'rainbow', 'sinebow', 'turbo', 'viridis', 'inferno', 'magma', 'plasma', 'cividis', 'bluegreen', 'bluegreen-3', 'bluegreen-4', 'bluegreen-5', 'bluegreen-6', 'bluegreen-7', 'bluegreen-8', 'bluegreen-9', 'bluepurple', 'bluepurple-3', 'bluepurple-4', 'bluepurple-5', 'bluepurple-6', 'bluepurple-7', 'bluepurple-8', 'bluepurple-9', 'goldgreen', 'goldgreen-3', 'goldgreen-4', 'goldgreen-5', 'goldgreen-6', 'goldgreen-7', 'goldgreen-8', 'goldgreen-9', 'goldorange', 'goldorange-3', 'goldorange-4', 'goldorange-5', 'goldorange-6', 'goldorange-7', 'goldorange-8', 'goldorange-9', 'goldred', 'goldred-3', 'goldred-4', 'goldred-5', 'goldred-6', 'goldred-7', 'goldred-8', 'goldred-9', 'greenblue', 'greenblue-3', 'greenblue-4', 'greenblue-5', 'greenblue-6', 'greenblue-7', 'greenblue-8', 'greenblue-9', 'orangered', 'orangered-3', 'orangered-4', 'orangered-5', 'orangered-6', 'orangered-7', 'orangered-8', 'orangered-9', 'purplebluegreen', 'purplebluegreen-3', 'purplebluegreen-4', 'purplebluegreen-5', 'purplebluegreen-6', 'purplebluegreen-7', 'purplebluegreen-8', 'purplebluegreen-9', 'purpleblue', 'purpleblue-3', 'purpleblue-4', 'purpleblue-5', 'purpleblue-6', 'purpleblue-7', 'purpleblue-8', 'purpleblue-9', 'purplered', 'purplered-3', 'purplered-4', 'purplered-5', 'purplered-6', 'purplered-7', 'purplered-8', 'purplered-9', 'redpurple', 'redpurple-3', 'redpurple-4', 'redpurple-5', 'redpurple-6', 'redpurple-7', 'redpurple-8', 'redpurple-9', 'yellowgreenblue', 'yellowgreenblue-3', 'yellowgreenblue-4', 'yellowgreenblue-5', 'yellowgreenblue-6', 'yellowgreenblue-7', 'yellowgreenblue-8', 'yellowgreenblue-9', 'yellowgreen', 'yellowgreen-3', 'yellowgreen-4', 'yellowgreen-5', 'yellowgreen-6', 'yellowgreen-7', 'yellowgreen-8', 'yellowgreen-9', 'yelloworangebrown', 'yelloworangebrown-3', 'yelloworangebrown-4', 'yelloworangebrown-5', 'yelloworangebrown-6', 'yelloworangebrown-7', 'yelloworangebrown-8', 'yelloworangebrown-9', 'yelloworangered', 'yelloworangered-3', 'yelloworangered-4', 'yelloworangered-5', 'yelloworangered-6', 'yelloworangered-7', 'yelloworangered-8', 'yelloworangered-9', 'darkblue', 'darkblue-3', 'darkblue-4', 'darkblue-5', 'darkblue-6', 'darkblue-7', 'darkblue-8', 'darkblue-9', 'darkgold', 'darkgold-3', 'darkgold-4', 'darkgold-5', 'darkgold-6', 'darkgold-7', 'darkgold-8', 'darkgold-9', 'darkgreen', 'darkgreen-3', 'darkgreen-4', 'darkgreen-5', 'darkgreen-6', 'darkgreen-7', 'darkgreen-8', 'darkgreen-9', 'darkmulti', 'darkmulti-3', 'darkmulti-4', 'darkmulti-5', 'darkmulti-6', 'darkmulti-7', 'darkmulti-8', 'darkmulti-9', 'darkred', 'darkred-3', 'darkred-4', 'darkred-5', 'darkred-6', 'darkred-7', 'darkred-8', 'darkred-9', 'lightgreyred', 'lightgreyred-3', 'lightgreyred-4', 'lightgreyred-5', 'lightgreyred-6', 'lightgreyred-7', 'lightgreyred-8', 'lightgreyred-9', 'lightgreyteal', 'lightgreyteal-3', 'lightgreyteal-4', 'lightgreyteal-5', 'lightgreyteal-6', 'lightgreyteal-7', 'lightgreyteal-8', 'lightgreyteal-9', 'lightmulti', 'lightmulti-3', 'lightmulti-4', 'lightmulti-5', 'lightmulti-6', 'lightmulti-7', 'lightmulti-8', 'lightmulti-9', 'lightorange', 'lightorange-3', 'lightorange-4', 'lightorange-5', 'lightorange-6', 'lightorange-7', 'lightorange-8', 'lightorange-9', 'lighttealblue', 'lighttealblue-3', 'lighttealblue-4', 'lighttealblue-5', 'lighttealblue-6', 'lighttealblue-7', 'lighttealblue-8', 'lighttealblue-9'] A string indicating a color `scheme `__ name (e.g., ``"category10"`` or ``"blues"``) or a `scheme parameter object @@ -18304,10 +18356,10 @@ def __init__( clamp: Optional[bool | dict | Parameter | SchemaBase] = Undefined, constant: Optional[dict | float | Parameter | SchemaBase] = Undefined, domain: Optional[ - str - | dict + dict | Parameter | SchemaBase + | Literal["unaggregated"] | Sequence[str | bool | dict | None | float | Parameter | SchemaBase] ] = Undefined, domainMax: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -18847,7 +18899,7 @@ class ScaleFieldDef(OffsetDef): **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -18885,7 +18937,7 @@ class ScaleFieldDef(OffsetDef): **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -19062,39 +19114,39 @@ class ScaleInvalidDataConfig(VegaLiteSchema): Parameters ---------- - angle : str, dict, :class:`ScaleInvalidDataShowAsangle`, :class:`ScaleInvalidDataShowAsValueangle` + angle : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsangle`, :class:`ScaleInvalidDataShowAsValueangle` - color : str, dict, :class:`ScaleInvalidDataShowAscolor`, :class:`ScaleInvalidDataShowAsValuecolor` + color : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAscolor`, :class:`ScaleInvalidDataShowAsValuecolor` - fill : str, dict, :class:`ScaleInvalidDataShowAsfill`, :class:`ScaleInvalidDataShowAsValuefill` + fill : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsfill`, :class:`ScaleInvalidDataShowAsValuefill` - fillOpacity : str, dict, :class:`ScaleInvalidDataShowAsfillOpacity`, :class:`ScaleInvalidDataShowAsValuefillOpacity` + fillOpacity : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsfillOpacity`, :class:`ScaleInvalidDataShowAsValuefillOpacity` - opacity : str, dict, :class:`ScaleInvalidDataShowAsopacity`, :class:`ScaleInvalidDataShowAsValueopacity` + opacity : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsopacity`, :class:`ScaleInvalidDataShowAsValueopacity` - radius : str, dict, :class:`ScaleInvalidDataShowAsradius`, :class:`ScaleInvalidDataShowAsValueradius` + radius : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsradius`, :class:`ScaleInvalidDataShowAsValueradius` - shape : str, dict, :class:`ScaleInvalidDataShowAsshape`, :class:`ScaleInvalidDataShowAsValueshape` + shape : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsshape`, :class:`ScaleInvalidDataShowAsValueshape` - size : str, dict, :class:`ScaleInvalidDataShowAssize`, :class:`ScaleInvalidDataShowAsValuesize` + size : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAssize`, :class:`ScaleInvalidDataShowAsValuesize` - stroke : str, dict, :class:`ScaleInvalidDataShowAsstroke`, :class:`ScaleInvalidDataShowAsValuestroke` + stroke : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsstroke`, :class:`ScaleInvalidDataShowAsValuestroke` - strokeDash : str, dict, :class:`ScaleInvalidDataShowAsstrokeDash`, :class:`ScaleInvalidDataShowAsValuestrokeDash` + strokeDash : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsstrokeDash`, :class:`ScaleInvalidDataShowAsValuestrokeDash` - strokeOpacity : str, dict, :class:`ScaleInvalidDataShowAsstrokeOpacity`, :class:`ScaleInvalidDataShowAsValuestrokeOpacity` + strokeOpacity : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsstrokeOpacity`, :class:`ScaleInvalidDataShowAsValuestrokeOpacity` - strokeWidth : str, dict, :class:`ScaleInvalidDataShowAsstrokeWidth`, :class:`ScaleInvalidDataShowAsValuestrokeWidth` + strokeWidth : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsstrokeWidth`, :class:`ScaleInvalidDataShowAsValuestrokeWidth` - theta : str, dict, :class:`ScaleInvalidDataShowAstheta`, :class:`ScaleInvalidDataShowAsValuetheta` + theta : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAstheta`, :class:`ScaleInvalidDataShowAsValuetheta` - x : str, dict, :class:`ScaleInvalidDataShowAsx`, :class:`ScaleInvalidDataShowAsValuex` + x : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsx`, :class:`ScaleInvalidDataShowAsValuex` - xOffset : str, dict, :class:`ScaleInvalidDataShowAsxOffset`, :class:`ScaleInvalidDataShowAsValuexOffset` + xOffset : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsxOffset`, :class:`ScaleInvalidDataShowAsValuexOffset` - y : str, dict, :class:`ScaleInvalidDataShowAsy`, :class:`ScaleInvalidDataShowAsValuey` + y : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsy`, :class:`ScaleInvalidDataShowAsValuey` - yOffset : str, dict, :class:`ScaleInvalidDataShowAsyOffset`, :class:`ScaleInvalidDataShowAsValueyOffset` + yOffset : dict, Literal['zero-or-min'], :class:`ScaleInvalidDataShowAsyOffset`, :class:`ScaleInvalidDataShowAsValueyOffset` """ @@ -19102,23 +19154,23 @@ class ScaleInvalidDataConfig(VegaLiteSchema): def __init__( self, - angle: Optional[str | dict | SchemaBase] = Undefined, - color: Optional[str | dict | SchemaBase] = Undefined, - fill: Optional[str | dict | SchemaBase] = Undefined, - fillOpacity: Optional[str | dict | SchemaBase] = Undefined, - opacity: Optional[str | dict | SchemaBase] = Undefined, - radius: Optional[str | dict | SchemaBase] = Undefined, - shape: Optional[str | dict | SchemaBase] = Undefined, - size: Optional[str | dict | SchemaBase] = Undefined, - stroke: Optional[str | dict | SchemaBase] = Undefined, - strokeDash: Optional[str | dict | SchemaBase] = Undefined, - strokeOpacity: Optional[str | dict | SchemaBase] = Undefined, - strokeWidth: Optional[str | dict | SchemaBase] = Undefined, - theta: Optional[str | dict | SchemaBase] = Undefined, - x: Optional[str | dict | SchemaBase] = Undefined, - xOffset: Optional[str | dict | SchemaBase] = Undefined, - y: Optional[str | dict | SchemaBase] = Undefined, - yOffset: Optional[str | dict | SchemaBase] = Undefined, + angle: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + color: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + fill: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + fillOpacity: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + opacity: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + radius: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + shape: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + size: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + stroke: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + strokeDash: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + strokeOpacity: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + strokeWidth: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + theta: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + x: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + xOffset: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + y: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, + yOffset: Optional[dict | SchemaBase | Literal["zero-or-min"]] = Undefined, **kwds, ): super().__init__( @@ -19550,7 +19602,7 @@ class ScaleInvalidDataShowAsValuex(ScaleInvalidDataShowAsx): Parameters ---------- - value : str, float + value : float, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. @@ -19560,7 +19612,7 @@ class ScaleInvalidDataShowAsValuex(ScaleInvalidDataShowAsx): _schema = {"$ref": '#/definitions/ScaleInvalidDataShowAsValue<"x">'} - def __init__(self, value: Optional[str | float] = Undefined, **kwds): + def __init__(self, value: Optional[float | Literal["width"]] = Undefined, **kwds): super().__init__(value=value, **kwds) @@ -19604,7 +19656,7 @@ class ScaleInvalidDataShowAsValuey(ScaleInvalidDataShowAsy): Parameters ---------- - value : str, float + value : float, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. @@ -19614,7 +19666,7 @@ class ScaleInvalidDataShowAsValuey(ScaleInvalidDataShowAsy): _schema = {"$ref": '#/definitions/ScaleInvalidDataShowAsValue<"y">'} - def __init__(self, value: Optional[str | float] = Undefined, **kwds): + def __init__(self, value: Optional[float | Literal["height"]] = Undefined, **kwds): super().__init__(value=value, **kwds) @@ -19745,7 +19797,7 @@ class SchemeParams(VegaLiteSchema): Parameters ---------- - name : :class:`Cyclical`, :class:`Diverging`, :class:`Categorical`, :class:`ColorScheme`, :class:`SequentialMultiHue`, :class:`SequentialSingleHue`, Literal['rainbow', 'sinebow'], Literal['blues', 'tealblues', 'teals', 'greens', 'browns', 'greys', 'purples', 'warmgreys', 'reds', 'oranges'], Literal['accent', 'category10', 'category20', 'category20b', 'category20c', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'tableau20'], Literal['blueorange', 'blueorange-3', 'blueorange-4', 'blueorange-5', 'blueorange-6', 'blueorange-7', 'blueorange-8', 'blueorange-9', 'blueorange-10', 'blueorange-11', 'brownbluegreen', 'brownbluegreen-3', 'brownbluegreen-4', 'brownbluegreen-5', 'brownbluegreen-6', 'brownbluegreen-7', 'brownbluegreen-8', 'brownbluegreen-9', 'brownbluegreen-10', 'brownbluegreen-11', 'purplegreen', 'purplegreen-3', 'purplegreen-4', 'purplegreen-5', 'purplegreen-6', 'purplegreen-7', 'purplegreen-8', 'purplegreen-9', 'purplegreen-10', 'purplegreen-11', 'pinkyellowgreen', 'pinkyellowgreen-3', 'pinkyellowgreen-4', 'pinkyellowgreen-5', 'pinkyellowgreen-6', 'pinkyellowgreen-7', 'pinkyellowgreen-8', 'pinkyellowgreen-9', 'pinkyellowgreen-10', 'pinkyellowgreen-11', 'purpleorange', 'purpleorange-3', 'purpleorange-4', 'purpleorange-5', 'purpleorange-6', 'purpleorange-7', 'purpleorange-8', 'purpleorange-9', 'purpleorange-10', 'purpleorange-11', 'redblue', 'redblue-3', 'redblue-4', 'redblue-5', 'redblue-6', 'redblue-7', 'redblue-8', 'redblue-9', 'redblue-10', 'redblue-11', 'redgrey', 'redgrey-3', 'redgrey-4', 'redgrey-5', 'redgrey-6', 'redgrey-7', 'redgrey-8', 'redgrey-9', 'redgrey-10', 'redgrey-11', 'redyellowblue', 'redyellowblue-3', 'redyellowblue-4', 'redyellowblue-5', 'redyellowblue-6', 'redyellowblue-7', 'redyellowblue-8', 'redyellowblue-9', 'redyellowblue-10', 'redyellowblue-11', 'redyellowgreen', 'redyellowgreen-3', 'redyellowgreen-4', 'redyellowgreen-5', 'redyellowgreen-6', 'redyellowgreen-7', 'redyellowgreen-8', 'redyellowgreen-9', 'redyellowgreen-10', 'redyellowgreen-11', 'spectral', 'spectral-3', 'spectral-4', 'spectral-5', 'spectral-6', 'spectral-7', 'spectral-8', 'spectral-9', 'spectral-10', 'spectral-11'], Literal['turbo', 'viridis', 'inferno', 'magma', 'plasma', 'cividis', 'bluegreen', 'bluegreen-3', 'bluegreen-4', 'bluegreen-5', 'bluegreen-6', 'bluegreen-7', 'bluegreen-8', 'bluegreen-9', 'bluepurple', 'bluepurple-3', 'bluepurple-4', 'bluepurple-5', 'bluepurple-6', 'bluepurple-7', 'bluepurple-8', 'bluepurple-9', 'goldgreen', 'goldgreen-3', 'goldgreen-4', 'goldgreen-5', 'goldgreen-6', 'goldgreen-7', 'goldgreen-8', 'goldgreen-9', 'goldorange', 'goldorange-3', 'goldorange-4', 'goldorange-5', 'goldorange-6', 'goldorange-7', 'goldorange-8', 'goldorange-9', 'goldred', 'goldred-3', 'goldred-4', 'goldred-5', 'goldred-6', 'goldred-7', 'goldred-8', 'goldred-9', 'greenblue', 'greenblue-3', 'greenblue-4', 'greenblue-5', 'greenblue-6', 'greenblue-7', 'greenblue-8', 'greenblue-9', 'orangered', 'orangered-3', 'orangered-4', 'orangered-5', 'orangered-6', 'orangered-7', 'orangered-8', 'orangered-9', 'purplebluegreen', 'purplebluegreen-3', 'purplebluegreen-4', 'purplebluegreen-5', 'purplebluegreen-6', 'purplebluegreen-7', 'purplebluegreen-8', 'purplebluegreen-9', 'purpleblue', 'purpleblue-3', 'purpleblue-4', 'purpleblue-5', 'purpleblue-6', 'purpleblue-7', 'purpleblue-8', 'purpleblue-9', 'purplered', 'purplered-3', 'purplered-4', 'purplered-5', 'purplered-6', 'purplered-7', 'purplered-8', 'purplered-9', 'redpurple', 'redpurple-3', 'redpurple-4', 'redpurple-5', 'redpurple-6', 'redpurple-7', 'redpurple-8', 'redpurple-9', 'yellowgreenblue', 'yellowgreenblue-3', 'yellowgreenblue-4', 'yellowgreenblue-5', 'yellowgreenblue-6', 'yellowgreenblue-7', 'yellowgreenblue-8', 'yellowgreenblue-9', 'yellowgreen', 'yellowgreen-3', 'yellowgreen-4', 'yellowgreen-5', 'yellowgreen-6', 'yellowgreen-7', 'yellowgreen-8', 'yellowgreen-9', 'yelloworangebrown', 'yelloworangebrown-3', 'yelloworangebrown-4', 'yelloworangebrown-5', 'yelloworangebrown-6', 'yelloworangebrown-7', 'yelloworangebrown-8', 'yelloworangebrown-9', 'yelloworangered', 'yelloworangered-3', 'yelloworangered-4', 'yelloworangered-5', 'yelloworangered-6', 'yelloworangered-7', 'yelloworangered-8', 'yelloworangered-9', 'darkblue', 'darkblue-3', 'darkblue-4', 'darkblue-5', 'darkblue-6', 'darkblue-7', 'darkblue-8', 'darkblue-9', 'darkgold', 'darkgold-3', 'darkgold-4', 'darkgold-5', 'darkgold-6', 'darkgold-7', 'darkgold-8', 'darkgold-9', 'darkgreen', 'darkgreen-3', 'darkgreen-4', 'darkgreen-5', 'darkgreen-6', 'darkgreen-7', 'darkgreen-8', 'darkgreen-9', 'darkmulti', 'darkmulti-3', 'darkmulti-4', 'darkmulti-5', 'darkmulti-6', 'darkmulti-7', 'darkmulti-8', 'darkmulti-9', 'darkred', 'darkred-3', 'darkred-4', 'darkred-5', 'darkred-6', 'darkred-7', 'darkred-8', 'darkred-9', 'lightgreyred', 'lightgreyred-3', 'lightgreyred-4', 'lightgreyred-5', 'lightgreyred-6', 'lightgreyred-7', 'lightgreyred-8', 'lightgreyred-9', 'lightgreyteal', 'lightgreyteal-3', 'lightgreyteal-4', 'lightgreyteal-5', 'lightgreyteal-6', 'lightgreyteal-7', 'lightgreyteal-8', 'lightgreyteal-9', 'lightmulti', 'lightmulti-3', 'lightmulti-4', 'lightmulti-5', 'lightmulti-6', 'lightmulti-7', 'lightmulti-8', 'lightmulti-9', 'lightorange', 'lightorange-3', 'lightorange-4', 'lightorange-5', 'lightorange-6', 'lightorange-7', 'lightorange-8', 'lightorange-9', 'lighttealblue', 'lighttealblue-3', 'lighttealblue-4', 'lighttealblue-5', 'lighttealblue-6', 'lighttealblue-7', 'lighttealblue-8', 'lighttealblue-9'] + name : :class:`Cyclical`, :class:`Diverging`, :class:`Categorical`, :class:`ColorScheme`, :class:`SequentialMultiHue`, :class:`SequentialSingleHue`, Literal['accent', 'category10', 'category20', 'category20b', 'category20c', 'dark2', 'paired', 'pastel1', 'pastel2', 'set1', 'set2', 'set3', 'tableau10', 'tableau20', 'blueorange', 'blueorange-3', 'blueorange-4', 'blueorange-5', 'blueorange-6', 'blueorange-7', 'blueorange-8', 'blueorange-9', 'blueorange-10', 'blueorange-11', 'brownbluegreen', 'brownbluegreen-3', 'brownbluegreen-4', 'brownbluegreen-5', 'brownbluegreen-6', 'brownbluegreen-7', 'brownbluegreen-8', 'brownbluegreen-9', 'brownbluegreen-10', 'brownbluegreen-11', 'purplegreen', 'purplegreen-3', 'purplegreen-4', 'purplegreen-5', 'purplegreen-6', 'purplegreen-7', 'purplegreen-8', 'purplegreen-9', 'purplegreen-10', 'purplegreen-11', 'pinkyellowgreen', 'pinkyellowgreen-3', 'pinkyellowgreen-4', 'pinkyellowgreen-5', 'pinkyellowgreen-6', 'pinkyellowgreen-7', 'pinkyellowgreen-8', 'pinkyellowgreen-9', 'pinkyellowgreen-10', 'pinkyellowgreen-11', 'purpleorange', 'purpleorange-3', 'purpleorange-4', 'purpleorange-5', 'purpleorange-6', 'purpleorange-7', 'purpleorange-8', 'purpleorange-9', 'purpleorange-10', 'purpleorange-11', 'redblue', 'redblue-3', 'redblue-4', 'redblue-5', 'redblue-6', 'redblue-7', 'redblue-8', 'redblue-9', 'redblue-10', 'redblue-11', 'redgrey', 'redgrey-3', 'redgrey-4', 'redgrey-5', 'redgrey-6', 'redgrey-7', 'redgrey-8', 'redgrey-9', 'redgrey-10', 'redgrey-11', 'redyellowblue', 'redyellowblue-3', 'redyellowblue-4', 'redyellowblue-5', 'redyellowblue-6', 'redyellowblue-7', 'redyellowblue-8', 'redyellowblue-9', 'redyellowblue-10', 'redyellowblue-11', 'redyellowgreen', 'redyellowgreen-3', 'redyellowgreen-4', 'redyellowgreen-5', 'redyellowgreen-6', 'redyellowgreen-7', 'redyellowgreen-8', 'redyellowgreen-9', 'redyellowgreen-10', 'redyellowgreen-11', 'spectral', 'spectral-3', 'spectral-4', 'spectral-5', 'spectral-6', 'spectral-7', 'spectral-8', 'spectral-9', 'spectral-10', 'spectral-11', 'blues', 'tealblues', 'teals', 'greens', 'browns', 'greys', 'purples', 'warmgreys', 'reds', 'oranges', 'rainbow', 'sinebow', 'turbo', 'viridis', 'inferno', 'magma', 'plasma', 'cividis', 'bluegreen', 'bluegreen-3', 'bluegreen-4', 'bluegreen-5', 'bluegreen-6', 'bluegreen-7', 'bluegreen-8', 'bluegreen-9', 'bluepurple', 'bluepurple-3', 'bluepurple-4', 'bluepurple-5', 'bluepurple-6', 'bluepurple-7', 'bluepurple-8', 'bluepurple-9', 'goldgreen', 'goldgreen-3', 'goldgreen-4', 'goldgreen-5', 'goldgreen-6', 'goldgreen-7', 'goldgreen-8', 'goldgreen-9', 'goldorange', 'goldorange-3', 'goldorange-4', 'goldorange-5', 'goldorange-6', 'goldorange-7', 'goldorange-8', 'goldorange-9', 'goldred', 'goldred-3', 'goldred-4', 'goldred-5', 'goldred-6', 'goldred-7', 'goldred-8', 'goldred-9', 'greenblue', 'greenblue-3', 'greenblue-4', 'greenblue-5', 'greenblue-6', 'greenblue-7', 'greenblue-8', 'greenblue-9', 'orangered', 'orangered-3', 'orangered-4', 'orangered-5', 'orangered-6', 'orangered-7', 'orangered-8', 'orangered-9', 'purplebluegreen', 'purplebluegreen-3', 'purplebluegreen-4', 'purplebluegreen-5', 'purplebluegreen-6', 'purplebluegreen-7', 'purplebluegreen-8', 'purplebluegreen-9', 'purpleblue', 'purpleblue-3', 'purpleblue-4', 'purpleblue-5', 'purpleblue-6', 'purpleblue-7', 'purpleblue-8', 'purpleblue-9', 'purplered', 'purplered-3', 'purplered-4', 'purplered-5', 'purplered-6', 'purplered-7', 'purplered-8', 'purplered-9', 'redpurple', 'redpurple-3', 'redpurple-4', 'redpurple-5', 'redpurple-6', 'redpurple-7', 'redpurple-8', 'redpurple-9', 'yellowgreenblue', 'yellowgreenblue-3', 'yellowgreenblue-4', 'yellowgreenblue-5', 'yellowgreenblue-6', 'yellowgreenblue-7', 'yellowgreenblue-8', 'yellowgreenblue-9', 'yellowgreen', 'yellowgreen-3', 'yellowgreen-4', 'yellowgreen-5', 'yellowgreen-6', 'yellowgreen-7', 'yellowgreen-8', 'yellowgreen-9', 'yelloworangebrown', 'yelloworangebrown-3', 'yelloworangebrown-4', 'yelloworangebrown-5', 'yelloworangebrown-6', 'yelloworangebrown-7', 'yelloworangebrown-8', 'yelloworangebrown-9', 'yelloworangered', 'yelloworangered-3', 'yelloworangered-4', 'yelloworangered-5', 'yelloworangered-6', 'yelloworangered-7', 'yelloworangered-8', 'yelloworangered-9', 'darkblue', 'darkblue-3', 'darkblue-4', 'darkblue-5', 'darkblue-6', 'darkblue-7', 'darkblue-8', 'darkblue-9', 'darkgold', 'darkgold-3', 'darkgold-4', 'darkgold-5', 'darkgold-6', 'darkgold-7', 'darkgold-8', 'darkgold-9', 'darkgreen', 'darkgreen-3', 'darkgreen-4', 'darkgreen-5', 'darkgreen-6', 'darkgreen-7', 'darkgreen-8', 'darkgreen-9', 'darkmulti', 'darkmulti-3', 'darkmulti-4', 'darkmulti-5', 'darkmulti-6', 'darkmulti-7', 'darkmulti-8', 'darkmulti-9', 'darkred', 'darkred-3', 'darkred-4', 'darkred-5', 'darkred-6', 'darkred-7', 'darkred-8', 'darkred-9', 'lightgreyred', 'lightgreyred-3', 'lightgreyred-4', 'lightgreyred-5', 'lightgreyred-6', 'lightgreyred-7', 'lightgreyred-8', 'lightgreyred-9', 'lightgreyteal', 'lightgreyteal-3', 'lightgreyteal-4', 'lightgreyteal-5', 'lightgreyteal-6', 'lightgreyteal-7', 'lightgreyteal-8', 'lightgreyteal-9', 'lightmulti', 'lightmulti-3', 'lightmulti-4', 'lightmulti-5', 'lightmulti-6', 'lightmulti-7', 'lightmulti-8', 'lightmulti-9', 'lightorange', 'lightorange-3', 'lightorange-4', 'lightorange-5', 'lightorange-6', 'lightorange-7', 'lightorange-8', 'lightorange-9', 'lighttealblue', 'lighttealblue-3', 'lighttealblue-4', 'lighttealblue-5', 'lighttealblue-6', 'lighttealblue-7', 'lighttealblue-8', 'lighttealblue-9'] A color scheme name for ordinal scales (e.g., ``"category10"`` or ``"blues"``). For the full list of supported schemes, please refer to the `Vega Scheme @@ -19831,7 +19883,7 @@ class SecondaryFieldDef(Position2Def): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -20058,7 +20110,7 @@ class SelectionParameter(VegaLiteSchema): * ``"point"`` -- to select multiple discrete data values; the first value is selected on ``click`` and additional values toggled on shift-click. * ``"interval"`` -- to select a continuous range of data values on ``drag``. - bind : str, dict, :class:`Binding`, :class:`BindInput`, :class:`BindRange`, :class:`BindDirect`, :class:`BindCheckbox`, :class:`LegendBinding`, :class:`BindRadioSelect`, :class:`LegendStreamBinding` + bind : dict, :class:`Binding`, :class:`BindInput`, :class:`BindRange`, :class:`BindDirect`, :class:`BindCheckbox`, :class:`LegendBinding`, :class:`BindRadioSelect`, Literal['legend', 'scales'], :class:`LegendStreamBinding` When set, a selection is populated by input elements (also known as dynamic query widgets) or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; to re-enable it, set the selection's `on @@ -20089,7 +20141,7 @@ def __init__( self, name: Optional[str | SchemaBase] = Undefined, select: Optional[dict | SchemaBase | SelectionType_T] = Undefined, - bind: Optional[str | dict | SchemaBase] = Undefined, + bind: Optional[dict | SchemaBase | Literal["legend", "scales"]] = Undefined, value: Optional[ str | bool | dict | None | float | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -20421,7 +20473,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefTypeForShapestringnull( **See also:** `scale `__ documentation. - sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text'], Literal['ascending', 'descending'] + sort : dict, None, :class:`Sort`, Sequence[str], Sequence[bool], Sequence[float], :class:`SortArray`, :class:`SortOrder`, :class:`AllSortString`, :class:`SortByChannel`, :class:`SortByEncoding`, :class:`EncodingSortField`, :class:`SortByChannelDesc`, Sequence[dict, :class:`DateTime`], Literal['-x', '-y', '-color', '-fill', '-stroke', '-strokeWidth', '-size', '-shape', '-fillOpacity', '-strokeOpacity', '-opacity', '-text', 'ascending', 'descending', 'x', 'y', 'color', 'fill', 'stroke', 'strokeWidth', 'size', 'shape', 'fillOpacity', 'strokeOpacity', 'opacity', 'text'] Sort order for the encoded field. For continuous fields (quantitative or temporal), ``sort`` can be either @@ -20459,7 +20511,7 @@ class FieldOrDatumDefWithConditionMarkPropFieldDefTypeForShapestringnull( **See also:** `sort `__ documentation. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -21220,7 +21272,7 @@ class FacetedUnitSpec(Spec, NonNormalizedSpec): Parameters ---------- - mark : str, dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape'] + mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape', 'boxplot', 'errorband', 'errorbar'] A string describing the mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"rule"``, ``"geoshape"``, and ``"text"``) or a `mark definition object @@ -21267,7 +21319,7 @@ class FacetedUnitSpec(Spec, NonNormalizedSpec): Description of this mark for commenting purpose. encoding : dict, :class:`FacetedEncoding` A key-value mapping between encoding channels and definition of fields. - height : str, dict, float, :class:`Step` + height : dict, float, :class:`Step`, Literal['container'] The height of a visualization. * For a plot with a continuous y-field, height should be a number. @@ -21313,7 +21365,7 @@ class FacetedUnitSpec(Spec, NonNormalizedSpec): An object defining the view background's fill and stroke. **Default value:** none (transparent) - width : str, dict, float, :class:`Step` + width : dict, float, :class:`Step`, Literal['container'] The width of a visualization. * For a plot with a continuous x-field, width should be a number. @@ -21338,14 +21390,14 @@ class FacetedUnitSpec(Spec, NonNormalizedSpec): def __init__( self, - mark: Optional[str | dict | SchemaBase | Mark_T] = Undefined, + mark: Optional[dict | SchemaBase | Mark_T | CompositeMark_T] = Undefined, align: Optional[dict | SchemaBase | LayoutAlign_T] = Undefined, bounds: Optional[Literal["full", "flush"]] = Undefined, center: Optional[bool | dict | SchemaBase] = Undefined, data: Optional[dict | None | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, - height: Optional[str | dict | float | SchemaBase] = Undefined, + height: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, name: Optional[str] = Undefined, params: Optional[Sequence[dict | SchemaBase]] = Undefined, projection: Optional[dict | SchemaBase] = Undefined, @@ -21354,7 +21406,7 @@ def __init__( title: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, transform: Optional[Sequence[dict | SchemaBase]] = Undefined, view: Optional[dict | SchemaBase] = Undefined, - width: Optional[str | dict | float | SchemaBase] = Undefined, + width: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, **kwds, ): super().__init__( @@ -21479,7 +21531,7 @@ class LayerSpec(Spec, NonNormalizedSpec): encoding : dict, :class:`SharedEncoding` A shared key-value mapping between encoding channels and definition of fields in the underlying layers. - height : str, dict, float, :class:`Step` + height : dict, float, :class:`Step`, Literal['container'] The height of a visualization. * For a plot with a continuous y-field, height should be a number. @@ -21513,7 +21565,7 @@ class LayerSpec(Spec, NonNormalizedSpec): An object defining the view background's fill and stroke. **Default value:** none (transparent) - width : str, dict, float, :class:`Step` + width : dict, float, :class:`Step`, Literal['container'] The width of a visualization. * For a plot with a continuous x-field, width should be a number. @@ -21542,14 +21594,14 @@ def __init__( data: Optional[dict | None | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, - height: Optional[str | dict | float | SchemaBase] = Undefined, + height: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, name: Optional[str] = Undefined, projection: Optional[dict | SchemaBase] = Undefined, resolve: Optional[dict | SchemaBase] = Undefined, title: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, transform: Optional[Sequence[dict | SchemaBase]] = Undefined, view: Optional[dict | SchemaBase] = Undefined, - width: Optional[str | dict | float | SchemaBase] = Undefined, + width: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, **kwds, ): super().__init__( @@ -21842,7 +21894,7 @@ class SphereGenerator(Generator): Parameters ---------- - sphere : bool, dict + sphere : dict, Literal[True] Generate sphere GeoJSON data for the full globe. name : str Provide a placeholder name and bind data at runtime. @@ -21852,7 +21904,7 @@ class SphereGenerator(Generator): def __init__( self, - sphere: Optional[bool | dict] = Undefined, + sphere: Optional[dict | Literal[True]] = Undefined, name: Optional[str] = Undefined, **kwds, ): @@ -22043,7 +22095,7 @@ class StringFieldDef(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -22111,7 +22163,7 @@ class StringFieldDef(VegaLiteSchema): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -22214,7 +22266,7 @@ def __init__( self, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, format: Optional[str | dict | SchemaBase] = Undefined, formatType: Optional[str] = Undefined, @@ -22259,7 +22311,7 @@ class StringFieldDefWithCondition(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -22334,7 +22386,7 @@ class StringFieldDefWithCondition(VegaLiteSchema): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -22438,7 +22490,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -22835,7 +22887,7 @@ class FieldOrDatumDefWithConditionStringFieldDefText(TextDef): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -22910,7 +22962,7 @@ class FieldOrDatumDefWithConditionStringFieldDefText(TextDef): * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. * ``"number"`` for quantitative fields as well as ordinal and nominal fields without ``timeUnit``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -23016,7 +23068,7 @@ def __init__( shorthand: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, condition: Optional[ dict | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -23091,7 +23143,7 @@ class TickConfig(AnyMarkConfig): **Default value:** 3/4 of step (width step for horizontal ticks and height step for vertical ticks). - baseline : str, dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : dict, :class:`ExprRef`, :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an expression reference that provides one of the valid values. The ``"line-top"`` and @@ -23417,24 +23469,24 @@ class TickConfig(AnyMarkConfig): The URL of the image file for image marks. width : dict, float, :class:`ExprRef` Width of the marks. - x : str, dict, float, :class:`ExprRef` + x : dict, float, :class:`ExprRef`, Literal['width'] X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without specified ``x2`` or ``width``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - x2 : str, dict, float, :class:`ExprRef` + x2 : dict, float, :class:`ExprRef`, Literal['width'] X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"width"`` for the width of the plot. - y : str, dict, float, :class:`ExprRef` + y : dict, float, :class:`ExprRef`, Literal['height'] Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without specified ``y2`` or ``height``. The ``value`` of this channel can be a number or a string ``"height"`` for the height of the plot. - y2 : str, dict, float, :class:`ExprRef` + y2 : dict, float, :class:`ExprRef`, Literal['height'] Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. The ``value`` of this channel can be a number or a string ``"height"`` for the @@ -23452,9 +23504,7 @@ def __init__( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, cornerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -23532,10 +23582,18 @@ def __init__( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, **kwds, ): super().__init__( @@ -23770,7 +23828,7 @@ class TimeUnitParams(VegaLiteSchema): If no ``unit`` is specified, maxbins is used to infer time units. step : float The number of steps between bins, in terms of the least significant unit provided. - unit : :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + unit : :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Defines how date-time values should be binned. utc : bool True to use UTC timezone. Equivalent to using a ``utc`` prefixed ``TimeUnit``. @@ -23802,7 +23860,7 @@ class TimeUnitTransformParams(VegaLiteSchema): If no ``unit`` is specified, maxbins is used to infer time units. step : float The number of steps between bins, in terms of the least significant unit provided. - unit : :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + unit : :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Defines how date-time values should be binned. utc : bool True to use UTC timezone. Equivalent to using a ``utc`` prefixed ``TimeUnit``. @@ -23852,7 +23910,7 @@ class TitleConfig(VegaLiteSchema): the output SVG group, removing the title from the ARIA accessibility tree. **Default value:** ``true`` - baseline : str, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for title and subtitle text. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly @@ -23919,7 +23977,7 @@ def __init__( anchor: Optional[dict | Parameter | SchemaBase | TitleAnchor_T] = Undefined, angle: Optional[dict | float | Parameter | SchemaBase] = Undefined, aria: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[str | SchemaBase | Baseline_T] = Undefined, + baseline: Optional[SchemaBase | TextBaseline_T] = Undefined, color: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T ] = Undefined, @@ -24031,7 +24089,7 @@ class TitleParams(VegaLiteSchema): the output SVG group, removing the title from the ARIA accessibility tree. **Default value:** ``true`` - baseline : str, :class:`Baseline`, :class:`TextBaseline`, Literal['top', 'middle', 'bottom'] + baseline : :class:`Baseline`, :class:`TextBaseline`, Literal['alphabetic', 'line-bottom', 'line-top', 'top', 'middle', 'bottom'] Vertical text baseline for title and subtitle text. One of ``"alphabetic"`` (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly @@ -24106,7 +24164,7 @@ def __init__( anchor: Optional[SchemaBase | TitleAnchor_T] = Undefined, angle: Optional[dict | float | Parameter | SchemaBase] = Undefined, aria: Optional[bool | dict | Parameter | SchemaBase] = Undefined, - baseline: Optional[str | SchemaBase | Baseline_T] = Undefined, + baseline: Optional[SchemaBase | TextBaseline_T] = Undefined, color: Optional[ str | dict | None | Parameter | SchemaBase | ColorName_T ] = Undefined, @@ -24215,7 +24273,7 @@ class TopLevelSelectionParameter(TopLevelParameter): * ``"point"`` -- to select multiple discrete data values; the first value is selected on ``click`` and additional values toggled on shift-click. * ``"interval"`` -- to select a continuous range of data values on ``drag``. - bind : str, dict, :class:`Binding`, :class:`BindInput`, :class:`BindRange`, :class:`BindDirect`, :class:`BindCheckbox`, :class:`LegendBinding`, :class:`BindRadioSelect`, :class:`LegendStreamBinding` + bind : dict, :class:`Binding`, :class:`BindInput`, :class:`BindRange`, :class:`BindDirect`, :class:`BindCheckbox`, :class:`LegendBinding`, :class:`BindRadioSelect`, Literal['legend', 'scales'], :class:`LegendStreamBinding` When set, a selection is populated by input elements (also known as dynamic query widgets) or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; to re-enable it, set the selection's `on @@ -24250,7 +24308,7 @@ def __init__( self, name: Optional[str | SchemaBase] = Undefined, select: Optional[dict | SchemaBase | SelectionType_T] = Undefined, - bind: Optional[str | dict | SchemaBase] = Undefined, + bind: Optional[dict | SchemaBase | Literal["legend", "scales"]] = Undefined, value: Optional[ str | bool | dict | None | float | SchemaBase | Sequence[dict | SchemaBase] ] = Undefined, @@ -24785,7 +24843,7 @@ class TopLevelLayerSpec(TopLevelSpec): encoding : dict, :class:`SharedEncoding` A shared key-value mapping between encoding channels and definition of fields in the underlying layers. - height : str, dict, float, :class:`Step` + height : dict, float, :class:`Step`, Literal['container'] The height of a visualization. * For a plot with a continuous y-field, height should be a number. @@ -24831,7 +24889,7 @@ class TopLevelLayerSpec(TopLevelSpec): An object defining the view background's fill and stroke. **Default value:** none (transparent) - width : str, dict, float, :class:`Step` + width : dict, float, :class:`Step`, Literal['container'] The width of a visualization. * For a plot with a continuous x-field, width should be a number. @@ -24872,7 +24930,7 @@ def __init__( datasets: Optional[dict | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, - height: Optional[str | dict | float | SchemaBase] = Undefined, + height: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, name: Optional[str] = Undefined, padding: Optional[dict | float | Parameter | SchemaBase] = Undefined, params: Optional[Sequence[dict | SchemaBase]] = Undefined, @@ -24882,7 +24940,7 @@ def __init__( transform: Optional[Sequence[dict | SchemaBase]] = Undefined, usermeta: Optional[dict | SchemaBase] = Undefined, view: Optional[dict | SchemaBase] = Undefined, - width: Optional[str | dict | float | SchemaBase] = Undefined, + width: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, **kwds, ): super().__init__( @@ -24927,7 +24985,7 @@ class TopLevelUnitSpec(TopLevelSpec): data : dict, None, :class:`Data`, :class:`UrlData`, :class:`Generator`, :class:`NamedData`, :class:`DataSource`, :class:`InlineData`, :class:`SphereGenerator`, :class:`SequenceGenerator`, :class:`GraticuleGenerator` An object describing the data source. Set to ``null`` to ignore the parent's data source. If no data is set, it is derived from the parent. - mark : str, dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape'] + mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape', 'boxplot', 'errorband', 'errorbar'] A string describing the mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"rule"``, ``"geoshape"``, and ``"text"``) or a `mark definition object @@ -24988,7 +25046,7 @@ class TopLevelUnitSpec(TopLevelSpec): Description of this mark for commenting purpose. encoding : dict, :class:`FacetedEncoding` A key-value mapping between encoding channels and definition of fields. - height : str, dict, float, :class:`Step` + height : dict, float, :class:`Step`, Literal['container'] The height of a visualization. * For a plot with a continuous y-field, height should be a number. @@ -25044,7 +25102,7 @@ class TopLevelUnitSpec(TopLevelSpec): An object defining the view background's fill and stroke. **Default value:** none (transparent) - width : str, dict, float, :class:`Step` + width : dict, float, :class:`Step`, Literal['container'] The width of a visualization. * For a plot with a continuous x-field, width should be a number. @@ -25076,7 +25134,7 @@ class TopLevelUnitSpec(TopLevelSpec): def __init__( self, data: Optional[dict | None | SchemaBase] = Undefined, - mark: Optional[str | dict | SchemaBase | Mark_T] = Undefined, + mark: Optional[dict | SchemaBase | Mark_T | CompositeMark_T] = Undefined, align: Optional[dict | SchemaBase | LayoutAlign_T] = Undefined, autosize: Optional[dict | SchemaBase | AutosizeType_T] = Undefined, background: Optional[ @@ -25088,7 +25146,7 @@ def __init__( datasets: Optional[dict | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, - height: Optional[str | dict | float | SchemaBase] = Undefined, + height: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, name: Optional[str] = Undefined, padding: Optional[dict | float | Parameter | SchemaBase] = Undefined, params: Optional[Sequence[dict | SchemaBase]] = Undefined, @@ -25099,7 +25157,7 @@ def __init__( transform: Optional[Sequence[dict | SchemaBase]] = Undefined, usermeta: Optional[dict | SchemaBase] = Undefined, view: Optional[dict | SchemaBase] = Undefined, - width: Optional[str | dict | float | SchemaBase] = Undefined, + width: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, **kwds, ): super().__init__( @@ -25289,7 +25347,7 @@ class TopoDataFormat(DataFormat): UTC date format parsing is supported similarly (e.g., ``{foo: "utc:'%m%d%Y'"}``). See more about `UTC time `__ - type : str + type : Literal['topojson'] Type of input data: ``"json"``, ``"csv"``, ``"tsv"``, ``"dsv"``. **Default value:** The default format type is determined by the extension of the @@ -25303,7 +25361,7 @@ def __init__( feature: Optional[str] = Undefined, mesh: Optional[str] = Undefined, parse: Optional[dict | None | SchemaBase] = Undefined, - type: Optional[str] = Undefined, + type: Optional[Literal["topojson"]] = Undefined, **kwds, ): super().__init__(feature=feature, mesh=mesh, parse=parse, type=type, **kwds) @@ -25348,7 +25406,7 @@ class BinTransform(Transform): Parameters ---------- - bin : bool, dict, :class:`BinParams` + bin : dict, Literal[True], :class:`BinParams` An object indicating bin properties, or simply ``true`` for using default bin parameters. field : str, :class:`FieldName` @@ -25364,7 +25422,7 @@ class BinTransform(Transform): def __init__( self, - bin: Optional[bool | dict | SchemaBase] = Undefined, + bin: Optional[dict | SchemaBase | Literal[True]] = Undefined, field: Optional[str | SchemaBase] = Undefined, **kwds, ): @@ -25967,7 +26025,7 @@ class TimeUnitTransform(Transform): ---------- field : str, :class:`FieldName` The data field to apply time unit. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, :class:`TimeUnitTransformParams`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`SingleTimeUnit`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, :class:`TimeUnitTransformParams`, Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] The timeUnit. as : str, :class:`FieldName` The output field to write the timeUnit value. @@ -26028,7 +26086,7 @@ class TypedFieldDef(VegaLiteSchema): Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0``, and at the middle of the band if set to ``0.5``. - bin : str, bool, dict, None, :class:`BinParams` + bin : bool, dict, None, Literal['binned'], :class:`BinParams` A flag for binning a ``quantitative`` field, `an object defining binning parameters `__, or indicating that the data for ``x`` or ``y`` channel are binned before they are imported into @@ -26064,7 +26122,7 @@ class TypedFieldDef(VegaLiteSchema): about escaping in the `field documentation `__. 2) ``field`` is not required if ``aggregate`` is ``count``. - timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'], Literal['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'], Literal['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'], Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'], Literal['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'], Literal['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'] + timeUnit : dict, :class:`TimeUnit`, :class:`MultiTimeUnit`, :class:`BinnedTimeUnit`, :class:`SingleTimeUnit`, :class:`TimeUnitParams`, :class:`UtcMultiTimeUnit`, :class:`UtcSingleTimeUnit`, :class:`LocalMultiTimeUnit`, :class:`LocalSingleTimeUnit`, Literal['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear', 'binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear', 'utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds', 'year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds', 'utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweekdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds', 'yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'] Time unit (e.g., ``year``, ``yearmonth``, ``month``, ``hours``) for a temporal field. or `a temporal field that gets casted as ordinal `__. @@ -26167,7 +26225,7 @@ def __init__( self, aggregate: Optional[dict | SchemaBase | NonArgAggregateOp_T] = Undefined, bandPosition: Optional[float] = Undefined, - bin: Optional[str | bool | dict | None | SchemaBase] = Undefined, + bin: Optional[bool | dict | None | SchemaBase | Literal["binned"]] = Undefined, field: Optional[str | dict | SchemaBase] = Undefined, timeUnit: Optional[ dict | SchemaBase | MultiTimeUnit_T | BinnedTimeUnit_T | SingleTimeUnit_T @@ -26205,7 +26263,7 @@ class UnitSpec(VegaLiteSchema): Parameters ---------- - mark : str, dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape'] + mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape', 'boxplot', 'errorband', 'errorbar'] A string describing the mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"rule"``, ``"geoshape"``, and ``"text"``) or a `mark definition object @@ -26236,7 +26294,7 @@ class UnitSpec(VegaLiteSchema): def __init__( self, - mark: Optional[str | dict | SchemaBase | Mark_T] = Undefined, + mark: Optional[dict | SchemaBase | Mark_T | CompositeMark_T] = Undefined, data: Optional[dict | None | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, @@ -26267,7 +26325,7 @@ class UnitSpecWithFrame(VegaLiteSchema): Parameters ---------- - mark : str, dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape'] + mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, :class:`CompositeMarkDef`, Literal['arc', 'area', 'bar', 'image', 'line', 'point', 'rect', 'rule', 'text', 'tick', 'trail', 'circle', 'square', 'geoshape', 'boxplot', 'errorband', 'errorbar'] A string describing the mark type (one of ``"bar"``, ``"circle"``, ``"square"``, ``"tick"``, ``"line"``, ``"area"``, ``"point"``, ``"rule"``, ``"geoshape"``, and ``"text"``) or a `mark definition object @@ -26279,7 +26337,7 @@ class UnitSpecWithFrame(VegaLiteSchema): Description of this mark for commenting purpose. encoding : dict, :class:`Encoding` A key-value mapping between encoding channels and definition of fields. - height : str, dict, float, :class:`Step` + height : dict, float, :class:`Step`, Literal['container'] The height of a visualization. * For a plot with a continuous y-field, height should be a number. @@ -26315,7 +26373,7 @@ class UnitSpecWithFrame(VegaLiteSchema): An object defining the view background's fill and stroke. **Default value:** none (transparent) - width : str, dict, float, :class:`Step` + width : dict, float, :class:`Step`, Literal['container'] The width of a visualization. * For a plot with a continuous x-field, width should be a number. @@ -26340,18 +26398,18 @@ class UnitSpecWithFrame(VegaLiteSchema): def __init__( self, - mark: Optional[str | dict | SchemaBase | Mark_T] = Undefined, + mark: Optional[dict | SchemaBase | Mark_T | CompositeMark_T] = Undefined, data: Optional[dict | None | SchemaBase] = Undefined, description: Optional[str] = Undefined, encoding: Optional[dict | SchemaBase] = Undefined, - height: Optional[str | dict | float | SchemaBase] = Undefined, + height: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, name: Optional[str] = Undefined, params: Optional[Sequence[dict | SchemaBase]] = Undefined, projection: Optional[dict | SchemaBase] = Undefined, title: Optional[str | dict | SchemaBase | Sequence[str]] = Undefined, transform: Optional[Sequence[dict | SchemaBase]] = Undefined, view: Optional[dict | SchemaBase] = Undefined, - width: Optional[str | dict | float | SchemaBase] = Undefined, + width: Optional[dict | float | SchemaBase | Literal["container"]] = Undefined, **kwds, ): super().__init__( @@ -26704,7 +26762,7 @@ class ValueDefnumberwidthheightExprRef(VegaLiteSchema): Parameters ---------- - value : str, dict, float, :class:`ExprRef` + value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constant value in visual domain (e.g., ``"red"`` / ``"#0099ff"`` / `gradient definition `__ for color, values between ``0`` to ``1`` for opacity). @@ -26714,7 +26772,9 @@ class ValueDefnumberwidthheightExprRef(VegaLiteSchema): def __init__( self, - value: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + value: Optional[ + dict | float | Parameter | SchemaBase | Literal["height", "width"] + ] = Undefined, **kwds, ): super().__init__(value=value, **kwds) @@ -27114,7 +27174,7 @@ class WindowFieldDef(VegaLiteSchema): Parameters ---------- - op : :class:`AggregateOp`, :class:`WindowOnlyOp`, Literal['row_number', 'rank', 'dense_rank', 'percent_rank', 'cume_dist', 'ntile', 'lag', 'lead', 'first_value', 'last_value', 'nth_value'], Literal['argmax', 'argmin', 'average', 'count', 'distinct', 'max', 'mean', 'median', 'min', 'missing', 'product', 'q1', 'q3', 'ci0', 'ci1', 'stderr', 'stdev', 'stdevp', 'sum', 'valid', 'values', 'variance', 'variancep', 'exponential', 'exponentialb'] + op : :class:`AggregateOp`, :class:`WindowOnlyOp`, Literal['argmax', 'argmin', 'average', 'count', 'distinct', 'max', 'mean', 'median', 'min', 'missing', 'product', 'q1', 'q3', 'ci0', 'ci1', 'stderr', 'stdev', 'stdevp', 'sum', 'valid', 'values', 'variance', 'variancep', 'exponential', 'exponentialb', 'row_number', 'rank', 'dense_rank', 'percent_rank', 'cume_dist', 'ntile', 'lag', 'lead', 'first_value', 'last_value', 'nth_value'] The window or aggregation operation to apply within a window (e.g., ``"rank"``, ``"lead"``, ``"sum"``, ``"average"`` or ``"count"``). See the list of all supported operations `here `__. diff --git a/altair/vegalite/v5/schema/mixins.py b/altair/vegalite/v5/schema/mixins.py index 940164158..90b8252ce 100644 --- a/altair/vegalite/v5/schema/mixins.py +++ b/altair/vegalite/v5/schema/mixins.py @@ -4,7 +4,7 @@ from __future__ import annotations import sys -from typing import TYPE_CHECKING, Sequence +from typing import TYPE_CHECKING, Literal, Sequence from altair.utils import use_signature from altair.utils.schemapi import Undefined @@ -39,9 +39,7 @@ def mark_arc( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -94,7 +92,7 @@ def mark_arc( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -130,12 +128,20 @@ def mark_arc( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -246,9 +252,7 @@ def mark_area( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -301,7 +305,7 @@ def mark_area( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -337,12 +341,20 @@ def mark_area( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -453,9 +465,7 @@ def mark_bar( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -508,7 +518,7 @@ def mark_bar( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -544,12 +554,20 @@ def mark_bar( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -660,9 +678,7 @@ def mark_image( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -715,7 +731,7 @@ def mark_image( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -751,12 +767,20 @@ def mark_image( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -867,9 +891,7 @@ def mark_line( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -922,7 +944,7 @@ def mark_line( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -958,12 +980,20 @@ def mark_line( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -1074,9 +1104,7 @@ def mark_point( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -1129,7 +1157,7 @@ def mark_point( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1165,12 +1193,20 @@ def mark_point( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -1281,9 +1317,7 @@ def mark_rect( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -1336,7 +1370,7 @@ def mark_rect( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1372,12 +1406,20 @@ def mark_rect( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -1488,9 +1530,7 @@ def mark_rule( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -1543,7 +1583,7 @@ def mark_rule( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1579,12 +1619,20 @@ def mark_rule( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -1695,9 +1743,7 @@ def mark_text( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -1750,7 +1796,7 @@ def mark_text( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1786,12 +1832,20 @@ def mark_text( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -1902,9 +1956,7 @@ def mark_tick( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -1957,7 +2009,7 @@ def mark_tick( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -1993,12 +2045,20 @@ def mark_tick( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -2109,9 +2169,7 @@ def mark_trail( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -2164,7 +2222,7 @@ def mark_trail( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -2200,12 +2258,20 @@ def mark_trail( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -2316,9 +2382,7 @@ def mark_circle( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -2371,7 +2435,7 @@ def mark_circle( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -2407,12 +2471,20 @@ def mark_circle( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -2523,9 +2595,7 @@ def mark_square( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -2578,7 +2648,7 @@ def mark_square( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -2614,12 +2684,20 @@ def mark_square( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -2730,9 +2808,7 @@ def mark_geoshape( ariaRoleDescription: Optional[str | dict | Parameter | SchemaBase] = Undefined, aspect: Optional[bool | dict | Parameter | SchemaBase] = Undefined, bandSize: Optional[float] = Undefined, - baseline: Optional[ - str | dict | Parameter | SchemaBase | Baseline_T - ] = Undefined, + baseline: Optional[dict | Parameter | SchemaBase | TextBaseline_T] = Undefined, binSpacing: Optional[float] = Undefined, blend: Optional[dict | Parameter | SchemaBase | Blend_T] = Undefined, clip: Optional[bool | dict | Parameter | SchemaBase] = Undefined, @@ -2785,7 +2861,7 @@ def mark_geoshape( orient: Optional[SchemaBase | Orientation_T] = Undefined, outerRadius: Optional[dict | float | Parameter | SchemaBase] = Undefined, padAngle: Optional[dict | float | Parameter | SchemaBase] = Undefined, - point: Optional[str | bool | dict | SchemaBase] = Undefined, + point: Optional[bool | dict | SchemaBase | Literal["transparent"]] = Undefined, radius: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2: Optional[dict | float | Parameter | SchemaBase] = Undefined, radius2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, @@ -2821,12 +2897,20 @@ def mark_geoshape( ] = Undefined, url: Optional[str | dict | Parameter | SchemaBase] = Undefined, width: Optional[dict | float | Parameter | SchemaBase] = Undefined, - x: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - x2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + x: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, + x2: Optional[ + dict | float | Parameter | SchemaBase | Literal["width"] + ] = Undefined, x2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, xOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, - y: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, - y2: Optional[str | dict | float | Parameter | SchemaBase] = Undefined, + y: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, + y2: Optional[ + dict | float | Parameter | SchemaBase | Literal["height"] + ] = Undefined, y2Offset: Optional[dict | float | Parameter | SchemaBase] = Undefined, yOffset: Optional[dict | float | Parameter | SchemaBase] = Undefined, **kwds, @@ -2933,7 +3017,7 @@ def mark_boxplot( box: Optional[bool | dict | SchemaBase] = Undefined, clip: Optional[bool] = Undefined, color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined, - extent: Optional[str | float] = Undefined, + extent: Optional[float | Literal["min-max"]] = Undefined, invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined, median: Optional[bool | dict | SchemaBase] = Undefined, opacity: Optional[float] = Undefined, diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index b99261be7..11e05fecb 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -307,11 +307,11 @@ def get_args(self, si: SchemaInfo) -> list[str]: altair_class_name = item_si.title item_type = f"core.{altair_class_name}" py_type = f"List[{item_type}]" - elif si.is_enum(): + elif si.is_literal(): # If it's an enum, we can type hint it as a Literal which tells # a type checker that only the values in enum are acceptable py_type = TypeAliasTracer.add_literal( - si, spell_literal(si.enum), replace=True + si, spell_literal(si.literal), replace=True ) contents.append(f"_: {py_type}") diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index e33536a29..ac0352de8 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -140,13 +140,13 @@ def add_literal( tp = alias elif (alias := self._literals_invert.get(tp)) and replace: tp = alias - elif replace and info.is_union_enum(): + elif replace and info.is_union_literal(): # Handles one very specific edge case `WindowFieldDef` # - Has an anonymous enum union # - One of the members is declared afterwards # - SchemaBase needs to be first, as the union wont be internally sorted it = ( - self.add_literal(el, spell_literal(el.enum), replace=True) + self.add_literal(el, spell_literal(el.literal), replace=True) for el in info.anyOf ) tp = f"Union[SchemaBase, {', '.join(it)}]" @@ -438,13 +438,13 @@ def to_type_repr( # noqa: C901 if self.is_empty(): tps.add("Any") - elif self.is_enum(): - tp_str = spell_literal(self.enum) + elif self.is_literal(): + tp_str = spell_literal(self.literal) if for_type_hints: tp_str = TypeAliasTracer.add_literal(self, tp_str, replace=True) tps.add(tp_str) - elif for_type_hints and self.is_union_enum(): - it = chain.from_iterable(el.enum for el in self.anyOf) + elif for_type_hints and self.is_union_literal(): + it = chain.from_iterable(el.literal for el in self.anyOf) tp_str = TypeAliasTracer.add_literal(self, spell_literal(it), replace=True) tps.add(tp_str) elif self.is_anyOf(): @@ -452,7 +452,7 @@ def to_type_repr( # noqa: C901 s.to_type_repr(target=target, as_str=False, use_concrete=use_concrete) for s in self.anyOf ) - tps.update(chain.from_iterable(it)) + tps.update(maybe_rewrap_literal(chain.from_iterable(it))) elif isinstance(self.type, list): options = [] subschema = SchemaInfo(dict(**self.schema)) @@ -587,9 +587,17 @@ def items(self) -> dict: return self.schema.get("items", {}) @property - def enum(self) -> list: + def enum(self) -> list[str]: return self.schema.get("enum", []) + @property + def const(self) -> str: + return self.schema.get("const", "") + + @property + def literal(self) -> list[str]: + return self.schema.get("enum", [self.const]) + @property def refname(self) -> str: return self.raw_schema.get("$ref", "#/").split("/")[-1] @@ -628,6 +636,12 @@ def is_reference(self) -> bool: def is_enum(self) -> bool: return "enum" in self.schema + def is_const(self) -> bool: + return "const" in self.schema + + def is_literal(self) -> bool: + return not ({"enum", "const"}.isdisjoint(self.schema)) + def is_empty(self) -> bool: return not (self.schema.keys() - EXCLUDE_KEYS) @@ -676,13 +690,13 @@ def is_union(self) -> bool: """ return self.is_anyOf() and self.type is None - def is_union_enum(self) -> bool: + def is_union_literal(self) -> bool: """ Candidate for reducing to a single ``Literal`` alias. E.g. `BinnedTimeUnit` """ - return self.is_union() and all(el.is_enum() for el in self.anyOf) + return self.is_union() and all(el.is_literal() for el in self.anyOf) def is_format(self) -> bool: """ @@ -940,9 +954,43 @@ def spell_nested_sequence( return f"Sequence[{s}]" -def spell_literal(it: Iterable[str], /) -> str: - s = ", ".join(f"{s!r}" for s in it) - return f"Literal[{s}]" +def spell_literal(it: Iterable[str], /, *, quote: bool = True) -> str: + """ + Combine individual ``str`` type reprs into a single ``Literal``. + + Parameters + ---------- + it + Type representations. + quote + Call ``repr()`` on each element in ``it``. + + .. note:: + Set to ``False`` if performing a second pass. + """ + it_el: Iterable[str] = (f"{s!r}" for s in it) if quote else it + return f"Literal[{', '.join(it_el)}]" + + +def maybe_rewrap_literal(it: Iterable[str], /) -> Iterator[str]: + """ + Where `it` may contain one or more `"enum"`, `"const"`, flatten to a single `Literal[...]`. + + All other type representations are yielded unchanged. + """ + seen: set[str] = set() + for s in it: + if s.startswith("Literal["): + seen.add(unwrap_literal(s)) + else: + yield s + if seen: + yield spell_literal(sorted(seen), quote=False) + + +def unwrap_literal(tp: str, /) -> str: + """`"Literal['value']"` -> `"value"`.""" + return re.sub(r"Literal\[(.+)\]", r"\g<1>", tp) def ruff_format_str(code: str | list[str]) -> str: From 0ebc6bc0deb00d94d54920bef49fbb0ef00406e3 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:38:39 +0100 Subject: [PATCH 048/139] fix: Exclude titles w/ `SchemaInfo.additionalProperties` Avoids the `DateTime` properties `Day`, `Month` --- tools/schemapi/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index ac0352de8..3903c6687 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -531,6 +531,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: and not self.is_format() and not self.is_array() and not self.is_type_alias() + and not self.additionalProperties ): tps.add(title) return tps From a5e94423ba50eb389b5608d789b787eaa07b0039 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:46:47 +0100 Subject: [PATCH 049/139] feat: Fill out `MANUAL_DEFS` with all remaining targets Will serve as a baseline for any replacement solution (provided the schema does not change first). --- tools/generate_schema_wrapper.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 0fea9c8dc..edf69a91a 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -846,15 +846,35 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] sub_dicts: dict[str, str] = {} + # FIXME: Replace with a recursive/graph approach MANUAL_DEFS = ( "ScaleInvalidDataConfig", "OverlayMarkDef", "LinearGradient", "RadialGradient", "GradientStop", + "TooltipContent", + "DateTime", + "TimeIntervalStep", + "IntervalSelectionConfigWithoutType", + "PointSelectionConfigWithoutType", + "Feature", + "GeoJsonFeature", + "GeoJsonFeatureCollection", + "GeometryCollection", + "Point", + "Polygon", + "LineString", + "MultiPoint", + "MultiPolygon", + "MultiLineString", + "BrushConfig", + "MergedStream", + "DerivedStream", ) + MANUAL_DEFS_VALID = (get_valid_identifier(k) for k in MANUAL_DEFS) SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) - SchemaInfo._remap_title.update((k, f"{k}Kwds") for k in MANUAL_DEFS) + SchemaInfo._remap_title.update((k, f"{k}Kwds") for k in MANUAL_DEFS_VALID) for prop, prop_info in config.properties.items(): if (classname := prop_info.refname) and classname.endswith("Config"): @@ -875,7 +895,7 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: for d_name in MANUAL_DEFS: info = SchemaInfo({"$ref": f"#/definitions/{d_name}"}, rootschema=schema) - name = f"{info.refname}Kwds" + name = f"{info.title}Kwds" td = CONFIG_SUB_TYPED_DICT.format( name=name, typed_dict_args=gen_config_typed_dict(info) ) From 9b6c4d6e31ab04300b76ea3f6fb78d3ef786bfe6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:48:23 +0100 Subject: [PATCH 050/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_config.py | 236 +++++++++++++++++++++++++-- 1 file changed, 220 insertions(+), 16 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index a330620cb..029a370d3 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -80,7 +80,7 @@ class RectConfigKwds(TypedDict, total=False): theta2: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -156,7 +156,7 @@ class AreaConfigKwds(TypedDict, total=False): theta2: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -217,7 +217,7 @@ class AxisConfigKwds(TypedDict, total=False): tickBand: Literal["center", "extent"] tickCap: StrokeCap_T tickColor: None | ColorHex | ColorName_T - tickCount: float | TimeIntervalStep | TimeInterval_T + tickCount: float | TimeIntervalStepKwds | TimeInterval_T tickDash: Sequence[float] tickDashOffset: float tickExtra: bool @@ -245,7 +245,7 @@ class AxisConfigKwds(TypedDict, total=False): titleX: float titleY: float translate: float - values: Sequence[str] | Sequence[bool] | Sequence[float] | Sequence[DateTime] + values: Sequence[str] | Sequence[bool] | Sequence[float] | Sequence[DateTimeKwds] zindex: float @@ -319,7 +319,7 @@ class BarConfigKwds(TypedDict, total=False): theta2: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -445,7 +445,7 @@ class MarkConfigKwds(TypedDict, total=False): theta2: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -611,7 +611,7 @@ class LegendConfigKwds(TypedDict, total=False): symbolStrokeColor: None | ColorHex | ColorName_T symbolStrokeWidth: float symbolType: str - tickCount: float | TimeIntervalStep | TimeInterval_T + tickCount: float | TimeIntervalStepKwds | TimeInterval_T title: None titleAlign: Align_T titleAnchor: TitleAnchor_T @@ -696,7 +696,7 @@ class LineConfigKwds(TypedDict, total=False): theta2: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -715,10 +715,14 @@ class ProjectionConfigKwds(TypedDict, total=False): distance: float extent: Sequence[Sequence[float]] fit: ( - GeoJsonFeature - | GeoJsonFeatureCollection - | Sequence[GeoJsonFeature] - | Sequence[GeoJsonFeature | GeoJsonFeatureCollection | Sequence[GeoJsonFeature]] + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + | Sequence[ + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + ] ) fraction: float lobes: float @@ -807,8 +811,8 @@ class ScaleConfigKwds(TypedDict, total=False): class SelectionConfigKwds(TypedDict, total=False): """Placeholder doc.""" - interval: IntervalSelectionConfigWithoutType - point: PointSelectionConfigWithoutType + interval: IntervalSelectionConfigWithoutTypeKwds + point: PointSelectionConfigWithoutTypeKwds class TickConfigKwds(TypedDict, total=False): @@ -878,7 +882,7 @@ class TickConfigKwds(TypedDict, total=False): thickness: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -1054,7 +1058,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): thetaOffset: float timeUnitBandPosition: float timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContent + tooltip: str | bool | None | float | TooltipContentKwds url: str width: float x: float | Literal["width"] @@ -1100,6 +1104,206 @@ class GradientStopKwds(TypedDict, total=False): offset: float +class TooltipContentKwds(TypedDict, total=False): + """Placeholder doc.""" + + content: Literal["encoding", "data"] + + +class DateTimeKwds(TypedDict, total=False): + """Placeholder doc.""" + + date: float + day: str | float + hours: float + milliseconds: float + minutes: float + month: str | float + quarter: float + seconds: float + utc: bool + year: float + + +class TimeIntervalStepKwds(TypedDict, total=False): + """Placeholder doc.""" + + interval: TimeInterval_T + step: float + + +class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): + """Placeholder doc.""" + + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + mark: BrushConfigKwds + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + translate: str | bool + zoom: str | bool + + +class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): + """Placeholder doc.""" + + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + nearest: bool + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + toggle: str | bool + + +class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): + """Placeholder doc.""" + + geometry: ( + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ) + properties: None + type: Literal["Feature"] + bbox: Sequence[float] + id: str | float + + +class GeoJsonFeatureKwds(TypedDict, total=False): + """Placeholder doc.""" + + geometry: ( + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ) + properties: None + type: Literal["Feature"] + bbox: Sequence[float] + id: str | float + + +class GeoJsonFeatureCollectionKwds(TypedDict, total=False): + """Placeholder doc.""" + + features: Sequence[FeatureGeometryGeoJsonPropertiesKwds] + type: Literal["FeatureCollection"] + bbox: Sequence[float] + + +class GeometryCollectionKwds(TypedDict, total=False): + """Placeholder doc.""" + + geometries: Sequence[ + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ] + type: Literal["GeometryCollection"] + bbox: Sequence[float] + + +class PointKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[float] + type: Literal["Point"] + bbox: Sequence[float] + + +class PolygonKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[Sequence[Sequence[float]]] + type: Literal["Polygon"] + bbox: Sequence[float] + + +class LineStringKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[Sequence[float]] + type: Literal["LineString"] + bbox: Sequence[float] + + +class MultiPointKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[Sequence[float]] + type: Literal["MultiPoint"] + bbox: Sequence[float] + + +class MultiPolygonKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[Sequence[Sequence[Sequence[float]]]] + type: Literal["MultiPolygon"] + bbox: Sequence[float] + + +class MultiLineStringKwds(TypedDict, total=False): + """Placeholder doc.""" + + coordinates: Sequence[Sequence[Sequence[float]]] + type: Literal["MultiLineString"] + bbox: Sequence[float] + + +class BrushConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + cursor: Cursor_T + fill: ColorHex | ColorName_T + fillOpacity: float + stroke: ColorHex | ColorName_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeOpacity: float + strokeWidth: float + + +class MergedStreamKwds(TypedDict, total=False): + """Placeholder doc.""" + + merge: Sequence[MergedStreamKwds | DerivedStreamKwds] + between: Sequence[MergedStreamKwds | DerivedStreamKwds] + consume: bool + debounce: float + filter: str | Sequence[str] + markname: str + marktype: MarkType_T + throttle: float + + +class DerivedStreamKwds(TypedDict, total=False): + """Placeholder doc.""" + + stream: MergedStreamKwds | DerivedStreamKwds + between: Sequence[MergedStreamKwds | DerivedStreamKwds] + consume: bool + debounce: float + filter: str | Sequence[str] + markname: str + marktype: MarkType_T + throttle: float + + # TODO: Non-`TypedDict` args From e2f0ed3fdb4efff66879552097347a1e45911cf8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 18:06:35 +0100 Subject: [PATCH 051/139] refactor: Renaming/tidying up new functions --- tools/generate_schema_wrapper.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index edf69a91a..783b54215 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -801,7 +801,7 @@ def generate_vegalite_mark_mixin( return imports, MARK_MIXIN.format(methods="\n".join(code)) -def _generate_sig_args( +def _signature_args( args: Iterable[str], props: SchemaProperties, *, @@ -827,19 +827,18 @@ def generate_mark_args( args = sorted((arg_info.required | arg_info.kwds) - {"type"}) dict_args = (f"{p}={p}" for p in args) return { - "method_args": ", ".join(_generate_sig_args(args, info.properties)), + "method_args": ", ".join(_signature_args(args, info.properties)), "dict_args": ", ".join(chain(dict_args, ("**kwds",))), } -def gen_config_typed_dict(prop_info: SchemaInfo) -> str: - arg_info = codegen.get_args(prop_info) - props = prop_info.properties - it = _generate_sig_args(arg_info.required_kwds, props, kind="typed_dict") +def generate_typed_dict_args(prop_info: SchemaInfo) -> str: + args = codegen.get_args(prop_info).required_kwds + it = _signature_args(args, prop_info.properties, kind="typed_dict") return "\n ".join(it) -def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: +def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: """TODO - Tidy up and use consistent naming.""" with schemafile.open(encoding="utf8") as f: schema = json.load(f) @@ -873,18 +872,19 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: "DerivedStream", ) MANUAL_DEFS_VALID = (get_valid_identifier(k) for k in MANUAL_DEFS) + KWDS: Literal["Kwds"] = "Kwds" SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) - SchemaInfo._remap_title.update((k, f"{k}Kwds") for k in MANUAL_DEFS_VALID) + SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in MANUAL_DEFS_VALID) for prop, prop_info in config.properties.items(): if (classname := prop_info.refname) and classname.endswith("Config"): - name = f"{classname}Kwds" + name = f"{classname}{KWDS}" top_dict_annotations.append(f"{prop}: {name}") if name not in sub_dicts: # HACK: Ensure no references to actual `...Config` classes exist # - Using regex due to forward references args = re.sub( - r"Config\b", r"ConfigKwds", gen_config_typed_dict(prop_info) + r"Config\b", rf"Config{KWDS}", generate_typed_dict_args(prop_info) ) sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( name=name, typed_dict_args=args @@ -895,11 +895,10 @@ def gen_each_config_typed_dict(schemafile: Path) -> Iterator[str]: for d_name in MANUAL_DEFS: info = SchemaInfo({"$ref": f"#/definitions/{d_name}"}, rootschema=schema) - name = f"{info.title}Kwds" - td = CONFIG_SUB_TYPED_DICT.format( - name=name, typed_dict_args=gen_config_typed_dict(info) + name = f"{info.title}{KWDS}" + sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( + name=name, typed_dict_args=generate_typed_dict_args(info) ) - sub_dicts[name] = td yield "\n".join(sub_dicts.values()) yield "# TODO: Non-`TypedDict` args" yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) @@ -1018,7 +1017,7 @@ def vegalite_main(skip_download: bool = False) -> None: "from .core import * # noqa: F403", ), "\n\n", - *gen_each_config_typed_dict(schemafile), + *generate_config_typed_dicts(schemafile), ] files[fp_theme_config] = content_theme_config From f045dc6b698b288ecc156bd15fa2c61f9b116124 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 19:12:35 +0100 Subject: [PATCH 052/139] refactor: Somewhat standardize imports --- tools/generate_schema_wrapper.py | 66 +++++++++++++------------------- tools/schemapi/utils.py | 7 +--- 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 783b54215..956edddf6 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -23,6 +23,7 @@ TypeAliasTracer, get_valid_identifier, import_type_checking, + import_typing_extensions, indent_docstring, resolve_references, rst_parse, @@ -37,11 +38,15 @@ reLink = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.MULTILINE) reSpecial = re.compile(r"[*_]{2,3}|`", re.MULTILINE) -HEADER: Final = """\ +HEADER_COMMENT = """\ # The contents of this file are automatically written by # tools/generate_schema_wrapper.py. Do not modify directly. """ +HEADER: Final = f"""{HEADER_COMMENT} +from __future__ import annotations\n +""" + SCHEMA_URL_TEMPLATE: Final = "https://vega.github.io/schema/{library}/{version}.json" CHANNEL_MYPY_IGNORE_STATEMENTS: Final = """\ @@ -505,7 +510,7 @@ def copy_schemapi_util() -> None: with source_fp.open(encoding="utf8") as source, destination_fp.open( "w", encoding="utf8" ) as dest: - dest.write(HEADER) + dest.write(HEADER_COMMENT) dest.writelines(source.readlines()) if sys.platform == "win32": ruff_format_py(destination_fp) @@ -619,7 +624,6 @@ def generate_vegalite_schema_wrapper(schema_file: Path) -> str: contents = [ HEADER, - "from __future__ import annotations\n" "from typing import Any, Literal, Union, Protocol, Sequence, List, Iterator, TYPE_CHECKING", "import pkgutil", "import json\n", @@ -743,9 +747,9 @@ def generate_vegalite_channel_wrappers( all_ = list(chain(it, COMPAT_EXPORTS)) imports = imports or [ - "from __future__ import annotations\n", + "import sys", "from typing import Any, overload, Sequence, List, Literal, Union, TYPE_CHECKING, TypedDict", - "from typing_extensions import TypeAlias", + import_typing_extensions((3, 10), "TypeAlias"), "import narwhals.stable.v1 as nw", "from altair.utils.schemapi import Undefined, with_property_setters", "from altair.utils import infer_encoding_types as _infer_encoding_types", @@ -760,7 +764,7 @@ def generate_vegalite_channel_wrappers( import_type_checking( "from altair import Parameter, SchemaBase", "from altair.typing import Optional", - "from typing_extensions import Self", + textwrap.indent(import_typing_extensions((3, 11), "Self"), " "), ), "\n" f"__all__ = {sorted(all_)}\n", CHANNEL_MIXINS, @@ -770,19 +774,10 @@ def generate_vegalite_channel_wrappers( return "\n".join(contents) -def generate_vegalite_mark_mixin( - schemafile: Path, markdefs: dict[str, str] -) -> tuple[list[str], str]: +def generate_vegalite_mark_mixin(schemafile: Path, markdefs: dict[str, str]) -> str: with schemafile.open(encoding="utf8") as f: schema = json.load(f) - imports = [ - "from typing import Any, Sequence, List, Literal, Union", - "", - "from altair.utils.schemapi import Undefined", - "from . import core", - ] - code = [] for mark_enum, mark_def in markdefs.items(): @@ -798,7 +793,7 @@ def generate_vegalite_mark_mixin( mark_method = MARK_METHOD.format(mark=mark, mark_def=mark_def, **mark_args) code.append("\n ".join(mark_method.splitlines())) - return imports, MARK_MIXIN.format(methods="\n".join(code)) + return MARK_MIXIN.format(methods="\n".join(code)) def _signature_args( @@ -904,12 +899,7 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) -def generate_vegalite_config_mixin(schemafile: Path) -> tuple[list[str], str]: - imports = [ - "from . import core", - "from altair.utils import use_signature", - ] - +def generate_vegalite_config_mixin(schemafile: Path) -> str: class_name = "ConfigMethodMixin" code = [ @@ -930,7 +920,7 @@ def generate_vegalite_config_mixin(schemafile: Path) -> tuple[list[str], str]: if classname and classname.endswith("Config"): method = CONFIG_PROP_METHOD.format(classname=classname, prop=prop) code.append("\n ".join(method.splitlines())) - return imports, "\n".join(code) + return "\n".join(code) def vegalite_main(skip_download: bool = False) -> None: @@ -975,27 +965,25 @@ def vegalite_main(skip_download: bool = False) -> None: markdefs = {k: f"{k}Def" for k in ["Mark", "BoxPlot", "ErrorBar", "ErrorBand"]} fp_mixins = schemapath / "mixins.py" print(f"Generating\n {schemafile!s}\n ->{fp_mixins!s}") - mark_imports, mark_mixin = generate_vegalite_mark_mixin(schemafile, markdefs) - config_imports, config_mixin = generate_vegalite_config_mixin(schemafile) - try_except_imports = [ - "if sys.version_info >= (3, 11):", - " from typing import Self", - "else:", - " from typing_extensions import Self", - ] - stdlib_imports = ["from __future__ import annotations\n", "import sys"] + mixins_imports = ( + "from typing import Any, Sequence, List, Literal, Union", + "from altair.utils import use_signature, Undefined", + "from . import core", + ) + + mark_mixin = generate_vegalite_mark_mixin(schemafile, markdefs) + config_mixin = generate_vegalite_config_mixin(schemafile) content_mixins = [ HEADER, - "\n".join(stdlib_imports), - "\n\n", - "\n".join(sorted({*mark_imports, *config_imports})), "\n\n", - "\n".join(try_except_imports), + "\n".join(mixins_imports), "\n\n", import_type_checking( - "from altair import Parameter, SchemaBase", + "import sys", + textwrap.indent(import_typing_extensions((3, 11), "Self"), " "), "from altair.typing import Optional", "from ._typing import * # noqa: F403", + "from altair import Parameter, SchemaBase", ), "\n\n\n", mark_mixin, @@ -1008,12 +996,10 @@ def vegalite_main(skip_download: bool = False) -> None: fp_theme_config: Path = schemapath / "_config.py" content_theme_config = [ HEADER, - "\n".join(stdlib_imports), "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", "\n\n", import_type_checking( "from ._typing import * # noqa: F403", - "from .core import Dict", "from .core import * # noqa: F403", ), "\n\n", diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 3903c6687..2ce25cbf3 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -1053,11 +1053,8 @@ def ruff_write_lint_format_str( def import_type_checking(*imports: str) -> str: """Write an `if TYPE_CHECKING` block.""" - return ( - "\n# ruff: noqa: F405\nif TYPE_CHECKING:\n" - + "\n".join(f" {s}" for s in imports) - + "\n" - ) + imports = "\n".join(f" {s}" for s in imports) + return f"\nif TYPE_CHECKING:\n # ruff: noqa: F405\n{imports}\n" def import_typing_extensions( From bb99389366011caecc887c1afb19e787aeee5b36 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 15 Aug 2024 20:41:18 +0100 Subject: [PATCH 053/139] feat(typing): Finish `ThemeConfig` hierarchy A user should now be able to specify a theme, with full type-checking - without needing to import any of the lower-level objects. --- altair/vegalite/v5/schema/_config.py | 195 ++++++++++++++++++++++++--- tools/generate_schema_wrapper.py | 23 +++- tools/schemapi/utils.py | 4 +- 3 files changed, 195 insertions(+), 27 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 9ca54262f..8e220208a 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -8,7 +8,6 @@ if TYPE_CHECKING: # ruff: noqa: F405 from ._typing import * # noqa: F403 - from .core import * # noqa: F403 class RectConfigKwds(TypedDict, total=False): @@ -1304,7 +1303,163 @@ class DerivedStreamKwds(TypedDict, total=False): throttle: float -# TODO: Non-`TypedDict` args +class AutoSizeParamsKwds(TypedDict, total=False): + """Placeholder doc.""" + + contains: Literal["content", "padding"] + resize: bool + type: AutosizeType_T + + +class LocaleKwds(TypedDict, total=False): + """Placeholder doc.""" + + number: NumberLocaleKwds + time: TimeLocaleKwds + + +class VariableParameterKwds(TypedDict, total=False): + """Placeholder doc.""" + + name: str + bind: ( + BindInputKwds + | BindRangeKwds + | BindDirectKwds + | BindCheckboxKwds + | BindRadioSelectKwds + ) + expr: str + react: bool + value: Any + + +class TopLevelSelectionParameterKwds(TypedDict, total=False): + """Placeholder doc.""" + + name: str + select: PointSelectionConfigKwds | IntervalSelectionConfigKwds | SelectionType_T + bind: ( + BindInputKwds + | BindRangeKwds + | BindDirectKwds + | BindCheckboxKwds + | BindRadioSelectKwds + | LegendStreamBindingKwds + | Literal["legend", "scales"] + ) + value: str | bool | None | float | DateTimeKwds | Sequence[Map] + views: Sequence[str] + + +class PointSelectionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + type: Literal["point"] + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + nearest: bool + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + toggle: str | bool + + +class IntervalSelectionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + type: Literal["interval"] + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + mark: BrushConfigKwds + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + translate: str | bool + zoom: str | bool + + +class BindInputKwds(TypedDict, total=False): + """Placeholder doc.""" + + autocomplete: str + debounce: float + element: str + input: str + name: str + placeholder: str + + +class BindRangeKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["range"] + debounce: float + element: str + max: float + min: float + name: str + step: float + + +class BindDirectKwds(TypedDict, total=False): + """Placeholder doc.""" + + element: str + debounce: float + event: str + + +class BindCheckboxKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["checkbox"] + debounce: float + element: str + name: str + + +class BindRadioSelectKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["radio", "select"] + options: Sequence[Any] + debounce: float + element: str + labels: Sequence[str] + name: str + + +class NumberLocaleKwds(TypedDict, total=False): + """Placeholder doc.""" + + currency: Sequence[str] + decimal: str + grouping: Sequence[float] + thousands: str + minus: str + nan: str + numerals: Sequence[str] + percent: str + + +class TimeLocaleKwds(TypedDict, total=False): + """Placeholder doc.""" + + date: str + dateTime: str + days: Sequence[str] + months: Sequence[str] + periods: Sequence[str] + shortDays: Sequence[str] + shortMonths: Sequence[str] + time: str + + +class LegendStreamBindingKwds(TypedDict, total=False): + """Placeholder doc.""" + + legend: str | MergedStreamKwds | DerivedStreamKwds class ThemeConfig(TypedDict, total=False): @@ -1312,8 +1467,8 @@ class ThemeConfig(TypedDict, total=False): arc: RectConfigKwds area: AreaConfigKwds - aria: Any # TODO - autosize: Any # TODO + aria: bool + autosize: AutoSizeParamsKwds | AutosizeType_T axis: AxisConfigKwds axisBand: AxisConfigKwds axisBottom: AxisConfigKwds @@ -1336,18 +1491,18 @@ class ThemeConfig(TypedDict, total=False): axisYPoint: AxisConfigKwds axisYQuantitative: AxisConfigKwds axisYTemporal: AxisConfigKwds - background: Any # TODO + background: ColorHex | ColorName_T bar: BarConfigKwds boxplot: BoxPlotConfigKwds circle: MarkConfigKwds concat: CompositionConfigKwds - countTitle: Any # TODO - customFormatTypes: Any # TODO + countTitle: str + customFormatTypes: bool errorband: ErrorBandConfigKwds errorbar: ErrorBarConfigKwds facet: CompositionConfigKwds - fieldTitle: Any # TODO - font: Any # TODO + fieldTitle: Literal["verbal", "functional", "plain"] + font: str geoshape: MarkConfigKwds header: HeaderConfigKwds headerColumn: HeaderConfigKwds @@ -1356,15 +1511,15 @@ class ThemeConfig(TypedDict, total=False): image: RectConfigKwds legend: LegendConfigKwds line: LineConfigKwds - lineBreak: Any # TODO - locale: Any # TODO + lineBreak: str + locale: LocaleKwds mark: MarkConfigKwds - normalizedNumberFormat: Any # TODO - normalizedNumberFormatType: Any # TODO - numberFormat: Any # TODO - numberFormatType: Any # TODO - padding: Any # TODO - params: Any # TODO + normalizedNumberFormat: str + normalizedNumberFormatType: str + numberFormat: str + numberFormatType: str + padding: float + params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] point: MarkConfigKwds projection: ProjectionConfigKwds range: RangeConfigKwds @@ -1373,11 +1528,11 @@ class ThemeConfig(TypedDict, total=False): scale: ScaleConfigKwds selection: SelectionConfigKwds square: MarkConfigKwds - style: Any # TODO + style: Map text: MarkConfigKwds tick: TickConfigKwds - timeFormat: Any # TODO - timeFormatType: Any # TODO + timeFormat: str + timeFormatType: str title: TitleConfigKwds tooltipFormat: FormatConfigKwds trail: LineConfigKwds diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 956edddf6..c21ae037b 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -865,6 +865,20 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: "BrushConfig", "MergedStream", "DerivedStream", + "AutoSizeParams", + "Locale", + "VariableParameter", + "TopLevelSelectionParameter", + "PointSelectionConfig", + "IntervalSelectionConfig", + "BindInput", + "BindRange", + "BindDirect", + "BindCheckbox", + "BindRadioSelect", + "NumberLocale", + "TimeLocale", + "LegendStreamBinding", ) MANUAL_DEFS_VALID = (get_valid_identifier(k) for k in MANUAL_DEFS) KWDS: Literal["Kwds"] = "Kwds" @@ -886,7 +900,8 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: ) else: - top_dict_annotations.append(f"{prop}: Any # TODO") + ann: str = prop_info.to_type_repr(target="annotation", use_concrete=True) + top_dict_annotations.append(f"{prop}: {ann}") for d_name in MANUAL_DEFS: info = SchemaInfo({"$ref": f"#/definitions/{d_name}"}, rootschema=schema) @@ -895,7 +910,6 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: name=name, typed_dict_args=generate_typed_dict_args(info) ) yield "\n".join(sub_dicts.values()) - yield "# TODO: Non-`TypedDict` args" yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) @@ -998,10 +1012,7 @@ def vegalite_main(skip_download: bool = False) -> None: HEADER, "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", "\n\n", - import_type_checking( - "from ._typing import * # noqa: F403", - "from .core import * # noqa: F403", - ), + import_type_checking("from ._typing import * # noqa: F403"), "\n\n", *generate_config_typed_dicts(schemafile), ] diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 2ce25cbf3..4c59c022b 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -732,7 +732,9 @@ def is_type_alias(self) -> bool: """ TP = "type" return ( - self.schema.keys() == {TP} and self.schema[TP] in jsonschema_to_python_types + self.schema.keys() == {TP} + and isinstance(self.type, str) + and self.type in jsonschema_to_python_types ) From 3c9aab5a094c1fbd18ebc8edcd70734bcddae545 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 16 Aug 2024 19:34:12 +0100 Subject: [PATCH 054/139] refactor: Tidy up `generate_schema_wrapper.py` - Adds and reuses `load_schema` - Factor out `_add_shorthand_property_to_field_encodings` - perf: Share non-modified shorthand dict in `load_schema_with_shorthand_properties` - Improve annotations - Remove some blank lines --- tools/generate_schema_wrapper.py | 87 ++++++++++++-------------------- 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index c21ae037b..84ff24dc5 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -462,36 +462,33 @@ def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: TypeAliasTracer.update_aliases(("VegaThemes", spell_literal(theme_names))) -def load_schema_with_shorthand_properties(schemapath: Path) -> dict: - with schemapath.open(encoding="utf8") as f: - schema = json.load(f) - - schema = _add_shorthand_property_to_field_encodings(schema) - return schema +def load_schema(fp: Path, /) -> dict[str, Any]: + """Reads and returns the root schema from ``fp``.""" + with fp.open(encoding="utf8") as f: + root_schema = json.load(f) + return root_schema -def _add_shorthand_property_to_field_encodings(schema: dict) -> dict: +def load_schema_with_shorthand_properties(fp: Path, /) -> dict[str, Any]: + schema = load_schema(fp) encoding_def = "FacetedEncoding" - encoding = SchemaInfo(schema["definitions"][encoding_def], rootschema=schema) - + shorthand = { + "anyOf": [ + {"type": "string"}, + {"type": "array", "items": {"type": "string"}}, + {"$ref": "#/definitions/RepeatRef"}, + ], + "description": "shorthand for field, aggregate, and type", + } for propschema in encoding.properties.values(): def_dict = get_field_datum_value_defs(propschema, schema) - - field_ref = def_dict.get("field") - if field_ref is not None: + if field_ref := def_dict.get("field", None): defschema = {"$ref": field_ref} defschema = copy.deepcopy(resolve_references(defschema, schema)) # For Encoding field definitions, we patch the schema by adding the # shorthand property. - defschema["properties"]["shorthand"] = { - "anyOf": [ - {"type": "string"}, - {"type": "array", "items": {"type": "string"}}, - {"$ref": "#/definitions/RepeatRef"}, - ], - "description": "shorthand for field, aggregate, and type", - } + defschema["properties"]["shorthand"] = shorthand if "required" not in defschema: defschema["required"] = ["shorthand"] elif "shorthand" not in defschema["required"]: @@ -532,7 +529,9 @@ def recursive_dict_update(schema: dict, root: dict, def_dict: dict) -> None: recursive_dict_update(sub_schema, root, def_dict) -def get_field_datum_value_defs(propschema: SchemaInfo, root: dict) -> dict[str, str]: +def get_field_datum_value_defs( + propschema: SchemaInfo, root: dict[str, Any] +) -> dict[str, str]: def_dict: dict[str, str | None] = dict.fromkeys(("field", "datum", "value")) schema = propschema.schema if propschema.is_reference() and "properties" in schema: @@ -578,14 +577,13 @@ def visit(nodes): return stack -def generate_vegalite_schema_wrapper(schema_file: Path) -> str: +def generate_vegalite_schema_wrapper(fp: Path, /) -> str: """Generate a schema wrapper at the given path.""" # TODO: generate simple tests for each wrapper basename = "VegaLiteSchema" - - rootschema = load_schema_with_shorthand_properties(schema_file) - + rootschema = load_schema_with_shorthand_properties(fp) definitions: dict[str, SchemaGenerator] = {} + graph: dict[str, list[str]] = {} for name in rootschema["definitions"]: defschema = {"$ref": "#/definitions/" + name} @@ -599,9 +597,6 @@ def generate_vegalite_schema_wrapper(schema_file: Path) -> str: basename=basename, rootschemarepr=CodeSnippet(f"{basename}._rootschema"), ) - - graph: dict[str, list[str]] = {} - for name, schema in definitions.items(): graph[name] = [] for child_name in schema.subclasses(): @@ -621,7 +616,6 @@ def generate_vegalite_schema_wrapper(schema_file: Path) -> str: EXCLUDE = {"Color", "Text", "LookupData", "Dict"} it = (c for c in definitions.keys() - EXCLUDE if not c.startswith("_")) all_ = [*sorted(it), "Root", "VegaLiteSchema", "SchemaBase", "load_schema"] - contents = [ HEADER, "from typing import Any, Literal, Union, Protocol, Sequence, List, Iterator, TYPE_CHECKING", @@ -682,21 +676,16 @@ def non_field_names(self) -> Iterator[str]: def generate_vegalite_channel_wrappers( - schemafile: Path, version: str, imports: list[str] | None = None + fp: Path, /, version: str, imports: list[str] | None = None ) -> str: - schema = load_schema_with_shorthand_properties(schemafile) - + schema = load_schema_with_shorthand_properties(fp) encoding_def = "FacetedEncoding" - encoding = SchemaInfo(schema["definitions"][encoding_def], rootschema=schema) - channel_infos: dict[str, ChannelInfo] = {} - - class_defs = [] + class_defs: list[Any] = [] for prop, propschema in encoding.properties.items(): def_dict = get_field_datum_value_defs(propschema, schema) - supports_arrays = any( schema_info.is_array() for schema_info in propschema.anyOf ) @@ -742,10 +731,8 @@ def generate_vegalite_channel_wrappers( "ValueChannelMixin", "with_property_setters", ) - it = chain.from_iterable(info.all_names for info in channel_infos.values()) all_ = list(chain(it, COMPAT_EXPORTS)) - imports = imports or [ "import sys", "from typing import Any, overload, Sequence, List, Literal, Union, TYPE_CHECKING, TypedDict", @@ -774,18 +761,14 @@ def generate_vegalite_channel_wrappers( return "\n".join(contents) -def generate_vegalite_mark_mixin(schemafile: Path, markdefs: dict[str, str]) -> str: - with schemafile.open(encoding="utf8") as f: - schema = json.load(f) - - code = [] +def generate_vegalite_mark_mixin(fp: Path, /, markdefs: dict[str, str]) -> str: + schema = load_schema(fp) + code: list[str] = [] for mark_enum, mark_def in markdefs.items(): _def = schema["definitions"][mark_enum] marks: list[Any] = _def["enum"] if "enum" in _def else [_def["const"]] info = SchemaInfo({"$ref": f"#/definitions/{mark_def}"}, rootschema=schema) - - # adapted from SchemaInfo.init_code mark_args = generate_mark_args(info) for mark in marks: @@ -833,10 +816,9 @@ def generate_typed_dict_args(prop_info: SchemaInfo) -> str: return "\n ".join(it) -def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: +def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: """TODO - Tidy up and use consistent naming.""" - with schemafile.open(encoding="utf8") as f: - schema = json.load(f) + schema = load_schema(fp) config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] sub_dicts: dict[str, str] = {} @@ -898,7 +880,6 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( name=name, typed_dict_args=args ) - else: ann: str = prop_info.to_type_repr(target="annotation", use_concrete=True) top_dict_annotations.append(f"{prop}: {ann}") @@ -913,15 +894,13 @@ def generate_config_typed_dicts(schemafile: Path) -> Iterator[str]: yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) -def generate_vegalite_config_mixin(schemafile: Path) -> str: +def generate_vegalite_config_mixin(fp: Path, /) -> str: class_name = "ConfigMethodMixin" - code = [ f"class {class_name}:", ' """A mixin class that defines config methods"""', ] - with schemafile.open(encoding="utf8") as f: - schema = json.load(f) + schema = load_schema(fp) info = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) # configure() method From 0be9f5dd2689fb67c77b6ba18befa3c33274d00d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:05:27 +0100 Subject: [PATCH 055/139] perf: Reprioritise unreachable `info.allOf` Appears to be some that used to be in the schema, but now is not. I've kept around with an error raised if it gets triggered in the future. --- tools/schemapi/codegen.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 11e05fecb..55a659716 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -52,23 +52,10 @@ def get_args(info: SchemaInfo) -> ArgInfo: invalid_kwds: set[str] = set() # TODO: specialize for anyOf/oneOf? - - if info.is_allOf(): - # recursively call function on all children - arginfo: list[ArgInfo] = [get_args(child) for child in info.allOf] - nonkeyword = all(args.nonkeyword for args in arginfo) - required = {args.required for args in arginfo} - kwds = {args.kwds for args in arginfo} - kwds -= required - invalid_kwds = {args.invalid_kwds for args in arginfo} - additional = all(args.additional for args in arginfo) - elif info.is_empty() or info.is_compound(): + if info.is_empty() or info.is_anyOf(): nonkeyword = True additional = True - elif not info.is_object(): - nonkeyword = True - additional = False - else: + elif info.is_object(): invalid_kwds = {p for p in info.required if not is_valid_identifier(p)} | { p for p in info.properties if not is_valid_identifier(p) } @@ -78,6 +65,20 @@ def get_args(info: SchemaInfo) -> ArgInfo: nonkeyword = False additional = True # additional = info.additionalProperties or info.patternProperties + else: + nonkeyword = True + additional = False + if info.is_allOf(): + # recursively call function on all children + msg = f"Branch is reachable with:\n{info.raw_schema!r}" + raise NotImplementedError(msg) + arginfo: list[ArgInfo] = [get_args(child) for child in info.allOf] + nonkeyword = all(args.nonkeyword for args in arginfo) + required = {args.required for args in arginfo} + kwds = {args.kwds for args in arginfo} + kwds -= required + invalid_kwds = {args.invalid_kwds for args in arginfo} + additional = all(args.additional for args in arginfo) return ArgInfo( nonkeyword=nonkeyword, From 882013ca2a5843cac361045731d9a60d3d702705 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:06:57 +0100 Subject: [PATCH 056/139] perf: Remove unused arg and compile pattern for `is_valid_identifier` --- tools/schemapi/utils.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 4c59c022b..65c79e115 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -52,6 +52,7 @@ "array": "list", "null": "None", } +_VALID_IDENT: re.Pattern[str] = re.compile(r"^[^\d\W]\w*\Z", re.ASCII) class _TypeAliasTracer: @@ -286,20 +287,9 @@ def get_valid_identifier( return valid -def is_valid_identifier(var: str, allow_unicode: bool = False): - """ - Return true if var contains a valid Python identifier. - - Parameters - ---------- - val : string - identifier to check - allow_unicode : bool (default: False) - if True, then allow Python 3 style unicode identifiers. - """ - flags = re.UNICODE if allow_unicode else re.ASCII - is_valid = re.match(r"^[^\d\W]\w*\Z", var, flags) - return is_valid and not keyword.iskeyword(var) +def is_valid_identifier(s: str, /) -> bool: + """Return ``True`` if ``s`` contains a valid Python identifier.""" + return _VALID_IDENT.match(s) and not keyword.iskeyword(s) class SchemaProperties: From 27819697def9877a33d49ec984e62b5ae61d634f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:07:50 +0100 Subject: [PATCH 057/139] refactor(typing): Fill out some more generics --- tools/schemapi/codegen.py | 4 ++-- tools/schemapi/utils.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 55a659716..e808bc7dc 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -6,7 +6,7 @@ import textwrap from dataclasses import dataclass from itertools import chain -from typing import Final, Iterator +from typing import Any, Final, Iterator from .utils import ( SchemaInfo, @@ -139,7 +139,7 @@ def _process_description(self, description: str): def __init__( self, classname: str, - schema: dict, + schema: dict[str, Any], rootschema: dict | None = None, basename: str | list[str] = "SchemaBase", schemarepr: object | None = None, diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 65c79e115..acd5e0fc3 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -350,7 +350,7 @@ def __init__( self.rootschema: dict[str, Any] = rootschema self.schema: dict[str, Any] = resolve_references(schema, rootschema) - def child(self, schema: dict) -> SchemaInfo: + def child(self, schema: dict[str, Any]) -> SchemaInfo: return self.__class__(schema, rootschema=self.rootschema) def __repr__(self) -> str: @@ -539,11 +539,11 @@ def definitions(self) -> SchemaProperties: ) @property - def required(self) -> list: + def required(self) -> list[str]: return self.schema.get("required", []) @property - def patternProperties(self) -> dict: + def patternProperties(self) -> dict[str, Any]: return self.schema.get("patternProperties", {}) @property @@ -574,7 +574,7 @@ def not_(self) -> SchemaInfo: return self.child(self.schema.get("not", {})) @property - def items(self) -> dict: + def items(self) -> dict[str, Any]: return self.schema.get("items", {}) @property From 9e1c8c48bb554dfe3567bfb148a0b3ac4fc36037 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:10:03 +0100 Subject: [PATCH 058/139] refactor(typing): Remove some `None` cases for `SchemaInfo` Using an empty string is consistent with `dict`, `list` properties. --- tools/schemapi/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index acd5e0fc3..5ee867384 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -551,8 +551,8 @@ def additionalProperties(self) -> bool: return self.schema.get("additionalProperties", True) @property - def type(self) -> str | list[Any] | None: - return self.schema.get("type", None) + def type(self) -> str | list[Any]: + return self.schema.get("type", "") @property def anyOf(self) -> Iterator[SchemaInfo]: @@ -594,8 +594,8 @@ def refname(self) -> str: return self.raw_schema.get("$ref", "#/").split("/")[-1] @property - def ref(self) -> str | None: - return self.raw_schema.get("$ref", None) + def ref(self) -> str: + return self.raw_schema.get("$ref", "") @property def description(self) -> str: @@ -679,7 +679,7 @@ def is_union(self) -> bool: Not a real class. """ - return self.is_anyOf() and self.type is None + return self.is_anyOf() and not self.type def is_union_literal(self) -> bool: """ From 11280df59e86164f16f4bb5caae178a284d02268 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:53:09 +0100 Subject: [PATCH 059/139] chore: Remove outdated TODO --- tools/generate_schema_wrapper.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 84ff24dc5..2be501693 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -817,7 +817,6 @@ def generate_typed_dict_args(prop_info: SchemaInfo) -> str: def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: - """TODO - Tidy up and use consistent naming.""" schema = load_schema(fp) config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] From f6b49239a7b7b7fae3d560d9d7df063d21a3d57c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:12:08 +0100 Subject: [PATCH 060/139] fix(typing): Resolve/ignore typing in `tools/` --- tools/schemapi/codegen.py | 2 +- tools/schemapi/utils.py | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index e808bc7dc..4e7da36cf 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -294,7 +294,7 @@ def get_args(self, si: SchemaInfo) -> list[str]: f"{p}: {info.to_type_repr(target='annotation', use_undefined=True)} = Undefined" for p, info in prop_infos.items() ) - elif si.type: + elif isinstance(si.type, str): py_type = jsonschema_to_python_types[si.type] if py_type == "list": # Try to get a type hint like "List[str]" which is more specific diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 5ee867384..0f3c4be0b 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -6,7 +6,7 @@ import re import subprocess import textwrap -import urllib +import urllib.parse from html import unescape from itertools import chain from operator import itemgetter @@ -289,7 +289,7 @@ def get_valid_identifier( def is_valid_identifier(s: str, /) -> bool: """Return ``True`` if ``s`` contains a valid Python identifier.""" - return _VALID_IDENT.match(s) and not keyword.iskeyword(s) + return _VALID_IDENT.match(s) is not None and not keyword.iskeyword(s) class SchemaProperties: @@ -311,11 +311,8 @@ def __bool__(self) -> bool: def __dir__(self) -> list[str]: return list(self._properties.keys()) - def __getattr__(self, attr): - try: - return self[attr] - except KeyError: - return super().__getattr__(attr) + def __getattr__(self, attr) -> SchemaInfo: + return self[attr] def __getitem__(self, attr) -> SchemaInfo: dct = self._properties[attr] @@ -748,7 +745,7 @@ def __init__( super().__init__(renderer, block, inline, plugins) def __call__(self, s: str) -> str: - s = super().__call__(s) + s = super().__call__(s) # pyright: ignore[reportAssignmentType] return unescape(s).replace(r"\ ,", ",").replace(r"\ ", " ") @@ -1045,8 +1042,8 @@ def ruff_write_lint_format_str( def import_type_checking(*imports: str) -> str: """Write an `if TYPE_CHECKING` block.""" - imports = "\n".join(f" {s}" for s in imports) - return f"\nif TYPE_CHECKING:\n # ruff: noqa: F405\n{imports}\n" + imps = "\n".join(f" {s}" for s in imports) + return f"\nif TYPE_CHECKING:\n # ruff: noqa: F405\n{imps}\n" def import_typing_extensions( From 9e35e3071339273411352da1e3a8d50b933e7c0f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:33:56 +0100 Subject: [PATCH 061/139] docs: Add note on `RelativeBandSize` exclusion --- tools/schemapi/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 550f7b8e5..5231a251c 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -498,6 +498,10 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: # but then we would need to write some overload signatures for # api.param). EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} + """ + `RelativeBandSize` excluded as it has a single property `band`, + but all instances also accept `float`. + """ REMAP_TITLE: dict[str, str] = SchemaInfo._remap_title title: str = self.title tps: set[str] = set() From 2efe2ea08cbef5c9abacab05a6a7ffbe23e09452 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:19:31 +0100 Subject: [PATCH 062/139] feat: Adds `SchemaProperties.__len__` --- tools/schemapi/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 5231a251c..58120174c 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -323,6 +323,9 @@ def __getitem__(self, attr) -> SchemaInfo: def __iter__(self) -> Iterator[str]: return iter(self._properties) + def __len__(self) -> int: + return len(self._properties) + def items(self) -> Iterator[tuple[str, SchemaInfo]]: return ((key, self[key]) for key in self) From d922e4bc3a12fc0f913a2b5da527e4b484763fbe Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:23:18 +0100 Subject: [PATCH 063/139] feat(typing): Enable type checking on `tools/` Also fixes some warnings only present for `mypy`, but not `pyright`. --- pyproject.toml | 4 ++-- tools/generate_api_docs.py | 2 +- tools/generate_schema_wrapper.py | 4 ++-- tools/schemapi/utils.py | 23 ++++++++++++++--------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3e6dd7533..a2a889f08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,7 @@ installer = "uv" [tool.hatch.envs.default.scripts] generate-schema-wrapper = [ - "mypy tools/schemapi/schemapi.py", + "mypy tools", "python tools/generate_schema_wrapper.py", "test" ] @@ -439,7 +439,7 @@ module = [ "ibis.*", # This refers to schemapi in the tools folder which is imported # by the tools scripts such as generate_schema_wrapper.py - "schemapi.*" + # "schemapi.*" ] ignore_missing_imports = true diff --git a/tools/generate_api_docs.py b/tools/generate_api_docs.py index d3771d6b7..15512ea72 100644 --- a/tools/generate_api_docs.py +++ b/tools/generate_api_docs.py @@ -112,7 +112,7 @@ def toplevel_charts() -> list[str]: def encoding_wrappers() -> list[str]: - return sorted(iter_objects(alt.channels, restrict_to_subclass=alt.SchemaBase)) + return sorted(iter_objects(alt.channels, restrict_to_subclass=alt.SchemaBase)) # type: ignore[attr-defined] def api_functions() -> list[str]: diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 567ed3e4b..bc2ba62e7 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -484,7 +484,7 @@ def load_schema_with_shorthand_properties(fp: Path, /) -> dict[str, Any]: for propschema in encoding.properties.values(): def_dict = get_field_datum_value_defs(propschema, schema) if field_ref := def_dict.get("field", None): - defschema = {"$ref": field_ref} + defschema: dict[str, Any] = {"$ref": field_ref} defschema = copy.deepcopy(resolve_references(defschema, schema)) # For Encoding field definitions, we patch the schema by adding the # shorthand property. @@ -702,7 +702,7 @@ def generate_vegalite_channel_wrappers( gen: SchemaGenerator defschema = {"$ref": definition} - kwds = { + kwds: dict[str, Any] = { "basename": basename, "schema": defschema, "rootschema": schema, diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 58120174c..cf6e9bac6 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -17,6 +17,8 @@ Iterable, Iterator, Literal, + Mapping, + MutableSequence, Sequence, overload, ) @@ -27,9 +29,9 @@ from tools.schemapi.schemapi import _resolve_references as resolve_references if TYPE_CHECKING: - from _collections_abc import dict_keys + from _collections_abc import KeysView from pathlib import Path - from typing_extensions import LiteralString, TypeAlias + from typing_extensions import LiteralString, Never, TypeAlias from mistune import BlockState @@ -139,7 +141,7 @@ def add_literal( self._update_literals(alias, tp) if replace: tp = alias - elif (alias := self._literals_invert.get(tp)) and replace: + elif (alias := self._literals_invert.get(tp, "")) and replace: tp = alias elif replace and info.is_union_literal(): # Handles one very specific edge case `WindowFieldDef` @@ -201,10 +203,13 @@ def write_module( extra `tools.generate_schema_wrapper.TYPING_EXTRA`. """ - ruff_format = ["ruff", "format", fp] + ruff_format: MutableSequence[str | Path] = ["ruff", "format", fp] if self._cmd_format: ruff_format.extend(self._cmd_format) - commands = (["ruff", "check", fp, *self._cmd_check], ruff_format) + commands: tuple[Sequence[str | Path], ...] = ( + ["ruff", "check", fp, *self._cmd_check], + ruff_format, + ) static = (header, "\n", *self._imports, "\n\n") self.update_aliases(*sorted(self._literals.items(), key=itemgetter(0))) all_ = [*iter(self._aliases), *extra_all] @@ -438,11 +443,11 @@ def to_type_repr( # noqa: C901 tp_str = TypeAliasTracer.add_literal(self, spell_literal(it), replace=True) tps.add(tp_str) elif self.is_anyOf(): - it = ( + it_nest = ( s.to_type_repr(target=target, as_str=False, use_concrete=use_concrete) for s in self.anyOf ) - tps.update(maybe_rewrap_literal(chain.from_iterable(it))) + tps.update(maybe_rewrap_literal(chain.from_iterable(it_nest))) elif isinstance(self.type, list): options = [] subschema = SchemaInfo(dict(**self.schema)) @@ -1015,7 +1020,7 @@ def ruff_format_py(fp: Path, /, *extra_args: str) -> None: ruff format --diff --check . ``` """ - cmd = ["ruff", "format", fp] + cmd: MutableSequence[str | Path] = ["ruff", "format", fp] if extra_args: cmd.extend(extra_args) r = subprocess.run(cmd, check=True) @@ -1036,7 +1041,7 @@ def ruff_write_lint_format_str( - Encoding set as default - `I001/2` are `isort` rules, to sort imports. """ - commands = ( + commands: Iterable[Sequence[str | Path]] = ( ["ruff", "check", fp, "--fix"], ["ruff", "check", fp, "--fix", "--select", "I001", "--select", "I002"], ) From 1330708abe003585ee1b82a9b185c3ecb8cfa392 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:26:28 +0100 Subject: [PATCH 064/139] refactor(typing): Fake immutability in `SchemaInfo` --- tools/generate_schema_wrapper.py | 3 ++- tools/schemapi/utils.py | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index bc2ba62e7..14cf34586 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -533,7 +533,8 @@ def get_field_datum_value_defs( propschema: SchemaInfo, root: dict[str, Any] ) -> dict[str, str]: def_dict: dict[str, str | None] = dict.fromkeys(("field", "datum", "value")) - schema = propschema.schema + _schema = propschema.schema + schema = _schema if isinstance(_schema, dict) else dict(_schema) if propschema.is_reference() and "properties" in schema: if "field" in schema["properties"]: def_dict["field"] = propschema.ref diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index cf6e9bac6..f86175c00 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -302,13 +302,13 @@ class SchemaProperties: def __init__( self, - properties: dict[str, Any], - schema: dict[str, Any], - rootschema: dict[str, Any] | None = None, + properties: Mapping[str, Any], + schema: Mapping[str, Any], + rootschema: Mapping[str, Any] | None = None, ) -> None: - self._properties: dict[str, Any] = properties - self._schema: dict[str, Any] = schema - self._rootschema: dict[str, Any] = rootschema or schema + self._properties: Mapping[str, Any] = properties + self._schema: Mapping[str, Any] = schema + self._rootschema: Mapping[str, Any] = rootschema or schema def __bool__(self) -> bool: return bool(self._properties) @@ -334,7 +334,7 @@ def __len__(self) -> int: def items(self) -> Iterator[tuple[str, SchemaInfo]]: return ((key, self[key]) for key in self) - def keys(self) -> dict_keys[str, Any]: + def keys(self) -> KeysView: return self._properties.keys() def values(self) -> Iterator[SchemaInfo]: @@ -347,13 +347,20 @@ class SchemaInfo: _remap_title: ClassVar[dict[str, str]] = {} def __init__( - self, schema: dict[str, Any], rootschema: dict[str, Any] | None = None + self, schema: Mapping[str, Any], rootschema: Mapping[str, Any] | None = None ) -> None: if not rootschema: rootschema = schema - self.raw_schema: dict[str, Any] = schema - self.rootschema: dict[str, Any] = rootschema - self.schema: dict[str, Any] = resolve_references(schema, rootschema) + self.raw_schema: Mapping[str, Any] + self.rootschema: Mapping[str, Any] + self.schema: Mapping[str, Any] + object.__setattr__(self, "raw_schema", schema) + object.__setattr__(self, "rootschema", rootschema) + object.__setattr__(self, "schema", resolve_references(schema, rootschema)) # type: ignore + + def __setattr__(self, name: str, value: Any) -> Never: + msg = f"{type(self).__name__!r} is immutable.\nCould not assign self.{name} = {value}" + raise TypeError(msg) def child(self, schema: dict[str, Any]) -> SchemaInfo: return self.__class__(schema, rootschema=self.rootschema) @@ -452,6 +459,7 @@ def to_type_repr( # noqa: C901 options = [] subschema = SchemaInfo(dict(**self.schema)) for typ_ in self.type: + # FIXME: Rewrite this to not mutate `SchemaInfo.schema` subschema.schema["type"] = typ_ # We always use title if possible for nested objects options.append( From 230d625d6ffc2462017db8b6255ae24907a9a9b1 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 16:57:22 +0100 Subject: [PATCH 065/139] refactor: Make `SchemaInfo` effectively immutable This was the only instance where a modification occured after init. The result of this is identical, simply moves the overwrite to the `dict` constructor. https://github.com/vega/altair/pull/3536#discussion_r1748159662 --- tools/schemapi/utils.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index f86175c00..9728ae5b4 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -456,16 +456,13 @@ def to_type_repr( # noqa: C901 ) tps.update(maybe_rewrap_literal(chain.from_iterable(it_nest))) elif isinstance(self.type, list): - options = [] - subschema = SchemaInfo(dict(**self.schema)) - for typ_ in self.type: - # FIXME: Rewrite this to not mutate `SchemaInfo.schema` - subschema.schema["type"] = typ_ - # We always use title if possible for nested objects - options.append( - subschema.to_type_repr(target=target, use_concrete=use_concrete) + # We always use title if possible for nested objects + tps.update( + SchemaInfo(dict(self.schema, type=tp)).to_type_repr( + target=target, use_concrete=use_concrete ) - tps.update(options) + for tp in self.type + ) elif self.is_array(): tps.add( spell_nested_sequence(self, target=target, use_concrete=use_concrete) From a67755ea73ec205408a62fc45792577241f4e6a0 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 21:59:50 +0100 Subject: [PATCH 066/139] feat: Make `SchemaInfo` hashable --- tools/schemapi/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 9728ae5b4..04a3a6678 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -2,6 +2,7 @@ from __future__ import annotations +import json import keyword import re import subprocess @@ -56,6 +57,8 @@ } _VALID_IDENT: re.Pattern[str] = re.compile(r"^[^\d\W]\w*\Z", re.ASCII) +_HASH_ENCODER = json.JSONEncoder(sort_keys=True, separators=(",", ":")) + class _TypeAliasTracer: """ @@ -362,6 +365,16 @@ def __setattr__(self, name: str, value: Any) -> Never: msg = f"{type(self).__name__!r} is immutable.\nCould not assign self.{name} = {value}" raise TypeError(msg) + def __hash__(self) -> int: + return hash(_HASH_ENCODER.encode(self.schema)) + + def __eq__(self, value: object) -> bool: + if isinstance(value, SchemaInfo): + if self.ref: + return self.ref == value.ref + return hash(self) == hash(value) + return False + def child(self, schema: dict[str, Any]) -> SchemaInfo: return self.__class__(schema, rootschema=self.rootschema) From ae23b23d62e95acb9778d140bec94c73aa1f7346 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 22:02:52 +0100 Subject: [PATCH 067/139] feat(DRAFT): Add WIP config schema sourcing Adapted from https://github.com/vega/altair/pull/3536#discussion_r1743942369 --- tools/generate_schema_wrapper.py | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 14cf34586..c42b43b7d 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -10,6 +10,7 @@ import textwrap from dataclasses import dataclass from itertools import chain +from keyword import iskeyword from pathlib import Path from typing import Any, Final, Iterable, Iterator, Literal from urllib import request @@ -894,6 +895,44 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) +def is_relevant_schema(info: SchemaInfo, /) -> bool: + EXCLUDE = {"ExprRef", "RelativeBandSize", "ParameterPredicate"} + return bool( + info.ref + and info.refname not in EXCLUDE + and info.properties + and info.type == "object" + and not info.is_value() + and "field" not in info.required + and not (iskeyword(next(iter(info.required), ""))) + ) + + +def iter_children(info: SchemaInfo, /) -> Iterator[SchemaInfo]: + yield from info.properties.values() + yield from info.anyOf + if info.items: + yield info.child(info.items) + + +def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: + """Equivalent to `get_all_objects`.""" + MAX_DEPTH = 6 + seen: set[SchemaInfo] = set() + if is_relevant_schema(info) and info not in seen: + seen.add(info) + if depth < MAX_DEPTH: + for prop_info in iter_children(info): + seen.update(find_relevant_schemas(prop_info, depth=depth + 1)) + return seen + + +def wip_config_schemas(fp: Path, /) -> set[SchemaInfo]: + schema = load_schema(fp) + config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) + return find_relevant_schemas(config) + + def generate_vegalite_config_mixin(fp: Path, /) -> str: class_name = "ConfigMethodMixin" code = [ From f62c82acce15edb3a2142d01e1964c51a7506887 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 7 Sep 2024 22:05:12 +0100 Subject: [PATCH 068/139] ci: Add patterns for `pyright` Duplicate of https://github.com/vega/altair/pull/3547/commits/c594e55e76613d0363e3b419a00cb2f920547755 --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a2a889f08..bd0fff68f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -448,3 +448,10 @@ extraPaths=["./tools"] pythonPlatform="All" pythonVersion="3.8" reportUnusedExpression="none" +include=[ + "./altair/**/*.py", + "./doc/*.py", + "./sphinxext/**/*.py", + "./tests/**/*.py", + "./tools/**/*.py", +] \ No newline at end of file From a70f259f0e711fbaa69205976ed5a04e1633611c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 8 Sep 2024 12:48:43 +0100 Subject: [PATCH 069/139] perf: Use cheaper comparison for `SchemaInfo.__eq__` Slightly faster (1.3s -> 1.2s) during deep recursion. Also a lot easier to understand https://github.com/vega/altair/pull/3536#discussion_r1749162672 --- tools/schemapi/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 04a3a6678..7038aa87d 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -372,7 +372,7 @@ def __eq__(self, value: object) -> bool: if isinstance(value, SchemaInfo): if self.ref: return self.ref == value.ref - return hash(self) == hash(value) + return self.schema == value.schema return False def child(self, schema: dict[str, Any]) -> SchemaInfo: From e40768e2dacce4c7bce24d8c89d2d789cd3c6e5c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:22:11 +0100 Subject: [PATCH 070/139] refactor: `iter_children` -> `SchemaInfo.iter_descendants` https://github.com/vega/altair/pull/3536#discussion_r1749164404 --- tools/generate_schema_wrapper.py | 9 +-------- tools/schemapi/utils.py | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index c42b43b7d..fd2353d16 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -908,13 +908,6 @@ def is_relevant_schema(info: SchemaInfo, /) -> bool: ) -def iter_children(info: SchemaInfo, /) -> Iterator[SchemaInfo]: - yield from info.properties.values() - yield from info.anyOf - if info.items: - yield info.child(info.items) - - def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: """Equivalent to `get_all_objects`.""" MAX_DEPTH = 6 @@ -922,7 +915,7 @@ def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: if is_relevant_schema(info) and info not in seen: seen.add(info) if depth < MAX_DEPTH: - for prop_info in iter_children(info): + for prop_info in info.iter_descendants(): seen.update(find_relevant_schemas(prop_info, depth=depth + 1)) return seen diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 7038aa87d..caf6b34eb 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -378,6 +378,15 @@ def __eq__(self, value: object) -> bool: def child(self, schema: dict[str, Any]) -> SchemaInfo: return self.__class__(schema, rootschema=self.rootschema) + def iter_descendants(self) -> Iterator[SchemaInfo]: + """Yields `properties`, `anyOf`, `items`.""" + if "properties" in self.schema: + yield from self.properties.values() + if "anyOf" in self.schema: + yield from self.anyOf + if self.items: + yield self.child(self.items) + def __repr__(self) -> str: keys = [] for key in sorted(self.schema.keys()): From 6334db087929e55abc7f8873f8a60b86fe9c6f5c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:24:48 +0100 Subject: [PATCH 071/139] feat: Avoid manual defs https://github.com/vega/altair/pull/3536#discussion_r1742442160 --- tools/generate_schema_wrapper.py | 80 ++++++-------------------------- 1 file changed, 14 insertions(+), 66 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index fd2353d16..93e2ce490 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -822,80 +822,34 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: schema = load_schema(fp) config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) top_dict_annotations: list[str] = [] - sub_dicts: dict[str, str] = {} - # FIXME: Replace with a recursive/graph approach - MANUAL_DEFS = ( - "ScaleInvalidDataConfig", - "OverlayMarkDef", - "LinearGradient", - "RadialGradient", - "GradientStop", - "TooltipContent", - "DateTime", - "TimeIntervalStep", - "IntervalSelectionConfigWithoutType", - "PointSelectionConfigWithoutType", - "Feature", - "GeoJsonFeature", - "GeoJsonFeatureCollection", - "GeometryCollection", - "Point", - "Polygon", - "LineString", - "MultiPoint", - "MultiPolygon", - "MultiLineString", - "BrushConfig", - "MergedStream", - "DerivedStream", - "AutoSizeParams", - "Locale", - "VariableParameter", - "TopLevelSelectionParameter", - "PointSelectionConfig", - "IntervalSelectionConfig", - "BindInput", - "BindRange", - "BindDirect", - "BindCheckbox", - "BindRadioSelect", - "NumberLocale", - "TimeLocale", - "LegendStreamBinding", - ) - MANUAL_DEFS_VALID = (get_valid_identifier(k) for k in MANUAL_DEFS) + relevant: dict[str, SchemaInfo] = { + x.title: x + for x in sorted(find_relevant_schemas(config), key=lambda x: x.refname) + if x.refname != "Config" + } KWDS: Literal["Kwds"] = "Kwds" SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) - SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in MANUAL_DEFS_VALID) + SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in relevant) + sub_dicts = ( + CONFIG_SUB_TYPED_DICT.format( + name=f"{info.title}{KWDS}", typed_dict_args=generate_typed_dict_args(info) + ) + for info in relevant.values() + ) + yield "\n".join(sub_dicts) for prop, prop_info in config.properties.items(): if (classname := prop_info.refname) and classname.endswith("Config"): name = f"{classname}{KWDS}" top_dict_annotations.append(f"{prop}: {name}") - if name not in sub_dicts: - # HACK: Ensure no references to actual `...Config` classes exist - # - Using regex due to forward references - args = re.sub( - r"Config\b", rf"Config{KWDS}", generate_typed_dict_args(prop_info) - ) - sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( - name=name, typed_dict_args=args - ) else: ann: str = prop_info.to_type_repr(target="annotation", use_concrete=True) top_dict_annotations.append(f"{prop}: {ann}") - - for d_name in MANUAL_DEFS: - info = SchemaInfo({"$ref": f"#/definitions/{d_name}"}, rootschema=schema) - name = f"{info.title}{KWDS}" - sub_dicts[name] = CONFIG_SUB_TYPED_DICT.format( - name=name, typed_dict_args=generate_typed_dict_args(info) - ) - yield "\n".join(sub_dicts.values()) yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) def is_relevant_schema(info: SchemaInfo, /) -> bool: + """Relevant for the purpose of `ThemeConfig`.""" EXCLUDE = {"ExprRef", "RelativeBandSize", "ParameterPredicate"} return bool( info.ref @@ -920,12 +874,6 @@ def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: return seen -def wip_config_schemas(fp: Path, /) -> set[SchemaInfo]: - schema = load_schema(fp) - config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) - return find_relevant_schemas(config) - - def generate_vegalite_config_mixin(fp: Path, /) -> str: class_name = "ConfigMethodMixin" code = [ From 2d89ad7fbbf241f2f5e0cfbac042a4aaa9d27b9c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:30:06 +0100 Subject: [PATCH 072/139] build: run `generate-schema-wrapper` **Important**: The diff here is due to the introduction of sorting only. https://github.com/vega/altair/pull/3536#discussion_r1742442160, https://github.com/vega/altair/pull/3536#discussion_r1748968290 --- altair/vegalite/v5/schema/_config.py | 1264 +++++++++++++------------- 1 file changed, 642 insertions(+), 622 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 8e220208a..9170276a8 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -10,7 +10,7 @@ from ._typing import * # noqa: F403 -class RectConfigKwds(TypedDict, total=False): +class AreaConfigKwds(TypedDict, total=False): """Placeholder doc.""" align: Align_T @@ -20,10 +20,8 @@ class RectConfigKwds(TypedDict, total=False): ariaRoleDescription: str aspect: bool baseline: TextBaseline_T - binSpacing: float blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - continuousBandSize: float cornerRadius: float cornerRadiusBottomLeft: float cornerRadiusBottomRight: float @@ -32,7 +30,6 @@ class RectConfigKwds(TypedDict, total=False): cursor: Cursor_T description: str dir: TextDirection_T - discreteBandSize: float dx: float dy: float ellipsis: str @@ -50,14 +47,15 @@ class RectConfigKwds(TypedDict, total=False): interpolate: Interpolate_T invalid: None | MarkInvalidDataMode_T limit: float + line: bool | OverlayMarkDefKwds lineBreak: str lineHeight: float - minBandSize: float opacity: float order: bool | None orient: Orientation_T outerRadius: float padAngle: float + point: bool | OverlayMarkDefKwds | Literal["transparent"] radius: float radius2: float shape: str @@ -88,80 +86,12 @@ class RectConfigKwds(TypedDict, total=False): y2: float | Literal["height"] -class AreaConfigKwds(TypedDict, total=False): +class AutoSizeParamsKwds(TypedDict, total=False): """Placeholder doc.""" - align: Align_T - angle: float - aria: bool - ariaRole: str - ariaRoleDescription: str - aspect: bool - baseline: TextBaseline_T - blend: Blend_T - color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - cornerRadius: float - cornerRadiusBottomLeft: float - cornerRadiusBottomRight: float - cornerRadiusTopLeft: float - cornerRadiusTopRight: float - cursor: Cursor_T - description: str - dir: TextDirection_T - dx: float - dy: float - ellipsis: str - endAngle: float - fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - fillOpacity: float - filled: bool - font: str - fontSize: float - fontStyle: str - fontWeight: FontWeight_T - height: float - href: str - innerRadius: float - interpolate: Interpolate_T - invalid: None | MarkInvalidDataMode_T - limit: float - line: bool | OverlayMarkDefKwds - lineBreak: str - lineHeight: float - opacity: float - order: bool | None - orient: Orientation_T - outerRadius: float - padAngle: float - point: bool | OverlayMarkDefKwds | Literal["transparent"] - radius: float - radius2: float - shape: str - size: float - smooth: bool - startAngle: float - stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - strokeCap: StrokeCap_T - strokeDash: Sequence[float] - strokeDashOffset: float - strokeJoin: StrokeJoin_T - strokeMiterLimit: float - strokeOffset: float - strokeOpacity: float - strokeWidth: float - tension: float - text: str | Sequence[str] - theta: float - theta2: float - timeUnitBandPosition: float - timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContentKwds - url: str - width: float - x: float | Literal["width"] - x2: float | Literal["width"] - y: float | Literal["height"] - y2: float | Literal["height"] + contains: Literal["content", "padding"] + resize: bool + type: AutosizeType_T class AxisConfigKwds(TypedDict, total=False): @@ -327,6 +257,57 @@ class BarConfigKwds(TypedDict, total=False): y2: float | Literal["height"] +class BindCheckboxKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["checkbox"] + debounce: float + element: str + name: str + + +class BindDirectKwds(TypedDict, total=False): + """Placeholder doc.""" + + element: str + debounce: float + event: str + + +class BindInputKwds(TypedDict, total=False): + """Placeholder doc.""" + + autocomplete: str + debounce: float + element: str + input: str + name: str + placeholder: str + + +class BindRadioSelectKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["radio", "select"] + options: Sequence[Any] + debounce: float + element: str + labels: Sequence[str] + name: str + + +class BindRangeKwds(TypedDict, total=False): + """Placeholder doc.""" + + input: Literal["range"] + debounce: float + element: str + max: float + min: float + name: str + step: float + + class BoxPlotConfigKwds(TypedDict, total=False): """Placeholder doc.""" @@ -379,78 +360,17 @@ class BoxPlotConfigKwds(TypedDict, total=False): ) -class MarkConfigKwds(TypedDict, total=False): +class BrushConfigKwds(TypedDict, total=False): """Placeholder doc.""" - align: Align_T - angle: float - aria: bool - ariaRole: str - ariaRoleDescription: str - aspect: bool - baseline: TextBaseline_T - blend: Blend_T - color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - cornerRadius: float - cornerRadiusBottomLeft: float - cornerRadiusBottomRight: float - cornerRadiusTopLeft: float - cornerRadiusTopRight: float cursor: Cursor_T - description: str - dir: TextDirection_T - dx: float - dy: float - ellipsis: str - endAngle: float - fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + fill: ColorHex | ColorName_T fillOpacity: float - filled: bool - font: str - fontSize: float - fontStyle: str - fontWeight: FontWeight_T - height: float - href: str - innerRadius: float - interpolate: Interpolate_T - invalid: None | MarkInvalidDataMode_T - limit: float - lineBreak: str - lineHeight: float - opacity: float - order: bool | None - orient: Orientation_T - outerRadius: float - padAngle: float - radius: float - radius2: float - shape: str - size: float - smooth: bool - startAngle: float - stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T - strokeCap: StrokeCap_T + stroke: ColorHex | ColorName_T strokeDash: Sequence[float] strokeDashOffset: float - strokeJoin: StrokeJoin_T - strokeMiterLimit: float - strokeOffset: float strokeOpacity: float strokeWidth: float - tension: float - text: str | Sequence[str] - theta: float - theta2: float - timeUnitBandPosition: float - timeUnitBandSize: float - tooltip: str | bool | None | float | TooltipContentKwds - url: str - width: float - x: float | Literal["width"] - x2: float | Literal["width"] - y: float | Literal["height"] - y2: float | Literal["height"] class CompositionConfigKwds(TypedDict, total=False): @@ -460,6 +380,34 @@ class CompositionConfigKwds(TypedDict, total=False): spacing: float +class DateTimeKwds(TypedDict, total=False): + """Placeholder doc.""" + + date: float + day: str | float + hours: float + milliseconds: float + minutes: float + month: str | float + quarter: float + seconds: float + utc: bool + year: float + + +class DerivedStreamKwds(TypedDict, total=False): + """Placeholder doc.""" + + stream: MergedStreamKwds | DerivedStreamKwds + between: Sequence[MergedStreamKwds | DerivedStreamKwds] + consume: bool + debounce: float + filter: str | Sequence[str] + markname: str + marktype: MarkType_T + throttle: float + + class ErrorBandConfigKwds(TypedDict, total=False): """Placeholder doc.""" @@ -512,33 +460,111 @@ class ErrorBarConfigKwds(TypedDict, total=False): ) -class HeaderConfigKwds(TypedDict, total=False): +class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): """Placeholder doc.""" - format: str - formatType: str - labelAlign: Align_T - labelAnchor: TitleAnchor_T - labelAngle: float - labelBaseline: TextBaseline_T - labelColor: ColorHex | ColorName_T - labelExpr: str - labelFont: str - labelFontSize: float - labelFontStyle: str - labelFontWeight: FontWeight_T - labelLimit: float - labelLineHeight: float - labelOrient: Orient_T - labelPadding: float - labels: bool - orient: Orient_T - title: None - titleAlign: Align_T - titleAnchor: TitleAnchor_T - titleAngle: float - titleBaseline: TextBaseline_T - titleColor: ColorHex | ColorName_T + geometry: ( + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ) + properties: None + type: Literal["Feature"] + bbox: Sequence[float] + id: str | float + + +class FormatConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + normalizedNumberFormat: str + normalizedNumberFormatType: str + numberFormat: str + numberFormatType: str + timeFormat: str + timeFormatType: str + + +class GeoJsonFeatureKwds(TypedDict, total=False): + """Placeholder doc.""" + + geometry: ( + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ) + properties: None + type: Literal["Feature"] + bbox: Sequence[float] + id: str | float + + +class GeoJsonFeatureCollectionKwds(TypedDict, total=False): + """Placeholder doc.""" + + features: Sequence[FeatureGeometryGeoJsonPropertiesKwds] + type: Literal["FeatureCollection"] + bbox: Sequence[float] + + +class GeometryCollectionKwds(TypedDict, total=False): + """Placeholder doc.""" + + geometries: Sequence[ + PointKwds + | PolygonKwds + | LineStringKwds + | MultiPointKwds + | MultiPolygonKwds + | MultiLineStringKwds + | GeometryCollectionKwds + ] + type: Literal["GeometryCollection"] + bbox: Sequence[float] + + +class GradientStopKwds(TypedDict, total=False): + """Placeholder doc.""" + + color: ColorHex | ColorName_T + offset: float + + +class HeaderConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + format: str + formatType: str + labelAlign: Align_T + labelAnchor: TitleAnchor_T + labelAngle: float + labelBaseline: TextBaseline_T + labelColor: ColorHex | ColorName_T + labelExpr: str + labelFont: str + labelFontSize: float + labelFontStyle: str + labelFontWeight: FontWeight_T + labelLimit: float + labelLineHeight: float + labelOrient: Orient_T + labelPadding: float + labels: bool + orient: Orient_T + title: None + titleAlign: Align_T + titleAnchor: TitleAnchor_T + titleAngle: float + titleBaseline: TextBaseline_T + titleColor: ColorHex | ColorName_T titleFont: str titleFontSize: float titleFontStyle: str @@ -549,6 +575,33 @@ class HeaderConfigKwds(TypedDict, total=False): titlePadding: float +class IntervalSelectionConfigKwds(TypedDict, total=False): + """Placeholder doc.""" + + type: Literal["interval"] + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + mark: BrushConfigKwds + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + translate: str | bool + zoom: str | bool + + +class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): + """Placeholder doc.""" + + clear: str | bool | MergedStreamKwds | DerivedStreamKwds + encodings: Sequence[SingleDefUnitChannel_T] + fields: Sequence[str] + mark: BrushConfigKwds + on: str | MergedStreamKwds | DerivedStreamKwds + resolve: SelectionResolution_T + translate: str | bool + zoom: str | bool + + class LegendConfigKwds(TypedDict, total=False): """Placeholder doc.""" @@ -629,6 +682,12 @@ class LegendConfigKwds(TypedDict, total=False): zindex: float +class LegendStreamBindingKwds(TypedDict, total=False): + """Placeholder doc.""" + + legend: str | MergedStreamKwds | DerivedStreamKwds + + class LineConfigKwds(TypedDict, total=False): """Placeholder doc.""" @@ -704,117 +763,34 @@ class LineConfigKwds(TypedDict, total=False): y2: float | Literal["height"] -class ProjectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" - - center: Sequence[float] - clipAngle: float - clipExtent: Sequence[Sequence[float]] - coefficient: float - distance: float - extent: Sequence[Sequence[float]] - fit: ( - GeoJsonFeatureKwds - | GeoJsonFeatureCollectionKwds - | Sequence[GeoJsonFeatureKwds] - | Sequence[ - GeoJsonFeatureKwds - | GeoJsonFeatureCollectionKwds - | Sequence[GeoJsonFeatureKwds] - ] - ) - fraction: float - lobes: float - parallel: float - parallels: Sequence[float] - pointRadius: float - precision: float - radius: float - ratio: float - reflectX: bool - reflectY: bool - rotate: Sequence[float] - scale: float - size: Sequence[float] - spacing: float - tilt: float - translate: Sequence[float] - type: ProjectionType_T - - -class RangeConfigKwds(TypedDict, total=False): +class LineStringKwds(TypedDict, total=False): """Placeholder doc.""" - category: ( - Sequence[ColorHex | ColorName_T] - | Sequence[str | bool | None | float | Sequence[float]] - | RangeEnum_T - ) - diverging: ( - Sequence[ColorHex | ColorName_T] - | Sequence[str | bool | None | float | Sequence[float]] - | RangeEnum_T - ) - heatmap: ( - Sequence[ColorHex | ColorName_T] - | Sequence[str | bool | None | float | Sequence[float]] - | RangeEnum_T - ) - ordinal: ( - Sequence[ColorHex | ColorName_T] - | Sequence[str | bool | None | float | Sequence[float]] - | RangeEnum_T - ) - ramp: ( - Sequence[ColorHex | ColorName_T] - | Sequence[str | bool | None | float | Sequence[float]] - | RangeEnum_T - ) - symbol: Sequence[str] + coordinates: Sequence[Sequence[float]] + type: Literal["LineString"] + bbox: Sequence[float] -class ScaleConfigKwds(TypedDict, total=False): +class LinearGradientKwds(TypedDict, total=False): """Placeholder doc.""" - bandPaddingInner: float - bandPaddingOuter: float - bandWithNestedOffsetPaddingInner: float - bandWithNestedOffsetPaddingOuter: float - barBandPaddingInner: float - clamp: bool - continuousPadding: float - invalid: ScaleInvalidDataConfigKwds - maxBandSize: float - maxFontSize: float - maxOpacity: float - maxSize: float - maxStrokeWidth: float - minBandSize: float - minFontSize: float - minOpacity: float - minSize: float - minStrokeWidth: float - offsetBandPaddingInner: float - offsetBandPaddingOuter: float - pointPadding: float - quantileCount: float - quantizeCount: float - rectBandPaddingInner: float - round: bool - tickBandPaddingInner: float - useUnaggregatedDomain: bool - xReverse: bool - zero: bool + gradient: Literal["linear"] + stops: Sequence[GradientStopKwds] + id: str + x1: float + x2: float + y1: float + y2: float -class SelectionConfigKwds(TypedDict, total=False): +class LocaleKwds(TypedDict, total=False): """Placeholder doc.""" - interval: IntervalSelectionConfigWithoutTypeKwds - point: PointSelectionConfigWithoutTypeKwds + number: NumberLocaleKwds + time: TimeLocaleKwds -class TickConfigKwds(TypedDict, total=False): +class MarkConfigKwds(TypedDict, total=False): """Placeholder doc.""" align: Align_T @@ -823,7 +799,6 @@ class TickConfigKwds(TypedDict, total=False): ariaRole: str ariaRoleDescription: str aspect: bool - bandSize: float baseline: TextBaseline_T blend: Blend_T color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T @@ -878,7 +853,6 @@ class TickConfigKwds(TypedDict, total=False): text: str | Sequence[str] theta: float theta2: float - thickness: float timeUnitBandPosition: float timeUnitBandSize: float tooltip: str | bool | None | float | TooltipContentKwds @@ -890,100 +864,54 @@ class TickConfigKwds(TypedDict, total=False): y2: float | Literal["height"] -class TitleConfigKwds(TypedDict, total=False): +class MergedStreamKwds(TypedDict, total=False): """Placeholder doc.""" - align: Align_T - anchor: TitleAnchor_T - angle: float - aria: bool - baseline: TextBaseline_T - color: None | ColorHex | ColorName_T - dx: float - dy: float - font: str - fontSize: float - fontStyle: str - fontWeight: FontWeight_T - frame: str | TitleFrame_T - limit: float - lineHeight: float - offset: float - orient: TitleOrient_T - subtitleColor: None | ColorHex | ColorName_T - subtitleFont: str - subtitleFontSize: float - subtitleFontStyle: str - subtitleFontWeight: FontWeight_T - subtitleLineHeight: float - subtitlePadding: float - zindex: float + merge: Sequence[MergedStreamKwds | DerivedStreamKwds] + between: Sequence[MergedStreamKwds | DerivedStreamKwds] + consume: bool + debounce: float + filter: str | Sequence[str] + markname: str + marktype: MarkType_T + throttle: float -class FormatConfigKwds(TypedDict, total=False): +class MultiLineStringKwds(TypedDict, total=False): """Placeholder doc.""" - normalizedNumberFormat: str - normalizedNumberFormatType: str - numberFormat: str - numberFormatType: str - timeFormat: str - timeFormatType: str + coordinates: Sequence[Sequence[Sequence[float]]] + type: Literal["MultiLineString"] + bbox: Sequence[float] -class ViewConfigKwds(TypedDict, total=False): +class MultiPointKwds(TypedDict, total=False): """Placeholder doc.""" - clip: bool - continuousHeight: float - continuousWidth: float - cornerRadius: float - cursor: Cursor_T - discreteHeight: float - discreteWidth: float - fill: None | ColorHex | ColorName_T - fillOpacity: float - opacity: float - step: float - stroke: None | ColorHex | ColorName_T - strokeCap: StrokeCap_T - strokeDash: Sequence[float] - strokeDashOffset: float - strokeJoin: StrokeJoin_T - strokeMiterLimit: float - strokeOpacity: float - strokeWidth: float + coordinates: Sequence[Sequence[float]] + type: Literal["MultiPoint"] + bbox: Sequence[float] -class ScaleInvalidDataConfigKwds(TypedDict, total=False): +class MultiPolygonKwds(TypedDict, total=False): """Placeholder doc.""" - angle: Value[float] | Literal["zero-or-min"] - color: ( - Literal["zero-or-min"] - | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] - ) - fill: ( - Literal["zero-or-min"] - | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] - ) - fillOpacity: Value[float] | Literal["zero-or-min"] - opacity: Value[float] | Literal["zero-or-min"] - radius: Value[float] | Literal["zero-or-min"] - shape: Value[str] | Literal["zero-or-min"] - size: Value[float] | Literal["zero-or-min"] - stroke: ( - Literal["zero-or-min"] - | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] - ) - strokeDash: Literal["zero-or-min"] | Value[Sequence[float]] - strokeOpacity: Value[float] | Literal["zero-or-min"] - strokeWidth: Value[float] | Literal["zero-or-min"] - theta: Value[float] | Literal["zero-or-min"] - x: Literal["zero-or-min"] | Value[float | Literal["width"]] - xOffset: Value[float] | Literal["zero-or-min"] - y: Literal["zero-or-min"] | Value[float | Literal["height"]] - yOffset: Value[float] | Literal["zero-or-min"] + coordinates: Sequence[Sequence[Sequence[Sequence[float]]]] + type: Literal["MultiPolygon"] + bbox: Sequence[float] + + +class NumberLocaleKwds(TypedDict, total=False): + """Placeholder doc.""" + + currency: Sequence[str] + decimal: str + grouping: Sequence[float] + thousands: str + minus: str + nan: str + numerals: Sequence[str] + percent: str class OverlayMarkDefKwds(TypedDict, total=False): @@ -1070,78 +998,25 @@ class OverlayMarkDefKwds(TypedDict, total=False): yOffset: float -class LinearGradientKwds(TypedDict, total=False): - """Placeholder doc.""" - - gradient: Literal["linear"] - stops: Sequence[GradientStopKwds] - id: str - x1: float - x2: float - y1: float - y2: float - - -class RadialGradientKwds(TypedDict, total=False): - """Placeholder doc.""" - - gradient: Literal["radial"] - stops: Sequence[GradientStopKwds] - id: str - r1: float - r2: float - x1: float - x2: float - y1: float - y2: float - - -class GradientStopKwds(TypedDict, total=False): - """Placeholder doc.""" - - color: ColorHex | ColorName_T - offset: float - - -class TooltipContentKwds(TypedDict, total=False): - """Placeholder doc.""" - - content: Literal["encoding", "data"] - - -class DateTimeKwds(TypedDict, total=False): - """Placeholder doc.""" - - date: float - day: str | float - hours: float - milliseconds: float - minutes: float - month: str | float - quarter: float - seconds: float - utc: bool - year: float - - -class TimeIntervalStepKwds(TypedDict, total=False): +class PointKwds(TypedDict, total=False): """Placeholder doc.""" - interval: TimeInterval_T - step: float + coordinates: Sequence[float] + type: Literal["Point"] + bbox: Sequence[float] -class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): +class PointSelectionConfigKwds(TypedDict, total=False): """Placeholder doc.""" + type: Literal["point"] clear: str | bool | MergedStreamKwds | DerivedStreamKwds encodings: Sequence[SingleDefUnitChannel_T] fields: Sequence[str] - mark: BrushConfigKwds + nearest: bool on: str | MergedStreamKwds | DerivedStreamKwds resolve: SelectionResolution_T - translate: str | bool - zoom: str | bool + toggle: str | bool class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): @@ -1156,310 +1031,455 @@ class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): toggle: str | bool -class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): +class PolygonKwds(TypedDict, total=False): """Placeholder doc.""" - geometry: ( - PointKwds - | PolygonKwds - | LineStringKwds - | MultiPointKwds - | MultiPolygonKwds - | MultiLineStringKwds - | GeometryCollectionKwds - ) - properties: None - type: Literal["Feature"] + coordinates: Sequence[Sequence[Sequence[float]]] + type: Literal["Polygon"] bbox: Sequence[float] - id: str | float -class GeoJsonFeatureKwds(TypedDict, total=False): +class ProjectionConfigKwds(TypedDict, total=False): """Placeholder doc.""" - geometry: ( - PointKwds - | PolygonKwds - | LineStringKwds - | MultiPointKwds - | MultiPolygonKwds - | MultiLineStringKwds - | GeometryCollectionKwds + center: Sequence[float] + clipAngle: float + clipExtent: Sequence[Sequence[float]] + coefficient: float + distance: float + extent: Sequence[Sequence[float]] + fit: ( + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + | Sequence[ + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + ] ) - properties: None - type: Literal["Feature"] - bbox: Sequence[float] - id: str | float + fraction: float + lobes: float + parallel: float + parallels: Sequence[float] + pointRadius: float + precision: float + radius: float + ratio: float + reflectX: bool + reflectY: bool + rotate: Sequence[float] + scale: float + size: Sequence[float] + spacing: float + tilt: float + translate: Sequence[float] + type: ProjectionType_T -class GeoJsonFeatureCollectionKwds(TypedDict, total=False): +class RadialGradientKwds(TypedDict, total=False): """Placeholder doc.""" - features: Sequence[FeatureGeometryGeoJsonPropertiesKwds] - type: Literal["FeatureCollection"] - bbox: Sequence[float] + gradient: Literal["radial"] + stops: Sequence[GradientStopKwds] + id: str + r1: float + r2: float + x1: float + x2: float + y1: float + y2: float -class GeometryCollectionKwds(TypedDict, total=False): - """Placeholder doc.""" - - geometries: Sequence[ - PointKwds - | PolygonKwds - | LineStringKwds - | MultiPointKwds - | MultiPolygonKwds - | MultiLineStringKwds - | GeometryCollectionKwds - ] - type: Literal["GeometryCollection"] - bbox: Sequence[float] - - -class PointKwds(TypedDict, total=False): +class RangeConfigKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[float] - type: Literal["Point"] - bbox: Sequence[float] + category: ( + Sequence[ColorHex | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + diverging: ( + Sequence[ColorHex | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + heatmap: ( + Sequence[ColorHex | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + ordinal: ( + Sequence[ColorHex | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + ramp: ( + Sequence[ColorHex | ColorName_T] + | Sequence[str | bool | None | float | Sequence[float]] + | RangeEnum_T + ) + symbol: Sequence[str] -class PolygonKwds(TypedDict, total=False): +class RectConfigKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[Sequence[Sequence[float]]] - type: Literal["Polygon"] - bbox: Sequence[float] + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + baseline: TextBaseline_T + binSpacing: float + blend: Blend_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + continuousBandSize: float + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float + cursor: Cursor_T + description: str + dir: TextDirection_T + discreteBandSize: float + dx: float + dy: float + ellipsis: str + endAngle: float + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + fillOpacity: float + filled: bool + font: str + fontSize: float + fontStyle: str + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + minBandSize: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str + size: float + smooth: bool + startAngle: float + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float + strokeOpacity: float + strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContentKwds + url: str + width: float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] -class LineStringKwds(TypedDict, total=False): +class ScaleConfigKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[Sequence[float]] - type: Literal["LineString"] - bbox: Sequence[float] + bandPaddingInner: float + bandPaddingOuter: float + bandWithNestedOffsetPaddingInner: float + bandWithNestedOffsetPaddingOuter: float + barBandPaddingInner: float + clamp: bool + continuousPadding: float + invalid: ScaleInvalidDataConfigKwds + maxBandSize: float + maxFontSize: float + maxOpacity: float + maxSize: float + maxStrokeWidth: float + minBandSize: float + minFontSize: float + minOpacity: float + minSize: float + minStrokeWidth: float + offsetBandPaddingInner: float + offsetBandPaddingOuter: float + pointPadding: float + quantileCount: float + quantizeCount: float + rectBandPaddingInner: float + round: bool + tickBandPaddingInner: float + useUnaggregatedDomain: bool + xReverse: bool + zero: bool -class MultiPointKwds(TypedDict, total=False): +class ScaleInvalidDataConfigKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[Sequence[float]] - type: Literal["MultiPoint"] - bbox: Sequence[float] + angle: Value[float] | Literal["zero-or-min"] + color: ( + Literal["zero-or-min"] + | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) + fill: ( + Literal["zero-or-min"] + | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) + fillOpacity: Value[float] | Literal["zero-or-min"] + opacity: Value[float] | Literal["zero-or-min"] + radius: Value[float] | Literal["zero-or-min"] + shape: Value[str] | Literal["zero-or-min"] + size: Value[float] | Literal["zero-or-min"] + stroke: ( + Literal["zero-or-min"] + | Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T] + ) + strokeDash: Literal["zero-or-min"] | Value[Sequence[float]] + strokeOpacity: Value[float] | Literal["zero-or-min"] + strokeWidth: Value[float] | Literal["zero-or-min"] + theta: Value[float] | Literal["zero-or-min"] + x: Literal["zero-or-min"] | Value[float | Literal["width"]] + xOffset: Value[float] | Literal["zero-or-min"] + y: Literal["zero-or-min"] | Value[float | Literal["height"]] + yOffset: Value[float] | Literal["zero-or-min"] -class MultiPolygonKwds(TypedDict, total=False): +class SelectionConfigKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[Sequence[Sequence[Sequence[float]]]] - type: Literal["MultiPolygon"] - bbox: Sequence[float] + interval: IntervalSelectionConfigWithoutTypeKwds + point: PointSelectionConfigWithoutTypeKwds -class MultiLineStringKwds(TypedDict, total=False): +class StyleConfigIndexKwds(TypedDict, total=False): """Placeholder doc.""" - coordinates: Sequence[Sequence[Sequence[float]]] - type: Literal["MultiLineString"] - bbox: Sequence[float] + arc: RectConfigKwds + area: AreaConfigKwds + bar: BarConfigKwds + circle: MarkConfigKwds + geoshape: MarkConfigKwds + image: RectConfigKwds + line: LineConfigKwds + mark: MarkConfigKwds + point: MarkConfigKwds + rect: RectConfigKwds + rule: MarkConfigKwds + square: MarkConfigKwds + text: MarkConfigKwds + tick: TickConfigKwds + trail: LineConfigKwds -class BrushConfigKwds(TypedDict, total=False): +class TickConfigKwds(TypedDict, total=False): """Placeholder doc.""" + align: Align_T + angle: float + aria: bool + ariaRole: str + ariaRoleDescription: str + aspect: bool + bandSize: float + baseline: TextBaseline_T + blend: Blend_T + color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + cornerRadius: float + cornerRadiusBottomLeft: float + cornerRadiusBottomRight: float + cornerRadiusTopLeft: float + cornerRadiusTopRight: float cursor: Cursor_T - fill: ColorHex | ColorName_T + description: str + dir: TextDirection_T + dx: float + dy: float + ellipsis: str + endAngle: float + fill: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T fillOpacity: float - stroke: ColorHex | ColorName_T + filled: bool + font: str + fontSize: float + fontStyle: str + fontWeight: FontWeight_T + height: float + href: str + innerRadius: float + interpolate: Interpolate_T + invalid: None | MarkInvalidDataMode_T + limit: float + lineBreak: str + lineHeight: float + opacity: float + order: bool | None + orient: Orientation_T + outerRadius: float + padAngle: float + radius: float + radius2: float + shape: str + size: float + smooth: bool + startAngle: float + stroke: None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T + strokeCap: StrokeCap_T strokeDash: Sequence[float] strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOffset: float strokeOpacity: float strokeWidth: float + tension: float + text: str | Sequence[str] + theta: float + theta2: float + thickness: float + timeUnitBandPosition: float + timeUnitBandSize: float + tooltip: str | bool | None | float | TooltipContentKwds + url: str + width: float + x: float | Literal["width"] + x2: float | Literal["width"] + y: float | Literal["height"] + y2: float | Literal["height"] -class MergedStreamKwds(TypedDict, total=False): +class TimeIntervalStepKwds(TypedDict, total=False): """Placeholder doc.""" - merge: Sequence[MergedStreamKwds | DerivedStreamKwds] - between: Sequence[MergedStreamKwds | DerivedStreamKwds] - consume: bool - debounce: float - filter: str | Sequence[str] - markname: str - marktype: MarkType_T - throttle: float + interval: TimeInterval_T + step: float -class DerivedStreamKwds(TypedDict, total=False): +class TimeLocaleKwds(TypedDict, total=False): """Placeholder doc.""" - stream: MergedStreamKwds | DerivedStreamKwds - between: Sequence[MergedStreamKwds | DerivedStreamKwds] - consume: bool - debounce: float - filter: str | Sequence[str] - markname: str - marktype: MarkType_T - throttle: float + date: str + dateTime: str + days: Sequence[str] + months: Sequence[str] + periods: Sequence[str] + shortDays: Sequence[str] + shortMonths: Sequence[str] + time: str -class AutoSizeParamsKwds(TypedDict, total=False): +class TitleConfigKwds(TypedDict, total=False): """Placeholder doc.""" - contains: Literal["content", "padding"] - resize: bool - type: AutosizeType_T + align: Align_T + anchor: TitleAnchor_T + angle: float + aria: bool + baseline: TextBaseline_T + color: None | ColorHex | ColorName_T + dx: float + dy: float + font: str + fontSize: float + fontStyle: str + fontWeight: FontWeight_T + frame: str | TitleFrame_T + limit: float + lineHeight: float + offset: float + orient: TitleOrient_T + subtitleColor: None | ColorHex | ColorName_T + subtitleFont: str + subtitleFontSize: float + subtitleFontStyle: str + subtitleFontWeight: FontWeight_T + subtitleLineHeight: float + subtitlePadding: float + zindex: float -class LocaleKwds(TypedDict, total=False): +class TooltipContentKwds(TypedDict, total=False): """Placeholder doc.""" - number: NumberLocaleKwds - time: TimeLocaleKwds + content: Literal["encoding", "data"] -class VariableParameterKwds(TypedDict, total=False): +class TopLevelSelectionParameterKwds(TypedDict, total=False): """Placeholder doc.""" name: str + select: PointSelectionConfigKwds | IntervalSelectionConfigKwds | SelectionType_T bind: ( BindInputKwds | BindRangeKwds | BindDirectKwds | BindCheckboxKwds | BindRadioSelectKwds + | LegendStreamBindingKwds + | Literal["legend", "scales"] ) - expr: str - react: bool - value: Any + value: str | bool | None | float | DateTimeKwds | Sequence[Map] + views: Sequence[str] -class TopLevelSelectionParameterKwds(TypedDict, total=False): +class VariableParameterKwds(TypedDict, total=False): """Placeholder doc.""" name: str - select: PointSelectionConfigKwds | IntervalSelectionConfigKwds | SelectionType_T bind: ( BindInputKwds | BindRangeKwds | BindDirectKwds | BindCheckboxKwds | BindRadioSelectKwds - | LegendStreamBindingKwds - | Literal["legend", "scales"] ) - value: str | bool | None | float | DateTimeKwds | Sequence[Map] - views: Sequence[str] - - -class PointSelectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" - - type: Literal["point"] - clear: str | bool | MergedStreamKwds | DerivedStreamKwds - encodings: Sequence[SingleDefUnitChannel_T] - fields: Sequence[str] - nearest: bool - on: str | MergedStreamKwds | DerivedStreamKwds - resolve: SelectionResolution_T - toggle: str | bool - - -class IntervalSelectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" - - type: Literal["interval"] - clear: str | bool | MergedStreamKwds | DerivedStreamKwds - encodings: Sequence[SingleDefUnitChannel_T] - fields: Sequence[str] - mark: BrushConfigKwds - on: str | MergedStreamKwds | DerivedStreamKwds - resolve: SelectionResolution_T - translate: str | bool - zoom: str | bool - - -class BindInputKwds(TypedDict, total=False): - """Placeholder doc.""" - - autocomplete: str - debounce: float - element: str - input: str - name: str - placeholder: str + expr: str + react: bool + value: Any -class BindRangeKwds(TypedDict, total=False): +class ViewConfigKwds(TypedDict, total=False): """Placeholder doc.""" - input: Literal["range"] - debounce: float - element: str - max: float - min: float - name: str + clip: bool + continuousHeight: float + continuousWidth: float + cornerRadius: float + cursor: Cursor_T + discreteHeight: float + discreteWidth: float + fill: None | ColorHex | ColorName_T + fillOpacity: float + opacity: float step: float - - -class BindDirectKwds(TypedDict, total=False): - """Placeholder doc.""" - - element: str - debounce: float - event: str - - -class BindCheckboxKwds(TypedDict, total=False): - """Placeholder doc.""" - - input: Literal["checkbox"] - debounce: float - element: str - name: str - - -class BindRadioSelectKwds(TypedDict, total=False): - """Placeholder doc.""" - - input: Literal["radio", "select"] - options: Sequence[Any] - debounce: float - element: str - labels: Sequence[str] - name: str - - -class NumberLocaleKwds(TypedDict, total=False): - """Placeholder doc.""" - - currency: Sequence[str] - decimal: str - grouping: Sequence[float] - thousands: str - minus: str - nan: str - numerals: Sequence[str] - percent: str - - -class TimeLocaleKwds(TypedDict, total=False): - """Placeholder doc.""" - - date: str - dateTime: str - days: Sequence[str] - months: Sequence[str] - periods: Sequence[str] - shortDays: Sequence[str] - shortMonths: Sequence[str] - time: str - - -class LegendStreamBindingKwds(TypedDict, total=False): - """Placeholder doc.""" - - legend: str | MergedStreamKwds | DerivedStreamKwds + stroke: None | ColorHex | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOpacity: float + strokeWidth: float class ThemeConfig(TypedDict, total=False): @@ -1528,7 +1548,7 @@ class ThemeConfig(TypedDict, total=False): scale: ScaleConfigKwds selection: SelectionConfigKwds square: MarkConfigKwds - style: Map + style: StyleConfigIndexKwds text: MarkConfigKwds tick: TickConfigKwds timeFormat: str From 0af1cd197c604ef2f9264fb6c2162656f4492ef6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sun, 8 Sep 2024 20:50:35 +0100 Subject: [PATCH 073/139] feat: Adds `_config.__all__` --- altair/vegalite/v5/schema/_config.py | 63 ++++++++++++++++++++++++++++ tools/generate_schema_wrapper.py | 3 ++ 2 files changed, 66 insertions(+) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 9170276a8..5140b845a 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -10,6 +10,69 @@ from ._typing import * # noqa: F403 +__all__ = [ + "AreaConfigKwds", + "AutoSizeParamsKwds", + "AxisConfigKwds", + "BarConfigKwds", + "BindCheckboxKwds", + "BindDirectKwds", + "BindInputKwds", + "BindRadioSelectKwds", + "BindRangeKwds", + "BoxPlotConfigKwds", + "BrushConfigKwds", + "CompositionConfigKwds", + "DateTimeKwds", + "DerivedStreamKwds", + "ErrorBandConfigKwds", + "ErrorBarConfigKwds", + "FeatureGeometryGeoJsonPropertiesKwds", + "FormatConfigKwds", + "GeoJsonFeatureCollectionKwds", + "GeoJsonFeatureKwds", + "GeometryCollectionKwds", + "GradientStopKwds", + "HeaderConfigKwds", + "IntervalSelectionConfigKwds", + "IntervalSelectionConfigWithoutTypeKwds", + "LegendConfigKwds", + "LegendStreamBindingKwds", + "LineConfigKwds", + "LineStringKwds", + "LinearGradientKwds", + "LocaleKwds", + "MarkConfigKwds", + "MergedStreamKwds", + "MultiLineStringKwds", + "MultiPointKwds", + "MultiPolygonKwds", + "NumberLocaleKwds", + "OverlayMarkDefKwds", + "PointKwds", + "PointSelectionConfigKwds", + "PointSelectionConfigWithoutTypeKwds", + "PolygonKwds", + "ProjectionConfigKwds", + "RadialGradientKwds", + "RangeConfigKwds", + "RectConfigKwds", + "ScaleConfigKwds", + "ScaleInvalidDataConfigKwds", + "SelectionConfigKwds", + "StyleConfigIndexKwds", + "ThemeConfig", + "TickConfigKwds", + "TimeIntervalStepKwds", + "TimeLocaleKwds", + "TitleConfigKwds", + "TooltipContentKwds", + "TopLevelSelectionParameterKwds", + "VariableParameterKwds", + "ViewConfigKwds", +] + + class AreaConfigKwds(TypedDict, total=False): """Placeholder doc.""" diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 93e2ce490..ff2bca60b 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -836,6 +836,9 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: ) for info in relevant.values() ) + _all = [f"{nm}{KWDS}" for nm in relevant] + _all.append("ThemeConfig") + yield f"__all__ = {_all}\n\n" yield "\n".join(sub_dicts) for prop, prop_info in config.properties.items(): From 2670e3bcf7aeca4c98be945af95dc28857e6eef5 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:57:18 +0100 Subject: [PATCH 074/139] refactor: Un-special-case `Dict`, include in `SchemaInfo.is_type_alias` The schema here is unique and aligns (conceptually) with the excluded types that fell under this rule --- tools/schemapi/utils.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index caf6b34eb..1d614bd5e 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -532,7 +532,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: # try to check for the type of the Parameter.param attribute # but then we would need to write some overload signatures for # api.param). - EXCLUDE_TITLE: set[str] = tp_param | {"Dict", "RelativeBandSize"} + EXCLUDE_TITLE: set[str] = tp_param | {"RelativeBandSize"} """ `RelativeBandSize` excluded as it has a single property `band`, but all instances also accept `float`. @@ -743,7 +743,7 @@ def is_type_alias(self) -> bool: """ Represents a name assigned to a literal type. - At the time of writing, all of these are: + At the time of writing, most of these are: SchemaInfo.schema = {"type": "string"} @@ -757,10 +757,19 @@ def is_type_alias(self) -> bool: arg = FieldName("name 1") The latter is not useful and adds noise. + + ``Dict`` is very similar case, with a *slightly* different schema: + + SchemaInfo.schema = {"additionalProperties": {}, "type": "object"} """ TP = "type" + ADDITIONAL = "additionalProperties" + keys = self.schema.keys() return ( - self.schema.keys() == {TP} + ( + (keys == {TP}) + or (keys == {TP, ADDITIONAL} and self.schema[ADDITIONAL] == {}) + ) and isinstance(self.type, str) and self.type in jsonschema_to_python_types ) From d63b8a66046d5184988605eaa728eaaad91d3847 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:21:07 +0100 Subject: [PATCH 075/139] docs: Update comments in `SchemaInfo.title_to_type_reprs` --- tools/schemapi/utils.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 1d614bd5e..e7d1a0353 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -525,13 +525,11 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: Avoid base classes/wrappers that don't provide type info. """ tp_param: set[str] = {"ExprRef", "ParameterExtent"} - # In these cases, a value parameter is also always accepted. - # It would be quite complex to further differentiate - # between a value and a selection parameter based on - # the type system (one could - # try to check for the type of the Parameter.param attribute - # but then we would need to write some overload signatures for - # api.param). + # In these cases, a `VariableParameter` is also always accepted. + # It could be difficult to differentiate `(Variable|Selection)Parameter`, with typing. + # TODO: A solution could be defining `Parameter` as generic over either `param` or `param_type`. + # - Rewriting the init logic to not use an `Undefined` default. + # - Any narrowing logic could be factored-out into `is_(selection|variable)_parameter` guards. EXCLUDE_TITLE: set[str] = tp_param | {"RelativeBandSize"} """ `RelativeBandSize` excluded as it has a single property `band`, @@ -542,8 +540,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: tps: set[str] = set() if not use_concrete: tps.add("SchemaBase") - # To keep type hints simple, we only use the SchemaBase class - # as the type hint for all classes which inherit from it. + # NOTE: To keep type hints simple, we annotate with `SchemaBase` for all subclasses. if title in tp_param: tps.add("Parameter") elif self.is_value(): From ebfdbd496236ca55c6375949c570d574f8ed553c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:42:52 +0100 Subject: [PATCH 076/139] refactor: `is_relevant_schema` -> `SchemaInfo.is_theme_config_target` https://github.com/vega/altair/pull/3536#discussion_r1750207216 --- tools/generate_schema_wrapper.py | 17 +---------------- tools/schemapi/utils.py | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index ff2bca60b..f54234865 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -10,7 +10,6 @@ import textwrap from dataclasses import dataclass from itertools import chain -from keyword import iskeyword from pathlib import Path from typing import Any, Final, Iterable, Iterator, Literal from urllib import request @@ -851,25 +850,11 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) -def is_relevant_schema(info: SchemaInfo, /) -> bool: - """Relevant for the purpose of `ThemeConfig`.""" - EXCLUDE = {"ExprRef", "RelativeBandSize", "ParameterPredicate"} - return bool( - info.ref - and info.refname not in EXCLUDE - and info.properties - and info.type == "object" - and not info.is_value() - and "field" not in info.required - and not (iskeyword(next(iter(info.required), ""))) - ) - - def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: """Equivalent to `get_all_objects`.""" MAX_DEPTH = 6 seen: set[SchemaInfo] = set() - if is_relevant_schema(info) and info not in seen: + if info.is_theme_config_target() and info not in seen: seen.add(info) if depth < MAX_DEPTH: for prop_info in info.iter_descendants(): diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index e7d1a0353..5da9bad90 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -3,13 +3,13 @@ from __future__ import annotations import json -import keyword import re import subprocess import textwrap import urllib.parse from html import unescape from itertools import chain +from keyword import iskeyword from operator import itemgetter from typing import ( TYPE_CHECKING, @@ -290,14 +290,14 @@ def get_valid_identifier( valid = "_" + valid # if the result is a reserved keyword, then add an underscore at the end - if keyword.iskeyword(valid): + if iskeyword(valid): valid += "_" return valid def is_valid_identifier(s: str, /) -> bool: """Return ``True`` if ``s`` contains a valid Python identifier.""" - return _VALID_IDENT.match(s) is not None and not keyword.iskeyword(s) + return _VALID_IDENT.match(s) is not None and not iskeyword(s) class SchemaProperties: @@ -771,6 +771,25 @@ def is_type_alias(self) -> bool: and self.type in jsonschema_to_python_types ) + def is_theme_config_target(self) -> bool: + """ + Return `True` for candidates classes in ``ThemeConfig`` hierarchy of ``TypedDict``(s). + + Satisfying these rules ensures: + - we generate meaningful annotations + - they improve autocompletion, without overwhelming the UX + """ + EXCLUDE = {"ExprRef", "ParameterPredicate", "RelativeBandSize"} + return bool( + self.ref + and self.refname not in EXCLUDE + and self.properties + and self.type == "object" + and not self.is_value() + and "field" not in self.required + and not (iskeyword(next(iter(self.required), ""))) + ) + class RSTRenderer(_RSTRenderer): def __init__(self) -> None: From 96a7460666b3a7f93508e7aec083df740a46d900 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:24:55 +0100 Subject: [PATCH 077/139] refactor: Simplify `generate_config_typed_dicts` - All of this logic is now handled elsewhere. - Updated some names to be more consistent --- tools/generate_schema_wrapper.py | 35 +++++++++++++------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index f54234865..e2fe77646 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -10,6 +10,7 @@ import textwrap from dataclasses import dataclass from itertools import chain +from operator import attrgetter from pathlib import Path from typing import Any, Final, Iterable, Iterator, Literal from urllib import request @@ -818,39 +819,31 @@ def generate_typed_dict_args(prop_info: SchemaInfo) -> str: def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: - schema = load_schema(fp) - config = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) - top_dict_annotations: list[str] = [] + KWDS: Literal["Kwds"] = "Kwds" + THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" + config = SchemaInfo({"$ref": "#/definitions/Config"}, load_schema(fp)) + relevant: dict[str, SchemaInfo] = { x.title: x - for x in sorted(find_relevant_schemas(config), key=lambda x: x.refname) + for x in sorted(find_theme_config_targets(config), key=attrgetter("refname")) if x.refname != "Config" } - KWDS: Literal["Kwds"] = "Kwds" SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in relevant) - sub_dicts = ( + + config_sub: Iterator[str] = ( CONFIG_SUB_TYPED_DICT.format( name=f"{info.title}{KWDS}", typed_dict_args=generate_typed_dict_args(info) ) for info in relevant.values() ) - _all = [f"{nm}{KWDS}" for nm in relevant] - _all.append("ThemeConfig") - yield f"__all__ = {_all}\n\n" - yield "\n".join(sub_dicts) - - for prop, prop_info in config.properties.items(): - if (classname := prop_info.refname) and classname.endswith("Config"): - name = f"{classname}{KWDS}" - top_dict_annotations.append(f"{prop}: {name}") - else: - ann: str = prop_info.to_type_repr(target="annotation", use_concrete=True) - top_dict_annotations.append(f"{prop}: {ann}") - yield CONFIG_TYPED_DICT.format(typed_dict_args="\n ".join(top_dict_annotations)) + config_sub_names = (f"{nm}{KWDS}" for nm in relevant) + yield f"__all__ = {[*config_sub_names, THEME_CONFIG]}\n\n" + yield "\n".join(config_sub) + yield CONFIG_TYPED_DICT.format(typed_dict_args=generate_typed_dict_args(config)) -def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: +def find_theme_config_targets(info: SchemaInfo, depth: int = 0, /) -> set[SchemaInfo]: """Equivalent to `get_all_objects`.""" MAX_DEPTH = 6 seen: set[SchemaInfo] = set() @@ -858,7 +851,7 @@ def find_relevant_schemas(info: SchemaInfo, depth: int = 0) -> set[SchemaInfo]: seen.add(info) if depth < MAX_DEPTH: for prop_info in info.iter_descendants(): - seen.update(find_relevant_schemas(prop_info, depth=depth + 1)) + seen.update(find_theme_config_targets(prop_info, depth + 1)) return seen From b3a7fb3921454065be9afce74baa45558a855def Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:30:01 +0100 Subject: [PATCH 078/139] docs: Link to discussion for unresolvable issue Closing threads on this, leaving comments for future reference. Cannot see a solution for this --- tools/schemapi/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 5da9bad90..4dd1fd2c0 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -506,7 +506,7 @@ def to_type_repr( # noqa: C901 tps.discard("str") elif len(tps) == 0 and as_str: # HACK: There is a single case that ends up empty here - # (LegendConfig.layout) + # See: https://github.com/vega/altair/pull/3536#discussion_r1714344162 tps = {"Map"} type_reprs = sort_type_reprs(tps) return ( From aae8e6ec46aa96e43c1a2a482dc7a6db7083dad6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:38:47 +0100 Subject: [PATCH 079/139] style: Use constant convention `FOR_TYPE_HINTS` --- tools/schemapi/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 4dd1fd2c0..9f607c65d 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -452,7 +452,7 @@ def to_type_repr( # noqa: C901 Wrap the result in ``altair.typing.Optional``. """ tps: set[str] = set() - for_type_hints: bool = target == "annotation" + FOR_TYPE_HINTS: bool = target == "annotation" if self.title: if target == "annotation": @@ -464,10 +464,10 @@ def to_type_repr( # noqa: C901 tps.add("Any") elif self.is_literal(): tp_str = spell_literal(self.literal) - if for_type_hints: + if FOR_TYPE_HINTS: tp_str = TypeAliasTracer.add_literal(self, tp_str, replace=True) tps.add(tp_str) - elif for_type_hints and self.is_union_literal(): + elif FOR_TYPE_HINTS and self.is_union_literal(): it = chain.from_iterable(el.literal for el in self.anyOf) tp_str = TypeAliasTracer.add_literal(self, spell_literal(it), replace=True) tps.add(tp_str) From 732b31dfe74924492fef51b6de378b364d99ba67 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:30:32 +0100 Subject: [PATCH 080/139] feat(typing): Accept an `Iterator` in `indent_docstring` Simply collects the lines if needed --- tools/schemapi/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 9f607c65d..6a03346f2 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -816,10 +816,12 @@ def __call__(self, s: str) -> str: def indent_docstring( # noqa: C901 - lines: list[str], indent_level: int, width: int = 100, lstrip=True + lines: Iterable[str], indent_level: int, width: int = 100, lstrip=True ) -> str: """Indent a docstring for use in generated code.""" final_lines = [] + if not isinstance(lines, list): + lines = list(lines) if len(lines) > 1: lines += [""] From 5c33b2c3a11d916eb8758cb270e2ad868c377442 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:32:37 +0100 Subject: [PATCH 081/139] feat: Adds initial docs for `_config.py` --- tools/generate_schema_wrapper.py | 49 +++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index e2fe77646..e50eb1286 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -228,14 +228,15 @@ def configure_{prop}(self, *args, **kwargs) -> Self: CONFIG_TYPED_DICT: Final = ''' class ThemeConfig(TypedDict, total=False): - """Placeholder doc.""" + """Placeholder doc. + {doc}""" {typed_dict_args} ''' CONFIG_SUB_TYPED_DICT: Final = ''' class {name}(TypedDict, total=False): - """Placeholder doc.""" + """{doc}""" {typed_dict_args} ''' @@ -800,6 +801,27 @@ def _signature_args( raise NotImplementedError +def _doc_args( + info: SchemaInfo, + *, + kind: Literal["method", "typed_dict"] = "method", + generate_summary: bool = True, +) -> Iterator[str]: + """Lazily build a docstring.""" + props = info.properties + if kind == "method": + raise NotImplementedError + elif kind == "typed_dict": + if generate_summary: + yield f"{info.title} ``TypedDict`` wrapper." + yield from ("", "Parameters", "----------") + for p in codegen.get_args(info).required_kwds: + yield f"{p}" + yield f" {process_description(props[p].deep_description)}" + else: + raise NotImplementedError + + def generate_mark_args( info: SchemaInfo, ) -> dict[Literal["method_args", "dict_args"], str]: @@ -812,12 +834,20 @@ def generate_mark_args( } -def generate_typed_dict_args(prop_info: SchemaInfo) -> str: - args = codegen.get_args(prop_info).required_kwds - it = _signature_args(args, prop_info.properties, kind="typed_dict") +def generate_typed_dict_args(info: SchemaInfo, /) -> str: + args = codegen.get_args(info).required_kwds + it = _signature_args(args, info.properties, kind="typed_dict") return "\n ".join(it) +def generate_typed_dict_doc(info: SchemaInfo, /, *, summary: bool = True) -> str: + return indent_docstring( + _doc_args(info, kind="typed_dict", generate_summary=summary), + indent_level=4, + lstrip=False, + ) + + def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: KWDS: Literal["Kwds"] = "Kwds" THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" @@ -833,14 +863,19 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: config_sub: Iterator[str] = ( CONFIG_SUB_TYPED_DICT.format( - name=f"{info.title}{KWDS}", typed_dict_args=generate_typed_dict_args(info) + name=f"{info.title}{KWDS}", + typed_dict_args=generate_typed_dict_args(info), + doc=generate_typed_dict_doc(info), ) for info in relevant.values() ) config_sub_names = (f"{nm}{KWDS}" for nm in relevant) yield f"__all__ = {[*config_sub_names, THEME_CONFIG]}\n\n" yield "\n".join(config_sub) - yield CONFIG_TYPED_DICT.format(typed_dict_args=generate_typed_dict_args(config)) + yield CONFIG_TYPED_DICT.format( + typed_dict_args=generate_typed_dict_args(config), + doc=generate_typed_dict_doc(config, summary=False), + ) def find_theme_config_targets(info: SchemaInfo, depth: int = 0, /) -> set[SchemaInfo]: From 0a04d4d41bea2ef3fbb94a0a56dda8152acabfe3 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:33:12 +0100 Subject: [PATCH 082/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_config.py | 5574 +++++++++++++++++++++++++- 1 file changed, 5515 insertions(+), 59 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 5140b845a..b4a89fd84 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -74,7 +74,405 @@ class AreaConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + AreaConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + line + A flag for overlaying line on top of area marks, or an object defining the + properties of the overlayed lines. + + * If this value is an empty object (``{}``) or ``true``, lines with default + properties will be used. + + * If this value is ``false``, no lines would be automatically added to area marks. + + **Default value:** ``false``. + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + point + A flag for overlaying points on top of line or area marks, or an object defining the + properties of the overlayed points. + + * If this property is ``"transparent"``, transparent points will be used (for + enhancing tooltips and selections). + + * If this property is an empty object (``{}``) or ``true``, filled points with + default properties will be used. + + * If this property is ``false``, no points would be automatically added to line or + area marks. + + **Default value:** ``false``. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -150,7 +548,33 @@ class AreaConfigKwds(TypedDict, total=False): class AutoSizeParamsKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + AutoSizeParams ``TypedDict`` wrapper. + + Parameters + ---------- + contains + Determines how size calculation should be performed, one of ``"content"`` or + ``"padding"``. The default setting (``"content"``) interprets the width and height + settings as the data rectangle (plotting) dimensions, to which padding is then + added. In contrast, the ``"padding"`` setting includes the padding within the view + size calculations, such that the width and height settings indicate the **total** + intended size of the view. + + **Default value**: ``"content"`` + resize + A boolean flag indicating if autosize layout should be re-calculated on every view + update. + + **Default value**: ``false`` + type + The sizing format type. One of ``"pad"``, ``"fit"``, ``"fit-x"``, ``"fit-y"``, or + ``"none"``. See the `autosize type + `__ documentation for + descriptions of each. + + **Default value**: ``"pad"`` + """ contains: Literal["content", "padding"] resize: bool @@ -158,7 +582,379 @@ class AutoSizeParamsKwds(TypedDict, total=False): class AxisConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + AxisConfig ``TypedDict`` wrapper. + + Parameters + ---------- + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG group, removing the axis from the ARIA accessibility tree. + + **Default value:** ``true`` + bandPosition + An interpolation fraction indicating where, for ``band`` scales, axis ticks should + be positioned. A value of ``0`` places ticks at the left edge of their bands. A + value of ``0.5`` places ticks in the middle of their bands. + + **Default value:** ``0.5`` + description + A text description of this axis for `ARIA accessibility + `__ (SVG output + only). If the ``aria`` property is true, for SVG output the `"aria-label" attribute + `__ + will be set to this description. If the description is unspecified it will be + automatically generated. + disable + Disable axis by default. + domain + A boolean flag indicating if the domain (the axis baseline) should be included as + part of the axis. + + **Default value:** ``true`` + domainCap + The stroke cap for the domain line's ending style. One of ``"butt"``, ``"round"`` or + ``"square"``. + + **Default value:** ``"butt"`` + domainColor + Color of axis domain line. + + **Default value:** ``"gray"``. + domainDash + An array of alternating [stroke, space] lengths for dashed domain lines. + domainDashOffset + The pixel offset at which to start drawing with the domain dash array. + domainOpacity + Opacity of the axis domain line. + domainWidth + Stroke width of axis domain line + + **Default value:** ``1`` + format + When used with the default ``"number"`` and ``"time"`` format type, the text + formatting pattern for labels of guides (axes, legends, headers) and text marks. + + * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's + `number format pattern `__. + * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time + format pattern `__. + + See the `format documentation `__ + for more examples. + + When used with a `custom formatType + `__, this + value will be passed as ``format`` alongside ``datum.value`` to the registered + function. + + **Default value:** Derived from `numberFormat + `__ config for number + format and from `timeFormat + `__ config for time + format. + formatType + The format type for labels. One of ``"number"``, ``"time"``, or a `registered custom + format type + `__. + + **Default value:** + + * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. + * ``"number"`` for quantitative fields as well as ordinal and nominal fields without + ``timeUnit``. + grid + A boolean flag indicating if grid lines should be included as part of the axis + + **Default value:** ``true`` for `continuous scales + `__ that are not + binned; otherwise, ``false``. + gridCap + The stroke cap for grid lines' ending style. One of ``"butt"``, ``"round"`` or + ``"square"``. + + **Default value:** ``"butt"`` + gridColor + Color of gridlines. + + **Default value:** ``"lightGray"``. + gridDash + An array of alternating [stroke, space] lengths for dashed grid lines. + gridDashOffset + The pixel offset at which to start drawing with the grid dash array. + gridOpacity + The stroke opacity of grid (value between [0,1]) + + **Default value:** ``1`` + gridWidth + The grid width, in pixels. + + **Default value:** ``1`` + labelAlign + Horizontal text alignment of axis tick labels, overriding the default setting for + the current axis orientation. + labelAngle + The rotation angle of the axis labels. + + **Default value:** ``-90`` for nominal and ordinal fields; ``0`` otherwise. + labelBaseline + Vertical text baseline of axis tick labels, overriding the default setting for the + current axis orientation. One of ``"alphabetic"`` (default), ``"top"``, + ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The ``"line-top"`` + and ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but + are calculated relative to the *lineHeight* rather than *fontSize* alone. + labelBound + Indicates if labels should be hidden if they exceed the axis range. If ``false`` + (the default) no bounds overlap analysis is performed. If ``true``, labels will be + hidden if they exceed the axis range by more than 1 pixel. If this property is a + number, it specifies the pixel tolerance: the maximum amount by which a label + bounding box may exceed the axis range. + + **Default value:** ``false``. + labelColor + The color of the tick label, can be in hex color code or regular color name. + labelExpr + `Vega expression `__ for customizing + labels. + + **Note:** The label text and value can be assessed via the ``label`` and ``value`` + properties of the axis's backing ``datum`` object. + labelFlush + Indicates if the first and last axis labels should be aligned flush with the scale + range. Flush alignment for a horizontal axis will left-align the first label and + right-align the last label. For vertical axes, bottom and top text baselines are + applied instead. If this property is a number, it also indicates the number of + pixels by which to offset the first and last labels; for example, a value of 2 will + flush-align the first and last labels and also push them 2 pixels outward from the + center of the axis. The additional adjustment can sometimes help the labels better + visually group with corresponding axis ticks. + + **Default value:** ``true`` for axis of a continuous x-scale. Otherwise, ``false``. + labelFlushOffset + Indicates the number of pixels by which to offset flush-adjusted labels. For + example, a value of ``2`` will push flush-adjusted labels 2 pixels outward from the + center of the axis. Offsets can help the labels better visually group with + corresponding axis ticks. + + **Default value:** ``0``. + labelFont + The font of the tick label. + labelFontSize + The font size of the label, in pixels. + labelFontStyle + Font style of the title. + labelFontWeight + Font weight of axis tick labels. + labelLimit + Maximum allowed pixel width of axis tick labels. + + **Default value:** ``180`` + labelLineHeight + Line height in pixels for multi-line label text or label text with ``"line-top"`` or + ``"line-bottom"`` baseline. + labelOffset + Position offset in pixels to apply to labels, in addition to tickOffset. + + **Default value:** ``0`` + labelOpacity + The opacity of the labels. + labelOverlap + The strategy to use for resolving overlap of axis labels. If ``false`` (the + default), no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a + strategy of removing every other label is used (this works well for standard linear + axes). If set to ``"greedy"``, a linear scan of the labels is performed, removing + any labels that overlaps with the last visible label (this often works better for + log-scaled axes). + + **Default value:** ``true`` for non-nominal fields with non-log scales; ``"greedy"`` + for log scales; otherwise ``false``. + labelPadding + The padding in pixels between labels and ticks. + + **Default value:** ``2`` + labelSeparation + The minimum separation that must be between label bounding boxes for them to be + considered non-overlapping (default ``0``). This property is ignored if + *labelOverlap* resolution is not enabled. + labels + A boolean flag indicating if labels should be included as part of the axis. + + **Default value:** ``true``. + maxExtent + The maximum extent in pixels that axis ticks and labels should use. This determines + a maximum offset value for axis titles. + + **Default value:** ``undefined``. + minExtent + The minimum extent in pixels that axis ticks and labels should use. This determines + a minimum offset value for axis titles. + + **Default value:** ``30`` for y-axis; ``undefined`` for x-axis. + offset + The offset, in pixels, by which to displace the axis from the edge of the enclosing + group or data rectangle. + + **Default value:** derived from the `axis config + `__'s + ``offset`` (``0`` by default) + orient + The orientation of the axis. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. The orientation can be used to further specialize the axis type (e.g., + a y-axis oriented towards the right edge of the chart). + + **Default value:** ``"bottom"`` for x-axes and ``"left"`` for y-axes. + position + The anchor position of the axis in pixels. For x-axes with top or bottom + orientation, this sets the axis group x coordinate. For y-axes with left or right + orientation, this sets the axis group y coordinate. + + **Default value**: ``0`` + style + A string or array of strings indicating the name of custom styles to apply to the + axis. A style is a named collection of axis property defined within the `style + configuration `__. If + style is an array, later styles will override earlier styles. + + **Default value:** (none) **Note:** Any specified style will augment the default + style. For example, an x-axis mark with ``"style": "foo"`` will use ``config.axisX`` + and ``config.style.foo`` (the specified style ``"foo"`` has higher precedence). + tickBand + For band scales, indicates if ticks and grid lines should be placed at the + ``"center"`` of a band (default) or at the band ``"extent"``s to indicate intervals + tickCap + The stroke cap for the tick lines' ending style. One of ``"butt"``, ``"round"`` or + ``"square"``. + + **Default value:** ``"butt"`` + tickColor + The color of the axis's tick. + + **Default value:** ``"gray"`` + tickCount + A desired number of ticks, for axes visualizing quantitative scales. The resulting + number may be different so that values are "nice" (multiples of 2, 5, 10) and lie + within the underlying scale's range. + + For scales of type ``"time"`` or ``"utc"``, the tick count can instead be a time + interval specifier. Legal string values are ``"millisecond"``, ``"second"``, + ``"minute"``, ``"hour"``, ``"day"``, ``"week"``, ``"month"``, and ``"year"``. + Alternatively, an object-valued interval specifier of the form ``{"interval": + "month", "step": 3}`` includes a desired number of interval steps. Here, ticks are + generated for each quarter (Jan, Apr, Jul, Oct) boundary. + + **Default value**: Determine using a formula ``ceil(width/40)`` for x and + ``ceil(height/40)`` for y. + tickDash + An array of alternating [stroke, space] lengths for dashed tick mark lines. + tickDashOffset + The pixel offset at which to start drawing with the tick mark dash array. + tickExtra + Boolean flag indicating if an extra axis tick should be added for the initial + position of the axis. This flag is useful for styling axes for ``band`` scales such + that ticks are placed on band boundaries rather in the middle of a band. Use in + conjunction with ``"bandPosition": 1`` and an axis ``"padding"`` value of ``0``. + tickMinStep + The minimum desired step between axis ticks, in terms of scale domain values. For + example, a value of ``1`` indicates that ticks should not be less than 1 unit apart. + If ``tickMinStep`` is specified, the ``tickCount`` value will be adjusted, if + necessary, to enforce the minimum step value. + tickOffset + Position offset in pixels to apply to ticks, labels, and gridlines. + tickOpacity + Opacity of the ticks. + tickRound + Boolean flag indicating if pixel position values should be rounded to the nearest + integer. + + **Default value:** ``true`` + tickSize + The size in pixels of axis ticks. + + **Default value:** ``5`` + tickWidth + The width, in pixels, of ticks. + + **Default value:** ``1`` + ticks + Boolean value that determines whether the axis should include ticks. + + **Default value:** ``true`` + title + A title for the field. If ``null``, the title will be removed. + + **Default value:** derived from the field's name and transformation function + (``aggregate``, ``bin`` and ``timeUnit``). If the field has an aggregate function, + the function is displayed as part of the title (e.g., ``"Sum of Profit"``). If the + field is binned or has a time unit applied, the applied function is shown in + parentheses (e.g., ``"Profit (binned)"``, ``"Transaction Date (year-month)"``). + Otherwise, the title is simply the field name. + + **Notes**: + + 1) You can customize the default field title format by providing the `fieldTitle + `__ property in + the `config `__ or `fieldTitle + function via the compile function's options + `__. + + 2) If both field definition's ``title`` and axis, header, or legend ``title`` are + defined, axis/header/legend title will be used. + titleAlign + Horizontal text alignment of axis titles. + titleAnchor + Text anchor position for placing axis titles. + titleAngle + Angle in degrees of axis titles. + titleBaseline + Vertical text baseline for axis titles. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The + ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and + ``"bottom"``, but are calculated relative to the *lineHeight* rather than *fontSize* + alone. + titleColor + Color of the title, can be in hex color code or regular color name. + titleFont + Font of the title. (e.g., ``"Helvetica Neue"``). + titleFontSize + Font size of the title. + titleFontStyle + Font style of the title. + titleFontWeight + Font weight of the title. This can be either a string (e.g ``"bold"``, ``"normal"``) + or a number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` + and ``"bold"`` = ``700``). + titleLimit + Maximum allowed pixel width of axis titles. + titleLineHeight + Line height in pixels for multi-line title text or title text with ``"line-top"`` or + ``"line-bottom"`` baseline. + titleOpacity + Opacity of the axis title. + titlePadding + The padding, in pixels, between title and axis. + titleX + X-coordinate of the axis title relative to the axis group. + titleY + Y-coordinate of the axis title relative to the axis group. + translate + Coordinate space translation offset for axis layout. By default, axes are translated + by a 0.5 pixel offset for both the x and y coordinates in order to align stroked + lines with the pixel grid. However, for vector graphics output these pixel-specific + adjustments may be undesirable, in which case translate can be changed (for example, + to zero). + + **Default value:** ``0.5`` + values + Explicitly set the visible axis tick values. + zindex + A non-negative integer indicating the z-index of the axis. If zindex is 0, axes + should be drawn behind all chart elements. To put them in front, set ``zindex`` to + ``1`` or more. + + **Default value:** ``0`` (behind the marks). + """ aria: bool bandPosition: float @@ -242,7 +1038,399 @@ class AxisConfigKwds(TypedDict, total=False): class BarConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BarConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + binSpacing + Offset between bars for binned field. The ideal value for this is either 0 + (preferred by statisticians) or 1 (Vega-Lite default, D3 example style). + + **Default value:** ``1`` + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + continuousBandSize + The default size of the bars on continuous scales. + + **Default value:** ``5`` + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusEnd + * For vertical bars, top-left and top-right corner radius. + + * For horizontal bars, top-right and bottom-right corner radius. + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + discreteBandSize + The default size of the bars with discrete dimensions. If unspecified, the default + size is ``step-2``, which provides 2 pixel offset between bars. + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + minBandSize + The minimum band size for bar and rectangle marks. **Default value:** ``0.25`` + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -321,7 +1509,24 @@ class BarConfigKwds(TypedDict, total=False): class BindCheckboxKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BindCheckbox ``TypedDict`` wrapper. + + Parameters + ---------- + input + + debounce + If defined, delays event handling until the specified milliseconds have elapsed + since the last event was fired. + element + An optional CSS selector string indicating the parent element to which the input + element should be added. By default, all input elements are added within the parent + container of the Vega view. + name + By default, the signal name is used to label input elements. This ``name`` property + can be used instead to specify a custom label for the bound signal. + """ input: Literal["checkbox"] debounce: float @@ -330,7 +1535,25 @@ class BindCheckboxKwds(TypedDict, total=False): class BindDirectKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BindDirect ``TypedDict`` wrapper. + + Parameters + ---------- + element + An input element that exposes a *value* property and supports the `EventTarget + `__ interface, or a + CSS selector string to such an element. When the element updates and dispatches an + event, the *value* property will be used as the new, bound signal value. When the + signal updates independent of the element, the *value* property will be set to the + signal value and a new event will be dispatched on the element. + debounce + If defined, delays event handling until the specified milliseconds have elapsed + since the last event was fired. + event + The event (default ``"input"``) to listen for to track changes on the external + element. + """ element: str debounce: float @@ -338,7 +1561,32 @@ class BindDirectKwds(TypedDict, total=False): class BindInputKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BindInput ``TypedDict`` wrapper. + + Parameters + ---------- + autocomplete + A hint for form autofill. See the `HTML autocomplete attribute + `__ for + additional information. + debounce + If defined, delays event handling until the specified milliseconds have elapsed + since the last event was fired. + element + An optional CSS selector string indicating the parent element to which the input + element should be added. By default, all input elements are added within the parent + container of the Vega view. + input + The type of input element to use. The valid values are ``"checkbox"``, ``"radio"``, + ``"range"``, ``"select"``, and any other legal `HTML form input type + `__. + name + By default, the signal name is used to label input elements. This ``name`` property + can be used instead to specify a custom label for the bound signal. + placeholder + Text that appears in the form control when it has no value set. + """ autocomplete: str debounce: float @@ -349,7 +1597,29 @@ class BindInputKwds(TypedDict, total=False): class BindRadioSelectKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BindRadioSelect ``TypedDict`` wrapper. + + Parameters + ---------- + input + + options + An array of options to select from. + debounce + If defined, delays event handling until the specified milliseconds have elapsed + since the last event was fired. + element + An optional CSS selector string indicating the parent element to which the input + element should be added. By default, all input elements are added within the parent + container of the Vega view. + labels + An array of label strings to represent the ``options`` values. If unspecified, the + ``options`` value will be coerced to a string and used as the label. + name + By default, the signal name is used to label input elements. This ``name`` property + can be used instead to specify a custom label for the bound signal. + """ input: Literal["radio", "select"] options: Sequence[Any] @@ -360,7 +1630,33 @@ class BindRadioSelectKwds(TypedDict, total=False): class BindRangeKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BindRange ``TypedDict`` wrapper. + + Parameters + ---------- + input + + debounce + If defined, delays event handling until the specified milliseconds have elapsed + since the last event was fired. + element + An optional CSS selector string indicating the parent element to which the input + element should be added. By default, all input elements are added within the parent + container of the Vega view. + max + Sets the maximum slider value. Defaults to the larger of the signal value and + ``100``. + min + Sets the minimum slider value. Defaults to the smaller of the signal value and + ``0``. + name + By default, the signal name is used to label input elements. This ``name`` property + can be used instead to specify a custom label for the bound signal. + step + Sets the minimum slider increment. If undefined, the step size will be automatically + determined based on the ``min`` and ``max`` values. + """ input: Literal["range"] debounce: float @@ -372,7 +1668,35 @@ class BindRangeKwds(TypedDict, total=False): class BoxPlotConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BoxPlotConfig ``TypedDict`` wrapper. + + Parameters + ---------- + box + + extent + The extent of the whiskers. Available options include: + + * ``"min-max"``: min and max are the lower and upper whiskers respectively. + * A number representing multiple of the interquartile range. This number will be + multiplied by the IQR to determine whisker boundary, which spans from the smallest + data to the largest data within the range *[Q1 - k * IQR, Q3 + k * IQR]* where + *Q1* and *Q3* are the first and third quartiles while *IQR* is the interquartile + range (*Q3-Q1*). + + **Default value:** ``1.5``. + median + + outliers + + rule + + size + Size of the box and median tick of a box plot + ticks + + """ box: ( bool @@ -424,7 +1748,36 @@ class BoxPlotConfigKwds(TypedDict, total=False): class BrushConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + BrushConfig ``TypedDict`` wrapper. + + Parameters + ---------- + cursor + The mouse cursor used over the interval mark. Any valid `CSS cursor type + `__ can be used. + fill + The fill color of the interval mark. + + **Default value:** ``"#333333"`` + fillOpacity + The fill opacity of the interval mark (a value between ``0`` and ``1``). + + **Default value:** ``0.125`` + stroke + The stroke color of the interval mark. + + **Default value:** ``"#ffffff"`` + strokeDash + An array of alternating stroke and space lengths, for creating dashed or dotted + lines. + strokeDashOffset + The offset (in pixels) with which to begin drawing the stroke dash array. + strokeOpacity + The stroke opacity of the interval mark (a value between ``0`` and ``1``). + strokeWidth + The stroke width of the interval mark. + """ cursor: Cursor_T fill: ColorHex | ColorName_T @@ -437,14 +1790,73 @@ class BrushConfigKwds(TypedDict, total=False): class CompositionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + CompositionConfig ``TypedDict`` wrapper. + + Parameters + ---------- + columns + The number of columns to include in the view composition layout. + + **Default value**: ``undefined`` -- An infinite number of columns (a single row) + will be assumed. This is equivalent to ``hconcat`` (for ``concat``) and to using the + ``column`` channel (for ``facet`` and ``repeat``). + + **Note**: + + 1) This property is only for: + + * the general (wrappable) ``concat`` operator (not ``hconcat``/``vconcat``) + * the ``facet`` and ``repeat`` operator with one field/repetition definition + (without row/column nesting) + + 2) Setting the ``columns`` to ``1`` is equivalent to ``vconcat`` (for ``concat``) + and to using the ``row`` channel (for ``facet`` and ``repeat``). + spacing + The default spacing in pixels between composed sub-views. + + **Default value**: ``20`` + """ columns: float spacing: float class DateTimeKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + DateTime ``TypedDict`` wrapper. + + Parameters + ---------- + date + Integer value representing the date (day of the month) from 1-31. + day + Value representing the day of a week. This can be one of: (1) integer value -- ``1`` + represents Monday; (2) case-insensitive day name (e.g., ``"Monday"``); (3) + case-insensitive, 3-character short day name (e.g., ``"Mon"``). + + **Warning:** A DateTime definition object with ``day``** should not be combined with + ``year``, ``quarter``, ``month``, or ``date``. + hours + Integer value representing the hour of a day from 0-23. + milliseconds + Integer value representing the millisecond segment of time. + minutes + Integer value representing the minute segment of time from 0-59. + month + One of: (1) integer value representing the month from ``1``-``12``. ``1`` represents + January; (2) case-insensitive month name (e.g., ``"January"``); (3) + case-insensitive, 3-character short month name (e.g., ``"Jan"``). + quarter + Integer value representing the quarter of the year (from 1-4). + seconds + Integer value representing the second segment (0-59) of a time value + utc + A boolean flag indicating if date time is in utc time. If false, the date time is in + local time + year + Integer value representing the year. + """ date: float day: str | float @@ -459,7 +1871,28 @@ class DateTimeKwds(TypedDict, total=False): class DerivedStreamKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + DerivedStream ``TypedDict`` wrapper. + + Parameters + ---------- + stream + + between + + consume + + debounce + + filter + + markname + + marktype + + throttle + + """ stream: MergedStreamKwds | DerivedStreamKwds between: Sequence[MergedStreamKwds | DerivedStreamKwds] @@ -472,7 +1905,51 @@ class DerivedStreamKwds(TypedDict, total=False): class ErrorBandConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ErrorBandConfig ``TypedDict`` wrapper. + + Parameters + ---------- + band + + borders + + extent + The extent of the band. Available options include: + + * ``"ci"``: Extend the band to the confidence interval of the mean. + * ``"stderr"``: The size of band are set to the value of standard error, extending + from the mean. + * ``"stdev"``: The size of band are set to the value of standard deviation, + extending from the mean. + * ``"iqr"``: Extend the band to the q1 and q3. + + **Default value:** ``"stderr"``. + interpolate + The line interpolation method for the error band. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: a piecewise constant function (a step function) consisting of + alternating horizontal and vertical lines. The y-value changes at the midpoint of + each pair of adjacent x-values. + * ``"step-before"``: a piecewise constant function (a step function) consisting of + alternating horizontal and vertical lines. The y-value changes before the x-value. + * ``"step-after"``: a piecewise constant function (a step function) consisting of + alternating horizontal and vertical lines. The y-value changes after the x-value. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + tension + The tension parameter for the interpolation type of the error band. + """ band: ( bool @@ -498,7 +1975,31 @@ class ErrorBandConfigKwds(TypedDict, total=False): class ErrorBarConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ErrorBarConfig ``TypedDict`` wrapper. + + Parameters + ---------- + extent + The extent of the rule. Available options include: + + * ``"ci"``: Extend the rule to the confidence interval of the mean. + * ``"stderr"``: The size of rule are set to the value of standard error, extending + from the mean. + * ``"stdev"``: The size of rule are set to the value of standard deviation, + extending from the mean. + * ``"iqr"``: Extend the rule to the q1 and q3. + + **Default value:** ``"stderr"``. + rule + + size + Size of the ticks of an error bar + thickness + Thickness of the ticks and the bar of an error bar + ticks + + """ extent: ErrorBarExtent_T rule: ( @@ -524,7 +2025,24 @@ class ErrorBarConfigKwds(TypedDict, total=False): class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + FeatureGeometryGeoJsonProperties ``TypedDict`` wrapper. + + Parameters + ---------- + geometry + The feature's geometry + properties + Properties associated with this feature. + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + id + A value that uniquely identifies this feature in a + https://tools.ietf.org/html/rfc7946#section-3.2. + """ geometry: ( PointKwds @@ -542,7 +2060,65 @@ class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): class FormatConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + FormatConfig ``TypedDict`` wrapper. + + Parameters + ---------- + normalizedNumberFormat + If normalizedNumberFormatType is not specified, D3 number format for axis labels, + text marks, and tooltips of normalized stacked fields (fields with ``stack: + "normalize"``). For example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.normalizedNumberFormatType`` is specified and + ``config.customFormatTypes`` is ``true``, this value will be passed as ``format`` + alongside ``datum.value`` to the ``config.numberFormatType`` function. **Default + value:** ``%`` + normalizedNumberFormatType + `Custom format type + `__ for + ``config.normalizedNumberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + numberFormat + If numberFormatType is not specified, D3 number format for guide labels, text marks, + and tooltips of non-normalized fields (fields *without* ``stack: "normalize"``). For + example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.numberFormatType`` is specified and ``config.customFormatTypes`` is + ``true``, this value will be passed as ``format`` alongside ``datum.value`` to the + ``config.numberFormatType`` function. + numberFormatType + `Custom format type + `__ for + ``config.numberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + timeFormat + Default time format for raw time values (without time units) in text marks, legend + labels and header labels. + + **Default value:** ``"%b %d, %Y"`` **Note:** Axes automatically determine the format + for each label automatically so this config does not affect axes. + timeFormatType + `Custom format type + `__ for + ``config.timeFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-time-format, + which is exposed as `timeFormat in Vega-Expression + `__. **Note:** You must + also set ``customFormatTypes`` to ``true`` and there must *not* be a ``timeUnit`` + defined to use this feature. + """ normalizedNumberFormat: str normalizedNumberFormatType: str @@ -553,7 +2129,24 @@ class FormatConfigKwds(TypedDict, total=False): class GeoJsonFeatureKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + GeoJsonFeature ``TypedDict`` wrapper. + + Parameters + ---------- + geometry + The feature's geometry + properties + Properties associated with this feature. + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + id + A value that uniquely identifies this feature in a + https://tools.ietf.org/html/rfc7946#section-3.2. + """ geometry: ( PointKwds @@ -571,7 +2164,19 @@ class GeoJsonFeatureKwds(TypedDict, total=False): class GeoJsonFeatureCollectionKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + GeoJsonFeatureCollection ``TypedDict`` wrapper. + + Parameters + ---------- + features + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ features: Sequence[FeatureGeometryGeoJsonPropertiesKwds] type: Literal["FeatureCollection"] @@ -579,7 +2184,19 @@ class GeoJsonFeatureCollectionKwds(TypedDict, total=False): class GeometryCollectionKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + GeometryCollection ``TypedDict`` wrapper. + + Parameters + ---------- + geometries + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ geometries: Sequence[ PointKwds @@ -595,14 +2212,161 @@ class GeometryCollectionKwds(TypedDict, total=False): class GradientStopKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + GradientStop ``TypedDict`` wrapper. + + Parameters + ---------- + color + The color value at this point in the gradient. + offset + The offset fraction for the color stop, indicating its position within the gradient. + """ color: ColorHex | ColorName_T offset: float class HeaderConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + HeaderConfig ``TypedDict`` wrapper. + + Parameters + ---------- + format + When used with the default ``"number"`` and ``"time"`` format type, the text + formatting pattern for labels of guides (axes, legends, headers) and text marks. + + * If the format type is ``"number"`` (e.g., for quantitative fields), this is D3's + `number format pattern `__. + * If the format type is ``"time"`` (e.g., for temporal fields), this is D3's `time + format pattern `__. + + See the `format documentation `__ + for more examples. + + When used with a `custom formatType + `__, this + value will be passed as ``format`` alongside ``datum.value`` to the registered + function. + + **Default value:** Derived from `numberFormat + `__ config for number + format and from `timeFormat + `__ config for time + format. + formatType + The format type for labels. One of ``"number"``, ``"time"``, or a `registered custom + format type + `__. + + **Default value:** + + * ``"time"`` for temporal fields and ordinal and nominal fields with ``timeUnit``. + * ``"number"`` for quantitative fields as well as ordinal and nominal fields without + ``timeUnit``. + labelAlign + Horizontal text alignment of header labels. One of ``"left"``, ``"center"``, or + ``"right"``. + labelAnchor + The anchor position for placing the labels. One of ``"start"``, ``"middle"``, or + ``"end"``. For example, with a label orientation of top these anchor positions map + to a left-, center-, or right-aligned label. + labelAngle + The rotation angle of the header labels. + + **Default value:** ``0`` for column header, ``-90`` for row header. + labelBaseline + The vertical text baseline for the header labels. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The + ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and + ``"bottom"``, but are calculated relative to the ``titleLineHeight`` rather than + ``titleFontSize`` alone. + labelColor + The color of the header label, can be in hex color code or regular color name. + labelExpr + `Vega expression `__ for customizing + labels. + + **Note:** The label text and value can be assessed via the ``label`` and ``value`` + properties of the header's backing ``datum`` object. + labelFont + The font of the header label. + labelFontSize + The font size of the header label, in pixels. + labelFontStyle + The font style of the header label. + labelFontWeight + The font weight of the header label. + labelLimit + The maximum length of the header label in pixels. The text value will be + automatically truncated if the rendered size exceeds the limit. + + **Default value:** ``0``, indicating no limit + labelLineHeight + Line height in pixels for multi-line header labels or title text with ``"line-top"`` + or ``"line-bottom"`` baseline. + labelOrient + The orientation of the header label. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + labelPadding + The padding, in pixel, between facet header's label and the plot. + + **Default value:** ``10`` + labels + A boolean flag indicating if labels should be included as part of the header. + + **Default value:** ``true``. + orient + Shortcut for setting both labelOrient and titleOrient. + title + Set to null to disable title for the axis, legend, or header. + titleAlign + Horizontal text alignment (to the anchor) of header titles. + titleAnchor + The anchor position for placing the title. One of ``"start"``, ``"middle"``, or + ``"end"``. For example, with an orientation of top these anchor positions map to a + left-, center-, or right-aligned title. + titleAngle + The rotation angle of the header title. + + **Default value:** ``0``. + titleBaseline + The vertical text baseline for the header title. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The + ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and + ``"bottom"``, but are calculated relative to the ``titleLineHeight`` rather than + ``titleFontSize`` alone. + + **Default value:** ``"middle"`` + titleColor + Color of the header title, can be in hex color code or regular color name. + titleFont + Font of the header title. (e.g., ``"Helvetica Neue"``). + titleFontSize + Font size of the header title. + titleFontStyle + The font style of the header title. + titleFontWeight + Font weight of the header title. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + titleLimit + The maximum length of the header title in pixels. The text value will be + automatically truncated if the rendered size exceeds the limit. + + **Default value:** ``0``, indicating no limit + titleLineHeight + Line height in pixels for multi-line header title text or title text with + ``"line-top"`` or ``"line-bottom"`` baseline. + titleOrient + The orientation of the header title. One of ``"top"``, ``"bottom"``, ``"left"`` or + ``"right"``. + titlePadding + The padding, in pixel, between facet header's title and the label. + + **Default value:** ``10`` + """ format: str formatType: str @@ -639,7 +2403,103 @@ class HeaderConfigKwds(TypedDict, total=False): class IntervalSelectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + IntervalSelectionConfig ``TypedDict`` wrapper. + + Parameters + ---------- + type + Determines the default event processing and data query for the selection. Vega-Lite + currently supports two selection types: + + * ``"point"`` -- to select multiple discrete data values; the first value is + selected on ``click`` and additional values toggled on shift-click. + * ``"interval"`` -- to select a continuous range of data values on ``drag``. + clear + Clears the selection, emptying it of all values. This property can be a `Event + Stream `__ or ``false`` to disable + clear. + + **Default value:** ``dblclick``. + + **See also:** `clear examples + `__ in the + documentation. + encodings + An array of encoding channels. The corresponding data field values must match for a + data tuple to fall within the selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + fields + An array of field names whose values must match for a data tuple to fall within the + selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + mark + An interval selection also adds a rectangle mark to depict the extents of the + interval. The ``mark`` property can be used to customize the appearance of the mark. + + **See also:** `mark examples + `__ in the documentation. + on + A `Vega event stream `__ (object or + selector) that triggers the selection. For interval selections, the event stream + must specify a `start and end + `__. + + **See also:** `on examples + `__ in the documentation. + resolve + With layered and multi-view displays, a strategy that determines how selections' + data queries are resolved when applied in a filter transform, conditional encoding + rule, or scale domain. + + One of: + + * ``"global"`` -- only one brush exists for the entire SPLOM. When the user begins + to drag, any previous brushes are cleared, and a new one is constructed. + * ``"union"`` -- each cell contains its own brush, and points are highlighted if + they lie within *any* of these individual brushes. + * ``"intersect"`` -- each cell contains its own brush, and points are highlighted + only if they fall within *all* of these individual brushes. + + **Default value:** ``global``. + + **See also:** `resolve examples + `__ in the + documentation. + translate + When truthy, allows a user to interactively move an interval selection + back-and-forth. Can be ``true``, ``false`` (to disable panning), or a `Vega event + stream definition `__ which must + include a start and end event to trigger continuous panning. Discrete panning (e.g., + pressing the left/right arrow keys) will be supported in future versions. + + **Default value:** ``true``, which corresponds to ``[pointerdown, window:pointerup] + > window:pointermove!``. This default allows users to clicks and drags within an + interval selection to reposition it. + + **See also:** `translate examples + `__ in the + documentation. + zoom + When truthy, allows a user to interactively resize an interval selection. Can be + ``true``, ``false`` (to disable zooming), or a `Vega event stream definition + `__. Currently, only ``wheel`` + events are supported, but custom event streams can still be used to specify filters, + debouncing, and throttling. Future versions will expand the set of events that can + trigger this transformation. + + **Default value:** ``true``, which corresponds to ``wheel!``. This default allows + users to use the mouse wheel to resize an interval selection. + + **See also:** `zoom examples + `__ in the documentation. + """ type: Literal["interval"] clear: str | bool | MergedStreamKwds | DerivedStreamKwds @@ -653,7 +2513,96 @@ class IntervalSelectionConfigKwds(TypedDict, total=False): class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + IntervalSelectionConfigWithoutType ``TypedDict`` wrapper. + + Parameters + ---------- + clear + Clears the selection, emptying it of all values. This property can be a `Event + Stream `__ or ``false`` to disable + clear. + + **Default value:** ``dblclick``. + + **See also:** `clear examples + `__ in the + documentation. + encodings + An array of encoding channels. The corresponding data field values must match for a + data tuple to fall within the selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + fields + An array of field names whose values must match for a data tuple to fall within the + selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + mark + An interval selection also adds a rectangle mark to depict the extents of the + interval. The ``mark`` property can be used to customize the appearance of the mark. + + **See also:** `mark examples + `__ in the documentation. + on + A `Vega event stream `__ (object or + selector) that triggers the selection. For interval selections, the event stream + must specify a `start and end + `__. + + **See also:** `on examples + `__ in the documentation. + resolve + With layered and multi-view displays, a strategy that determines how selections' + data queries are resolved when applied in a filter transform, conditional encoding + rule, or scale domain. + + One of: + + * ``"global"`` -- only one brush exists for the entire SPLOM. When the user begins + to drag, any previous brushes are cleared, and a new one is constructed. + * ``"union"`` -- each cell contains its own brush, and points are highlighted if + they lie within *any* of these individual brushes. + * ``"intersect"`` -- each cell contains its own brush, and points are highlighted + only if they fall within *all* of these individual brushes. + + **Default value:** ``global``. + + **See also:** `resolve examples + `__ in the + documentation. + translate + When truthy, allows a user to interactively move an interval selection + back-and-forth. Can be ``true``, ``false`` (to disable panning), or a `Vega event + stream definition `__ which must + include a start and end event to trigger continuous panning. Discrete panning (e.g., + pressing the left/right arrow keys) will be supported in future versions. + + **Default value:** ``true``, which corresponds to ``[pointerdown, window:pointerup] + > window:pointermove!``. This default allows users to clicks and drags within an + interval selection to reposition it. + + **See also:** `translate examples + `__ in the + documentation. + zoom + When truthy, allows a user to interactively resize an interval selection. Can be + ``true``, ``false`` (to disable zooming), or a `Vega event stream definition + `__. Currently, only ``wheel`` + events are supported, but custom event streams can still be used to specify filters, + debouncing, and throttling. Future versions will expand the set of events that can + trigger this transformation. + + **Default value:** ``true``, which corresponds to ``wheel!``. This default allows + users to use the mouse wheel to resize an interval selection. + + **See also:** `zoom examples + `__ in the documentation. + """ clear: str | bool | MergedStreamKwds | DerivedStreamKwds encodings: Sequence[SingleDefUnitChannel_T] @@ -666,7 +2615,282 @@ class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): class LegendConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + LegendConfig ``TypedDict`` wrapper. + + Parameters + ---------- + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG group, removing the legend from the ARIA accessibility tree. + + **Default value:** ``true`` + clipHeight + The height in pixels to clip symbol legend entries and limit their size. + columnPadding + The horizontal padding in pixels between symbol legend entries. + + **Default value:** ``10``. + columns + The number of columns in which to arrange symbol legend entries. A value of ``0`` or + lower indicates a single row with one column per entry. + cornerRadius + Corner radius for the full legend. + description + A text description of this legend for `ARIA accessibility + `__ (SVG output + only). If the ``aria`` property is true, for SVG output the `"aria-label" attribute + `__ + will be set to this description. If the description is unspecified it will be + automatically generated. + direction + The direction of the legend, one of ``"vertical"`` or ``"horizontal"``. + + **Default value:** + + * For top-/bottom-``orient``ed legends, ``"horizontal"`` + * For left-/right-``orient``ed legends, ``"vertical"`` + * For top/bottom-left/right-``orient``ed legends, ``"horizontal"`` for gradient + legends and ``"vertical"`` for symbol legends. + disable + Disable legend by default + fillColor + Background fill color for the full legend. + gradientDirection + The default direction (``"horizontal"`` or ``"vertical"``) for gradient legends. + + **Default value:** ``"vertical"``. + gradientHorizontalMaxLength + Max legend length for a horizontal gradient when ``config.legend.gradientLength`` is + undefined. + + **Default value:** ``200`` + gradientHorizontalMinLength + Min legend length for a horizontal gradient when ``config.legend.gradientLength`` is + undefined. + + **Default value:** ``100`` + gradientLabelLimit + The maximum allowed length in pixels of color ramp gradient labels. + gradientLabelOffset + Vertical offset in pixels for color ramp gradient labels. + + **Default value:** ``2``. + gradientLength + The length in pixels of the primary axis of a color gradient. This value corresponds + to the height of a vertical gradient or the width of a horizontal gradient. + + **Default value:** ``200``. + gradientOpacity + Opacity of the color gradient. + gradientStrokeColor + The color of the gradient stroke, can be in hex color code or regular color name. + + **Default value:** ``"lightGray"``. + gradientStrokeWidth + The width of the gradient stroke, in pixels. + + **Default value:** ``0``. + gradientThickness + The thickness in pixels of the color gradient. This value corresponds to the width + of a vertical gradient or the height of a horizontal gradient. + + **Default value:** ``16``. + gradientVerticalMaxLength + Max legend length for a vertical gradient when ``config.legend.gradientLength`` is + undefined. + + **Default value:** ``200`` + gradientVerticalMinLength + Min legend length for a vertical gradient when ``config.legend.gradientLength`` is + undefined. + + **Default value:** ``100`` + gridAlign + The alignment to apply to symbol legends rows and columns. The supported string + values are ``"all"``, ``"each"`` (the default), and ``none``. For more information, + see the `grid layout documentation `__. + + **Default value:** ``"each"``. + labelAlign + The alignment of the legend label, can be left, center, or right. + labelBaseline + The position of the baseline of legend label, can be ``"top"``, ``"middle"``, + ``"bottom"``, or ``"alphabetic"``. + + **Default value:** ``"middle"``. + labelColor + The color of the legend label, can be in hex color code or regular color name. + labelFont + The font of the legend label. + labelFontSize + The font size of legend label. + + **Default value:** ``10``. + labelFontStyle + The font style of legend label. + labelFontWeight + The font weight of legend label. + labelLimit + Maximum allowed pixel width of legend tick labels. + + **Default value:** ``160``. + labelOffset + The offset of the legend label. + + **Default value:** ``4``. + labelOpacity + Opacity of labels. + labelOverlap + The strategy to use for resolving overlap of labels in gradient legends. If + ``false``, no overlap reduction is attempted. If set to ``true`` or ``"parity"``, a + strategy of removing every other label is used. If set to ``"greedy"``, a linear + scan of the labels is performed, removing any label that overlaps with the last + visible label (this often works better for log-scaled axes). + + **Default value:** ``"greedy"`` for ``log scales otherwise ``true`. + labelPadding + Padding in pixels between the legend and legend labels. + labelSeparation + The minimum separation that must be between label bounding boxes for them to be + considered non-overlapping (default ``0``). This property is ignored if + *labelOverlap* resolution is not enabled. + layout + + legendX + Custom x-position for legend with orient "none". + legendY + Custom y-position for legend with orient "none". + offset + The offset in pixels by which to displace the legend from the data rectangle and + axes. + + **Default value:** ``18``. + orient + The orientation of the legend, which determines how the legend is positioned within + the scene. One of ``"left"``, ``"right"``, ``"top"``, ``"bottom"``, ``"top-left"``, + ``"top-right"``, ``"bottom-left"``, ``"bottom-right"``, ``"none"``. + + **Default value:** ``"right"`` + padding + The padding between the border and content of the legend group. + + **Default value:** ``0``. + rowPadding + The vertical padding in pixels between symbol legend entries. + + **Default value:** ``2``. + strokeColor + Border stroke color for the full legend. + strokeDash + Border stroke dash pattern for the full legend. + strokeWidth + Border stroke width for the full legend. + symbolBaseFillColor + Default fill color for legend symbols. Only applied if there is no ``"fill"`` scale + color encoding for the legend. + + **Default value:** ``"transparent"``. + symbolBaseStrokeColor + Default stroke color for legend symbols. Only applied if there is no ``"fill"`` + scale color encoding for the legend. + + **Default value:** ``"gray"``. + symbolDash + An array of alternating [stroke, space] lengths for dashed symbol strokes. + symbolDashOffset + The pixel offset at which to start drawing with the symbol stroke dash array. + symbolDirection + The default direction (``"horizontal"`` or ``"vertical"``) for symbol legends. + + **Default value:** ``"vertical"``. + symbolFillColor + The color of the legend symbol, + symbolLimit + The maximum number of allowed entries for a symbol legend. Additional entries will + be dropped. + symbolOffset + Horizontal pixel offset for legend symbols. + + **Default value:** ``0``. + symbolOpacity + Opacity of the legend symbols. + symbolSize + The size of the legend symbol, in pixels. + + **Default value:** ``100``. + symbolStrokeColor + Stroke color for legend symbols. + symbolStrokeWidth + The width of the symbol's stroke. + + **Default value:** ``1.5``. + symbolType + The symbol shape. One of the plotting shapes ``circle`` (default), ``square``, + ``cross``, ``diamond``, ``triangle-up``, ``triangle-down``, ``triangle-right``, or + ``triangle-left``, the line symbol ``stroke``, or one of the centered directional + shapes ``arrow``, ``wedge``, or ``triangle``. Alternatively, a custom `SVG path + string `__ can be + provided. For correct sizing, custom shape paths should be defined within a square + bounding box with coordinates ranging from -1 to 1 along both the x and y + dimensions. + + **Default value:** ``"circle"``. + tickCount + The desired number of tick values for quantitative legends. + title + Set to null to disable title for the axis, legend, or header. + titleAlign + Horizontal text alignment for legend titles. + + **Default value:** ``"left"``. + titleAnchor + Text anchor position for placing legend titles. + titleBaseline + Vertical text baseline for legend titles. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or ``"line-bottom"``. The + ``"line-top"`` and ``"line-bottom"`` values operate similarly to ``"top"`` and + ``"bottom"``, but are calculated relative to the *lineHeight* rather than *fontSize* + alone. + + **Default value:** ``"top"``. + titleColor + The color of the legend title, can be in hex color code or regular color name. + titleFont + The font of the legend title. + titleFontSize + The font size of the legend title. + titleFontStyle + The font style of the legend title. + titleFontWeight + The font weight of the legend title. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + titleLimit + Maximum allowed pixel width of legend titles. + + **Default value:** ``180``. + titleLineHeight + Line height in pixels for multi-line title text or title text with ``"line-top"`` or + ``"line-bottom"`` baseline. + titleOpacity + Opacity of the legend title. + titleOrient + Orientation of the legend title. + titlePadding + The padding, in pixels, between title and legend. + + **Default value:** ``5``. + unselectedOpacity + The opacity of unselected legend entries. + + **Default value:** 0.35. + zindex + The integer z-index indicating the layering of the legend group relative to other + axis, mark, and legend groups. + """ aria: bool clipHeight: float @@ -746,13 +2970,408 @@ class LegendConfigKwds(TypedDict, total=False): class LegendStreamBindingKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + LegendStreamBinding ``TypedDict`` wrapper. + + Parameters + ---------- + legend + + """ legend: str | MergedStreamKwds | DerivedStreamKwds class LineConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + LineConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + point + A flag for overlaying points on top of line or area marks, or an object defining the + properties of the overlayed points. + + * If this property is ``"transparent"``, transparent points will be used (for + enhancing tooltips and selections). + + * If this property is an empty object (``{}``) or ``true``, filled points with + default properties will be used. + + * If this property is ``false``, no points would be automatically added to line or + area marks. + + **Default value:** ``false``. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -827,7 +3446,19 @@ class LineConfigKwds(TypedDict, total=False): class LineStringKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + LineString ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[Sequence[float]] type: Literal["LineString"] @@ -835,7 +3466,34 @@ class LineStringKwds(TypedDict, total=False): class LinearGradientKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + LinearGradient ``TypedDict`` wrapper. + + Parameters + ---------- + gradient + The type of gradient. Use ``"linear"`` for a linear gradient. + stops + An array of gradient stops defining the gradient color sequence. + id + + x1 + The starting x-coordinate, in normalized [0, 1] coordinates, of the linear gradient. + + **Default value:** ``0`` + x2 + The ending x-coordinate, in normalized [0, 1] coordinates, of the linear gradient. + + **Default value:** ``1`` + y1 + The starting y-coordinate, in normalized [0, 1] coordinates, of the linear gradient. + + **Default value:** ``0`` + y2 + The ending y-coordinate, in normalized [0, 1] coordinates, of the linear gradient. + + **Default value:** ``0`` + """ gradient: Literal["linear"] stops: Sequence[GradientStopKwds] @@ -847,14 +3505,397 @@ class LinearGradientKwds(TypedDict, total=False): class LocaleKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + Locale ``TypedDict`` wrapper. + + Parameters + ---------- + number + Locale definition for formatting numbers. + time + Locale definition for formatting dates and times. + """ number: NumberLocaleKwds time: TimeLocaleKwds class MarkConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + MarkConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -928,7 +3969,28 @@ class MarkConfigKwds(TypedDict, total=False): class MergedStreamKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + MergedStream ``TypedDict`` wrapper. + + Parameters + ---------- + merge + + between + + consume + + debounce + + filter + + markname + + marktype + + throttle + + """ merge: Sequence[MergedStreamKwds | DerivedStreamKwds] between: Sequence[MergedStreamKwds | DerivedStreamKwds] @@ -941,7 +4003,19 @@ class MergedStreamKwds(TypedDict, total=False): class MultiLineStringKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + MultiLineString ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[Sequence[Sequence[float]]] type: Literal["MultiLineString"] @@ -949,7 +4023,19 @@ class MultiLineStringKwds(TypedDict, total=False): class MultiPointKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + MultiPoint ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[Sequence[float]] type: Literal["MultiPoint"] @@ -957,7 +4043,19 @@ class MultiPointKwds(TypedDict, total=False): class MultiPolygonKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + MultiPolygon ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[Sequence[Sequence[Sequence[float]]]] type: Literal["MultiPolygon"] @@ -965,7 +4063,28 @@ class MultiPolygonKwds(TypedDict, total=False): class NumberLocaleKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + NumberLocale ``TypedDict`` wrapper. + + Parameters + ---------- + currency + The currency prefix and suffix (e.g., ["$", ""]). + decimal + The decimal point (e.g., "."). + grouping + The array of group sizes (e.g., [3]), cycled as needed. + thousands + The group separator (e.g., ","). + minus + The minus sign (defaults to hyphen-minus, "-"). + nan + The not-a-number value (defaults to "NaN"). + numerals + An array of ten strings to replace the numerals 0-9. + percent + The percent sign (defaults to "%"). + """ currency: Sequence[str] decimal: str @@ -978,7 +4097,413 @@ class NumberLocaleKwds(TypedDict, total=False): class OverlayMarkDefKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + OverlayMarkDef ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + clip + Whether a mark be clipped to the enclosing group's width and height. + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + radius2Offset + Offset for radius2. + radiusOffset + Offset for radius. + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + style + A string or array of strings indicating the name of custom styles to apply to the + mark. A style is a named collection of mark property defaults defined within the + `style configuration + `__. If style is an + array, later styles will override earlier styles. Any `mark properties + `__ explicitly + defined within the ``encoding`` will override a style default. + + **Default value:** The mark's name. For example, a bar mark will have style + ``"bar"`` by default. **Note:** Any specified style will augment the default style. + For example, a bar mark with ``"style": "foo"`` will receive from + ``config.style.bar`` and ``config.style.foo`` (the specified style ``"foo"`` has + higher precedence). + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + theta2Offset + Offset for theta2. + thetaOffset + Offset for theta. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2Offset + Offset for x2-position. + xOffset + Offset for x-position. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2Offset + Offset for y2-position. + yOffset + Offset for y-position. + """ align: Align_T angle: float @@ -1062,7 +4587,23 @@ class OverlayMarkDefKwds(TypedDict, total=False): class PointKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + Point ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + A Position is an array of coordinates. + https://tools.ietf.org/html/rfc7946#section-3.1.1 Array should contain between two + and three elements. The previous GeoJSON specification allowed more elements (e.g., + which could be used to represent M values), but the current specification only + allows X, Y, and (optionally) Z to be defined. + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[float] type: Literal["Point"] @@ -1070,7 +4611,102 @@ class PointKwds(TypedDict, total=False): class PointSelectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + PointSelectionConfig ``TypedDict`` wrapper. + + Parameters + ---------- + type + Determines the default event processing and data query for the selection. Vega-Lite + currently supports two selection types: + + * ``"point"`` -- to select multiple discrete data values; the first value is + selected on ``click`` and additional values toggled on shift-click. + * ``"interval"`` -- to select a continuous range of data values on ``drag``. + clear + Clears the selection, emptying it of all values. This property can be a `Event + Stream `__ or ``false`` to disable + clear. + + **Default value:** ``dblclick``. + + **See also:** `clear examples + `__ in the + documentation. + encodings + An array of encoding channels. The corresponding data field values must match for a + data tuple to fall within the selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + fields + An array of field names whose values must match for a data tuple to fall within the + selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + nearest + When true, an invisible voronoi diagram is computed to accelerate discrete + selection. The data value *nearest* the mouse cursor is added to the selection. + + **Default value:** ``false``, which means that data values must be interacted with + directly (e.g., clicked on) to be added to the selection. + + **See also:** `nearest examples + `__ documentation. + on + A `Vega event stream `__ (object or + selector) that triggers the selection. For interval selections, the event stream + must specify a `start and end + `__. + + **See also:** `on examples + `__ in the documentation. + resolve + With layered and multi-view displays, a strategy that determines how selections' + data queries are resolved when applied in a filter transform, conditional encoding + rule, or scale domain. + + One of: + + * ``"global"`` -- only one brush exists for the entire SPLOM. When the user begins + to drag, any previous brushes are cleared, and a new one is constructed. + * ``"union"`` -- each cell contains its own brush, and points are highlighted if + they lie within *any* of these individual brushes. + * ``"intersect"`` -- each cell contains its own brush, and points are highlighted + only if they fall within *all* of these individual brushes. + + **Default value:** ``global``. + + **See also:** `resolve examples + `__ in the + documentation. + toggle + Controls whether data values should be toggled (inserted or removed from a point + selection) or only ever inserted into point selections. + + One of: + + * ``true`` -- the default behavior, which corresponds to ``"event.shiftKey"``. As a + result, data values are toggled when the user interacts with the shift-key + pressed. + * ``false`` -- disables toggling behaviour; the selection will only ever contain a + single data value corresponding to the most recent interaction. + * A `Vega expression `__ which is + re-evaluated as the user interacts. If the expression evaluates to ``true``, the + data value is toggled into or out of the point selection. If the expression + evaluates to ``false``, the point selection is first cleared, and the data value + is then inserted. For example, setting the value to the Vega expression ``"true"`` + will toggle data values without the user pressing the shift-key. + + **Default value:** ``true`` + + **See also:** `toggle examples + `__ in the + documentation. + """ type: Literal["point"] clear: str | bool | MergedStreamKwds | DerivedStreamKwds @@ -1083,7 +4719,95 @@ class PointSelectionConfigKwds(TypedDict, total=False): class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + PointSelectionConfigWithoutType ``TypedDict`` wrapper. + + Parameters + ---------- + clear + Clears the selection, emptying it of all values. This property can be a `Event + Stream `__ or ``false`` to disable + clear. + + **Default value:** ``dblclick``. + + **See also:** `clear examples + `__ in the + documentation. + encodings + An array of encoding channels. The corresponding data field values must match for a + data tuple to fall within the selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + fields + An array of field names whose values must match for a data tuple to fall within the + selection. + + **See also:** The `projection with encodings and fields section + `__ in the + documentation. + nearest + When true, an invisible voronoi diagram is computed to accelerate discrete + selection. The data value *nearest* the mouse cursor is added to the selection. + + **Default value:** ``false``, which means that data values must be interacted with + directly (e.g., clicked on) to be added to the selection. + + **See also:** `nearest examples + `__ documentation. + on + A `Vega event stream `__ (object or + selector) that triggers the selection. For interval selections, the event stream + must specify a `start and end + `__. + + **See also:** `on examples + `__ in the documentation. + resolve + With layered and multi-view displays, a strategy that determines how selections' + data queries are resolved when applied in a filter transform, conditional encoding + rule, or scale domain. + + One of: + + * ``"global"`` -- only one brush exists for the entire SPLOM. When the user begins + to drag, any previous brushes are cleared, and a new one is constructed. + * ``"union"`` -- each cell contains its own brush, and points are highlighted if + they lie within *any* of these individual brushes. + * ``"intersect"`` -- each cell contains its own brush, and points are highlighted + only if they fall within *all* of these individual brushes. + + **Default value:** ``global``. + + **See also:** `resolve examples + `__ in the + documentation. + toggle + Controls whether data values should be toggled (inserted or removed from a point + selection) or only ever inserted into point selections. + + One of: + + * ``true`` -- the default behavior, which corresponds to ``"event.shiftKey"``. As a + result, data values are toggled when the user interacts with the shift-key + pressed. + * ``false`` -- disables toggling behaviour; the selection will only ever contain a + single data value corresponding to the most recent interaction. + * A `Vega expression `__ which is + re-evaluated as the user interacts. If the expression evaluates to ``true``, the + data value is toggled into or out of the point selection. If the expression + evaluates to ``false``, the point selection is first cleared, and the data value + is then inserted. For example, setting the value to the Vega expression ``"true"`` + will toggle data values without the user pressing the shift-key. + + **Default value:** ``true`` + + **See also:** `toggle examples + `__ in the + documentation. + """ clear: str | bool | MergedStreamKwds | DerivedStreamKwds encodings: Sequence[SingleDefUnitChannel_T] @@ -1095,7 +4819,19 @@ class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): class PolygonKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + Polygon ``TypedDict`` wrapper. + + Parameters + ---------- + coordinates + + type + Specifies the type of GeoJSON object. + bbox + Bounding box of the coordinate range of the object's Geometries, Features, or + Feature Collections. https://tools.ietf.org/html/rfc7946#section-5 + """ coordinates: Sequence[Sequence[Sequence[float]]] type: Literal["Polygon"] @@ -1103,7 +4839,112 @@ class PolygonKwds(TypedDict, total=False): class ProjectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ProjectionConfig ``TypedDict`` wrapper. + + Parameters + ---------- + center + The projection's center, a two-element array of longitude and latitude in degrees. + + **Default value:** ``[0, 0]`` + clipAngle + The projection's clipping circle radius to the specified angle in degrees. If + ``null``, switches to `antimeridian `__ cutting + rather than small-circle clipping. + clipExtent + The projection's viewport clip extent to the specified bounds in pixels. The extent + bounds are specified as an array ``[[x0, y0], [x1, y1]]``, where ``x0`` is the + left-side of the viewport, ``y0`` is the top, ``x1`` is the right and ``y1`` is the + bottom. If ``null``, no viewport clipping is performed. + coefficient + The coefficient parameter for the ``hammer`` projection. + + **Default value:** ``2`` + distance + For the ``satellite`` projection, the distance from the center of the sphere to the + point of view, as a proportion of the sphere's radius. The recommended maximum clip + angle for a given ``distance`` is acos(1 / distance) converted to degrees. If tilt + is also applied, then more conservative clipping may be necessary. + + **Default value:** ``2.0`` + extent + + fit + + fraction + The fraction parameter for the ``bottomley`` projection. + + **Default value:** ``0.5``, corresponding to a sin(ψ) where ψ = π/6. + lobes + The number of lobes in projections that support multi-lobe views: ``berghaus``, + ``gingery``, or ``healpix``. The default value varies based on the projection type. + parallel + The parallel parameter for projections that support it: ``armadillo``, ``bonne``, + ``craig``, ``cylindricalEqualArea``, ``cylindricalStereographic``, + ``hammerRetroazimuthal``, ``loximuthal``, or ``rectangularPolyconic``. The default + value varies based on the projection type. + parallels + For conic projections, the `two standard parallels + `__ that define the map layout. + The default depends on the specific conic projection used. + pointRadius + The default radius (in pixels) to use when drawing GeoJSON ``Point`` and + ``MultiPoint`` geometries. This parameter sets a constant default value. To modify + the point radius in response to data, see the corresponding parameter of the GeoPath + and GeoShape transforms. + + **Default value:** ``4.5`` + precision + The threshold for the projection's `adaptive resampling + `__ to the specified value in pixels. This + value corresponds to the `Douglas-Peucker distance + `__. + If precision is not specified, returns the projection's current resampling precision + which defaults to ``√0.5 ≅ 0.70710…``. + radius + The radius parameter for the ``airy`` or ``gingery`` projection. The default value + varies based on the projection type. + ratio + The ratio parameter for the ``hill``, ``hufnagel``, or ``wagner`` projections. The + default value varies based on the projection type. + reflectX + Sets whether or not the x-dimension is reflected (negated) in the output. + reflectY + Sets whether or not the y-dimension is reflected (negated) in the output. + rotate + The projection's three-axis rotation to the specified angles, which must be a two- + or three-element array of numbers [``lambda``, ``phi``, ``gamma``] specifying the + rotation angles in degrees about each spherical axis. (These correspond to yaw, + pitch and roll.) + + **Default value:** ``[0, 0, 0]`` + scale + The projection's scale (zoom) factor, overriding automatic fitting. The default + scale is projection-specific. The scale factor corresponds linearly to the distance + between projected points; however, scale factor values are not equivalent across + projections. + size + Used in conjunction with fit, provides the width and height in pixels of the area to + which the projection should be automatically fit. + spacing + The spacing parameter for the ``lagrange`` projection. + + **Default value:** ``0.5`` + tilt + The tilt angle (in degrees) for the ``satellite`` projection. + + **Default value:** ``0``. + translate + The projection's translation offset as a two-element array ``[tx, ty]``. + type + The cartographic projection to use. This value is case-insensitive, for example + ``"albers"`` and ``"Albers"`` indicate the same projection type. You can find all + valid projection types `in the documentation + `__. + + **Default value:** ``equalEarth`` + """ center: Sequence[float] clipAngle: float @@ -1141,7 +4982,48 @@ class ProjectionConfigKwds(TypedDict, total=False): class RadialGradientKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + RadialGradient ``TypedDict`` wrapper. + + Parameters + ---------- + gradient + The type of gradient. Use ``"radial"`` for a radial gradient. + stops + An array of gradient stops defining the gradient color sequence. + id + + r1 + The radius length, in normalized [0, 1] coordinates, of the inner circle for the + gradient. + + **Default value:** ``0`` + r2 + The radius length, in normalized [0, 1] coordinates, of the outer circle for the + gradient. + + **Default value:** ``0.5`` + x1 + The x-coordinate, in normalized [0, 1] coordinates, for the center of the inner + circle for the gradient. + + **Default value:** ``0.5`` + x2 + The x-coordinate, in normalized [0, 1] coordinates, for the center of the outer + circle for the gradient. + + **Default value:** ``0.5`` + y1 + The y-coordinate, in normalized [0, 1] coordinates, for the center of the inner + circle for the gradient. + + **Default value:** ``0.5`` + y2 + The y-coordinate, in normalized [0, 1] coordinates, for the center of the outer + circle for the gradient. + + **Default value:** ``0.5`` + """ gradient: Literal["radial"] stops: Sequence[GradientStopKwds] @@ -1155,7 +5037,30 @@ class RadialGradientKwds(TypedDict, total=False): class RangeConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + RangeConfig ``TypedDict`` wrapper. + + Parameters + ---------- + category + Default `color scheme `__ for categorical + data. + diverging + Default `color scheme `__ for diverging + quantitative ramps. + heatmap + Default `color scheme `__ for + quantitative heatmaps. + ordinal + Default `color scheme `__ for + rank-ordered data. + ramp + Default `color scheme `__ for sequential + quantitative ramps. + symbol + Array of `symbol `__ names or paths + for the default shape palette. + """ category: ( Sequence[ColorHex | ColorName_T] @@ -1186,7 +5091,395 @@ class RangeConfigKwds(TypedDict, total=False): class RectConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + RectConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + binSpacing + Offset between bars for binned field. The ideal value for this is either 0 + (preferred by statisticians) or 1 (Vega-Lite default, D3 example style). + + **Default value:** ``1`` + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + continuousBandSize + The default size of the bars on continuous scales. + + **Default value:** ``5`` + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + discreteBandSize + The default size of the bars with discrete dimensions. If unspecified, the default + size is ``step-2``, which provides 2 pixel offset between bars. + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + minBandSize + The minimum band size for bar and rectangle marks. **Default value:** ``0.25`` + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -1264,7 +5557,156 @@ class RectConfigKwds(TypedDict, total=False): class ScaleConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ScaleConfig ``TypedDict`` wrapper. + + Parameters + ---------- + bandPaddingInner + Default inner padding for ``x`` and ``y`` band scales. + + **Default value:** + + * ``nestedOffsetPaddingInner`` for x/y scales with nested x/y offset scales. + * ``barBandPaddingInner`` for bar marks (``0.1`` by default) + * ``rectBandPaddingInner`` for rect and other marks (``0`` by default) + bandPaddingOuter + Default outer padding for ``x`` and ``y`` band scales. + + **Default value:** ``paddingInner/2`` (which makes *width/height = number of unique + values * step*) + bandWithNestedOffsetPaddingInner + Default inner padding for ``x`` and ``y`` band scales with nested ``xOffset`` and + ``yOffset`` encoding. + + **Default value:** ``0.2`` + bandWithNestedOffsetPaddingOuter + Default outer padding for ``x`` and ``y`` band scales with nested ``xOffset`` and + ``yOffset`` encoding. + + **Default value:** ``0.2`` + barBandPaddingInner + Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"bar"`` marks. + + **Default value:** ``0.1`` + clamp + If true, values that exceed the data domain are clamped to either the minimum or + maximum range value + continuousPadding + Default padding for continuous x/y scales. + + **Default:** The bar width for continuous x-scale of a vertical bar and continuous + y-scale of a horizontal bar.; ``0`` otherwise. + invalid + An object that defines scale outputs per channel for invalid values (nulls and NaNs + on a continuous scale). + + * The keys in this object are the scale channels. + * The values is either ``"zero-or-min"`` (use zero if the scale includes zero or min + value otherwise) or a value definition ``{value: ...}``. + + *Example:* Setting this ``config.scale.invalid`` property to ``{color: {value: + '#aaa'}}`` will make the visualization color all invalid values with '#aaa'. + + See [https://vega.github.io/vega-lite/docs/invalid-data.html](Invalid Data Docs) for + more details. + maxBandSize + The default max value for mapping quantitative fields to bar's size/bandSize. + + If undefined (default), we will use the axis's size (width or height) - 1. + maxFontSize + The default max value for mapping quantitative fields to text's size/fontSize scale. + + **Default value:** ``40`` + maxOpacity + Default max opacity for mapping a field to opacity. + + **Default value:** ``0.8`` + maxSize + Default max value for point size scale. + maxStrokeWidth + Default max strokeWidth for the scale of strokeWidth for rule and line marks and of + size for trail marks. + + **Default value:** ``4`` + minBandSize + The default min value for mapping quantitative fields to bar and tick's + size/bandSize scale. + + **Default value:** ``2`` + minFontSize + The default min value for mapping quantitative fields to text's size/fontSize scale. + + **Default value:** ``8`` + minOpacity + Default minimum opacity for mapping a field to opacity. + + **Default value:** ``0.3`` + minSize + Default minimum value for point size scale. + + **Default value:** ``9`` + minStrokeWidth + Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and + of size for trail marks. + + **Default value:** ``1`` + offsetBandPaddingInner + Default padding inner for xOffset/yOffset's band scales. + + **Default Value:** ``0`` + offsetBandPaddingOuter + Default padding outer for xOffset/yOffset's band scales. + + **Default Value:** ``0`` + pointPadding + Default outer padding for ``x`` and ``y`` point-ordinal scales. + + **Default value:** ``0.5`` (which makes *width/height = number of unique values * + step*) + quantileCount + Default range cardinality for `quantile + `__ scale. + + **Default value:** ``4`` + quantizeCount + Default range cardinality for `quantize + `__ scale. + + **Default value:** ``4`` + rectBandPaddingInner + Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"rect"`` marks. + + **Default value:** ``0`` + round + If true, rounds numeric output values to integers. This can be helpful for snapping + to the pixel grid. (Only available for ``x``, ``y``, and ``size`` scales.) + tickBandPaddingInner + Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"tick"`` marks. + + **Default value:** ``0.25`` + useUnaggregatedDomain + Use the source data range before aggregation as scale domain instead of aggregated + data for aggregate axis. + + This is equivalent to setting ``domain`` to ``"unaggregate"`` for aggregated + *quantitative* fields by default. + + This property only works with aggregate functions that produce values within the raw + data domain (``"mean"``, ``"average"``, ``"median"``, ``"q1"``, ``"q3"``, ``"min"``, + ``"max"``). For other aggregations that produce values outside of the raw data + domain (e.g. ``"count"``, ``"sum"``), this property is ignored. + + **Default value:** ``false`` + xReverse + Reverse x-scale by default (useful for right-to-left charts). + zero + Default ``scale.zero`` for `continuous + `__ scales except for + (1) x/y-scales of non-ranged bar or area charts and (2) size scales. + + **Default value:** ``true`` + """ bandPaddingInner: float bandPaddingOuter: float @@ -1298,7 +5740,46 @@ class ScaleConfigKwds(TypedDict, total=False): class ScaleInvalidDataConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ScaleInvalidDataConfig ``TypedDict`` wrapper. + + Parameters + ---------- + angle + + color + + fill + + fillOpacity + + opacity + + radius + + shape + + size + + stroke + + strokeDash + + strokeOpacity + + strokeWidth + + theta + + x + + xOffset + + y + + yOffset + + """ angle: Value[float] | Literal["zero-or-min"] color: ( @@ -1329,14 +5810,70 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): class SelectionConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + SelectionConfig ``TypedDict`` wrapper. + + Parameters + ---------- + interval + The default definition for an `interval + `__ selection. All + properties and transformations for an interval selection definition (except + ``type``) may be specified here. + + For instance, setting ``interval`` to ``{"translate": false}`` disables the ability + to move interval selections by default. + point + The default definition for a `point + `__ selection. All + properties and transformations for a point selection definition (except ``type``) + may be specified here. + + For instance, setting ``point`` to ``{"on": "dblclick"}`` populates point selections + on double-click by default. + """ interval: IntervalSelectionConfigWithoutTypeKwds point: PointSelectionConfigWithoutTypeKwds class StyleConfigIndexKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + StyleConfigIndex ``TypedDict`` wrapper. + + Parameters + ---------- + arc + Arc-specific Config + area + Area-Specific Config + bar + Bar-Specific Config + circle + Circle-Specific Config + geoshape + Geoshape-Specific Config + image + Image-specific Config + line + Line-Specific Config + mark + Mark Config + point + Point-Specific Config + rect + Rect-Specific Config + rule + Rule-Specific Config + square + Square-Specific Config + text + Text-Specific Config + tick + Tick-Specific Config + trail + Trail-Specific Config + """ arc: RectConfigKwds area: AreaConfigKwds @@ -1356,7 +5893,390 @@ class StyleConfigIndexKwds(TypedDict, total=False): class TickConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TickConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). + One of ``"left"``, ``"right"``, ``"center"``. + + **Note:** Expression reference is *not* supported for range marks. + angle + The rotation angle of the text, in degrees. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG element, removing the mark item from the ARIA accessibility tree. + ariaRole + Sets the type of user interface element of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "role" attribute. Warning: this + property is experimental and may be changed in the future. + ariaRoleDescription + A human-readable, author-localized description for the role of the mark item for + `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the "aria-roledescription" attribute. + Warning: this property is experimental and may be changed in the future. + aspect + Whether to keep aspect ratio of image marks. + bandSize + The width of the ticks. + + **Default value:** 3/4 of step (width step for horizontal ticks and height step for + vertical ticks). + baseline + For text marks, the vertical text baseline. One of ``"alphabetic"`` (default), + ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, ``"line-bottom"``, or an + expression reference that provides one of the valid values. The ``"line-top"`` and + ``"line-bottom"`` values operate similarly to ``"top"`` and ``"bottom"``, but are + calculated relative to the ``lineHeight`` rather than ``fontSize`` alone. + + For range marks, the vertical alignment of the marks. One of ``"top"``, + ``"middle"``, ``"bottom"``. + + **Note:** Expression reference is *not* supported for range marks. + blend + The color blend mode for drawing an item on its current background. Any valid `CSS + mix-blend-mode `__ + value can be used. + + __Default value:__ ``"source-over"`` + color + Default color. + + **Default value:** :raw-html:`` ■ :raw-html:`` + ``"#4682b4"`` + + **Note:** + + * This property cannot be used in a `style config + `__. + * The ``fill`` and ``stroke`` properties have higher precedence than ``color`` and + will override ``color``. + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cornerRadiusBottomLeft + The radius in pixels of rounded rectangles' bottom left corner. + + **Default value:** ``0`` + cornerRadiusBottomRight + The radius in pixels of rounded rectangles' bottom right corner. + + **Default value:** ``0`` + cornerRadiusTopLeft + The radius in pixels of rounded rectangles' top right corner. + + **Default value:** ``0`` + cornerRadiusTopRight + The radius in pixels of rounded rectangles' top left corner. + + **Default value:** ``0`` + cursor + The mouse cursor used over the mark. Any valid `CSS cursor type + `__ can be used. + description + A text description of the mark item for `ARIA accessibility + `__ (SVG output + only). If specified, this property determines the `"aria-label" attribute + `__. + dir + The direction of the text. One of ``"ltr"`` (left-to-right) or ``"rtl"`` + (right-to-left). This property determines on which side is truncated in response to + the limit parameter. + + **Default value:** ``"ltr"`` + dx + The horizontal offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + dy + The vertical offset, in pixels, between the text label and its anchor point. The + offset is applied after rotation by the *angle* property. + ellipsis + The ellipsis string for text truncated in response to the limit parameter. + + **Default value:** ``"…"`` + endAngle + The end angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + fill + Default fill color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove fill. + + **Default value:** (None) + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + filled + Whether the mark's color should be used as fill color instead of stroke color. + + **Default value:** ``false`` for all ``point``, ``line``, and ``rule`` marks as well + as ``geoshape`` marks for `graticule + `__ data sources; + otherwise, ``true``. + + **Note:** This property cannot be used in a `style config + `__. + font + The typeface to set the text in (e.g., ``"Helvetica Neue"``). + fontSize + The font size, in pixels. + + **Default value:** ``11`` + fontStyle + The font style (e.g., ``"italic"``). + fontWeight + The font weight. This can be either a string (e.g ``"bold"``, ``"normal"``) or a + number (``100``, ``200``, ``300``, ..., ``900`` where ``"normal"`` = ``400`` and + ``"bold"`` = ``700``). + height + Height of the marks. + href + A URL to load upon mouse click. If defined, the mark acts as a hyperlink. + innerRadius + The inner radius in pixels of arc marks. ``innerRadius`` is an alias for + ``radius2``. + + **Default value:** ``0`` + interpolate + The line interpolation method to use for line and area marks. One of the following: + + * ``"linear"``: piecewise linear segments, as in a polyline. + * ``"linear-closed"``: close the linear segments to form a polygon. + * ``"step"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"step-before"``: alternate between vertical and horizontal segments, as in a + step function. + * ``"step-after"``: alternate between horizontal and vertical segments, as in a step + function. + * ``"basis"``: a B-spline, with control point duplication on the ends. + * ``"basis-open"``: an open B-spline; may not intersect the start or end. + * ``"basis-closed"``: a closed B-spline, as in a loop. + * ``"cardinal"``: a Cardinal spline, with control point duplication on the ends. + * ``"cardinal-open"``: an open Cardinal spline; may not intersect the start or end, + but will intersect other control points. + * ``"cardinal-closed"``: a closed Cardinal spline, as in a loop. + * ``"bundle"``: equivalent to basis, except the tension parameter is used to + straighten the spline. + * ``"monotone"``: cubic interpolation that preserves monotonicity in y. + invalid + Invalid data mode, which defines how the marks and corresponding scales should + represent invalid values (``null`` and ``NaN`` in continuous scales *without* + defined output for invalid values). + + * ``"filter"`` — *Exclude* all invalid values from the visualization's *marks* and + *scales*. For path marks (for line, area, trail), this option will create paths + that connect valid points, as if the data rows with invalid values do not exist. + + * ``"break-paths-filter-domains"`` — Break path marks (for line, area, trail) at + invalid values. For non-path marks, this is equivalent to ``"filter"``. All + *scale* domains will *exclude* these filtered data points. + + * ``"break-paths-show-domains"`` — Break paths (for line, area, trail) at invalid + values. Hide invalid values for non-path marks. All *scale* domains will + *include* these filtered data points (for both path and non-path marks). + + * ``"show"`` or ``null`` — Show all data points in the marks and scale domains. Each + scale will use the output for invalid values defined in ``config.scale.invalid`` + or, if unspecified, by default invalid values will produce the same visual values + as zero (if the scale includes zero) or the minimum value (if the scale does not + include zero). + + * ``"break-paths-show-path-domains"`` (default) — This is equivalent to + ``"break-paths-show-domains"`` for path-based marks (line/area/trail) and + ``"filter"`` for non-path marks. + + **Note**: If any channel's scale has an output for invalid values defined in + ``config.scale.invalid``, all values for the scales will be considered "valid" since + they can produce a reasonable output for the scales. Thus, fields for such channels + will not be filtered and will not cause path breaks. + limit + The maximum length of the text mark in pixels. The text value will be automatically + truncated if the rendered size exceeds the limit. + + **Default value:** ``0`` -- indicating no limit + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property is ignored if the text is array-valued. + lineHeight + The line height in pixels (the spacing between subsequent lines of text) for + multi-line text marks. + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + order + For line and trail marks, this ``order`` property can be set to ``null`` or + ``false`` to make the lines use the original order in the data sources. + orient + The orientation of a non-stacked bar, tick, area, and line charts. The value is + either horizontal (default) or vertical. + + * For bar, rule and tick, this determines whether the size of the bar and tick + should be applied to x or y dimension. + * For area, this property determines the orient property of the Vega output. + * For line and trail marks, this property determines the sort order of the points in + the line if ``config.sortLineBy`` is not specified. For stacked charts, this is + always determined by the orientation of the stack; therefore explicitly specified + value will be ignored. + outerRadius + The outer radius in pixels of arc marks. ``outerRadius`` is an alias for ``radius``. + + **Default value:** ``0`` + padAngle + The angular padding applied to sides of the arc, in radians. + radius + For arc mark, the primary (outer) radius in pixels. + + For text marks, polar coordinate radial offset, in pixels, of the text from the + origin determined by the ``x`` and ``y`` properties. + + **Default value:** ``min(plot_width, plot_height)/2`` + radius2 + The secondary (inner) radius in pixels of arc marks. + + **Default value:** ``0`` + shape + Shape of the point marks. Supported values include: + + * plotting shapes: ``"circle"``, ``"square"``, ``"cross"``, ``"diamond"``, + ``"triangle-up"``, ``"triangle-down"``, ``"triangle-right"``, or + ``"triangle-left"``. + * the line symbol ``"stroke"`` + * centered directional shapes ``"arrow"``, ``"wedge"``, or ``"triangle"`` + * a custom `SVG path string + `__ (For correct + sizing, custom shape paths should be defined within a square bounding box with + coordinates ranging from -1 to 1 along both the x and y dimensions.) + + **Default value:** ``"circle"`` + size + Default size for marks. + + * For ``point``/``circle``/``square``, this represents the pixel area of the marks. + Note that this value sets the area of the symbol; the side lengths will increase + with the square root of this value. + * For ``bar``, this represents the band size of the bar, in pixels. + * For ``text``, this represents the font size, in pixels. + + **Default value:** + + * ``30`` for point, circle, square marks; width/height's ``step`` + * ``2`` for bar marks with discrete dimensions; + * ``5`` for bar marks with continuous dimensions; + * ``11`` for text marks. + smooth + A boolean flag (default true) indicating if the image should be smoothed when + resized. If false, individual pixels should be scaled directly rather than + interpolated with smoothing. For SVG rendering, this option may not work in some + browsers due to lack of standardization. + startAngle + The start angle in radians for arc marks. A value of ``0`` indicates up (north), + increasing values proceed clockwise. + stroke + Default stroke color. This property has higher precedence than ``config.color``. Set + to ``null`` to remove stroke. + + **Default value:** (None) + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOffset + The offset in pixels at which to draw the group stroke and fill. If unspecified, the + default behavior is to dynamically offset stroked groups such that 1 pixel stroke + widths align with the pixel grid. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + tension + Depending on the interpolation type, sets the tension parameter (for line and area + marks). + text + Placeholder text if the ``text`` channel is not specified + theta + * For arc marks, the arc length in radians if theta2 is not specified, otherwise the + start arc angle. (A value of 0 indicates up or “north”, increasing values proceed + clockwise.) + + * For text marks, polar coordinate angle in radians. + theta2 + The end angle of arc marks in radians. A value of 0 indicates up or “north”, + increasing values proceed clockwise. + thickness + Thickness of the tick mark. + + **Default value:** ``1`` + timeUnitBandPosition + Default relative band position for a time unit. If set to ``0``, the marks will be + positioned at the beginning of the time unit band step. If set to ``0.5``, the marks + will be positioned in the middle of the time unit band step. + timeUnitBandSize + Default relative band size for a time unit. If set to ``1``, the bandwidth of the + marks will be equal to the time unit band step. If set to ``0.5``, bandwidth of the + marks will be half of the time unit band step. + tooltip + The tooltip text string to show upon mouse hover or an object defining which fields + should the tooltip be derived from. + + * If ``tooltip`` is ``true`` or ``{"content": "encoding"}``, then all fields from + ``encoding`` will be used. + * If ``tooltip`` is ``{"content": "data"}``, then all fields that appear in the + highlighted data point will be used. + * If set to ``null`` or ``false``, then no tooltip will be used. + + See the `tooltip `__ + documentation for a detailed discussion about tooltip in Vega-Lite. + + **Default value:** ``null`` + url + The URL of the image file for image marks. + width + Width of the marks. + x + X coordinates of the marks, or width of horizontal ``"bar"`` and ``"area"`` without + specified ``x2`` or ``width``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + x2 + X2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"width"`` for the width + of the plot. + y + Y coordinates of the marks, or height of vertical ``"bar"`` and ``"area"`` without + specified ``y2`` or ``height``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + y2 + Y2 coordinates for ranged ``"area"``, ``"bar"``, ``"rect"``, and ``"rule"``. + + The ``value`` of this channel can be a number or a string ``"height"`` for the + height of the plot. + """ align: Align_T angle: float @@ -1432,14 +6352,44 @@ class TickConfigKwds(TypedDict, total=False): class TimeIntervalStepKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TimeIntervalStep ``TypedDict`` wrapper. + + Parameters + ---------- + interval + + step + + """ interval: TimeInterval_T step: float class TimeLocaleKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TimeLocale ``TypedDict`` wrapper. + + Parameters + ---------- + date + The date (%x) format specifier (e.g., "%m/%d/%Y"). + dateTime + The date and time (%c) format specifier (e.g., "%a %b %e %X %Y"). + days + The full names of the weekdays, starting with Sunday. + months + The full names of the months (starting with January). + periods + The A.M. and P.M. equivalents (e.g., ["AM", "PM"]). + shortDays + The abbreviated names of the weekdays, starting with Sunday. + shortMonths + The abbreviated names of the months (starting with January). + time + The time (%X) format specifier (e.g., "%H:%M:%S"). + """ date: str dateTime: str @@ -1452,7 +6402,85 @@ class TimeLocaleKwds(TypedDict, total=False): class TitleConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TitleConfig ``TypedDict`` wrapper. + + Parameters + ---------- + align + Horizontal text alignment for title text. One of ``"left"``, ``"center"``, or + ``"right"``. + anchor + The anchor position for placing the title and subtitle text. One of ``"start"``, + ``"middle"``, or ``"end"``. For example, with an orientation of top these anchor + positions map to a left-, center-, or right-aligned title. + angle + Angle in degrees of title and subtitle text. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG group, removing the title from the ARIA accessibility tree. + + **Default value:** ``true`` + baseline + Vertical text baseline for title and subtitle text. One of ``"alphabetic"`` + (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or + ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly + to ``"top"`` and ``"bottom"``, but are calculated relative to the *lineHeight* + rather than *fontSize* alone. + color + Text color for title text. + dx + Delta offset for title and subtitle text x-coordinate. + dy + Delta offset for title and subtitle text y-coordinate. + font + Font name for title text. + fontSize + Font size in pixels for title text. + fontStyle + Font style for title text. + fontWeight + Font weight for title text. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + frame + The reference frame for the anchor position, one of ``"bounds"`` (to anchor relative + to the full bounding box) or ``"group"`` (to anchor relative to the group width or + height). + limit + The maximum allowed length in pixels of title and subtitle text. + lineHeight + Line height in pixels for multi-line title text or title text with ``"line-top"`` or + ``"line-bottom"`` baseline. + offset + The orthogonal offset in pixels by which to displace the title group from its + position along the edge of the chart. + orient + Default title orientation (``"top"``, ``"bottom"``, ``"left"``, or ``"right"``) + subtitleColor + Text color for subtitle text. + subtitleFont + Font name for subtitle text. + subtitleFontSize + Font size in pixels for subtitle text. + subtitleFontStyle + Font style for subtitle text. + subtitleFontWeight + Font weight for subtitle text. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + subtitleLineHeight + Line height in pixels for multi-line subtitle text. + subtitlePadding + The padding in pixels between title and subtitle text. + zindex + The integer z-index indicating the layering of the title group relative to other + axis, mark, and legend groups. + + **Default value:** ``0``. + """ align: Align_T anchor: TitleAnchor_T @@ -1482,13 +6510,64 @@ class TitleConfigKwds(TypedDict, total=False): class TooltipContentKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TooltipContent ``TypedDict`` wrapper. + + Parameters + ---------- + content + + """ content: Literal["encoding", "data"] class TopLevelSelectionParameterKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + TopLevelSelectionParameter ``TypedDict`` wrapper. + + Parameters + ---------- + name + Required. A unique name for the selection parameter. Selection names should be valid + JavaScript identifiers: they should contain only alphanumeric characters (or "$", or + "_") and may not start with a digit. Reserved keywords that may not be used as + parameter names are "datum", "event", "item", and "parent". + select + Determines the default event processing and data query for the selection. Vega-Lite + currently supports two selection types: + + * ``"point"`` -- to select multiple discrete data values; the first value is + selected on ``click`` and additional values toggled on shift-click. + * ``"interval"`` -- to select a continuous range of data values on ``drag``. + bind + When set, a selection is populated by input elements (also known as dynamic query + widgets) or by interacting with the corresponding legend. Direct manipulation + interaction is disabled by default; to re-enable it, set the selection's `on + `__ + property. + + Legend bindings are restricted to selections that only specify a single field or + encoding. + + Query widget binding takes the form of Vega's `input element binding definition + `__ or can be a mapping between + projected field/encodings and binding definitions. + + **See also:** `bind `__ + documentation. + value + Initialize the selection with a mapping between `projected channels or field names + `__ and initial + values. + + **See also:** `init `__ + documentation. + views + By default, top-level selections are applied to every view in the visualization. If + this property is specified, selections will only be applied to views with the given + names. + """ name: str select: PointSelectionConfigKwds | IntervalSelectionConfigKwds | SelectionType_T @@ -1506,7 +6585,36 @@ class TopLevelSelectionParameterKwds(TypedDict, total=False): class VariableParameterKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + VariableParameter ``TypedDict`` wrapper. + + Parameters + ---------- + name + A unique name for the variable parameter. Parameter names should be valid JavaScript + identifiers: they should contain only alphanumeric characters (or "$", or "_") and + may not start with a digit. Reserved keywords that may not be used as parameter + names are "datum", "event", "item", and "parent". + bind + Binds the parameter to an external input element such as a slider, selection list or + radio button group. + expr + An expression for the value of the parameter. This expression may include other + parameters, in which case the parameter will automatically update in response to + upstream parameter changes. + react + A boolean flag (default ``true``) indicating if the update expression should be + automatically re-evaluated when any upstream signal dependencies update. If + ``false``, the update expression will not register any dependencies on other + signals, even for initialization. + + **Default value:** ``true`` + value + The `initial value `__ of the + parameter. + + **Default value:** ``undefined`` + """ name: str bind: ( @@ -1522,7 +6630,83 @@ class VariableParameterKwds(TypedDict, total=False): class ViewConfigKwds(TypedDict, total=False): - """Placeholder doc.""" + """ + ViewConfig ``TypedDict`` wrapper. + + Parameters + ---------- + clip + Whether the view should be clipped. + continuousHeight + The default height when the plot has a continuous y-field for x or latitude, or has + arc marks. + + **Default value:** ``200`` + continuousWidth + The default width when the plot has a continuous field for x or longitude, or has + arc marks. + + **Default value:** ``200`` + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cursor + The mouse cursor used over the view. Any valid `CSS cursor type + `__ can be used. + discreteHeight + The default height when the plot has non arc marks and either a discrete y-field or + no y-field. The height can be either a number indicating a fixed height or an object + in the form of ``{step: number}`` defining the height per discrete step. + + **Default value:** a step size based on ``config.view.step``. + discreteWidth + The default width when the plot has non-arc marks and either a discrete x-field or + no x-field. The width can be either a number indicating a fixed width or an object + in the form of ``{step: number}`` defining the width per discrete step. + + **Default value:** a step size based on ``config.view.step``. + fill + The fill color. + + **Default value:** ``undefined`` + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + step + Default step size for x-/y- discrete fields. + stroke + The stroke color. + + **Default value:** ``"#ddd"`` + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + """ clip: bool continuousHeight: float @@ -1546,7 +6730,279 @@ class ViewConfigKwds(TypedDict, total=False): class ThemeConfig(TypedDict, total=False): - """Placeholder doc.""" + """ + Placeholder doc. + + Parameters + ---------- + arc + Arc-specific Config + area + Area-Specific Config + aria + A boolean flag indicating if ARIA default attributes should be included for marks + and guides (SVG output only). If false, the ``"aria-hidden"`` attribute will be set + for all guides, removing them from the ARIA accessibility tree and Vega-Lite will + not generate default descriptions for marks. + + **Default value:** ``true``. + autosize + How the visualization size should be determined. If a string, should be one of + ``"pad"``, ``"fit"`` or ``"none"``. Object values can additionally specify + parameters for content sizing and automatic resizing. + + **Default value**: ``pad`` + axis + Axis configuration, which determines default properties for all ``x`` and ``y`` + `axes `__. For a full list of axis + configuration options, please see the `corresponding section of the axis + documentation `__. + axisBand + Config for axes with "band" scales. + axisBottom + Config for x-axis along the bottom edge of the chart. + axisDiscrete + Config for axes with "point" or "band" scales. + axisLeft + Config for y-axis along the left edge of the chart. + axisPoint + Config for axes with "point" scales. + axisQuantitative + Config for quantitative axes. + axisRight + Config for y-axis along the right edge of the chart. + axisTemporal + Config for temporal axes. + axisTop + Config for x-axis along the top edge of the chart. + axisX + X-axis specific config. + axisXBand + Config for x-axes with "band" scales. + axisXDiscrete + Config for x-axes with "point" or "band" scales. + axisXPoint + Config for x-axes with "point" scales. + axisXQuantitative + Config for x-quantitative axes. + axisXTemporal + Config for x-temporal axes. + axisY + Y-axis specific config. + axisYBand + Config for y-axes with "band" scales. + axisYDiscrete + Config for y-axes with "point" or "band" scales. + axisYPoint + Config for y-axes with "point" scales. + axisYQuantitative + Config for y-quantitative axes. + axisYTemporal + Config for y-temporal axes. + background + CSS color property to use as the background of the entire view. + + **Default value:** ``"white"`` + bar + Bar-Specific Config + boxplot + Box Config + circle + Circle-Specific Config + concat + Default configuration for all concatenation and repeat view composition operators + (``concat``, ``hconcat``, ``vconcat``, and ``repeat``) + countTitle + Default axis and legend title for count fields. + + **Default value:** ``'Count of Records``. + customFormatTypes + Allow the ``formatType`` property for text marks and guides to accept a custom + formatter function `registered as a Vega expression + `__. + errorband + ErrorBand Config + errorbar + ErrorBar Config + facet + Default configuration for the ``facet`` view composition operator + fieldTitle + Defines how Vega-Lite generates title for fields. There are three possible styles: + + * ``"verbal"`` (Default) - displays function in a verbal style (e.g., "Sum of + field", "Year-month of date", "field (binned)"). + * ``"function"`` - displays function using parentheses and capitalized texts (e.g., + "SUM(field)", "YEARMONTH(date)", "BIN(field)"). + * ``"plain"`` - displays only the field name without functions (e.g., "field", + "date", "field"). + font + Default font for all text marks, titles, and labels. + geoshape + Geoshape-Specific Config + header + Header configuration, which determines default properties for all `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerColumn + Header configuration, which determines default properties for column `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerFacet + Header configuration, which determines default properties for non-row/column facet + `headers `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerRow + Header configuration, which determines default properties for row `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + image + Image-specific Config + legend + Legend configuration, which determines default properties for all `legends + `__. For a full list of legend + configuration options, please see the `corresponding section of in the legend + documentation `__. + line + Line-Specific Config + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property provides a global default for text marks, which is + overridden by mark or style config settings, and by the lineBreak mark encoding + channel. If signal-valued, either string or regular expression (regexp) values are + valid. + locale + Locale definitions for string parsing and formatting of number and date values. The + locale object should contain ``number`` and/or ``time`` properties with `locale + definitions `__. Locale definitions + provided in the config block may be overridden by the View constructor locale + option. + mark + Mark Config + normalizedNumberFormat + If normalizedNumberFormatType is not specified, D3 number format for axis labels, + text marks, and tooltips of normalized stacked fields (fields with ``stack: + "normalize"``). For example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.normalizedNumberFormatType`` is specified and + ``config.customFormatTypes`` is ``true``, this value will be passed as ``format`` + alongside ``datum.value`` to the ``config.numberFormatType`` function. **Default + value:** ``%`` + normalizedNumberFormatType + `Custom format type + `__ for + ``config.normalizedNumberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + numberFormat + If numberFormatType is not specified, D3 number format for guide labels, text marks, + and tooltips of non-normalized fields (fields *without* ``stack: "normalize"``). For + example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.numberFormatType`` is specified and ``config.customFormatTypes`` is + ``true``, this value will be passed as ``format`` alongside ``datum.value`` to the + ``config.numberFormatType`` function. + numberFormatType + `Custom format type + `__ for + ``config.numberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + padding + The default visualization padding, in pixels, from the edge of the visualization + canvas to the data rectangle. If a number, specifies padding for all sides. If an + object, the value should have the format ``{"left": 5, "top": 5, "right": 5, + "bottom": 5}`` to specify padding for each side of the visualization. + + **Default value**: ``5`` + params + Dynamic variables or selections that parameterize a visualization. + point + Point-Specific Config + projection + Projection configuration, which determines default properties for all `projections + `__. For a full list of + projection configuration options, please see the `corresponding section of the + projection documentation + `__. + range + An object hash that defines default range arrays or schemes for using with scales. + For a full list of scale range configuration options, please see the `corresponding + section of the scale documentation + `__. + rect + Rect-Specific Config + rule + Rule-Specific Config + scale + Scale configuration determines default properties for all `scales + `__. For a full list of scale + configuration options, please see the `corresponding section of the scale + documentation `__. + selection + An object hash for defining default properties for each type of selections. + square + Square-Specific Config + style + An object hash that defines key-value mappings to determine default properties for + marks with a given `style + `__. The keys represent + styles names; the values have to be valid `mark configuration objects + `__. + text + Text-Specific Config + tick + Tick-Specific Config + timeFormat + Default time format for raw time values (without time units) in text marks, legend + labels and header labels. + + **Default value:** ``"%b %d, %Y"`` **Note:** Axes automatically determine the format + for each label automatically so this config does not affect axes. + timeFormatType + `Custom format type + `__ for + ``config.timeFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-time-format, + which is exposed as `timeFormat in Vega-Expression + `__. **Note:** You must + also set ``customFormatTypes`` to ``true`` and there must *not* be a ``timeUnit`` + defined to use this feature. + title + Title configuration, which determines default properties for all `titles + `__. For a full list of title + configuration options, please see the `corresponding section of the title + documentation `__. + tooltipFormat + Define `custom format configuration + `__ for tooltips. If + unspecified, default format config will be applied. + trail + Trail-Specific Config + view + Default properties for `single view plots + `__. + """ arc: RectConfigKwds area: AreaConfigKwds From b486f101b4d037e37bb3c5f5df6e8697bbcb5701 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:55:26 +0100 Subject: [PATCH 083/139] docs: Add summary for `ThemeConfig` Based on: - https://vega.github.io/vega-lite/docs/config.html - https://altair-viz.github.io/user_guide/configuration.html --- altair/vegalite/v5/schema/_config.py | 2 +- tools/generate_schema_wrapper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index b4a89fd84..22bab0032 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -6731,7 +6731,7 @@ class ViewConfigKwds(TypedDict, total=False): class ThemeConfig(TypedDict, total=False): """ - Placeholder doc. + Top-Level Configuration ``TypedDict`` for creating a consistent theme. Parameters ---------- diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index e50eb1286..daf0d3704 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -228,7 +228,7 @@ def configure_{prop}(self, *args, **kwargs) -> Self: CONFIG_TYPED_DICT: Final = ''' class ThemeConfig(TypedDict, total=False): - """Placeholder doc. + """Top-Level Configuration ``TypedDict`` for creating a consistent theme. {doc}""" {typed_dict_args} From 81349ea217e06cd1e2686fc7e4988cf3080168d4 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:00:29 +0100 Subject: [PATCH 084/139] test(typing): Adds `test_theme_config_typing` Pushing with errors for discussion --- tests/vegalite/v5/test_theme.py | 663 ++++++++++++++++++++++++++++++++ 1 file changed, 663 insertions(+) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index dbd4abb2d..65dbd9ddd 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -5,6 +5,7 @@ import pytest import altair.vegalite.v5 as alt +from altair.vegalite.v5.schema._config import ThemeConfig from altair.vegalite.v5.schema._typing import is_color_hex from altair.vegalite.v5.theme import VEGA_THEMES, register_theme, themes @@ -52,3 +53,665 @@ def custom_theme() -> dict[str, int]: ) def test_is_color_hex(color_code: Any, *, valid: bool) -> None: assert is_color_hex(color_code) == valid + + +def test_theme_config_typing(*, enable_mypy: bool = True) -> None: + """ + Declares most of the default themes as ``ThemeConfig``. + + Adding a typed argument to the signature ensures ``mypy`` checks this. + """ + # ruff: noqa: F841 + + carbonwhite: ThemeConfig = { + "arc": {"fill": "#6929c4"}, + "area": {"fill": "#6929c4"}, + "axis": { + "grid": True, + "gridColor": "#e0e0e0", + "labelAngle": 0, + "labelColor": "#525252", + "labelFont": 'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif', + "labelFontSize": 12, + "labelFontWeight": 400, + "titleColor": "#161616", + "titleFontSize": 12, + "titleFontWeight": 600, + }, + "axisX": {"titlePadding": 10}, + "axisY": {"titlePadding": 2.5}, + "background": "#ffffff", + "circle": {"fill": "#6929c4"}, + "group": {"fill": "#ffffff"}, + "path": {"stroke": "#6929c4"}, + "range": { + "category": [ + "#6929c4", + "#1192e8", + "#005d5d", + "#9f1853", + "#fa4d56", + "#570408", + "#198038", + "#002d9c", + "#ee538b", + "#b28600", + "#009d9a", + "#012749", + "#8a3800", + "#a56eff", + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d", + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30", + ], + }, + "rect": {"fill": "#6929c4"}, + "shape": {"stroke": "#6929c4"}, + "style": { + "guide-label": { + "fill": "#525252", + "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', + "fontWeight": 400, + }, + "guide-title": { + "fill": "#525252", + "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', + "fontWeight": 400, + }, + }, + "symbol": {"stroke": "#6929c4"}, + "title": { + "anchor": "start", + "color": "#161616", + "dy": -15, + "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', + "fontSize": 16, + "fontWeight": 600, + }, + "view": {"fill": "#ffffff", "stroke": "#ffffff"}, + } + + dark = ThemeConfig( + axis={"domainColor": "#fff", "gridColor": "#888", "tickColor": "#fff"}, + background="#333", + style={"guide-label": {"fill": "#fff"}, "guide-title": {"fill": "#fff"}}, + title={"color": "#fff", "subtitleColor": "#fff"}, + view={"stroke": "#888"}, + ) + + excel: ThemeConfig = { + "arc": {"fill": "#4572a7"}, + "area": {"fill": "#4572a7"}, + "axis": { + "bandPosition": 0.5, + "grid": True, + "gridColor": "#000000", + "gridOpacity": 1, + "gridWidth": 0.5, + "labelPadding": 10, + "tickSize": 5, + "tickWidth": 0.5, + }, + "axisBand": {"grid": False, "tickExtra": True}, + "background": "#fff", + "legend": { + "labelBaseline": "middle", + "labelFontSize": 11, + "symbolSize": 50, + "symbolType": "square", + }, + "line": {"stroke": "#4572a7", "strokeWidth": 2}, + "path": {"stroke": "#4572a7"}, + "range": { + "category": [ + "#4572a7", + "#aa4643", + "#8aa453", + "#71598e", + "#4598ae", + "#d98445", + "#94aace", + "#d09393", + "#b9cc98", + "#a99cbc", + ] + }, + "rect": {"fill": "#4572a7"}, + "shape": {"stroke": "#4572a7"}, + "symbol": {"fill": "#4572a7", "size": 50, "strokeWidth": 1.5}, + } + fivethirtyeight: ThemeConfig = { + "arc": {"fill": "#30a2da"}, + "area": {"fill": "#30a2da"}, + "axis": { + "domainColor": "#cbcbcb", + "grid": True, + "gridColor": "#cbcbcb", + "gridWidth": 1, + "labelColor": "#999", + "labelFontSize": 10, + "labelPadding": 4, + "tickColor": "#cbcbcb", + "tickSize": 10, + "titleColor": "#333", + "titleFontSize": 14, + "titlePadding": 10, + }, + "axisBand": {"grid": False}, + "background": "#f0f0f0", + "bar": {"binSpacing": 2, "fill": "#30a2da", "stroke": None}, + "group": {"fill": "#f0f0f0"}, + "legend": { + "labelColor": "#333", + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square", + "titleColor": "#333", + "titleFontSize": 14, + "titlePadding": 10, + }, + "line": {"stroke": "#30a2da", "strokeWidth": 2}, + "path": {"stroke": "#30a2da", "strokeWidth": 0.5}, + "point": {"filled": True, "shape": "circle"}, + "range": { + "category": [ + "#30a2da", + "#fc4f30", + "#e5ae38", + "#6d904f", + "#8b8b8b", + "#b96db8", + "#ff9e27", + "#56cc60", + "#52d2ca", + "#52689e", + "#545454", + "#9fe4f8", + ], + "diverging": [ + "#cc0020", + "#e77866", + "#f6e7e1", + "#d6e8ed", + "#91bfd9", + "#1d78b5", + ], + "heatmap": ["#d6e8ed", "#cee0e5", "#91bfd9", "#549cc6", "#1d78b5"], + }, + "rect": {"fill": "#30a2da"}, + "shape": {"stroke": "#30a2da"}, + "title": {"anchor": "start", "fontSize": 24, "fontWeight": 600, "offset": 20}, + } + ggplot2: ThemeConfig = { + "arc": {"fill": "#000"}, + "area": {"fill": "#000"}, + "axis": { + "domain": False, + "grid": True, + "gridColor": "#FFFFFF", + "gridOpacity": 1, + "labelColor": "#7F7F7F", + "labelPadding": 4, + "tickColor": "#7F7F7F", + "tickSize": 5.67, + "titleFontSize": 16, + "titleFontWeight": "normal", + }, + "group": {"fill": "#e5e5e5"}, + "legend": {"labelBaseline": "middle", "labelFontSize": 11, "symbolSize": 40}, + "line": {"stroke": "#000"}, + "path": {"stroke": "#000"}, + "range": { + "category": [ + "#000000", + "#7F7F7F", + "#1A1A1A", + "#999999", + "#333333", + "#B0B0B0", + "#4D4D4D", + "#C9C9C9", + "#666666", + "#DCDCDC", + ] + }, + "rect": {"fill": "#000"}, + "shape": {"stroke": "#000"}, + "symbol": {"fill": "#000", "size": 40}, + } + googlecharts: ThemeConfig = { + "arc": {"fill": "#3366CC"}, + "area": {"fill": "#3366CC"}, + "axis": { + "domain": False, + "grid": True, + "gridColor": "#ccc", + "tickColor": "#ccc", + }, + "background": "#fff", + "circle": {"fill": "#3366CC"}, + "padding": {"bottom": 10, "left": 10, "right": 10, "top": 10}, + "path": {"stroke": "#3366CC"}, + "range": { + "category": [ + "#4285F4", + "#DB4437", + "#F4B400", + "#0F9D58", + "#AB47BC", + "#00ACC1", + "#FF7043", + "#9E9D24", + "#5C6BC0", + "#F06292", + "#00796B", + "#C2185B", + ], + "heatmap": ["#c6dafc", "#5e97f6", "#2a56c6"], + }, + "rect": {"fill": "#3366CC"}, + "shape": {"stroke": "#3366CC"}, + "style": { + "group-title": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-label": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-title": {"font": "Arial, sans-serif", "fontSize": 12}, + }, + "symbol": {"stroke": "#3366CC"}, + "title": { + "anchor": "start", + "dy": -3, + "font": "Arial, sans-serif", + "fontSize": 14, + "fontWeight": "bold", + }, + } + latimes: ThemeConfig = { + "arc": {"fill": "#82c6df"}, + "area": {"fill": "#82c6df"}, + "axis": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "labelFontWeight": "normal", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal", + }, + "axisX": {"labelAngle": 0, "labelPadding": 4, "tickSize": 3}, + "axisY": { + "labelBaseline": "middle", + "maxExtent": 45, + "minExtent": 45, + "tickSize": 2, + "titleAlign": "left", + "titleAngle": 0, + "titleX": -45, + "titleY": -11, + }, + "background": "#ffffff", + "legend": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "symbolType": "square", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal", + }, + "line": {"stroke": "#82c6df", "strokeWidth": 2}, + "path": {"stroke": "#82c6df"}, + "range": { + "category": [ + "#ec8431", + "#829eb1", + "#c89d29", + "#3580b1", + "#adc839", + "#ab7fb4", + ], + "diverging": [ + "#e68a4f", + "#f4bb6a", + "#f9e39c", + "#dadfe2", + "#a6b7c6", + "#849eae", + ], + "heatmap": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + "ordinal": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + "ramp": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + }, + "rect": {"fill": "#82c6df"}, + "shape": {"stroke": "#82c6df"}, + "symbol": {"fill": "#82c6df", "size": 30}, + "title": { + "anchor": "start", + "color": "#000000", + "font": "Benton Gothic Bold, sans-serif", + "fontSize": 22, + "fontWeight": "normal", + }, + } + powerbi: ThemeConfig = { + "arc": {"fill": "#118DFF"}, + "area": {"fill": "#118DFF", "line": True, "opacity": 0.6}, + "axis": { + "domain": False, + "grid": False, + "labelColor": "#605E5C", + "labelFontSize": 12, + "ticks": False, + "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16, + "titleFontWeight": "normal", + }, + "axisBand": {"tickExtra": True}, + "axisQuantitative": { + "grid": True, + "gridColor": "#C8C6C4", + "gridDash": [1, 5], + "labelFlush": False, + "tickCount": 3, + }, + "axisX": {"labelPadding": 5}, + "axisY": {"labelPadding": 10}, + "background": "transparent", + "bar": {"fill": "#118DFF"}, + "font": "Segoe UI", + "header": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16, + }, + "legend": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "symbolSize": 75, + "symbolType": "circle", + "titleColor": "#605E5C", + "titleFont": "Segoe UI", + "titleFontWeight": "bold", + }, + "line": { + "stroke": "#118DFF", + "strokeCap": "round", + "strokeJoin": "round", + "strokeWidth": 3, + }, + "path": {"stroke": "#118DFF"}, + "point": {"fill": "#118DFF", "filled": True, "size": 75}, + "range": { + "category": [ + "#118DFF", + "#12239E", + "#E66C37", + "#6B007B", + "#E044A7", + "#744EC2", + "#D9B300", + "#D64550", + ], + "diverging": ["#DEEFFF", "#118DFF"], + "heatmap": ["#DEEFFF", "#118DFF"], + "ordinal": [ + "#DEEFFF", + "#c7e4ff", + "#b0d9ff", + "#9aceff", + "#83c3ff", + "#6cb9ff", + "#55aeff", + "#3fa3ff", + "#2898ff", + "#118DFF", + ], + }, + "rect": {"fill": "#118DFF"}, + "shape": {"stroke": "#118DFF"}, + "symbol": {"fill": "#118DFF", "size": 50, "strokeWidth": 1.5}, + "text": {"fill": "#605E5C", "font": "Segoe UI", "fontSize": 12}, + "view": {"stroke": "transparent"}, + } + quartz: ThemeConfig = { + "arc": {"fill": "#ab5787"}, + "area": {"fill": "#ab5787"}, + "axis": { + "domainColor": "#979797", + "domainWidth": 0.5, + "gridWidth": 0.2, + "labelColor": "#979797", + "tickColor": "#979797", + "tickWidth": 0.2, + "titleColor": "#979797", + }, + "axisBand": {"grid": False}, + "axisX": {"grid": True, "tickSize": 10}, + "axisY": {"domain": False, "grid": True, "tickSize": 0}, + "background": "#f9f9f9", + "legend": { + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square", + }, + "line": {"stroke": "#ab5787"}, + "path": {"stroke": "#ab5787"}, + "range": { + "category": [ + "#ab5787", + "#51b2e5", + "#703c5c", + "#168dd9", + "#d190b6", + "#00609f", + "#d365ba", + "#154866", + "#666666", + "#c4c4c4", + ] + }, + "rect": {"fill": "#ab5787"}, + "shape": {"stroke": "#ab5787"}, + "symbol": {"fill": "#ab5787", "size": 30}, + } + urbaninstitute: ThemeConfig = { + "arc": {"fill": "#1696d2"}, + "area": {"fill": "#1696d2"}, + "axisX": { + "domain": True, + "domainColor": "#000000", + "domainWidth": 1, + "grid": False, + "labelAngle": 0, + "labelFont": "Lato", + "labelFontSize": 12, + "tickColor": "#000000", + "tickSize": 5, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + }, + "axisY": { + "domain": False, + "domainWidth": 1, + "grid": True, + "gridColor": "#DEDDDD", + "gridWidth": 1, + "labelFont": "Lato", + "labelFontSize": 12, + "labelPadding": 8, + "ticks": False, + "titleAngle": 0, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + "titleX": 18, + "titleY": -10, + }, + "background": "#FFFFFF", + "legend": { + "labelFont": "Lato", + "labelFontSize": 12, + "offset": 10, + "orient": "right", + "symbolSize": 100, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + }, + "line": {"color": "#1696d2", "stroke": "#1696d2", "strokeWidth": 5}, + "path": {"stroke": "#1696d2", "strokeWidth": 0.5}, + "point": {"filled": True}, + "range": { + "category": [ + "#1696d2", + "#ec008b", + "#fdbf11", + "#000000", + "#d2d2d2", + "#55b748", + ], + "diverging": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a", + ], + "heatmap": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a", + ], + "ordinal": [ + "#cfe8f3", + "#a2d4ec", + "#73bfe2", + "#46abdb", + "#1696d2", + "#12719e", + ], + "ramp": [ + "#CFE8F3", + "#A2D4EC", + "#73BFE2", + "#46ABDB", + "#1696D2", + "#12719E", + "#0A4C6A", + "#062635", + ], + }, + "rect": {"fill": "#1696d2"}, + "shape": {"stroke": "#1696d2"}, + "style": {"bar": {"fill": "#1696d2", "stroke": None}}, + "symbol": {"fill": "#1696d2", "size": 30}, + "text": { + "align": "center", + "color": "#1696d2", + "font": "Lato", + "fontSize": 11, + "fontWeight": 400, + "size": 11, + }, + "title": {"anchor": "start", "font": "Lato", "fontSize": 18}, + "trail": {"color": "#1696d2", "size": 1, "stroke": "#1696d2", "strokeWidth": 0}, + "view": {"stroke": "transparent"}, + } + vox: ThemeConfig = { + "arc": {"fill": "#3e5c69"}, + "area": {"fill": "#3e5c69"}, + "axis": { + "domainWidth": 0.5, + "grid": True, + "labelPadding": 2, + "tickSize": 5, + "tickWidth": 0.5, + "titleFontWeight": "normal", + }, + "axisBand": {"grid": False}, + "axisX": {"gridWidth": 0.2}, + "axisY": {"gridDash": [3], "gridWidth": 0.4}, + "background": "#fff", + "legend": {"labelFontSize": 11, "padding": 1, "symbolType": "square"}, + "line": {"stroke": "#3e5c69"}, + "path": {"stroke": "#3e5c69"}, + "range": { + "category": [ + "#3e5c69", + "#6793a6", + "#182429", + "#0570b0", + "#3690c0", + "#74a9cf", + "#a6bddb", + "#e2ddf2", + ] + }, + "rect": {"fill": "#3e5c69"}, + "shape": {"stroke": "#3e5c69"}, + "symbol": {"fill": "#3e5c69"}, + } From ff364a1db38dc4311e28ac54cd8ab8276adf98d6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:52:08 +0100 Subject: [PATCH 085/139] test: Remove `Vega`-only properties from theme tests "group", "path", "shape", "symbol" all appear in a `vega-themes` definition. Haven't found any documentation on this, for `vega-lite`. All of these properties are not mentioned in the `Config` schema --- tests/vegalite/v5/test_theme.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 65dbd9ddd..03abd2ce4 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -188,7 +188,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "symbolType": "square", }, "line": {"stroke": "#4572a7", "strokeWidth": 2}, - "path": {"stroke": "#4572a7"}, "range": { "category": [ "#4572a7", @@ -204,8 +203,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ] }, "rect": {"fill": "#4572a7"}, - "shape": {"stroke": "#4572a7"}, - "symbol": {"fill": "#4572a7", "size": 50, "strokeWidth": 1.5}, } fivethirtyeight: ThemeConfig = { "arc": {"fill": "#30a2da"}, @@ -227,7 +224,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "axisBand": {"grid": False}, "background": "#f0f0f0", "bar": {"binSpacing": 2, "fill": "#30a2da", "stroke": None}, - "group": {"fill": "#f0f0f0"}, "legend": { "labelColor": "#333", "labelFontSize": 11, @@ -239,7 +235,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "titlePadding": 10, }, "line": {"stroke": "#30a2da", "strokeWidth": 2}, - "path": {"stroke": "#30a2da", "strokeWidth": 0.5}, "point": {"filled": True, "shape": "circle"}, "range": { "category": [ @@ -267,7 +262,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "heatmap": ["#d6e8ed", "#cee0e5", "#91bfd9", "#549cc6", "#1d78b5"], }, "rect": {"fill": "#30a2da"}, - "shape": {"stroke": "#30a2da"}, "title": {"anchor": "start", "fontSize": 24, "fontWeight": 600, "offset": 20}, } ggplot2: ThemeConfig = { @@ -285,10 +279,8 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "titleFontSize": 16, "titleFontWeight": "normal", }, - "group": {"fill": "#e5e5e5"}, "legend": {"labelBaseline": "middle", "labelFontSize": 11, "symbolSize": 40}, "line": {"stroke": "#000"}, - "path": {"stroke": "#000"}, "range": { "category": [ "#000000", @@ -304,8 +296,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ] }, "rect": {"fill": "#000"}, - "shape": {"stroke": "#000"}, - "symbol": {"fill": "#000", "size": 40}, } googlecharts: ThemeConfig = { "arc": {"fill": "#3366CC"}, @@ -385,7 +375,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "titleFontWeight": "normal", }, "line": {"stroke": "#82c6df", "strokeWidth": 2}, - "path": {"stroke": "#82c6df"}, "range": { "category": [ "#ec8431", @@ -432,8 +421,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ], }, "rect": {"fill": "#82c6df"}, - "shape": {"stroke": "#82c6df"}, - "symbol": {"fill": "#82c6df", "size": 30}, "title": { "anchor": "start", "color": "#000000", @@ -493,7 +480,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "strokeJoin": "round", "strokeWidth": 3, }, - "path": {"stroke": "#118DFF"}, "point": {"fill": "#118DFF", "filled": True, "size": 75}, "range": { "category": [ @@ -522,8 +508,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ], }, "rect": {"fill": "#118DFF"}, - "shape": {"stroke": "#118DFF"}, - "symbol": {"fill": "#118DFF", "size": 50, "strokeWidth": 1.5}, "text": {"fill": "#605E5C", "font": "Segoe UI", "fontSize": 12}, "view": {"stroke": "transparent"}, } @@ -550,7 +534,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "symbolType": "square", }, "line": {"stroke": "#ab5787"}, - "path": {"stroke": "#ab5787"}, "range": { "category": [ "#ab5787", @@ -566,8 +549,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ] }, "rect": {"fill": "#ab5787"}, - "shape": {"stroke": "#ab5787"}, - "symbol": {"fill": "#ab5787", "size": 30}, } urbaninstitute: ThemeConfig = { "arc": {"fill": "#1696d2"}, @@ -615,7 +596,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "titlePadding": 10, }, "line": {"color": "#1696d2", "stroke": "#1696d2", "strokeWidth": 5}, - "path": {"stroke": "#1696d2", "strokeWidth": 0.5}, "point": {"filled": True}, "range": { "category": [ @@ -666,9 +646,7 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ], }, "rect": {"fill": "#1696d2"}, - "shape": {"stroke": "#1696d2"}, "style": {"bar": {"fill": "#1696d2", "stroke": None}}, - "symbol": {"fill": "#1696d2", "size": 30}, "text": { "align": "center", "color": "#1696d2", @@ -698,7 +676,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "background": "#fff", "legend": {"labelFontSize": 11, "padding": 1, "symbolType": "square"}, "line": {"stroke": "#3e5c69"}, - "path": {"stroke": "#3e5c69"}, "range": { "category": [ "#3e5c69", @@ -712,6 +689,4 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ] }, "rect": {"fill": "#3e5c69"}, - "shape": {"stroke": "#3e5c69"}, - "symbol": {"fill": "#3e5c69"}, } From bf36b6917db889954db2dacef2ed0f9b129ce725 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:55:20 +0100 Subject: [PATCH 086/139] fix(typing): Misc typing fixes --- tools/generate_schema_wrapper.py | 10 ++++++++-- tools/schemapi/codegen.py | 3 ++- tools/schemapi/utils.py | 12 ++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index daf0d3704..769978231 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -349,6 +349,8 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: ''' +_ChannelType = Literal["field", "datum", "value"] + class SchemaGenerator(codegen.SchemaGenerator): schema_class_template = textwrap.dedent( @@ -533,8 +535,10 @@ def recursive_dict_update(schema: dict, root: dict, def_dict: dict) -> None: def get_field_datum_value_defs( propschema: SchemaInfo, root: dict[str, Any] -) -> dict[str, str]: - def_dict: dict[str, str | None] = dict.fromkeys(("field", "datum", "value")) +) -> dict[_ChannelType, str]: + def_dict: dict[_ChannelType, str | None] = dict.fromkeys( + ("field", "datum", "value") + ) _schema = propschema.schema schema = _schema if isinstance(_schema, dict) else dict(_schema) if propschema.is_reference() and "properties" in schema: @@ -722,6 +726,8 @@ def generate_vegalite_channel_wrappers( temp_name = f"{classname}Value" channel_info.value_class_name = temp_name gen = ValueSchemaGenerator(temp_name, nodefault=["value"], **kwds) + else: + raise NotImplementedError class_defs.append(gen.schema_class()) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 4e7da36cf..cfa3d612c 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -133,7 +133,8 @@ def __init__({arglist}): """ ).lstrip() - def _process_description(self, description: str): + @staticmethod + def _process_description(description: str): return description def __init__( diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 6a03346f2..b47a56930 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -413,18 +413,18 @@ def to_type_repr( self, *, as_str: Literal[True] = ..., - target: TargetType = "doc", - use_concrete: bool = False, - use_undefined: bool = False, + target: TargetType = ..., + use_concrete: bool = ..., + use_undefined: bool = ..., ) -> str: ... @overload def to_type_repr( self, *, as_str: Literal[False], - target: TargetType = "doc", - use_concrete: bool = False, - use_undefined: bool = False, + target: TargetType = ..., + use_concrete: bool = ..., + use_undefined: bool = ..., ) -> list[str]: ... def to_type_repr( # noqa: C901 self, From 79804ec6b1ee009c83d6993e390a040832e3bafc Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:10:18 +0100 Subject: [PATCH 087/139] fix: Remove `Vega`-only properties from vendored `vega-themes.json` The fix here should allow these properties in the future - were they to become available in `Config` https://github.com/vega/altair/actions/runs/10789757058/job/29923430898?pr=3536 --- altair/vegalite/v5/schema/vega-themes.json | 142 --------------------- tools/generate_schema_wrapper.py | 21 ++- 2 files changed, 17 insertions(+), 146 deletions(-) diff --git a/altair/vegalite/v5/schema/vega-themes.json b/altair/vegalite/v5/schema/vega-themes.json index 22d8664b8..10ad14d5d 100644 --- a/altair/vegalite/v5/schema/vega-themes.json +++ b/altair/vegalite/v5/schema/vega-themes.json @@ -28,12 +28,6 @@ "circle": { "fill": "#6929c4" }, - "group": { - "fill": "#ffffff" - }, - "path": { - "stroke": "#6929c4" - }, "range": { "category": [ "#6929c4", @@ -85,9 +79,6 @@ "rect": { "fill": "#6929c4" }, - "shape": { - "stroke": "#6929c4" - }, "style": { "guide-label": { "fill": "#525252", @@ -100,9 +91,6 @@ "fontWeight": 400 } }, - "symbol": { - "stroke": "#6929c4" - }, "title": { "anchor": "start", "color": "#161616", @@ -145,12 +133,6 @@ "circle": { "fill": "#d4bbff" }, - "group": { - "fill": "#161616" - }, - "path": { - "stroke": "#d4bbff" - }, "range": { "category": [ "#8a3ffc", @@ -202,9 +184,6 @@ "rect": { "fill": "#d4bbff" }, - "shape": { - "stroke": "#d4bbff" - }, "style": { "guide-label": { "fill": "#c6c6c6", @@ -217,9 +196,6 @@ "fontWeight": 400 } }, - "symbol": { - "stroke": "#d4bbff" - }, "title": { "anchor": "start", "color": "#f4f4f4", @@ -262,12 +238,6 @@ "circle": { "fill": "#d4bbff" }, - "group": { - "fill": "#161616" - }, - "path": { - "stroke": "#d4bbff" - }, "range": { "category": [ "#8a3ffc", @@ -319,9 +289,6 @@ "rect": { "fill": "#d4bbff" }, - "shape": { - "stroke": "#d4bbff" - }, "style": { "guide-label": { "fill": "#c6c6c6", @@ -334,9 +301,6 @@ "fontWeight": 400 } }, - "symbol": { - "stroke": "#d4bbff" - }, "title": { "anchor": "start", "color": "#f4f4f4", @@ -379,12 +343,6 @@ "circle": { "fill": "#6929c4" }, - "group": { - "fill": "#ffffff" - }, - "path": { - "stroke": "#6929c4" - }, "range": { "category": [ "#6929c4", @@ -436,9 +394,6 @@ "rect": { "fill": "#6929c4" }, - "shape": { - "stroke": "#6929c4" - }, "style": { "guide-label": { "fill": "#525252", @@ -451,9 +406,6 @@ "fontWeight": 400 } }, - "symbol": { - "stroke": "#6929c4" - }, "title": { "anchor": "start", "color": "#161616", @@ -522,9 +474,6 @@ "stroke": "#4572a7", "strokeWidth": 2 }, - "path": { - "stroke": "#4572a7" - }, "range": { "category": [ "#4572a7", @@ -541,14 +490,6 @@ }, "rect": { "fill": "#4572a7" - }, - "shape": { - "stroke": "#4572a7" - }, - "symbol": { - "fill": "#4572a7", - "size": 50, - "strokeWidth": 1.5 } }, "fivethirtyeight": { @@ -581,9 +522,6 @@ "fill": "#30a2da", "stroke": null }, - "group": { - "fill": "#f0f0f0" - }, "legend": { "labelColor": "#333", "labelFontSize": 11, @@ -598,10 +536,6 @@ "stroke": "#30a2da", "strokeWidth": 2 }, - "path": { - "stroke": "#30a2da", - "strokeWidth": 0.5 - }, "point": { "filled": true, "shape": "circle" @@ -640,9 +574,6 @@ "rect": { "fill": "#30a2da" }, - "shape": { - "stroke": "#30a2da" - }, "title": { "anchor": "start", "fontSize": 24, @@ -669,9 +600,6 @@ "titleFontSize": 16, "titleFontWeight": "normal" }, - "group": { - "fill": "#e5e5e5" - }, "legend": { "labelBaseline": "middle", "labelFontSize": 11, @@ -680,9 +608,6 @@ "line": { "stroke": "#000" }, - "path": { - "stroke": "#000" - }, "range": { "category": [ "#000000", @@ -699,13 +624,6 @@ }, "rect": { "fill": "#000" - }, - "shape": { - "stroke": "#000" - }, - "symbol": { - "fill": "#000", - "size": 40 } }, "googlecharts": { @@ -731,9 +649,6 @@ "right": 10, "top": 10 }, - "path": { - "stroke": "#3366CC" - }, "range": { "category": [ "#4285F4", @@ -758,9 +673,6 @@ "rect": { "fill": "#3366CC" }, - "shape": { - "stroke": "#3366CC" - }, "style": { "group-title": { "font": "Arial, sans-serif", @@ -775,9 +687,6 @@ "fontSize": 12 } }, - "symbol": { - "stroke": "#3366CC" - }, "title": { "anchor": "start", "dy": -3, @@ -829,9 +738,6 @@ "stroke": "#82c6df", "strokeWidth": 2 }, - "path": { - "stroke": "#82c6df" - }, "range": { "category": [ "#ec8431", @@ -880,13 +786,6 @@ "rect": { "fill": "#82c6df" }, - "shape": { - "stroke": "#82c6df" - }, - "symbol": { - "fill": "#82c6df", - "size": 30 - }, "title": { "anchor": "start", "color": "#000000", @@ -963,9 +862,6 @@ "strokeJoin": "round", "strokeWidth": 3 }, - "path": { - "stroke": "#118DFF" - }, "point": { "fill": "#118DFF", "filled": true, @@ -1006,14 +902,6 @@ "rect": { "fill": "#118DFF" }, - "shape": { - "stroke": "#118DFF" - }, - "symbol": { - "fill": "#118DFF", - "size": 50, - "strokeWidth": 1.5 - }, "text": { "fill": "#605E5C", "font": "Segoe UI", @@ -1061,9 +949,6 @@ "line": { "stroke": "#ab5787" }, - "path": { - "stroke": "#ab5787" - }, "range": { "category": [ "#ab5787", @@ -1080,13 +965,6 @@ }, "rect": { "fill": "#ab5787" - }, - "shape": { - "stroke": "#ab5787" - }, - "symbol": { - "fill": "#ab5787", - "size": 30 } }, "urbaninstitute": { @@ -1143,10 +1021,6 @@ "stroke": "#1696d2", "strokeWidth": 5 }, - "path": { - "stroke": "#1696d2", - "strokeWidth": 0.5 - }, "point": { "filled": true }, @@ -1201,19 +1075,12 @@ "rect": { "fill": "#1696d2" }, - "shape": { - "stroke": "#1696d2" - }, "style": { "bar": { "fill": "#1696d2", "stroke": null } }, - "symbol": { - "fill": "#1696d2", - "size": 30 - }, "text": { "align": "center", "color": "#1696d2", @@ -1273,9 +1140,6 @@ "line": { "stroke": "#3e5c69" }, - "path": { - "stroke": "#3e5c69" - }, "range": { "category": [ "#3e5c69", @@ -1290,12 +1154,6 @@ }, "rect": { "fill": "#3e5c69" - }, - "shape": { - "stroke": "#3e5c69" - }, - "symbol": { - "fill": "#3e5c69" } } } \ No newline at end of file diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 769978231..0913dc1c9 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -49,6 +49,8 @@ """ SCHEMA_URL_TEMPLATE: Final = "https://vega.github.io/schema/{library}/{version}.json" +SCHEMA_FILE = "vega-lite-schema.json" +THEMES_FILE = "vega-themes.json" CHANNEL_MYPY_IGNORE_STATEMENTS: Final = """\ # These errors need to be ignored as they come from the overload methods @@ -448,7 +450,7 @@ def download_schemafile( url = schema_url(version=version) schemadir = Path(schemapath) schemadir.mkdir(parents=True, exist_ok=True) - fp = schemadir / "vega-lite-schema.json" + fp = schemadir / SCHEMA_FILE if not skip_download: request.urlretrieve(url, fp) elif not fp.exists(): @@ -457,8 +459,19 @@ def download_schemafile( return fp +def _vega_lite_props_only( + themes: dict[str, dict[str, Any]], props: SchemaProperties, / +) -> Iterator[tuple[str, dict[str, Any]]]: + """Removes properties that are allowed in `Vega` but not `Vega-Lite` from theme definitions.""" + keep = props.keys() + for name, theme_spec in themes.items(): + yield name, {k: v for k, v in theme_spec.items() if k in keep} + + def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: - themes = vlc.get_themes() + root = load_schema(fp.parent / SCHEMA_FILE) + vl_props = SchemaInfo({"$ref": "#/definitions/Config"}, root).properties + themes = dict(_vega_lite_props_only(vlc.get_themes(), vl_props)) data = json.dumps(themes, indent=indent, sort_keys=True) fp.write_text(data, encoding="utf8") @@ -636,7 +649,7 @@ def generate_vegalite_schema_wrapper(fp: Path, /) -> str: "from ._typing import * # noqa: F403", ), "\n" f"__all__ = {all_}\n", - LOAD_SCHEMA.format(schemafile="vega-lite-schema.json"), + LOAD_SCHEMA.format(schemafile=SCHEMA_FILE), BASE_SCHEMA.format(basename=basename), schema_class( "Root", @@ -929,7 +942,7 @@ def vegalite_main(skip_download: bool = False) -> None: skip_download=skip_download, ) - fp_themes = schemapath / "vega-themes.json" + fp_themes = schemapath / THEMES_FILE print(f"Updating themes\n {schemafile!s}\n ->{fp_themes!s}") update_vega_themes(fp_themes) From 0bdfa72470551b2bc39e4adc76b7e989ccdf259b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:10:09 +0100 Subject: [PATCH 088/139] fix: Support hyphenated keys in `TypedDict`(s) This support does not extend to `mypy`, so I've mentioned that in the doc. See https://peps.python.org/pep-0728/#reference-implementation https://github.com/vega/altair/actions/runs/10789757058/job/29923430898?pr=3536 --- altair/vegalite/v5/schema/_config.py | 21 +++++- tests/vegalite/v5/test_theme.py | 22 ++++-- tools/generate_schema_wrapper.py | 101 ++++++++++++++++++++------- tools/schemapi/utils.py | 15 +++- 4 files changed, 126 insertions(+), 33 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 22bab0032..787a6404a 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -3,8 +3,15 @@ from __future__ import annotations +import sys from typing import TYPE_CHECKING, Any, Literal, Sequence, TypedDict +if sys.version_info >= (3, 14): + from typing import TypedDict +else: + from typing_extensions import TypedDict + + if TYPE_CHECKING: # ruff: noqa: F405 from ._typing import * # noqa: F403 @@ -5837,7 +5844,7 @@ class SelectionConfigKwds(TypedDict, total=False): point: PointSelectionConfigWithoutTypeKwds -class StyleConfigIndexKwds(TypedDict, total=False): +class StyleConfigIndexKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] """ StyleConfigIndex ``TypedDict`` wrapper. @@ -5873,6 +5880,17 @@ class StyleConfigIndexKwds(TypedDict, total=False): Tick-Specific Config trail Trail-Specific Config + + Notes + ----- + The following keys may be specified as string literals **only**: + + ['group-subtitle', 'group-title', 'guide-label', 'guide-title'] + + See `PEP728`_ for type checker compatibility. + + .. _PEP728: + https://peps.python.org/pep-0728/#reference-implementation """ arc: RectConfigKwds @@ -5890,6 +5908,7 @@ class StyleConfigIndexKwds(TypedDict, total=False): text: MarkConfigKwds tick: TickConfigKwds trail: LineConfigKwds + __extra_items__: MarkConfigKwds class TickConfigKwds(TypedDict, total=False): diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 03abd2ce4..a18268d9c 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -139,7 +139,7 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "fill": "#525252", "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', "fontWeight": 400, - }, + }, # type: ignore[typeddict-unknown-key] "guide-title": { "fill": "#525252", "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', @@ -161,7 +161,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: dark = ThemeConfig( axis={"domainColor": "#fff", "gridColor": "#888", "tickColor": "#fff"}, background="#333", - style={"guide-label": {"fill": "#fff"}, "guide-title": {"fill": "#fff"}}, + style={ + "guide-label": {"fill": "#fff"}, + "guide-title": {"fill": "#fff"}, + }, # type: ignore[typeddict-unknown-key] title={"color": "#fff", "subtitleColor": "#fff"}, view={"stroke": "#888"}, ) @@ -330,9 +333,18 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "rect": {"fill": "#3366CC"}, "shape": {"stroke": "#3366CC"}, "style": { - "group-title": {"font": "Arial, sans-serif", "fontSize": 12}, - "guide-label": {"font": "Arial, sans-serif", "fontSize": 12}, - "guide-title": {"font": "Arial, sans-serif", "fontSize": 12}, + "group-title": { # type: ignore[typeddict-unknown-key] + "font": "Arial, sans-serif", + "fontSize": 12, + }, + "guide-label": { + "font": "Arial, sans-serif", + "fontSize": 12, + }, + "guide-title": { + "font": "Arial, sans-serif", + "fontSize": 12, + }, }, "symbol": {"stroke": "#3366CC"}, "title": { diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 0913dc1c9..3a4531b90 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -22,6 +22,7 @@ from tools.schemapi.utils import ( SchemaProperties, TypeAliasTracer, + finalize_type_reprs, get_valid_identifier, import_type_checking, import_typing_extensions, @@ -227,22 +228,28 @@ def configure_{prop}(self, *args, **kwargs) -> Self: copy.config["{prop}"] = core.{classname}(*args, **kwargs) return copy """ +UNIVERSAL_TYPED_DICT = ''' +class {name}(TypedDict{init_subclass_args}):{comment} + """{doc}""" -CONFIG_TYPED_DICT: Final = ''' -class ThemeConfig(TypedDict, total=False): - """Top-Level Configuration ``TypedDict`` for creating a consistent theme. - {doc}""" {typed_dict_args} - ''' +THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" +THEME_CONFIG_SUMMARY = ( + "Top-Level Configuration ``TypedDict`` for creating a consistent theme." +) +EXTRA_ITEMS_MESSAGE = """\ + Notes + ----- + The following keys may be specified as string literals **only**: -CONFIG_SUB_TYPED_DICT: Final = ''' -class {name}(TypedDict, total=False): - """{doc}""" + {invalid_kwds} - {typed_dict_args} -''' + See `PEP728`_ for type checker compatibility. + .. _PEP728: + https://peps.python.org/pep-0728/#reference-implementation +""" ENCODE_METHOD: Final = ''' class _EncodingMixin: @@ -824,15 +831,14 @@ def _doc_args( info: SchemaInfo, *, kind: Literal["method", "typed_dict"] = "method", - generate_summary: bool = True, + summary: str | None = None, ) -> Iterator[str]: """Lazily build a docstring.""" props = info.properties if kind == "method": raise NotImplementedError elif kind == "typed_dict": - if generate_summary: - yield f"{info.title} ``TypedDict`` wrapper." + yield summary or f"{info.title} ``TypedDict`` wrapper." yield from ("", "Parameters", "----------") for p in codegen.get_args(info).required_kwds: yield f"{p}" @@ -853,23 +859,72 @@ def generate_mark_args( } -def generate_typed_dict_args(info: SchemaInfo, /) -> str: +def _typed_dict_args(info: SchemaInfo, /) -> str: args = codegen.get_args(info).required_kwds it = _signature_args(args, info.properties, kind="typed_dict") return "\n ".join(it) -def generate_typed_dict_doc(info: SchemaInfo, /, *, summary: bool = True) -> str: +def _typed_dict_doc(info: SchemaInfo, /, *, summary: str | None = None) -> str: return indent_docstring( - _doc_args(info, kind="typed_dict", generate_summary=summary), + _doc_args(info, kind="typed_dict", summary=summary), indent_level=4, lstrip=False, ) +def generate_typed_dict( + info: SchemaInfo, name: str, *, summary: str | None = None +) -> str: + """ + _summary_. + + TODO: Tidy up, finish doc + + Parameters + ---------- + info + Schema. + name + Full target class name. + Include a pre/post-fix if ``SchemaInfo.title`` already exists. + summary + When provided, used instead of generated summary line. + """ + TARGET: Literal["annotation"] = "annotation" + arg_info = codegen.get_args(info) + init_subclass_args = ", total=False" + comment = "" + td_args = _typed_dict_args(info) + td_doc = _typed_dict_doc(info, summary=summary) + if kwds := arg_info.invalid_kwds: + init_subclass_args = ", closed=True, total=False" + comment = " # type: ignore[call-arg]" + props = info.properties + kwds_all_tps = chain.from_iterable( + props[p].to_type_repr(as_str=False, target=TARGET, use_concrete=True) + for p in kwds + ) + td_args = ( + f"{td_args}\n " + f"__extra_items__: {finalize_type_reprs(kwds_all_tps, target=TARGET)}" + ) + td_doc = ( + f"{td_doc}\n" + f"{EXTRA_ITEMS_MESSAGE.format(invalid_kwds=repr(sorted(kwds)))}" + ) + + return UNIVERSAL_TYPED_DICT.format( + name=name, + init_subclass_args=init_subclass_args, + comment=comment, + doc=td_doc, + typed_dict_args=td_args, + ) + + def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: KWDS: Literal["Kwds"] = "Kwds" - THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" config = SchemaInfo({"$ref": "#/definitions/Config"}, load_schema(fp)) relevant: dict[str, SchemaInfo] = { @@ -881,20 +936,13 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in relevant) config_sub: Iterator[str] = ( - CONFIG_SUB_TYPED_DICT.format( - name=f"{info.title}{KWDS}", - typed_dict_args=generate_typed_dict_args(info), - doc=generate_typed_dict_doc(info), - ) + generate_typed_dict(info, name=f"{info.title}{KWDS}") for info in relevant.values() ) config_sub_names = (f"{nm}{KWDS}" for nm in relevant) yield f"__all__ = {[*config_sub_names, THEME_CONFIG]}\n\n" yield "\n".join(config_sub) - yield CONFIG_TYPED_DICT.format( - typed_dict_args=generate_typed_dict_args(config), - doc=generate_typed_dict_doc(config, summary=False), - ) + yield generate_typed_dict(config, THEME_CONFIG, summary=THEME_CONFIG_SUMMARY) def find_theme_config_targets(info: SchemaInfo, depth: int = 0, /) -> set[SchemaInfo]: @@ -1007,6 +1055,7 @@ def vegalite_main(skip_download: bool = False) -> None: content_theme_config = [ HEADER, "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", + import_typing_extensions((3, 14), "TypedDict", include_sys=True), "\n\n", import_type_checking("from ._typing import * # noqa: F403"), "\n\n", diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index b47a56930..5466e5cdc 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -960,6 +960,18 @@ def collapse_type_repr( raise TypeError(msg) +def finalize_type_reprs( + tps: Iterable[str], + /, + *, + target: TargetType, + use_undefined: bool = False, +) -> str: + return collapse_type_repr( + sort_type_reprs(tps), target=target, use_undefined=use_undefined + ) + + def sort_type_reprs(tps: Iterable[str], /) -> list[str]: # Shorter types are usually the more relevant ones, e.g. `str` instead # of `SchemaBase`. Output order from set is non-deterministic -> If @@ -968,7 +980,8 @@ def sort_type_reprs(tps: Iterable[str], /) -> list[str]: # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts # for more infos. # Using lower as we don't want to prefer uppercase such as "None" over - it = sorted(tps, key=str.lower) # Tertiary sort + dedup = tps if isinstance(tps, set) else set(tps) + it = sorted(dedup, key=str.lower) # Tertiary sort it = sorted(it, key=len) # Secondary sort return sorted(it, key=TypeAliasTracer.is_cached) # Primary sort From 427a0ddf66c9dc26bd138f79f16d085c42adea33 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:12:39 +0100 Subject: [PATCH 089/139] chore: Add note on remaining issue --- tests/vegalite/v5/test_theme.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index a18268d9c..c62a649c0 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -60,6 +60,9 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: Declares most of the default themes as ``ThemeConfig``. Adding a typed argument to the signature ensures ``mypy`` checks this. + + ## Missing + ### Padding inline dict """ # ruff: noqa: F841 @@ -311,7 +314,12 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: }, "background": "#fff", "circle": {"fill": "#3366CC"}, - "padding": {"bottom": 10, "left": 10, "right": 10, "top": 10}, + "padding": { + "bottom": 10, + "left": 10, + "right": 10, + "top": 10, + }, # FIXME: [typeddict-item] "path": {"stroke": "#3366CC"}, "range": { "category": [ From e564ca5a9a163d40669a0e9f1634fe93d16d9ea5 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:03:14 +0100 Subject: [PATCH 090/139] fix(DRAFT): Hack workaround for `Padding` https://github.com/vega/altair/pull/3536#discussion_r1750768426 --- altair/vegalite/v5/schema/_config.py | 2 +- tools/schemapi/utils.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 787a6404a..e92fea49f 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -7076,7 +7076,7 @@ class ThemeConfig(TypedDict, total=False): normalizedNumberFormatType: str numberFormat: str numberFormatType: str - padding: float + padding: float | Map params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] point: MarkConfigKwds projection: ProjectionConfigKwds diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 5466e5cdc..da832588a 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -549,6 +549,8 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: tps.add(f"Value[{t}]") elif title in REMAP_TITLE: tps.add(REMAP_TITLE[title]) + elif title == "Padding": + tps.update(("float", "Map")) elif ( (title not in EXCLUDE_TITLE) and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) From 73f6b251330b742c05a19e6f475cacd830ced48f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:15:11 +0100 Subject: [PATCH 091/139] test: Adds `binste_altair_theme` Author @binste https://gist.github.com/binste/b4042fa76a89d72d45cbbb9355ec6906 https://github.com/vega/altair/pull/3536#discussion_r1747701361 --- tests/vegalite/v5/test_theme.py | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index c62a649c0..24c3b1162 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -710,3 +710,60 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: }, "rect": {"fill": "#3e5c69"}, } + + +def binste_altair_theme() -> ThemeConfig: + """Copied from https://gist.github.com/binste/b4042fa76a89d72d45cbbb9355ec6906.""" + return ThemeConfig( + { + "axis": { + "labelFontSize": 16, + "titleFontSize": 16, + "titleFontWeight": "normal", + "gridColor": "lightGray", + "labelAngle": 0, + "labelFlush": False, + "labelPadding": 5, + }, + "axisY": { + "domain": False, + "ticks": False, + "labelPadding": 10, + "titleAngle": 0, + "titleY": -20, + "titleAlign": "left", + "titlePadding": 0, + }, + "axisTemporal": {"grid": False}, + "axisDiscrete": {"ticks": False, "labelPadding": 10, "grid": False}, + "scale": {"barBandPaddingInner": 0.2}, + "header": {"labelFontSize": 16, "titleFontSize": 16}, + "legend": { + "labelFontSize": 16, + "titleFontSize": 16, + "titleFontWeight": "normal", + }, + "title": { + "fontSize": 20, + "fontStyle": "normal", + "align": "left", + "anchor": "start", + "orient": "top", + "fontWeight": 600, + "offset": 10, + "subtitlePadding": 3, + "subtitleFontSize": 16, + }, + "view": { + "strokeWidth": 0, + "continuousHeight": 350, + "continuousWidth": 600, + "step": 50, + }, + "line": {"strokeWidth": 3.5}, + "text": {"fontSize": 16}, + "circle": {"size": 60}, + "point": {"size": 60}, + "square": {"size": 60}, + } + ) From ab41cb7c976b7add1ab76b54b14938b1b9300402 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:28:29 +0100 Subject: [PATCH 092/139] test: Adds `husky_theme` - https://github.com/deppen8/husky-altair-theme - https://github.com/vega/altair/issues/3519#issuecomment-2292010192 --- tests/vegalite/v5/test_theme.py | 117 ++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 24c3b1162..cefc53ff1 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -767,3 +767,120 @@ def binste_altair_theme() -> ThemeConfig: "square": {"size": 60}, } ) + + +def husky_theme() -> ThemeConfig: + """ + Adapted from https://github.com/deppen8/husky-altair-theme/blob/46f680532ee38c44e656903d3f1affe11b9982bb/husky_theme.py. + + Keeps 2 errors present in the original (marked by `# type: ignore[...]`). + """ + PURPLE = "#4b2e83" + GOLD = "#b7a57a" + METALLIC_GOLD = "#85754d" + LIGHT_GRAY = "#d9d9d9" + DARK_GRAY = "#444444" + BLACK = "#000000" + + HEADER_FONT = "EncodeSans-Regular" + BODY_FONT = "OpenSans-Regular" + BODY_FONT_BOLD = "OpenSans-Bold" + + return ThemeConfig( + { + "title": { + "fontSize": 18, + "font": HEADER_FONT, + "anchor": "start", + "color": PURPLE, + }, + "axisX": { + "domain": True, + "domainColor": DARK_GRAY, + "domainWidth": 1, + "grid": True, + "gridColor": LIGHT_GRAY, + "gridWidth": 0.5, + "labelFont": BODY_FONT, + "labelFontSize": 12, + "labelColor": DARK_GRAY, + "labelAngle": 0, + "tickColor": DARK_GRAY, + "tickSize": 5, + "titleFont": BODY_FONT_BOLD, + "titleFontSize": 12, + }, + "axisY": { + "domain": True, + "domainColor": DARK_GRAY, + "grid": True, + "gridColor": LIGHT_GRAY, + "gridWidth": 0.5, + "labelFont": BODY_FONT, + "labelFontSize": 12, + "labelAngle": 0, + "ticks": True, + "titleFont": BODY_FONT_BOLD, + "titleFontSize": 12, + }, + "header": { + "labelFont": BODY_FONT, + "labelFontSize": 16, + "titleFont": BODY_FONT_BOLD, + "titleFontSize": 16, + }, + "range": { + "category": [ + PURPLE, + GOLD, + LIGHT_GRAY, + METALLIC_GOLD, + BLACK, + DARK_GRAY, + ], + "diverging": [PURPLE, "#c2a5cf", LIGHT_GRAY, GOLD, METALLIC_GOLD], + }, + "legend": { + "labelFont": BODY_FONT, + "labelFontSize": 12, + "symbolSize": 100, + "titleFont": BODY_FONT_BOLD, + "titleFontSize": 12, + }, + "area": { + "fill": PURPLE, + }, + "circle": {"fill": PURPLE, "size": 40}, + "line": { + "color": PURPLE, + "stroke": PURPLE, + "strokeWidth": 3, + }, + "trail": { + "color": PURPLE, + "stroke": PURPLE, + "strokeWidth": 0, + "size": 1, + }, + "path": { + "stroke": PURPLE, + "strokeWidth": 0.5, + }, # type: ignore[typeddict-unknown-key] + "point": {"color": PURPLE, "size": 40}, + "text": { + "font": BODY_FONT, + "color": PURPLE, + "fontSize": 11, + "align": "right", + "size": 14, + }, + "bar": { + "size": 10, + "binSpacing": 1, + "continuousBandSize": 10, + "fill": PURPLE, + "stroke": False, # type: ignore[typeddict-item] + }, + "tick": {"color": PURPLE}, + }, + ) From 1dc4c059574b40d31831cb21628e19d918a0a217 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:43:56 +0100 Subject: [PATCH 093/139] test: Refactor, add runtime testing of `ThemeConfig` --- tests/vegalite/v5/test_theme.py | 152 +++++++++++++++++++++++--------- 1 file changed, 108 insertions(+), 44 deletions(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index cefc53ff1..34d753b6b 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any +from typing import TYPE_CHECKING, Any, Callable, cast import pytest @@ -9,9 +9,17 @@ from altair.vegalite.v5.schema._typing import is_color_hex from altair.vegalite.v5.theme import VEGA_THEMES, register_theme, themes +if TYPE_CHECKING: + import sys + + if sys.version_info >= (3, 11): + from typing import LiteralString + else: + from typing_extensions import LiteralString + @pytest.fixture -def chart(): +def chart() -> alt.Chart: return alt.Chart("data.csv").mark_bar().encode(x="x:Q") @@ -55,18 +63,14 @@ def test_is_color_hex(color_code: Any, *, valid: bool) -> None: assert is_color_hex(color_code) == valid -def test_theme_config_typing(*, enable_mypy: bool = True) -> None: +def carbonwhite_theme() -> ThemeConfig: """ - Declares most of the default themes as ``ThemeConfig``. - - Adding a typed argument to the signature ensures ``mypy`` checks this. + Only including **1/4** of `carbon`_ , which gives sufficient structural coverage. - ## Missing - ### Padding inline dict + .. _carbon: + https://github.com/vega/vega-themes/blob/5f1a5c5b22cc462cf3d46894212152b71cfe964f/src/carbongen.ts """ - # ruff: noqa: F841 - - carbonwhite: ThemeConfig = { + return { "arc": {"fill": "#6929c4"}, "area": {"fill": "#6929c4"}, "axis": { @@ -85,8 +89,6 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "axisY": {"titlePadding": 2.5}, "background": "#ffffff", "circle": {"fill": "#6929c4"}, - "group": {"fill": "#ffffff"}, - "path": {"stroke": "#6929c4"}, "range": { "category": [ "#6929c4", @@ -136,20 +138,18 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: ], }, "rect": {"fill": "#6929c4"}, - "shape": {"stroke": "#6929c4"}, "style": { "guide-label": { "fill": "#525252", "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', "fontWeight": 400, - }, # type: ignore[typeddict-unknown-key] + }, "guide-title": { "fill": "#525252", "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', "fontWeight": 400, }, - }, - "symbol": {"stroke": "#6929c4"}, + }, # type: ignore[typeddict-unknown-key] "title": { "anchor": "start", "color": "#161616", @@ -161,7 +161,9 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "view": {"fill": "#ffffff", "stroke": "#ffffff"}, } - dark = ThemeConfig( + +def dark_theme() -> ThemeConfig: + return ThemeConfig( axis={"domainColor": "#fff", "gridColor": "#888", "tickColor": "#fff"}, background="#333", style={ @@ -172,7 +174,9 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: view={"stroke": "#888"}, ) - excel: ThemeConfig = { + +def excel_theme() -> ThemeConfig: + return { "arc": {"fill": "#4572a7"}, "area": {"fill": "#4572a7"}, "axis": { @@ -210,7 +214,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: }, "rect": {"fill": "#4572a7"}, } - fivethirtyeight: ThemeConfig = { + + +def fivethirtyeight_theme() -> ThemeConfig: + return { "arc": {"fill": "#30a2da"}, "area": {"fill": "#30a2da"}, "axis": { @@ -270,7 +277,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "rect": {"fill": "#30a2da"}, "title": {"anchor": "start", "fontSize": 24, "fontWeight": 600, "offset": 20}, } - ggplot2: ThemeConfig = { + + +def ggplot2_theme() -> ThemeConfig: + return { "arc": {"fill": "#000"}, "area": {"fill": "#000"}, "axis": { @@ -303,7 +313,12 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: }, "rect": {"fill": "#000"}, } - googlecharts: ThemeConfig = { + + +# FIXME: Support key-completion for `ThemeConfig.padding` ``Padding`` +def googlecharts_theme() -> ThemeConfig: + """``Padding`` definition `float | Map` needs to be stricter.""" + return { "arc": {"fill": "#3366CC"}, "area": {"fill": "#3366CC"}, "axis": { @@ -319,8 +334,7 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "left": 10, "right": 10, "top": 10, - }, # FIXME: [typeddict-item] - "path": {"stroke": "#3366CC"}, + }, "range": { "category": [ "#4285F4", @@ -339,22 +353,11 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "heatmap": ["#c6dafc", "#5e97f6", "#2a56c6"], }, "rect": {"fill": "#3366CC"}, - "shape": {"stroke": "#3366CC"}, "style": { - "group-title": { # type: ignore[typeddict-unknown-key] - "font": "Arial, sans-serif", - "fontSize": 12, - }, - "guide-label": { - "font": "Arial, sans-serif", - "fontSize": 12, - }, - "guide-title": { - "font": "Arial, sans-serif", - "fontSize": 12, - }, - }, - "symbol": {"stroke": "#3366CC"}, + "group-title": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-label": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-title": {"font": "Arial, sans-serif", "fontSize": 12}, + }, # type: ignore[typeddict-unknown-key] "title": { "anchor": "start", "dy": -3, @@ -363,7 +366,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "fontWeight": "bold", }, } - latimes: ThemeConfig = { + + +def latimes_theme() -> ThemeConfig: + return { "arc": {"fill": "#82c6df"}, "area": {"fill": "#82c6df"}, "axis": { @@ -449,7 +455,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "fontWeight": "normal", }, } - powerbi: ThemeConfig = { + + +def powerbi_theme() -> ThemeConfig: + return { "arc": {"fill": "#118DFF"}, "area": {"fill": "#118DFF", "line": True, "opacity": 0.6}, "axis": { @@ -531,7 +540,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "text": {"fill": "#605E5C", "font": "Segoe UI", "fontSize": 12}, "view": {"stroke": "transparent"}, } - quartz: ThemeConfig = { + + +def quartz_theme() -> ThemeConfig: + return { "arc": {"fill": "#ab5787"}, "area": {"fill": "#ab5787"}, "axis": { @@ -570,7 +582,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: }, "rect": {"fill": "#ab5787"}, } - urbaninstitute: ThemeConfig = { + + +def urbaninstitute_theme() -> ThemeConfig: + return { "arc": {"fill": "#1696d2"}, "area": {"fill": "#1696d2"}, "axisX": { @@ -679,7 +694,10 @@ def test_theme_config_typing(*, enable_mypy: bool = True) -> None: "trail": {"color": "#1696d2", "size": 1, "stroke": "#1696d2", "strokeWidth": 0}, "view": {"stroke": "transparent"}, } - vox: ThemeConfig = { + + +def vox_theme() -> ThemeConfig: + return { "arc": {"fill": "#3e5c69"}, "area": {"fill": "#3e5c69"}, "axis": { @@ -884,3 +902,49 @@ def husky_theme() -> ThemeConfig: "tick": {"color": PURPLE}, }, ) + + +known_themes: pytest.MarkDecorator = pytest.mark.parametrize( + "theme_func", + [ + carbonwhite_theme, + dark_theme, + excel_theme, + fivethirtyeight_theme, + ggplot2_theme, + googlecharts_theme, + latimes_theme, + powerbi_theme, + quartz_theme, + urbaninstitute_theme, + vox_theme, + binste_altair_theme, + husky_theme, + ], +) +""" +``pytest.mark.parametrize`` decorator. + +Provides themes from `vega-themes`_ and `other sources`_. + +Notes +----- +These are **redefined by hand** to run through a type checker. + +.. _vega-themes: + https://vega.github.io/vega-themes/ +.. _other sources: + https://github.com/vega/altair/issues/3519#issuecomment-2292010192 +""" + + +@known_themes +def test_theme_config(theme_func: Callable[[], ThemeConfig], chart) -> None: + """ + Simple-minded extra safety for themes. + + See ``(test_vega_themes|test_register_theme_decorator)`` for comprehensive suite. + """ + name = cast("LiteralString", theme_func.__qualname__) + register_theme(name, enable=True) + assert chart.to_dict(validate=True) From 5315a3d5a2ecb40cd7e17e849259daccb943cf3e Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:59:29 +0100 Subject: [PATCH 094/139] refactor: Reuse `finalize_type_reprs` - Extracted final steps of ``SchemaInfo.to_type_repr``. - Improved docs --- tools/schemapi/utils.py | 75 +++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index da832588a..bdb353cc6 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -508,11 +508,10 @@ def to_type_repr( # noqa: C901 # HACK: There is a single case that ends up empty here # See: https://github.com/vega/altair/pull/3536#discussion_r1714344162 tps = {"Map"} - type_reprs = sort_type_reprs(tps) return ( - collapse_type_repr(type_reprs, target=target, use_undefined=use_undefined) + finalize_type_reprs(tps, target=target, use_undefined=use_undefined) if as_str - else type_reprs + else sort_type_reprs(tps) ) def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: @@ -929,7 +928,7 @@ def flatten(container: Iterable) -> Iterable: yield i -def collapse_type_repr( +def finalize_type_reprs( tps: Iterable[str], /, *, @@ -937,19 +936,41 @@ def collapse_type_repr( use_undefined: bool = False, ) -> str: """ - Returns collected types as `str`. + Deduplicates, sorts, and returns ``tps`` as a single string. Parameters ---------- tps - Unique, sorted, `type_representations` + Collected type representations. target Destination for the type. - `'doc'` skips `Union`, `Optional` parts. + + .. note:: + `"doc"` skips ``(Union|Optional)`` wrappers. + use_undefined Wrap the result in `altair.typing.Optional`. Avoids exposing `UndefinedType`. """ + return _collapse_type_repr( + sort_type_reprs(tps), target=target, use_undefined=use_undefined + ) + + +def _collapse_type_repr( + tps: Iterable[str], + /, + *, + target: TargetType, + use_undefined: bool = False, +) -> str: + """ + Flatten unique types into a single string. + + See Also + -------- + - ``utils.finalize_type_reprs`` + """ tp_str = ", ".join(tps) if target == "doc": return tp_str @@ -962,26 +983,28 @@ def collapse_type_repr( raise TypeError(msg) -def finalize_type_reprs( - tps: Iterable[str], - /, - *, - target: TargetType, - use_undefined: bool = False, -) -> str: - return collapse_type_repr( - sort_type_reprs(tps), target=target, use_undefined=use_undefined - ) - - def sort_type_reprs(tps: Iterable[str], /) -> list[str]: - # Shorter types are usually the more relevant ones, e.g. `str` instead - # of `SchemaBase`. Output order from set is non-deterministic -> If - # types have same length names, order would be non-deterministic as it is - # returned from sort. Hence, we sort as well by type name as a tie-breaker, - # see https://docs.python.org/3.10/howto/sorting.html#sort-stability-and-complex-sorts - # for more infos. - # Using lower as we don't want to prefer uppercase such as "None" over + """ + Shorter types are usually the more relevant ones, e.g. `str` instead of `SchemaBase`. + + We use `set`_ for unique elements, but the lack of ordering requires additional sorts: + - If types have same length names, order would still be non-deterministic + - Hence, we sort as well by type name as a tie-breaker, see `sort-stability`_. + - Using ``str.lower`` gives priority to `builtins`_ over ``None``. + - Lowest priority is given to generated aliases from ``TypeAliasTracer``. + - These are purely to improve autocompletion + + Related + ------- + - https://github.com/vega/altair/pull/3573#discussion_r1747121600 + + .. _set: + https://docs.python.org/3/tutorial/datastructures.html#sets + .. _sort-stability: + https://docs.python.org/3/howto/sorting.html#sort-stability-and-complex-sorts + .. _builtins: + https://docs.python.org/3/library/functions.html + """ dedup = tps if isinstance(tps, set) else set(tps) it = sorted(dedup, key=str.lower) # Tertiary sort it = sorted(it, key=len) # Secondary sort From c816ca3b9c01ef49df60347ae3ab4e6747364187 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:49:57 +0100 Subject: [PATCH 095/139] chore: Rename `init_subclass_args` -> `metaclass_kwds` The latter is more accurate, there is no `__init__subclass__` involved - despite the similar syntax --- tools/generate_schema_wrapper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 3a4531b90..6acf71da7 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -229,7 +229,7 @@ def configure_{prop}(self, *args, **kwargs) -> Self: return copy """ UNIVERSAL_TYPED_DICT = ''' -class {name}(TypedDict{init_subclass_args}):{comment} +class {name}(TypedDict{metaclass_kwds}):{comment} """{doc}""" {typed_dict_args} @@ -893,12 +893,12 @@ def generate_typed_dict( """ TARGET: Literal["annotation"] = "annotation" arg_info = codegen.get_args(info) - init_subclass_args = ", total=False" + metaclass_kwds = ", total=False" comment = "" td_args = _typed_dict_args(info) td_doc = _typed_dict_doc(info, summary=summary) if kwds := arg_info.invalid_kwds: - init_subclass_args = ", closed=True, total=False" + metaclass_kwds = ", closed=True, total=False" comment = " # type: ignore[call-arg]" props = info.properties kwds_all_tps = chain.from_iterable( @@ -916,7 +916,7 @@ def generate_typed_dict( return UNIVERSAL_TYPED_DICT.format( name=name, - init_subclass_args=init_subclass_args, + metaclass_kwds=metaclass_kwds, comment=comment, doc=td_doc, typed_dict_args=td_args, From 7c55a35c53cac9783f27d2ecf35ce7cb8fbb4a2e Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:51:47 +0100 Subject: [PATCH 096/139] refactor: Use only `generate_typed_dict` for `TypedDict`(s) --- tools/generate_schema_wrapper.py | 50 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 6acf71da7..24c237ffa 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -234,11 +234,15 @@ class {name}(TypedDict{metaclass_kwds}):{comment} {typed_dict_args} ''' +ENCODE_KWDS: Literal["EncodeKwds"] = "EncodeKwds" THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" -THEME_CONFIG_SUMMARY = ( +ENCODE_KWDS_SUMMARY: Final = ( + "Encoding channels map properties of the data to visual properties of the chart." +) +THEME_CONFIG_SUMMARY: Final = ( "Top-Level Configuration ``TypedDict`` for creating a consistent theme." ) -EXTRA_ITEMS_MESSAGE = """\ +EXTRA_ITEMS_MESSAGE: Final = """\ Notes ----- The following keys may be specified as string literals **only**: @@ -277,13 +281,6 @@ def encode({method_args}) -> Self: return copy ''' -ENCODE_TYPED_DICT: Final = ''' -class EncodeKwds(TypedDict, total=False): - """Encoding channels map properties of the data to visual properties of the chart. - {docstring}""" - {channels} - -''' # NOTE: Not yet reasonable to generalize `TypeAliasType`, `TypeVar` # Revisit if this starts to become more common @@ -785,7 +782,9 @@ def generate_vegalite_channel_wrappers( "\n" f"__all__ = {sorted(all_)}\n", CHANNEL_MIXINS, *class_defs, - *generate_encoding_artifacts(channel_infos, ENCODE_METHOD, ENCODE_TYPED_DICT), + *generate_encoding_artifacts( + channel_infos, ENCODE_METHOD, facet_encoding=encoding + ), ] return "\n".join(contents) @@ -874,7 +873,11 @@ def _typed_dict_doc(info: SchemaInfo, /, *, summary: str | None = None) -> str: def generate_typed_dict( - info: SchemaInfo, name: str, *, summary: str | None = None + info: SchemaInfo, + name: str, + *, + summary: str | None = None, + override_args: Iterable[str] | None = None, ) -> str: """ _summary_. @@ -890,12 +893,22 @@ def generate_typed_dict( Include a pre/post-fix if ``SchemaInfo.title`` already exists. summary When provided, used instead of generated summary line. + override_args + Inject custom handling for types. + + Notes + ----- + - Internally handles keys that are not valid python identifiers """ TARGET: Literal["annotation"] = "annotation" arg_info = codegen.get_args(info) metaclass_kwds = ", total=False" comment = "" - td_args = _typed_dict_args(info) + td_args = ( + _typed_dict_args(info) + if override_args is None + else "\n ".join(override_args) + ) td_doc = _typed_dict_doc(info, summary=summary) if kwds := arg_info.invalid_kwds: metaclass_kwds = ", closed=True, total=False" @@ -1086,7 +1099,10 @@ def vegalite_main(skip_download: bool = False) -> None: def generate_encoding_artifacts( - channel_infos: dict[str, ChannelInfo], fmt_method: str, fmt_typed_dict: str + channel_infos: dict[str, ChannelInfo], + fmt_method: str, + *, + facet_encoding: SchemaInfo, ) -> Iterator[str]: """ Generate ``Chart.encode()`` and related typing structures. @@ -1141,9 +1157,11 @@ def generate_encoding_artifacts( method_args=", ".join(signature_args), docstring=indent_docstring(signature_doc_params, indent_level=8, lstrip=False), ) - typed_dict: str = fmt_typed_dict.format( - channels="\n ".join(typed_dict_args), - docstring=indent_docstring(typed_dict_doc_params, indent_level=4, lstrip=False), + typed_dict = generate_typed_dict( + facet_encoding, + ENCODE_KWDS, + summary=ENCODE_KWDS_SUMMARY, + override_args=typed_dict_args, ) artifacts: Iterable[str] = *type_aliases, method, typed_dict yield from artifacts From 44624ef253272cacccc1d69c1e90abd4bd9c353d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:20:27 +0100 Subject: [PATCH 097/139] refactor: Move `process_description` to `tools.schemapi.utils` Suspect this might have been used more dynamically in the past. Currently doesn't make sense defining across 3 files --- tools/generate_schema_wrapper.py | 29 +++-------------------------- tools/schemapi/codegen.py | 9 +++------ tools/schemapi/utils.py | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 32 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 24c237ffa..e3dd8a7f9 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -5,7 +5,6 @@ import argparse import copy import json -import re import sys import textwrap from dataclasses import dataclass @@ -18,6 +17,8 @@ import vl_convert as vlc sys.path.insert(0, str(Path.cwd())) + + from tools.schemapi import CodeSnippet, SchemaInfo, codegen from tools.schemapi.utils import ( SchemaProperties, @@ -27,8 +28,8 @@ import_type_checking, import_typing_extensions, indent_docstring, + process_description, resolve_references, - rst_parse, rst_syntax_for_class, ruff_format_py, ruff_write_lint_format_str, @@ -37,8 +38,6 @@ SCHEMA_VERSION: Final = "v5.20.1" -reLink = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.MULTILINE) -reSpecial = re.compile(r"[*_]{2,3}|`", re.MULTILINE) HEADER_COMMENT = """\ # The contents of this file are automatically written by @@ -369,28 +368,6 @@ class {classname}({basename}): ''' ) - @staticmethod - def _process_description(description: str) -> str: - return process_description(description) - - -def process_description(description: str) -> str: - # remove formatting from links - description = "".join( - [ - reSpecial.sub("", d) if i % 2 else d - for i, d in enumerate(reLink.split(description)) - ] - ) - description = rst_parse(description) - # Some entries in the Vega-Lite schema miss the second occurence of '__' - description = description.replace("__Default value: ", "__Default value:__ ") - # Fixing ambiguous unicode, RUF001 produces RUF002 in docs - description = description.replace("’", "'") # noqa: RUF001 [RIGHT SINGLE QUOTATION MARK] - description = description.replace("–", "-") # noqa: RUF001 [EN DASH] - description = description.replace(" ", " ") # noqa: RUF001 [NO-BREAK SPACE] - return description.strip() - class FieldSchemaGenerator(SchemaGenerator): schema_class_template = textwrap.dedent( diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index cfa3d612c..47322cc66 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -15,6 +15,7 @@ indent_docstring, is_valid_identifier, jsonschema_to_python_types, + process_description, spell_literal, ) @@ -133,10 +134,6 @@ def __init__({arglist}): """ ).lstrip() - @staticmethod - def _process_description(description: str): - return description - def __init__( self, classname: str, @@ -206,7 +203,7 @@ def docstring(self, indent: int = 0) -> str: # https://numpydoc.readthedocs.io/en/latest/format.html#extended-summary # Remove condition from description desc: str = re.sub(r"\n\{\n(\n|.)*\n\}", "", info.description) - ext_summary: list[str] = self._process_description(desc).splitlines() + ext_summary: list[str] = process_description(desc).splitlines() # Remove lines which contain the "raw-html" directive which cannot be processed # by Sphinx at this level of the docstring. It works for descriptions # of attributes which is why we do not do the same below. The removed @@ -228,7 +225,7 @@ def docstring(self, indent: int = 0) -> str: propinfo = info.properties[prop] doc += [ f"{prop} : {propinfo.to_type_repr()}", - f" {self._process_description(propinfo.deep_description)}", + f" {process_description(propinfo.deep_description)}", ] return indent_docstring(doc, indent_level=indent, width=100, lstrip=True) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index bdb353cc6..842444410 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -55,7 +55,10 @@ "array": "list", "null": "None", } + _VALID_IDENT: re.Pattern[str] = re.compile(r"^[^\d\W]\w*\Z", re.ASCII) +_RE_LINK: re.Pattern[str] = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.MULTILINE) +_RE_SPECIAL: re.Pattern[str] = re.compile(r"[*_]{2,3}|`", re.MULTILINE) _HASH_ENCODER = json.JSONEncoder(sort_keys=True, separators=(",", ":")) @@ -1184,3 +1187,19 @@ def import_typing_extensions( """ rst_parse: RSTParse = RSTParse(RSTRenderer()) + + +def process_description(description: str) -> str: + # remove formatting from links + description = "".join( + _RE_SPECIAL.sub("", d) if i % 2 else d + for i, d in enumerate(_RE_LINK.split(description)) + ) + description = rst_parse(description) + # Some entries in the Vega-Lite schema miss the second occurence of '__' + description = description.replace("__Default value: ", "__Default value:__ ") + # Fixing ambiguous unicode, RUF001 produces RUF002 in docs + description = description.replace("’", "'") # noqa: RUF001 [RIGHT SINGLE QUOTATION MARK] + description = description.replace("–", "-") # noqa: RUF001 [EN DASH] + description = description.replace(" ", " ") # noqa: RUF001 [NO-BREAK SPACE] + return description.strip() From b5e54d8c6653d0636c0dc1caaf2ab4dc423e05d3 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:23:41 +0100 Subject: [PATCH 098/139] docs: Add note to `SchemaGenerator.subclasses` --- tools/schemapi/codegen.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 47322cc66..18ad21051 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -157,7 +157,15 @@ def __init__( self.kwargs = kwargs def subclasses(self) -> Iterator[str]: - """Return an Iterator over subclass names, if any.""" + """ + Return an Iterator over subclass names, if any. + + NOTE + ---- + *Does not represent subclasses**. + + Represents a ``Union`` of schemas (``SchemaInfo.anyOf``). + """ for child in SchemaInfo(self.schema, self.rootschema).anyOf: if child.is_reference(): yield child.refname From 6d744f872c3ab06613dc8eeba833ec48408f499c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 17:53:40 +0100 Subject: [PATCH 099/139] refactor: Include `process_description` in `deep_description` Every usage of the property is wrapped in the call. No longer need to import in `generate_schema_wrapper.py` --- tools/generate_schema_wrapper.py | 5 ++--- tools/schemapi/codegen.py | 2 +- tools/schemapi/utils.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index e3dd8a7f9..d6b875f96 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -28,7 +28,6 @@ import_type_checking, import_typing_extensions, indent_docstring, - process_description, resolve_references, rst_syntax_for_class, ruff_format_py, @@ -818,7 +817,7 @@ def _doc_args( yield from ("", "Parameters", "----------") for p in codegen.get_args(info).required_kwds: yield f"{p}" - yield f" {process_description(props[p].deep_description)}" + yield f" {props[p].deep_description}" else: raise NotImplementedError @@ -1125,7 +1124,7 @@ def generate_encoding_artifacts( typed_dict_args.append(f"{channel}: {tp_inner}") signature_args.append(f"{channel}: Optional[{tp_inner}] = Undefined") - description: str = f" {process_description(info.deep_description)}" + description: str = f" {info.deep_description}" signature_doc_params.extend((f"{channel} : {doc_types_flat}", description)) typed_dict_doc_params.extend((f"{channel}", description)) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 18ad21051..f63fdcf58 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -233,7 +233,7 @@ def docstring(self, indent: int = 0) -> str: propinfo = info.properties[prop] doc += [ f"{prop} : {propinfo.to_type_repr()}", - f" {process_description(propinfo.deep_description)}", + f" {propinfo.deep_description}", ] return indent_docstring(doc, indent_level=indent, width=100, lstrip=True) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 842444410..402b759f0 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -642,7 +642,7 @@ def description(self) -> str: @property def deep_description(self) -> str: - return self._get_description(include_sublevels=True) + return process_description(self._get_description(include_sublevels=True)) def _get_description(self, include_sublevels: bool = False) -> str: desc = self.raw_schema.get("description", self.schema.get("description", "")) From dd05abd810c045c1780a32882419f7e7c64f871d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:31:42 +0100 Subject: [PATCH 100/139] perf: Replace relative links on entire description Previously was len(description.split()) times --- tools/schemapi/utils.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 402b759f0..83cdca9b0 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -905,12 +905,6 @@ def fix_docstring_issues(docstring: str) -> str: docstring, flags=re.MULTILINE, ) - - # Links to the vega-lite documentation cannot be relative but instead need to - # contain the full URL. - docstring = docstring.replace( - "types#datetime", "https://vega.github.io/vega-lite/docs/datetime.html" - ) return docstring @@ -1198,6 +1192,11 @@ def process_description(description: str) -> str: description = rst_parse(description) # Some entries in the Vega-Lite schema miss the second occurence of '__' description = description.replace("__Default value: ", "__Default value:__ ") + # Links to the vega-lite documentation cannot be relative but instead need to + # contain the full URL. + description = description.replace( + "types#datetime", "https://vega.github.io/vega-lite/docs/datetime.html" + ) # Fixing ambiguous unicode, RUF001 produces RUF002 in docs description = description.replace("’", "'") # noqa: RUF001 [RIGHT SINGLE QUOTATION MARK] description = description.replace("–", "-") # noqa: RUF001 [EN DASH] From bed12857c9533e8b94c2772f2a5b54c7c919afc9 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 19:17:21 +0100 Subject: [PATCH 101/139] refactor(perf): Compile patterns and tidy up `fix_docstring_issues` Still don't fully understand why this is written so verbosely --- tools/schemapi/utils.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 83cdca9b0..075c2b16a 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -32,6 +32,7 @@ if TYPE_CHECKING: from _collections_abc import KeysView from pathlib import Path + from re import Pattern from typing_extensions import LiteralString, Never, TypeAlias from mistune import BlockState @@ -56,9 +57,11 @@ "null": "None", } -_VALID_IDENT: re.Pattern[str] = re.compile(r"^[^\d\W]\w*\Z", re.ASCII) -_RE_LINK: re.Pattern[str] = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.MULTILINE) -_RE_SPECIAL: re.Pattern[str] = re.compile(r"[*_]{2,3}|`", re.MULTILINE) +_VALID_IDENT: Pattern[str] = re.compile(r"^[^\d\W]\w*\Z", re.ASCII) +_RE_LINK: Pattern[str] = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.MULTILINE) +_RE_SPECIAL: Pattern[str] = re.compile(r"[*_]{2,3}|`", re.MULTILINE) +_RE_LIST_MISSING_ASTERISK: Pattern[str] = re.compile(r"^-(?=[ `\"a-z])", re.MULTILINE) +_RE_LIST_MISSING_WHITESPACE: Pattern[str] = re.compile(r"^\*(?=[`\"a-z])", re.MULTILINE) _HASH_ENCODER = json.JSONEncoder(sort_keys=True, separators=(",", ":")) @@ -888,24 +891,20 @@ def indent_docstring( # noqa: C901 def fix_docstring_issues(docstring: str) -> str: - # All lists should start with '*' followed by a whitespace. Fixes the ones - # which either do not have a whitespace or/and start with '-' by first replacing - # "-" with "*" and then adding a whitespace where necessary - docstring = re.sub( - r"^-(?=[ `\"a-z])", - "*", - docstring, - flags=re.MULTILINE, - ) - # Now add a whitespace where an asterisk is followed by one of the characters - # in the square brackets of the regex pattern - docstring = re.sub( - r"^\*(?=[`\"a-z])", - "* ", - docstring, - flags=re.MULTILINE, + """ + All lists should start with `"* "`. + + 1. Fixes the ones which either do not have `" "` and/or start with `"-"` replacing `"-"` -> `"*"` and then adding `" "` where necessary. + 2. Now add a `" "` where a `"*"` is followed by one of the characters in the square brackets of the regex pattern. + + Parameters + ---------- + docstring + A processed docstring line. + """ + return _RE_LIST_MISSING_WHITESPACE.sub( + "* ", _RE_LIST_MISSING_ASTERISK.sub("*", docstring) ) - return docstring def rst_syntax_for_class(class_name: str) -> str: From 025aae5f6e34907a3526dc40d89e4877d8ba8ce1 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 20:15:13 +0100 Subject: [PATCH 102/139] chore: Remove unused code --- tools/generate_schema_wrapper.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index d6b875f96..32aa60160 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -1099,7 +1099,6 @@ def generate_encoding_artifacts( type_aliases: list[str] = [] typed_dict_args: list[str] = [] signature_doc_params: list[str] = ["", "Parameters", "----------"] - typed_dict_doc_params: list[str] = ["", "Parameters", "----------"] for channel, info in channel_infos.items(): alias_name: str = f"Channel{channel[0].upper()}{channel[1:]}" @@ -1127,7 +1126,6 @@ def generate_encoding_artifacts( description: str = f" {info.deep_description}" signature_doc_params.extend((f"{channel} : {doc_types_flat}", description)) - typed_dict_doc_params.extend((f"{channel}", description)) method: str = fmt_method.format( method_args=", ".join(signature_args), From 9bc28d4a1062788a2bb06bb9d67313dc582abca2 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:26:57 +0100 Subject: [PATCH 103/139] refactor: Factor out `_doc_args`, add `iter_args` --- tools/generate_schema_wrapper.py | 43 ++++++++++++-------------------- tools/schemapi/codegen.py | 24 ++++++++++++++---- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 32aa60160..0cdad8293 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -802,26 +802,6 @@ def _signature_args( raise NotImplementedError -def _doc_args( - info: SchemaInfo, - *, - kind: Literal["method", "typed_dict"] = "method", - summary: str | None = None, -) -> Iterator[str]: - """Lazily build a docstring.""" - props = info.properties - if kind == "method": - raise NotImplementedError - elif kind == "typed_dict": - yield summary or f"{info.title} ``TypedDict`` wrapper." - yield from ("", "Parameters", "----------") - for p in codegen.get_args(info).required_kwds: - yield f"{p}" - yield f" {props[p].deep_description}" - else: - raise NotImplementedError - - def generate_mark_args( info: SchemaInfo, ) -> dict[Literal["method_args", "dict_args"], str]: @@ -835,17 +815,26 @@ def generate_mark_args( def _typed_dict_args(info: SchemaInfo, /) -> str: - args = codegen.get_args(info).required_kwds - it = _signature_args(args, info.properties, kind="typed_dict") - return "\n ".join(it) + args = codegen.get_args(info) + return "\n ".join( + f"{p}: {p_info.to_type_repr(target='annotation', use_concrete=True)}" + for p, p_info in args.iter_args(args.required, args.kwds) + ) def _typed_dict_doc(info: SchemaInfo, /, *, summary: str | None = None) -> str: - return indent_docstring( - _doc_args(info, kind="typed_dict", summary=summary), - indent_level=4, - lstrip=False, + args = codegen.get_args(info) + it = chain.from_iterable( + (p, f" {p_info.deep_description}") + for p, p_info in args.iter_args(args.required, args.kwds) + ) + lines = ( + summary or f"{info.title} ``TypedDict`` wrapper.", + "", + "Parameters", + "----------", ) + return indent_docstring(chain(lines, it), indent_level=4, lstrip=False) def generate_typed_dict( diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index f63fdcf58..ed5d20141 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -6,7 +6,7 @@ import textwrap from dataclasses import dataclass from itertools import chain -from typing import Any, Final, Iterator +from typing import Any, Final, Iterable, Iterator from .utils import ( SchemaInfo, @@ -37,11 +37,24 @@ class ArgInfo: kwds: set[str] invalid_kwds: set[str] additional: bool + schema_info: SchemaInfo - @property - def required_kwds(self) -> tuple[str, ...]: - """Independently sort, then concat ``.required``, ``.kwds`` properties.""" - return *sorted(self.required), *sorted(self.kwds) + def iter_args( + self, *prop_groups: Iterable[str] + ) -> Iterator[tuple[str, SchemaInfo]]: + """ + Yields (property_name, property_info). + + Useful for signatures and docstrings. + + Parameters + ---------- + *prop_groups + Each group will independently sorted, and chained. + """ + props = self.schema_info.properties + for p in chain.from_iterable(sorted(group) for group in prop_groups): + yield p, props[p] def get_args(info: SchemaInfo) -> ArgInfo: @@ -87,6 +100,7 @@ def get_args(info: SchemaInfo) -> ArgInfo: kwds=kwds, invalid_kwds=invalid_kwds, additional=additional, + schema_info=info, ) From 626401eb69bab2d7954bc841fde0efc9bb48fa6c Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:32:09 +0100 Subject: [PATCH 104/139] refactor: Remove unused `ruff_format_str` Was replaced with `ruff_write_lint_format_str` in 485eae5d6695645241a35e5f5aa6ef06bdd479d4 --- tools/schemapi/utils.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 075c2b16a..608e3f403 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -1085,20 +1085,6 @@ def unwrap_literal(tp: str, /) -> str: return re.sub(r"Literal\[(.+)\]", r"\g<1>", tp) -def ruff_format_str(code: str | list[str]) -> str: - if isinstance(code, list): - code = "\n".join(code) - - r = subprocess.run( - # Name of the file does not seem to matter but ruff requires one - ["ruff", "format", "--stdin-filename", "placeholder.py"], - input=code.encode(), - check=True, - capture_output=True, - ) - return r.stdout.decode() - - def ruff_format_py(fp: Path, /, *extra_args: str) -> None: """ Format an existing file. From a5c05676bed91082c1841b08bd4e2d4fb765746f Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:22:04 +0100 Subject: [PATCH 105/139] refactor: Factor out `_signature_args`, enhance `ArgInfo.iter_args` - Moved constant parts of mark methods to the template --- tools/generate_schema_wrapper.py | 49 +++++++++++--------------------- tools/schemapi/codegen.py | 17 +++++++++-- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 0cdad8293..ae481f98f 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -7,6 +7,7 @@ import json import sys import textwrap +from collections import deque from dataclasses import dataclass from itertools import chain from operator import attrgetter @@ -198,9 +199,9 @@ class MarkMethodMixin: ''' MARK_METHOD: Final = ''' -def mark_{mark}({method_args}) -> Self: +def mark_{mark}(self, {method_args}, **kwds) -> Self: """Set the chart's mark to '{mark}' (see :class:`{mark_def}`).""" - kwds = dict({dict_args}) + kwds = dict({dict_args}, **kwds) copy = self.copy(deep=False) # type: ignore[attr-defined] if any(val is not Undefined for val in kwds.values()): copy.mark = core.{mark_def}(type="{mark}", **kwds) @@ -783,35 +784,18 @@ def generate_vegalite_mark_mixin(fp: Path, /, markdefs: dict[str, str]) -> str: return MARK_MIXIN.format(methods="\n".join(code)) -def _signature_args( - args: Iterable[str], - props: SchemaProperties, - *, - kind: Literal["method", "typed_dict"] = "method", -) -> Iterator[str]: - """Lazily build a typed argument list.""" - if kind == "method": - yield "self" - for p in args: - yield f"{p}: {props[p].to_type_repr(target='annotation', use_undefined=True)} = Undefined" - yield "**kwds" - elif kind == "typed_dict": - for p in args: - yield f"{p}: {props[p].to_type_repr(target='annotation', use_concrete=True)}" - else: - raise NotImplementedError - - def generate_mark_args( - info: SchemaInfo, + info: SchemaInfo, / ) -> dict[Literal["method_args", "dict_args"], str]: - arg_info = codegen.get_args(info) - args = sorted((arg_info.required | arg_info.kwds) - {"type"}) - dict_args = (f"{p}={p}" for p in args) - return { - "method_args": ", ".join(_signature_args(args, info.properties)), - "dict_args": ", ".join(chain(dict_args, ("**kwds",))), - } + args = codegen.get_args(info) + method_args: deque[str] = deque() + dict_args: deque[str] = deque() + for p, p_info in args.iter_args(args.required | args.kwds, exclude="type"): + dict_args.append(f"{p}={p}") + method_args.append( + f"{p}: {p_info.to_type_repr(target='annotation', use_undefined=True)} = Undefined" + ) + return {"method_args": ", ".join(method_args), "dict_args": ", ".join(dict_args)} def _typed_dict_args(info: SchemaInfo, /) -> str: @@ -876,12 +860,11 @@ def generate_typed_dict( ) td_doc = _typed_dict_doc(info, summary=summary) if kwds := arg_info.invalid_kwds: - metaclass_kwds = ", closed=True, total=False" + metaclass_kwds = f", closed=True{metaclass_kwds}" comment = " # type: ignore[call-arg]" - props = info.properties kwds_all_tps = chain.from_iterable( - props[p].to_type_repr(as_str=False, target=TARGET, use_concrete=True) - for p in kwds + info.to_type_repr(as_str=False, target=TARGET, use_concrete=True) + for _, info in arg_info.iter_args(kwds) ) td_args = ( f"{td_args}\n " diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index ed5d20141..e08c9c754 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -40,7 +40,7 @@ class ArgInfo: schema_info: SchemaInfo def iter_args( - self, *prop_groups: Iterable[str] + self, *prop_groups: Iterable[str], exclude: str | Iterable[str] | None = None ) -> Iterator[tuple[str, SchemaInfo]]: """ Yields (property_name, property_info). @@ -51,10 +51,21 @@ def iter_args( ---------- *prop_groups Each group will independently sorted, and chained. + exclude + Property name(s) to omit if they appear in any of ``prop_groups``. """ props = self.schema_info.properties - for p in chain.from_iterable(sorted(group) for group in prop_groups): - yield p, props[p] + it = chain.from_iterable( + sorted(g if isinstance(g, set) else set(g)) for g in prop_groups + ) + if exclude is not None: + exclude = {exclude} if isinstance(exclude, str) else set(exclude) + for p in it: + if p not in exclude: + yield p, props[p] + else: + for p in it: + yield p, props[p] def get_args(info: SchemaInfo) -> ArgInfo: From 36fdaa6ed0663424483fefde4aeaf449e654c63a Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:32:05 +0100 Subject: [PATCH 106/139] refactor: Add `SchemaInfo.from_refname` constructor Replaces all instances that use this pattern --- tools/generate_schema_wrapper.py | 17 +++++++++-------- tools/schemapi/utils.py | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index ae481f98f..1decf5bff 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -451,7 +451,7 @@ def _vega_lite_props_only( def update_vega_themes(fp: Path, /, indent: str | int | None = 2) -> None: root = load_schema(fp.parent / SCHEMA_FILE) - vl_props = SchemaInfo({"$ref": "#/definitions/Config"}, root).properties + vl_props = SchemaInfo.from_refname("Config", root).properties themes = dict(_vega_lite_props_only(vlc.get_themes(), vl_props)) data = json.dumps(themes, indent=indent, sort_keys=True) fp.write_text(data, encoding="utf8") @@ -773,7 +773,7 @@ def generate_vegalite_mark_mixin(fp: Path, /, markdefs: dict[str, str]) -> str: for mark_enum, mark_def in markdefs.items(): _def = schema["definitions"][mark_enum] marks: list[Any] = _def["enum"] if "enum" in _def else [_def["const"]] - info = SchemaInfo({"$ref": f"#/definitions/{mark_def}"}, rootschema=schema) + info = SchemaInfo.from_refname(mark_def, rootschema=schema) mark_args = generate_mark_args(info) for mark in marks: @@ -886,12 +886,13 @@ def generate_typed_dict( def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: KWDS: Literal["Kwds"] = "Kwds" - config = SchemaInfo({"$ref": "#/definitions/Config"}, load_schema(fp)) + CONFIG: Literal["Config"] = "Config" + config = SchemaInfo.from_refname(CONFIG, load_schema(fp)) relevant: dict[str, SchemaInfo] = { x.title: x for x in sorted(find_theme_config_targets(config), key=attrgetter("refname")) - if x.refname != "Config" + if x.refname != CONFIG } SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in relevant) @@ -920,21 +921,21 @@ def find_theme_config_targets(info: SchemaInfo, depth: int = 0, /) -> set[Schema def generate_vegalite_config_mixin(fp: Path, /) -> str: class_name = "ConfigMethodMixin" + CONFIG: Literal["Config"] = "Config" code = [ f"class {class_name}:", ' """A mixin class that defines config methods"""', ] - schema = load_schema(fp) - info = SchemaInfo({"$ref": "#/definitions/Config"}, rootschema=schema) + info = SchemaInfo.from_refname(CONFIG, rootschema=load_schema(fp)) # configure() method - method = CONFIG_METHOD.format(classname="Config", method="configure") + method = CONFIG_METHOD.format(classname=CONFIG, method="configure") code.append("\n ".join(method.splitlines())) # configure_prop() methods for prop, prop_info in info.properties.items(): classname = prop_info.refname - if classname and classname.endswith("Config"): + if classname and classname.endswith(CONFIG): method = CONFIG_PROP_METHOD.format(classname=classname, prop=prop) code.append("\n ".join(method.splitlines())) return "\n".join(code) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 608e3f403..fab7ba523 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -343,7 +343,7 @@ def __len__(self) -> int: def items(self) -> Iterator[tuple[str, SchemaInfo]]: return ((key, self[key]) for key in self) - def keys(self) -> KeysView: + def keys(self) -> KeysView[str]: return self._properties.keys() def values(self) -> Iterator[SchemaInfo]: @@ -367,6 +367,10 @@ def __init__( object.__setattr__(self, "rootschema", rootschema) object.__setattr__(self, "schema", resolve_references(schema, rootschema)) # type: ignore + @classmethod + def from_refname(cls, refname: str, /, rootschema: Mapping[str, Any]) -> SchemaInfo: + return cls({"$ref": f"#/definitions/{refname}"}, rootschema) + def __setattr__(self, name: str, value: Any) -> Never: msg = f"{type(self).__name__!r} is immutable.\nCould not assign self.{name} = {value}" raise TypeError(msg) From 1b236f9602b7f147b177b22fbba6e6baa2a4bc01 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:33:12 +0100 Subject: [PATCH 107/139] docs: Add some missing docs --- tools/schemapi/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index fab7ba523..4c9fc1b1f 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -1015,7 +1015,7 @@ def spell_nested_sequence( info: SchemaInfo, *, target: TargetType, use_concrete: bool ) -> str: """ - Summary. + Return a type representation for an array. Notes ----- @@ -1172,7 +1172,9 @@ def import_typing_extensions( rst_parse: RSTParse = RSTParse(RSTRenderer()) +# TODO: Investigate `mistune.Markdown.(before|after)_render_hooks`. def process_description(description: str) -> str: + """Parse a JSON encoded markdown description into an `RST` string.""" # remove formatting from links description = "".join( _RE_SPECIAL.sub("", d) if i % 2 else d From 160ee638f01f0c5198d3874d5fd53e118db97cd7 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:35:34 +0100 Subject: [PATCH 108/139] refactor: Reorganize `.rst` utils to be together --- tools/schemapi/utils.py | 227 ++++++++++++++++++++-------------------- 1 file changed, 114 insertions(+), 113 deletions(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 4c9fc1b1f..3474d7e77 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -802,119 +802,6 @@ def is_theme_config_target(self) -> bool: ) -class RSTRenderer(_RSTRenderer): - def __init__(self) -> None: - super().__init__() - - def inline_html(self, token: dict[str, Any], state: BlockState) -> str: - html = token["raw"] - return rf"\ :raw-html:`{html}`\ " - - -class RSTParse(mistune.Markdown): - def __init__( - self, - renderer: mistune.BaseRenderer, - block: mistune.BlockParser | None = None, - inline: mistune.InlineParser | None = None, - plugins=None, - ) -> None: - super().__init__(renderer, block, inline, plugins) - - def __call__(self, s: str) -> str: - s = super().__call__(s) # pyright: ignore[reportAssignmentType] - return unescape(s).replace(r"\ ,", ",").replace(r"\ ", " ") - - -def indent_docstring( # noqa: C901 - lines: Iterable[str], indent_level: int, width: int = 100, lstrip=True -) -> str: - """Indent a docstring for use in generated code.""" - final_lines = [] - if not isinstance(lines, list): - lines = list(lines) - if len(lines) > 1: - lines += [""] - - for i, line in enumerate(lines): - stripped = line.lstrip() - if stripped: - leading_space = len(line) - len(stripped) - indent = indent_level + leading_space - wrapper = textwrap.TextWrapper( - width=width - indent, - initial_indent=indent * " ", - subsequent_indent=indent * " ", - break_long_words=False, - break_on_hyphens=False, - drop_whitespace=True, - ) - list_wrapper = textwrap.TextWrapper( - width=width - indent, - initial_indent=indent * " " + "* ", - subsequent_indent=indent * " " + " ", - break_long_words=False, - break_on_hyphens=False, - drop_whitespace=True, - ) - for line in stripped.split("\n"): - line_stripped = line.lstrip() - line_stripped = fix_docstring_issues(line_stripped) - if line_stripped == "": - final_lines.append("") - elif line_stripped.startswith("* "): - final_lines.extend(list_wrapper.wrap(line_stripped[2:])) - # Matches lines where an attribute is mentioned followed by the accepted - # types (lines starting with a character sequence that - # does not contain white spaces or '*' followed by ' : '). - # It therefore matches 'condition : anyOf(...' but not '**Notes** : ...' - # These lines should not be wrapped at all but appear on one line - elif re.match(r"[^\s*]+ : ", line_stripped): - final_lines.append(indent * " " + line_stripped) - else: - final_lines.extend(wrapper.wrap(line_stripped)) - - # If this is the last line, put in an indent - elif i + 1 == len(lines): - final_lines.append(indent_level * " ") - # If it's not the last line, this is a blank line that should not indent. - else: - final_lines.append("") - # Remove any trailing whitespaces on the right side - stripped_lines = [] - for i, line in enumerate(final_lines): - if i + 1 == len(final_lines): - stripped_lines.append(line) - else: - stripped_lines.append(line.rstrip()) - # Join it all together - wrapped = "\n".join(stripped_lines) - if lstrip: - wrapped = wrapped.lstrip() - return wrapped - - -def fix_docstring_issues(docstring: str) -> str: - """ - All lists should start with `"* "`. - - 1. Fixes the ones which either do not have `" "` and/or start with `"-"` replacing `"-"` -> `"*"` and then adding `" "` where necessary. - 2. Now add a `" "` where a `"*"` is followed by one of the characters in the square brackets of the regex pattern. - - Parameters - ---------- - docstring - A processed docstring line. - """ - return _RE_LIST_MISSING_WHITESPACE.sub( - "* ", _RE_LIST_MISSING_ASTERISK.sub("*", docstring) - ) - - -def rst_syntax_for_class(class_name: str) -> str: - return f":class:`{class_name}`" - - def flatten(container: Iterable) -> Iterable: """ Flatten arbitrarily flattened list. @@ -1169,6 +1056,120 @@ def import_typing_extensions( rather than repeating long literals in every method definition. """ + +class RSTRenderer(_RSTRenderer): + def __init__(self) -> None: + super().__init__() + + def inline_html(self, token: dict[str, Any], state: BlockState) -> str: + html = token["raw"] + return rf"\ :raw-html:`{html}`\ " + + +class RSTParse(mistune.Markdown): + def __init__( + self, + renderer: mistune.BaseRenderer, + block: mistune.BlockParser | None = None, + inline: mistune.InlineParser | None = None, + plugins=None, + ) -> None: + super().__init__(renderer, block, inline, plugins) + + def __call__(self, s: str) -> str: + s = super().__call__(s) # pyright: ignore[reportAssignmentType] + return unescape(s).replace(r"\ ,", ",").replace(r"\ ", " ") + + +def indent_docstring( # noqa: C901 + lines: Iterable[str], indent_level: int, width: int = 100, lstrip=True +) -> str: + """Indent a docstring for use in generated code.""" + final_lines = [] + if not isinstance(lines, list): + lines = list(lines) + if len(lines) > 1: + lines += [""] + + for i, line in enumerate(lines): + stripped = line.lstrip() + if stripped: + leading_space = len(line) - len(stripped) + indent = indent_level + leading_space + wrapper = textwrap.TextWrapper( + width=width - indent, + initial_indent=indent * " ", + subsequent_indent=indent * " ", + break_long_words=False, + break_on_hyphens=False, + drop_whitespace=True, + ) + list_wrapper = textwrap.TextWrapper( + width=width - indent, + initial_indent=indent * " " + "* ", + subsequent_indent=indent * " " + " ", + break_long_words=False, + break_on_hyphens=False, + drop_whitespace=True, + ) + for line in stripped.split("\n"): + line_stripped = line.lstrip() + line_stripped = fix_docstring_issues(line_stripped) + if line_stripped == "": + final_lines.append("") + elif line_stripped.startswith("* "): + final_lines.extend(list_wrapper.wrap(line_stripped[2:])) + # Matches lines where an attribute is mentioned followed by the accepted + # types (lines starting with a character sequence that + # does not contain white spaces or '*' followed by ' : '). + # It therefore matches 'condition : anyOf(...' but not '**Notes** : ...' + # These lines should not be wrapped at all but appear on one line + elif re.match(r"[^\s*]+ : ", line_stripped): + final_lines.append(indent * " " + line_stripped) + else: + final_lines.extend(wrapper.wrap(line_stripped)) + + # If this is the last line, put in an indent + elif i + 1 == len(lines): + final_lines.append(indent_level * " ") + # If it's not the last line, this is a blank line that should not indent. + else: + final_lines.append("") + # Remove any trailing whitespaces on the right side + stripped_lines = [] + for i, line in enumerate(final_lines): + if i + 1 == len(final_lines): + stripped_lines.append(line) + else: + stripped_lines.append(line.rstrip()) + # Join it all together + wrapped = "\n".join(stripped_lines) + if lstrip: + wrapped = wrapped.lstrip() + return wrapped + + +def fix_docstring_issues(docstring: str) -> str: + """ + All lists should start with `"* "`. + + 1. Fixes the ones which either do not have `" "` and/or start with `"-"` replacing `"-"` -> `"*"` and then adding `" "` where necessary. + 2. Now add a `" "` where a `"*"` is followed by one of the characters in the square brackets of the regex pattern. + + Parameters + ---------- + docstring + A processed docstring line. + """ + return _RE_LIST_MISSING_WHITESPACE.sub( + "* ", _RE_LIST_MISSING_ASTERISK.sub("*", docstring) + ) + + +def rst_syntax_for_class(class_name: str) -> str: + return f":class:`{class_name}`" + + rst_parse: RSTParse = RSTParse(RSTRenderer()) From 7e85b367f2d78a35866276f5c275b2cd9e3db90a Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:39:44 +0100 Subject: [PATCH 109/139] refactor: Remove unused parameters --- tools/generate_schema_wrapper.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 1decf5bff..75771da48 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -676,9 +676,7 @@ def non_field_names(self) -> Iterator[str]: yield self.value_class_name -def generate_vegalite_channel_wrappers( - fp: Path, /, version: str, imports: list[str] | None = None -) -> str: +def generate_vegalite_channel_wrappers(fp: Path, /) -> str: schema = load_schema_with_shorthand_properties(fp) encoding_def = "FacetedEncoding" encoding = SchemaInfo(schema["definitions"][encoding_def], rootschema=schema) @@ -736,7 +734,7 @@ def generate_vegalite_channel_wrappers( ) it = chain.from_iterable(info.all_names for info in channel_infos.values()) all_ = list(chain(it, COMPAT_EXPORTS)) - imports = imports or [ + imports = [ "import sys", "from typing import Any, overload, Sequence, List, Literal, Union, TYPE_CHECKING, TypedDict", import_typing_extensions((3, 10), "TypeAlias"), @@ -979,7 +977,7 @@ def vegalite_main(skip_download: bool = False) -> None: # Generate the channel wrappers fp_channels = schemapath / "channels.py" print(f"Generating\n {schemafile!s}\n ->{fp_channels!s}") - files[fp_channels] = generate_vegalite_channel_wrappers(schemafile, version=version) + files[fp_channels] = generate_vegalite_channel_wrappers(schemafile) # generate the mark mixin markdefs = {k: f"{k}Def" for k in ["Mark", "BoxPlot", "ErrorBar", "ErrorBand"]} From 36ebca69e1ffc5d9ab3a52e5994a04cb5f2f1bfa Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:46:20 +0100 Subject: [PATCH 110/139] refactor: Move more constants into templates --- tools/generate_schema_wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 75771da48..cd5248d2f 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -256,7 +256,7 @@ class {name}(TypedDict{metaclass_kwds}):{comment} ENCODE_METHOD: Final = ''' class _EncodingMixin: - def encode({method_args}) -> Self: + def encode(self, *args: Any, {method_args}) -> Self: """Map properties of the data to visual properties of the chart (see :class:`FacetedEncoding`) {docstring}""" # Compat prep for `infer_encoding_types` signature @@ -1066,7 +1066,7 @@ def generate_encoding_artifacts( - but this translates poorly to an IDE - `info.supports_arrays` """ - signature_args: list[str] = ["self", "*args: Any"] + signature_args: list[str] = [] type_aliases: list[str] = [] typed_dict_args: list[str] = [] signature_doc_params: list[str] = ["", "Parameters", "----------"] From 7b7390af9e4134cfc25965b14ecd54b2f521a036 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:16:37 +0100 Subject: [PATCH 111/139] refactor: Accept multiple remap titles Partial fix for https://github.com/vega/altair/pull/3536#discussion_r1752575371 --- tools/generate_schema_wrapper.py | 6 ++++-- tools/schemapi/utils.py | 8 +++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index cd5248d2f..679b0f8c0 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -892,8 +892,10 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: for x in sorted(find_theme_config_targets(config), key=attrgetter("refname")) if x.refname != CONFIG } - SchemaInfo._remap_title.update({"HexColor": "ColorHex"}) - SchemaInfo._remap_title.update((k, f"{k}{KWDS}") for k in relevant) + SchemaInfo._remap_title.update( + {"HexColor": ("ColorHex",), "Padding": ("float", "Map")} + ) + SchemaInfo._remap_title.update((k, (f"{k}{KWDS}",)) for k in relevant) config_sub: Iterator[str] = ( generate_typed_dict(info, name=f"{info.title}{KWDS}") diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 3474d7e77..7bef983b3 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -353,7 +353,7 @@ def values(self) -> Iterator[SchemaInfo]: class SchemaInfo: """A wrapper for inspecting a JSON schema.""" - _remap_title: ClassVar[dict[str, str]] = {} + _remap_title: ClassVar[dict[str, Sequence[str]]] = {} def __init__( self, schema: Mapping[str, Any], rootschema: Mapping[str, Any] | None = None @@ -544,7 +544,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: `RelativeBandSize` excluded as it has a single property `band`, but all instances also accept `float`. """ - REMAP_TITLE: dict[str, str] = SchemaInfo._remap_title + REMAP_TITLE = SchemaInfo._remap_title title: str = self.title tps: set[str] = set() if not use_concrete: @@ -557,9 +557,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: t = value.to_type_repr(target="annotation", use_concrete=use_concrete) tps.add(f"Value[{t}]") elif title in REMAP_TITLE: - tps.add(REMAP_TITLE[title]) - elif title == "Padding": - tps.update(("float", "Map")) + tps.update(REMAP_TITLE[title]) elif ( (title not in EXCLUDE_TITLE) and not TypeAliasTracer.is_cached(title, include_concrete=use_concrete) From af7c17c26a14f4d5dc409872570d47dc71af897b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:24:45 +0100 Subject: [PATCH 112/139] docs: Finish `generate_typed_dict` --- tools/generate_schema_wrapper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 679b0f8c0..0a0ff4c8e 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -827,9 +827,7 @@ def generate_typed_dict( override_args: Iterable[str] | None = None, ) -> str: """ - _summary_. - - TODO: Tidy up, finish doc + Return a fully typed & documented ``TypedDict``. Parameters ---------- @@ -841,7 +839,7 @@ def generate_typed_dict( summary When provided, used instead of generated summary line. override_args - Inject custom handling for types. + When provided, used instead of ``_typed_dict_args``. Notes ----- From 072f5127afd54c90ca1db85d8817742ee49cb693 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:59:38 +0100 Subject: [PATCH 113/139] feat(typing): Adds `RowCol` generic Related https://github.com/vega/altair/pull/3536#issuecomment-2343859781 --- altair/vegalite/v5/schema/_typing.py | 22 ++++++++++++++++++++++ tools/generate_schema_wrapper.py | 20 ++++++++++++++++++++ tools/schemapi/utils.py | 12 ++++++++++++ 3 files changed, 54 insertions(+) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 8f9e1b383..5c5c452a3 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -170,6 +170,28 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: return bool(pattern.fullmatch(obj)) +CT = TypeVar("CT") +RT = TypeVar("RT") + + +class RowCol(TypedDict, Generic[CT, RT], total=False): + """ + A `Generic`_ two-item ``dict``. + + Parameters + ---------- + column: CT + row: RT + + .. _Generic: + https://typing.readthedocs.io/en/latest/spec/generics.html#generics + + """ + + column: CT + row: RT + + VegaThemes: TypeAlias = Literal[ "carbong10", "carbong100", diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 0a0ff4c8e..d4dba1258 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -352,6 +352,26 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: pattern: re.Pattern[str] = next(it) return bool(pattern.fullmatch(obj)) + +CT = TypeVar("CT") +RT = TypeVar("RT") + +class RowCol(TypedDict, Generic[CT, RT], total=False): + """ + A `Generic`_ two-item ``dict``. + + Parameters + ---------- + column: CT + row: RT + + .. _Generic: + https://typing.readthedocs.io/en/latest/spec/generics.html#generics + + """ + + column: CT + row: RT ''' _ChannelType = Literal["field", "datum", "value"] diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 7bef983b3..9dfff80cf 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -556,6 +556,10 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: value = self.properties["value"] t = value.to_type_repr(target="annotation", use_concrete=use_concrete) tps.add(f"Value[{t}]") + elif self.is_rowcol(): + row = self.properties["row"] + t = row.to_type_repr(target="annotation", use_concrete=use_concrete) + tps.add(f"RowCol[{t}, {t}]") elif title in REMAP_TITLE: tps.update(REMAP_TITLE[title]) elif ( @@ -714,6 +718,14 @@ def is_object(self) -> bool: def is_value(self) -> bool: return self.is_object() and self.properties.keys() == {"value"} + def is_rowcol(self) -> bool: + props = self.properties + return ( + self.is_object() + and props.keys() == {"column", "row"} + and props["column"] == props["row"] + ) + def is_array(self) -> bool: return self.type == "array" From 007f3731ba3764ee95a8b8c934ab5e37ff0bb634 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 13:04:27 +0100 Subject: [PATCH 114/139] feat(typing): Adds missing types for `TopLevelUnitSpec` Resolves most of https://github.com/vega/altair/pull/3536#issuecomment-2343859781 --- altair/vegalite/v5/schema/_config.py | 524 +++++++++++++++++++++++++++ altair/vegalite/v5/schema/_typing.py | 2 + tools/generate_schema_wrapper.py | 17 +- 3 files changed, 541 insertions(+), 2 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index e92fea49f..a421e79d5 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -21,6 +21,7 @@ "AreaConfigKwds", "AutoSizeParamsKwds", "AxisConfigKwds", + "AxisResolveMapKwds", "BarConfigKwds", "BindCheckboxKwds", "BindDirectKwds", @@ -44,6 +45,7 @@ "IntervalSelectionConfigKwds", "IntervalSelectionConfigWithoutTypeKwds", "LegendConfigKwds", + "LegendResolveMapKwds", "LegendStreamBindingKwds", "LineConfigKwds", "LineStringKwds", @@ -61,21 +63,27 @@ "PointSelectionConfigWithoutTypeKwds", "PolygonKwds", "ProjectionConfigKwds", + "ProjectionKwds", "RadialGradientKwds", "RangeConfigKwds", "RectConfigKwds", + "ResolveKwds", "ScaleConfigKwds", "ScaleInvalidDataConfigKwds", + "ScaleResolveMapKwds", "SelectionConfigKwds", + "StepKwds", "StyleConfigIndexKwds", "ThemeConfig", "TickConfigKwds", "TimeIntervalStepKwds", "TimeLocaleKwds", "TitleConfigKwds", + "TitleParamsKwds", "TooltipContentKwds", "TopLevelSelectionParameterKwds", "VariableParameterKwds", + "ViewBackgroundKwds", "ViewConfigKwds", ] @@ -1044,6 +1052,22 @@ class AxisConfigKwds(TypedDict, total=False): zindex: float +class AxisResolveMapKwds(TypedDict, total=False): + """ + AxisResolveMap ``TypedDict`` wrapper. + + Parameters + ---------- + x + + y + + """ + + x: ResolveMode_T + y: ResolveMode_T + + class BarConfigKwds(TypedDict, total=False): """ BarConfig ``TypedDict`` wrapper. @@ -2976,6 +3000,49 @@ class LegendConfigKwds(TypedDict, total=False): zindex: float +class LegendResolveMapKwds(TypedDict, total=False): + """ + LegendResolveMap ``TypedDict`` wrapper. + + Parameters + ---------- + angle + + color + + fill + + fillOpacity + + opacity + + shape + + size + + stroke + + strokeDash + + strokeOpacity + + strokeWidth + + """ + + angle: ResolveMode_T + color: ResolveMode_T + fill: ResolveMode_T + fillOpacity: ResolveMode_T + opacity: ResolveMode_T + shape: ResolveMode_T + size: ResolveMode_T + stroke: ResolveMode_T + strokeDash: ResolveMode_T + strokeOpacity: ResolveMode_T + strokeWidth: ResolveMode_T + + class LegendStreamBindingKwds(TypedDict, total=False): """ LegendStreamBinding ``TypedDict`` wrapper. @@ -4845,6 +4912,149 @@ class PolygonKwds(TypedDict, total=False): bbox: Sequence[float] +class ProjectionKwds(TypedDict, total=False): + """ + Projection ``TypedDict`` wrapper. + + Parameters + ---------- + center + The projection's center, a two-element array of longitude and latitude in degrees. + + **Default value:** ``[0, 0]`` + clipAngle + The projection's clipping circle radius to the specified angle in degrees. If + ``null``, switches to `antimeridian `__ cutting + rather than small-circle clipping. + clipExtent + The projection's viewport clip extent to the specified bounds in pixels. The extent + bounds are specified as an array ``[[x0, y0], [x1, y1]]``, where ``x0`` is the + left-side of the viewport, ``y0`` is the top, ``x1`` is the right and ``y1`` is the + bottom. If ``null``, no viewport clipping is performed. + coefficient + The coefficient parameter for the ``hammer`` projection. + + **Default value:** ``2`` + distance + For the ``satellite`` projection, the distance from the center of the sphere to the + point of view, as a proportion of the sphere's radius. The recommended maximum clip + angle for a given ``distance`` is acos(1 / distance) converted to degrees. If tilt + is also applied, then more conservative clipping may be necessary. + + **Default value:** ``2.0`` + extent + + fit + + fraction + The fraction parameter for the ``bottomley`` projection. + + **Default value:** ``0.5``, corresponding to a sin(ψ) where ψ = π/6. + lobes + The number of lobes in projections that support multi-lobe views: ``berghaus``, + ``gingery``, or ``healpix``. The default value varies based on the projection type. + parallel + The parallel parameter for projections that support it: ``armadillo``, ``bonne``, + ``craig``, ``cylindricalEqualArea``, ``cylindricalStereographic``, + ``hammerRetroazimuthal``, ``loximuthal``, or ``rectangularPolyconic``. The default + value varies based on the projection type. + parallels + For conic projections, the `two standard parallels + `__ that define the map layout. + The default depends on the specific conic projection used. + pointRadius + The default radius (in pixels) to use when drawing GeoJSON ``Point`` and + ``MultiPoint`` geometries. This parameter sets a constant default value. To modify + the point radius in response to data, see the corresponding parameter of the GeoPath + and GeoShape transforms. + + **Default value:** ``4.5`` + precision + The threshold for the projection's `adaptive resampling + `__ to the specified value in pixels. This + value corresponds to the `Douglas-Peucker distance + `__. + If precision is not specified, returns the projection's current resampling precision + which defaults to ``√0.5 ≅ 0.70710…``. + radius + The radius parameter for the ``airy`` or ``gingery`` projection. The default value + varies based on the projection type. + ratio + The ratio parameter for the ``hill``, ``hufnagel``, or ``wagner`` projections. The + default value varies based on the projection type. + reflectX + Sets whether or not the x-dimension is reflected (negated) in the output. + reflectY + Sets whether or not the y-dimension is reflected (negated) in the output. + rotate + The projection's three-axis rotation to the specified angles, which must be a two- + or three-element array of numbers [``lambda``, ``phi``, ``gamma``] specifying the + rotation angles in degrees about each spherical axis. (These correspond to yaw, + pitch and roll.) + + **Default value:** ``[0, 0, 0]`` + scale + The projection's scale (zoom) factor, overriding automatic fitting. The default + scale is projection-specific. The scale factor corresponds linearly to the distance + between projected points; however, scale factor values are not equivalent across + projections. + size + Used in conjunction with fit, provides the width and height in pixels of the area to + which the projection should be automatically fit. + spacing + The spacing parameter for the ``lagrange`` projection. + + **Default value:** ``0.5`` + tilt + The tilt angle (in degrees) for the ``satellite`` projection. + + **Default value:** ``0``. + translate + The projection's translation offset as a two-element array ``[tx, ty]``. + type + The cartographic projection to use. This value is case-insensitive, for example + ``"albers"`` and ``"Albers"`` indicate the same projection type. You can find all + valid projection types `in the documentation + `__. + + **Default value:** ``equalEarth`` + """ + + center: Sequence[float] + clipAngle: float + clipExtent: Sequence[Sequence[float]] + coefficient: float + distance: float + extent: Sequence[Sequence[float]] + fit: ( + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + | Sequence[ + GeoJsonFeatureKwds + | GeoJsonFeatureCollectionKwds + | Sequence[GeoJsonFeatureKwds] + ] + ) + fraction: float + lobes: float + parallel: float + parallels: Sequence[float] + pointRadius: float + precision: float + radius: float + ratio: float + reflectX: bool + reflectY: bool + rotate: Sequence[float] + scale: float + size: Sequence[float] + spacing: float + tilt: float + translate: Sequence[float] + type: ProjectionType_T + + class ProjectionConfigKwds(TypedDict, total=False): """ ProjectionConfig ``TypedDict`` wrapper. @@ -5563,6 +5773,25 @@ class RectConfigKwds(TypedDict, total=False): y2: float | Literal["height"] +class ResolveKwds(TypedDict, total=False): + """ + Resolve ``TypedDict`` wrapper. + + Parameters + ---------- + axis + + legend + + scale + + """ + + axis: AxisResolveMapKwds + legend: LegendResolveMapKwds + scale: ScaleResolveMapKwds + + class ScaleConfigKwds(TypedDict, total=False): """ ScaleConfig ``TypedDict`` wrapper. @@ -5816,6 +6045,67 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): yOffset: Value[float] | Literal["zero-or-min"] +class ScaleResolveMapKwds(TypedDict, total=False): + """ + ScaleResolveMap ``TypedDict`` wrapper. + + Parameters + ---------- + angle + + color + + fill + + fillOpacity + + opacity + + radius + + shape + + size + + stroke + + strokeDash + + strokeOpacity + + strokeWidth + + theta + + x + + xOffset + + y + + yOffset + + """ + + angle: ResolveMode_T + color: ResolveMode_T + fill: ResolveMode_T + fillOpacity: ResolveMode_T + opacity: ResolveMode_T + radius: ResolveMode_T + shape: ResolveMode_T + size: ResolveMode_T + stroke: ResolveMode_T + strokeDash: ResolveMode_T + strokeOpacity: ResolveMode_T + strokeWidth: ResolveMode_T + theta: ResolveMode_T + x: ResolveMode_T + xOffset: ResolveMode_T + y: ResolveMode_T + yOffset: ResolveMode_T + + class SelectionConfigKwds(TypedDict, total=False): """ SelectionConfig ``TypedDict`` wrapper. @@ -5844,6 +6134,31 @@ class SelectionConfigKwds(TypedDict, total=False): point: PointSelectionConfigWithoutTypeKwds +class StepKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] + """ + Step ``TypedDict`` wrapper. + + Parameters + ---------- + step + The size (width/height) per discrete step. + + Notes + ----- + The following keys may be specified as string literals **only**: + + ['for'] + + See `PEP728`_ for type checker compatibility. + + .. _PEP728: + https://peps.python.org/pep-0728/#reference-implementation + """ + + step: float + __extra_items__: StepFor_T + + class StyleConfigIndexKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] """ StyleConfigIndex ``TypedDict`` wrapper. @@ -6528,6 +6843,137 @@ class TitleConfigKwds(TypedDict, total=False): zindex: float +class TitleParamsKwds(TypedDict, total=False): + """ + TitleParams ``TypedDict`` wrapper. + + Parameters + ---------- + text + The title text. + align + Horizontal text alignment for title text. One of ``"left"``, ``"center"``, or + ``"right"``. + anchor + The anchor position for placing the title. One of ``"start"``, ``"middle"``, or + ``"end"``. For example, with an orientation of top these anchor positions map to a + left-, center-, or right-aligned title. + + **Default value:** ``"middle"`` for `single + `__ and `layered + `__ views. ``"start"`` for other + composite views. + + **Note:** `For now `__, ``anchor`` is + only customizable only for `single + `__ and `layered + `__ views. For other composite + views, ``anchor`` is always ``"start"``. + angle + Angle in degrees of title and subtitle text. + aria + A boolean flag indicating if `ARIA attributes + `__ should be + included (SVG output only). If ``false``, the "aria-hidden" attribute will be set on + the output SVG group, removing the title from the ARIA accessibility tree. + + **Default value:** ``true`` + baseline + Vertical text baseline for title and subtitle text. One of ``"alphabetic"`` + (default), ``"top"``, ``"middle"``, ``"bottom"``, ``"line-top"``, or + ``"line-bottom"``. The ``"line-top"`` and ``"line-bottom"`` values operate similarly + to ``"top"`` and ``"bottom"``, but are calculated relative to the *lineHeight* + rather than *fontSize* alone. + color + Text color for title text. + dx + Delta offset for title and subtitle text x-coordinate. + dy + Delta offset for title and subtitle text y-coordinate. + font + Font name for title text. + fontSize + Font size in pixels for title text. + fontStyle + Font style for title text. + fontWeight + Font weight for title text. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + frame + The reference frame for the anchor position, one of ``"bounds"`` (to anchor relative + to the full bounding box) or ``"group"`` (to anchor relative to the group width or + height). + limit + The maximum allowed length in pixels of title and subtitle text. + lineHeight + Line height in pixels for multi-line title text or title text with ``"line-top"`` or + ``"line-bottom"`` baseline. + offset + The orthogonal offset in pixels by which to displace the title group from its + position along the edge of the chart. + orient + Default title orientation (``"top"``, ``"bottom"``, ``"left"``, or ``"right"``) + style + A `mark style property `__ + to apply to the title text mark. + + **Default value:** ``"group-title"``. + subtitle + The subtitle Text. + subtitleColor + Text color for subtitle text. + subtitleFont + Font name for subtitle text. + subtitleFontSize + Font size in pixels for subtitle text. + subtitleFontStyle + Font style for subtitle text. + subtitleFontWeight + Font weight for subtitle text. This can be either a string (e.g ``"bold"``, + ``"normal"``) or a number (``100``, ``200``, ``300``, ..., ``900`` where + ``"normal"`` = ``400`` and ``"bold"`` = ``700``). + subtitleLineHeight + Line height in pixels for multi-line subtitle text. + subtitlePadding + The padding in pixels between title and subtitle text. + zindex + The integer z-index indicating the layering of the title group relative to other + axis, mark and legend groups. + + **Default value:** ``0``. + """ + + text: str | Sequence[str] + align: Align_T + anchor: TitleAnchor_T + angle: float + aria: bool + baseline: TextBaseline_T + color: None | ColorHex | ColorName_T + dx: float + dy: float + font: str + fontSize: float + fontStyle: str + fontWeight: FontWeight_T + frame: str | TitleFrame_T + limit: float + lineHeight: float + offset: float + orient: TitleOrient_T + style: str | Sequence[str] + subtitle: str | Sequence[str] + subtitleColor: None | ColorHex | ColorName_T + subtitleFont: str + subtitleFontSize: float + subtitleFontStyle: str + subtitleFontWeight: FontWeight_T + subtitleLineHeight: float + subtitlePadding: float + zindex: float + + class TooltipContentKwds(TypedDict, total=False): """ TooltipContent ``TypedDict`` wrapper. @@ -6648,6 +7094,84 @@ class VariableParameterKwds(TypedDict, total=False): value: Any +class ViewBackgroundKwds(TypedDict, total=False): + """ + ViewBackground ``TypedDict`` wrapper. + + Parameters + ---------- + cornerRadius + The radius in pixels of rounded rectangles or arcs' corners. + + **Default value:** ``0`` + cursor + The mouse cursor used over the view. Any valid `CSS cursor type + `__ can be used. + fill + The fill color. + + **Default value:** ``undefined`` + fillOpacity + The fill opacity (value between [0,1]). + + **Default value:** ``1`` + opacity + The overall opacity (value between [0,1]). + + **Default value:** ``0.7`` for non-aggregate plots with ``point``, ``tick``, + ``circle``, or ``square`` marks or layered ``bar`` charts and ``1`` otherwise. + stroke + The stroke color. + + **Default value:** ``"#ddd"`` + strokeCap + The stroke cap for line ending style. One of ``"butt"``, ``"round"``, or + ``"square"``. + + **Default value:** ``"butt"`` + strokeDash + An array of alternating stroke, space lengths for creating dashed or dotted lines. + strokeDashOffset + The offset (in pixels) into which to begin drawing with the stroke dash array. + strokeJoin + The stroke line join method. One of ``"miter"``, ``"round"`` or ``"bevel"``. + + **Default value:** ``"miter"`` + strokeMiterLimit + The miter limit at which to bevel a line join. + strokeOpacity + The stroke opacity (value between [0,1]). + + **Default value:** ``1`` + strokeWidth + The stroke width, in pixels. + style + A string or array of strings indicating the name of custom styles to apply to the + view background. A style is a named collection of mark property defaults defined + within the `style configuration + `__. If style is an + array, later styles will override earlier styles. + + **Default value:** ``"cell"`` **Note:** Any specified view background properties + will augment the default style. + """ + + cornerRadius: float + cursor: Cursor_T + fill: None | ColorHex | ColorName_T + fillOpacity: float + opacity: float + stroke: None | ColorHex | ColorName_T + strokeCap: StrokeCap_T + strokeDash: Sequence[float] + strokeDashOffset: float + strokeJoin: StrokeJoin_T + strokeMiterLimit: float + strokeOpacity: float + strokeWidth: float + style: str | Sequence[str] + + class ViewConfigKwds(TypedDict, total=False): """ ViewConfig ``TypedDict`` wrapper. diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 5c5c452a3..ff211f026 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -80,6 +80,7 @@ "SortOrder_T", "StackOffset_T", "StandardType_T", + "StepFor_T", "StrokeCap_T", "StrokeJoin_T", "TextBaseline_T", @@ -1175,6 +1176,7 @@ class RowCol(TypedDict, Generic[CT, RT], total=False): SortOrder_T: TypeAlias = Literal["ascending", "descending"] StackOffset_T: TypeAlias = Literal["zero", "center", "normalize"] StandardType_T: TypeAlias = Literal["quantitative", "ordinal", "temporal", "nominal"] +StepFor_T: TypeAlias = Literal["position", "offset"] StrokeCap_T: TypeAlias = Literal["butt", "round", "square"] StrokeJoin_T: TypeAlias = Literal["miter", "round", "bevel"] TextBaseline_T: TypeAlias = Literal[ diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index d4dba1258..904f5cfa9 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -903,11 +903,24 @@ def generate_typed_dict( def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: KWDS: Literal["Kwds"] = "Kwds" CONFIG: Literal["Config"] = "Config" - config = SchemaInfo.from_refname(CONFIG, load_schema(fp)) + TOP_LEVEL_EXTRAS = ( + "Step", + "Projection", + "Resolve", + "TitleParams", + "ViewBackground", + ) + root = load_schema(fp) + config = SchemaInfo.from_refname(CONFIG, root) + theme_targets = find_theme_config_targets(config) + for name in TOP_LEVEL_EXTRAS: + theme_targets.update( + find_theme_config_targets(SchemaInfo.from_refname(name, root)) + ) relevant: dict[str, SchemaInfo] = { x.title: x - for x in sorted(find_theme_config_targets(config), key=attrgetter("refname")) + for x in sorted(theme_targets, key=attrgetter("refname")) if x.refname != CONFIG } SchemaInfo._remap_title.update( From 2afdc19673519140453ce6376009fd4d054b7322 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:31:49 +0100 Subject: [PATCH 115/139] fix: Add `RowCol` to `_typing.__all__` --- altair/vegalite/v5/schema/_typing.py | 1 + tools/generate_schema_wrapper.py | 1 + 2 files changed, 2 insertions(+) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index ff211f026..072365ba3 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -69,6 +69,7 @@ "ProjectionType_T", "RangeEnum_T", "ResolveMode_T", + "RowCol", "ScaleInterpolateEnum_T", "ScaleType_T", "SelectionResolution_T", diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 904f5cfa9..6435c9fea 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -1069,6 +1069,7 @@ def vegalite_main(skip_download: bool = False) -> None: "Value", "ColorHex", "is_color_hex", + "RowCol", header=HEADER, extra=TYPING_EXTRA, ) From 2c70eb67deabd7b7b853d03925d5a27e7e952697 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:34:12 +0100 Subject: [PATCH 116/139] fix: Version-gate `typing_extensions` in `utils` --- tools/schemapi/utils.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index 9dfff80cf..f23f8d5bf 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -5,6 +5,7 @@ import json import re import subprocess +import sys import textwrap import urllib.parse from html import unescape @@ -21,6 +22,8 @@ Mapping, MutableSequence, Sequence, + TypeVar, + Union, overload, ) @@ -33,10 +36,25 @@ from _collections_abc import KeysView from pathlib import Path from re import Pattern - from typing_extensions import LiteralString, Never, TypeAlias from mistune import BlockState +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType +if sys.version_info >= (3, 11): + from typing import LiteralString, Never +else: + from typing_extensions import LiteralString, Never +if sys.version_info >= (3, 10): + from typing import TypeAlias +else: + from typing_extensions import TypeAlias + +T = TypeVar("T") + +OneOrSeq = TypeAliasType("OneOrSeq", Union[T, Sequence[T]], type_params=(T,)) TargetType: TypeAlias = Literal["annotation", "doc"] EXCLUDE_KEYS: frozenset[ From ef3df183d794c94c025b9fdc84fa67c1654f7cf7 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:36:40 +0100 Subject: [PATCH 117/139] feat: Support callables in `ArgInfo.iter_args` --- tools/schemapi/__init__.py | 22 +++++++++++++--- tools/schemapi/codegen.py | 54 +++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 6 deletions(-) diff --git a/tools/schemapi/__init__.py b/tools/schemapi/__init__.py index 023a9a2af..55c5f4148 100644 --- a/tools/schemapi/__init__.py +++ b/tools/schemapi/__init__.py @@ -1,8 +1,24 @@ """schemapi: tools for generating Python APIs from JSON schemas.""" from tools.schemapi import codegen, utils -from tools.schemapi.codegen import CodeSnippet +from tools.schemapi.codegen import ( + CodeSnippet, + arg_invalid_kwds, + arg_kwds, + arg_required_kwds, +) from tools.schemapi.schemapi import SchemaBase, Undefined -from tools.schemapi.utils import SchemaInfo +from tools.schemapi.utils import OneOrSeq, SchemaInfo -__all__ = ["CodeSnippet", "SchemaBase", "SchemaInfo", "Undefined", "codegen", "utils"] +__all__ = [ + "CodeSnippet", + "OneOrSeq", + "SchemaBase", + "SchemaInfo", + "Undefined", + "arg_invalid_kwds", + "arg_kwds", + "arg_required_kwds", + "codegen", + "utils", +] diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index e08c9c754..cb063223e 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -3,10 +3,12 @@ from __future__ import annotations import re +import sys import textwrap from dataclasses import dataclass from itertools import chain -from typing import Any, Final, Iterable, Iterator +from operator import attrgetter +from typing import Any, Callable, Final, Iterable, Iterator, TypeVar, Union from .utils import ( SchemaInfo, @@ -19,6 +21,23 @@ spell_literal, ) +if sys.version_info >= (3, 12): + from typing import TypeAliasType +else: + from typing_extensions import TypeAliasType + + +T1 = TypeVar("T1") +T2 = TypeVar("T2") +AttrGetter = TypeAliasType( + "AttrGetter", Callable[[T1], Union[T2, "tuple[T2, ...]"]], type_params=(T1, T2) +) +""" +Intended to model the signature of ``operator.attrgetter``. + +Spelled more generically to support future extension. +""" + class CodeSnippet: """Object whose repr() is a string of code.""" @@ -40,7 +59,10 @@ class ArgInfo: schema_info: SchemaInfo def iter_args( - self, *prop_groups: Iterable[str], exclude: str | Iterable[str] | None = None + self, + group: Iterable[str] | AttrGetter[ArgInfo, set[str]], + *more_groups: Iterable[str] | AttrGetter[ArgInfo, set[str]], + exclude: str | Iterable[str] | None = None, ) -> Iterator[tuple[str, SchemaInfo]]: """ Yields (property_name, property_info). @@ -56,7 +78,7 @@ def iter_args( """ props = self.schema_info.properties it = chain.from_iterable( - sorted(g if isinstance(g, set) else set(g)) for g in prop_groups + sorted(g) for g in self._normalize_groups(group, *more_groups) ) if exclude is not None: exclude = {exclude} if isinstance(exclude, str) else set(exclude) @@ -67,6 +89,32 @@ def iter_args( for p in it: yield p, props[p] + def _normalize_groups( + self, *groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] + ) -> Iterator[set[str]]: + for group in groups: + if isinstance(group, set): + yield group + elif isinstance(group, Iterable): + yield set(group) + elif callable(group): + result = group(self) + if isinstance(result, set): + yield result + else: + yield from result + else: + msg = ( + f"Expected all cases to be reducible to a `set[str]`," + f" but got {type(group).__name__!r}" + ) + raise TypeError(msg) + + +arg_required_kwds: AttrGetter[ArgInfo, set[str]] = attrgetter("required", "kwds") +arg_invalid_kwds: AttrGetter[ArgInfo, set[str]] = attrgetter("invalid_kwds") +arg_kwds: AttrGetter[ArgInfo, set[str]] = attrgetter("kwds") + def get_args(info: SchemaInfo) -> ArgInfo: """Return the list of args & kwds for building the __init__ function.""" From 4f3c0e7963faafef2dab81e6905b5c665f0c4f11 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:39:26 +0100 Subject: [PATCH 118/139] feat: Define `ThemeConfig` as subset of `TopLevelUnitSpec` https://github.com/vega/altair/pull/3536#issuecomment-2343859781 --- tools/generate_schema_wrapper.py | 64 ++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 6435c9fea..942fc2bda 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -12,7 +12,7 @@ from itertools import chain from operator import attrgetter from pathlib import Path -from typing import Any, Final, Iterable, Iterator, Literal +from typing import TYPE_CHECKING, Any, Final, Iterable, Iterator, Literal from urllib import request import vl_convert as vlc @@ -20,7 +20,14 @@ sys.path.insert(0, str(Path.cwd())) -from tools.schemapi import CodeSnippet, SchemaInfo, codegen +from tools.schemapi import ( # noqa: F401 + CodeSnippet, + SchemaInfo, + arg_invalid_kwds, + arg_kwds, + arg_required_kwds, + codegen, +) from tools.schemapi.utils import ( SchemaProperties, TypeAliasTracer, @@ -36,6 +43,9 @@ spell_literal, ) +if TYPE_CHECKING: + from tools.schemapi.codegen import ArgInfo, AttrGetter + SCHEMA_VERSION: Final = "v5.20.1" @@ -808,7 +818,7 @@ def generate_mark_args( args = codegen.get_args(info) method_args: deque[str] = deque() dict_args: deque[str] = deque() - for p, p_info in args.iter_args(args.required | args.kwds, exclude="type"): + for p, p_info in args.iter_args(arg_required_kwds, exclude="type"): dict_args.append(f"{p}={p}") method_args.append( f"{p}: {p_info.to_type_repr(target='annotation', use_undefined=True)} = Undefined" @@ -816,19 +826,31 @@ def generate_mark_args( return {"method_args": ", ".join(method_args), "dict_args": ", ".join(dict_args)} -def _typed_dict_args(info: SchemaInfo, /) -> str: +def _typed_dict_args( + info: SchemaInfo, + /, + groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, + exclude: str | Iterable[str] | None = None, +) -> str: args = codegen.get_args(info) return "\n ".join( f"{p}: {p_info.to_type_repr(target='annotation', use_concrete=True)}" - for p, p_info in args.iter_args(args.required, args.kwds) + for p, p_info in args.iter_args(groups, exclude=exclude) ) -def _typed_dict_doc(info: SchemaInfo, /, *, summary: str | None = None) -> str: +def _typed_dict_doc( + info: SchemaInfo, + /, + *, + summary: str | None = None, + groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, + exclude: str | Iterable[str] | None = None, +) -> str: args = codegen.get_args(info) it = chain.from_iterable( (p, f" {p_info.deep_description}") - for p, p_info in args.iter_args(args.required, args.kwds) + for p, p_info in args.iter_args(groups, exclude=exclude) ) lines = ( summary or f"{info.title} ``TypedDict`` wrapper.", @@ -845,6 +867,8 @@ def generate_typed_dict( *, summary: str | None = None, override_args: Iterable[str] | None = None, + groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, + exclude: str | Iterable[str] | None = None, ) -> str: """ Return a fully typed & documented ``TypedDict``. @@ -870,17 +894,19 @@ def generate_typed_dict( metaclass_kwds = ", total=False" comment = "" td_args = ( - _typed_dict_args(info) + _typed_dict_args(info, groups=groups, exclude=exclude) if override_args is None else "\n ".join(override_args) ) - td_doc = _typed_dict_doc(info, summary=summary) - if kwds := arg_info.invalid_kwds: + td_doc = _typed_dict_doc(info, summary=summary, groups=groups, exclude=exclude) + if (kwds := arg_info.invalid_kwds) and list( + arg_info.iter_args(kwds, exclude=exclude) + ): metaclass_kwds = f", closed=True{metaclass_kwds}" comment = " # type: ignore[call-arg]" kwds_all_tps = chain.from_iterable( info.to_type_repr(as_str=False, target=TARGET, use_concrete=True) - for _, info in arg_info.iter_args(kwds) + for _, info in arg_info.iter_args(kwds, exclude=exclude) ) td_args = ( f"{td_args}\n " @@ -903,6 +929,7 @@ def generate_typed_dict( def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: KWDS: Literal["Kwds"] = "Kwds" CONFIG: Literal["Config"] = "Config" + TOP_LEVEL: Literal["TopLevelUnitSpec"] = "TopLevelUnitSpec" TOP_LEVEL_EXTRAS = ( "Step", "Projection", @@ -910,6 +937,7 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: "TitleParams", "ViewBackground", ) + TOP_LEVEL_EXCLUDE = {"$schema", "data", "datasets", "encoding", "transform"} root = load_schema(fp) config = SchemaInfo.from_refname(CONFIG, root) theme_targets = find_theme_config_targets(config) @@ -919,15 +947,13 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: ) relevant: dict[str, SchemaInfo] = { - x.title: x - for x in sorted(theme_targets, key=attrgetter("refname")) - if x.refname != CONFIG + x.title: x for x in sorted(theme_targets, key=attrgetter("refname")) } + SchemaInfo._remap_title.update( {"HexColor": ("ColorHex",), "Padding": ("float", "Map")} ) SchemaInfo._remap_title.update((k, (f"{k}{KWDS}",)) for k in relevant) - config_sub: Iterator[str] = ( generate_typed_dict(info, name=f"{info.title}{KWDS}") for info in relevant.values() @@ -935,7 +961,13 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: config_sub_names = (f"{nm}{KWDS}" for nm in relevant) yield f"__all__ = {[*config_sub_names, THEME_CONFIG]}\n\n" yield "\n".join(config_sub) - yield generate_typed_dict(config, THEME_CONFIG, summary=THEME_CONFIG_SUMMARY) + yield generate_typed_dict( + SchemaInfo.from_refname(TOP_LEVEL, root), + THEME_CONFIG, + summary=THEME_CONFIG_SUMMARY, + groups=arg_kwds, + exclude=TOP_LEVEL_EXCLUDE, + ) def find_theme_config_targets(info: SchemaInfo, depth: int = 0, /) -> set[SchemaInfo]: From ff01520fb97eb54c2a3cf5e972f88234b389fd31 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:39:56 +0100 Subject: [PATCH 119/139] build: run `generate-schema-wrapper` --- altair/vegalite/v5/schema/_config.py | 770 ++++++++++++++++----------- 1 file changed, 461 insertions(+), 309 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index a421e79d5..76944d74d 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -31,6 +31,7 @@ "BoxPlotConfigKwds", "BrushConfigKwds", "CompositionConfigKwds", + "ConfigKwds", "DateTimeKwds", "DerivedStreamKwds", "ErrorBandConfigKwds", @@ -1853,6 +1854,355 @@ class CompositionConfigKwds(TypedDict, total=False): spacing: float +class ConfigKwds(TypedDict, total=False): + """ + Config ``TypedDict`` wrapper. + + Parameters + ---------- + arc + Arc-specific Config + area + Area-Specific Config + aria + A boolean flag indicating if ARIA default attributes should be included for marks + and guides (SVG output only). If false, the ``"aria-hidden"`` attribute will be set + for all guides, removing them from the ARIA accessibility tree and Vega-Lite will + not generate default descriptions for marks. + + **Default value:** ``true``. + autosize + How the visualization size should be determined. If a string, should be one of + ``"pad"``, ``"fit"`` or ``"none"``. Object values can additionally specify + parameters for content sizing and automatic resizing. + + **Default value**: ``pad`` + axis + Axis configuration, which determines default properties for all ``x`` and ``y`` + `axes `__. For a full list of axis + configuration options, please see the `corresponding section of the axis + documentation `__. + axisBand + Config for axes with "band" scales. + axisBottom + Config for x-axis along the bottom edge of the chart. + axisDiscrete + Config for axes with "point" or "band" scales. + axisLeft + Config for y-axis along the left edge of the chart. + axisPoint + Config for axes with "point" scales. + axisQuantitative + Config for quantitative axes. + axisRight + Config for y-axis along the right edge of the chart. + axisTemporal + Config for temporal axes. + axisTop + Config for x-axis along the top edge of the chart. + axisX + X-axis specific config. + axisXBand + Config for x-axes with "band" scales. + axisXDiscrete + Config for x-axes with "point" or "band" scales. + axisXPoint + Config for x-axes with "point" scales. + axisXQuantitative + Config for x-quantitative axes. + axisXTemporal + Config for x-temporal axes. + axisY + Y-axis specific config. + axisYBand + Config for y-axes with "band" scales. + axisYDiscrete + Config for y-axes with "point" or "band" scales. + axisYPoint + Config for y-axes with "point" scales. + axisYQuantitative + Config for y-quantitative axes. + axisYTemporal + Config for y-temporal axes. + background + CSS color property to use as the background of the entire view. + + **Default value:** ``"white"`` + bar + Bar-Specific Config + boxplot + Box Config + circle + Circle-Specific Config + concat + Default configuration for all concatenation and repeat view composition operators + (``concat``, ``hconcat``, ``vconcat``, and ``repeat``) + countTitle + Default axis and legend title for count fields. + + **Default value:** ``'Count of Records``. + customFormatTypes + Allow the ``formatType`` property for text marks and guides to accept a custom + formatter function `registered as a Vega expression + `__. + errorband + ErrorBand Config + errorbar + ErrorBar Config + facet + Default configuration for the ``facet`` view composition operator + fieldTitle + Defines how Vega-Lite generates title for fields. There are three possible styles: + + * ``"verbal"`` (Default) - displays function in a verbal style (e.g., "Sum of + field", "Year-month of date", "field (binned)"). + * ``"function"`` - displays function using parentheses and capitalized texts (e.g., + "SUM(field)", "YEARMONTH(date)", "BIN(field)"). + * ``"plain"`` - displays only the field name without functions (e.g., "field", + "date", "field"). + font + Default font for all text marks, titles, and labels. + geoshape + Geoshape-Specific Config + header + Header configuration, which determines default properties for all `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerColumn + Header configuration, which determines default properties for column `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerFacet + Header configuration, which determines default properties for non-row/column facet + `headers `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + headerRow + Header configuration, which determines default properties for row `headers + `__. + + For a full list of header configuration options, please see the `corresponding + section of in the header documentation + `__. + image + Image-specific Config + legend + Legend configuration, which determines default properties for all `legends + `__. For a full list of legend + configuration options, please see the `corresponding section of in the legend + documentation `__. + line + Line-Specific Config + lineBreak + A delimiter, such as a newline character, upon which to break text strings into + multiple lines. This property provides a global default for text marks, which is + overridden by mark or style config settings, and by the lineBreak mark encoding + channel. If signal-valued, either string or regular expression (regexp) values are + valid. + locale + Locale definitions for string parsing and formatting of number and date values. The + locale object should contain ``number`` and/or ``time`` properties with `locale + definitions `__. Locale definitions + provided in the config block may be overridden by the View constructor locale + option. + mark + Mark Config + normalizedNumberFormat + If normalizedNumberFormatType is not specified, D3 number format for axis labels, + text marks, and tooltips of normalized stacked fields (fields with ``stack: + "normalize"``). For example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.normalizedNumberFormatType`` is specified and + ``config.customFormatTypes`` is ``true``, this value will be passed as ``format`` + alongside ``datum.value`` to the ``config.numberFormatType`` function. **Default + value:** ``%`` + normalizedNumberFormatType + `Custom format type + `__ for + ``config.normalizedNumberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + numberFormat + If numberFormatType is not specified, D3 number format for guide labels, text marks, + and tooltips of non-normalized fields (fields *without* ``stack: "normalize"``). For + example ``"s"`` for SI units. Use `D3's number format pattern + `__. + + If ``config.numberFormatType`` is specified and ``config.customFormatTypes`` is + ``true``, this value will be passed as ``format`` alongside ``datum.value`` to the + ``config.numberFormatType`` function. + numberFormatType + `Custom format type + `__ for + ``config.numberFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is + exposed as `format in Vega-Expression + `__. **Note:** You must also + set ``customFormatTypes`` to ``true`` to use this feature. + padding + The default visualization padding, in pixels, from the edge of the visualization + canvas to the data rectangle. If a number, specifies padding for all sides. If an + object, the value should have the format ``{"left": 5, "top": 5, "right": 5, + "bottom": 5}`` to specify padding for each side of the visualization. + + **Default value**: ``5`` + params + Dynamic variables or selections that parameterize a visualization. + point + Point-Specific Config + projection + Projection configuration, which determines default properties for all `projections + `__. For a full list of + projection configuration options, please see the `corresponding section of the + projection documentation + `__. + range + An object hash that defines default range arrays or schemes for using with scales. + For a full list of scale range configuration options, please see the `corresponding + section of the scale documentation + `__. + rect + Rect-Specific Config + rule + Rule-Specific Config + scale + Scale configuration determines default properties for all `scales + `__. For a full list of scale + configuration options, please see the `corresponding section of the scale + documentation `__. + selection + An object hash for defining default properties for each type of selections. + square + Square-Specific Config + style + An object hash that defines key-value mappings to determine default properties for + marks with a given `style + `__. The keys represent + styles names; the values have to be valid `mark configuration objects + `__. + text + Text-Specific Config + tick + Tick-Specific Config + timeFormat + Default time format for raw time values (without time units) in text marks, legend + labels and header labels. + + **Default value:** ``"%b %d, %Y"`` **Note:** Axes automatically determine the format + for each label automatically so this config does not affect axes. + timeFormatType + `Custom format type + `__ for + ``config.timeFormat``. + + **Default value:** ``undefined`` -- This is equilvalent to call D3-time-format, + which is exposed as `timeFormat in Vega-Expression + `__. **Note:** You must + also set ``customFormatTypes`` to ``true`` and there must *not* be a ``timeUnit`` + defined to use this feature. + title + Title configuration, which determines default properties for all `titles + `__. For a full list of title + configuration options, please see the `corresponding section of the title + documentation `__. + tooltipFormat + Define `custom format configuration + `__ for tooltips. If + unspecified, default format config will be applied. + trail + Trail-Specific Config + view + Default properties for `single view plots + `__. + """ + + arc: RectConfigKwds + area: AreaConfigKwds + aria: bool + autosize: AutoSizeParamsKwds | AutosizeType_T + axis: AxisConfigKwds + axisBand: AxisConfigKwds + axisBottom: AxisConfigKwds + axisDiscrete: AxisConfigKwds + axisLeft: AxisConfigKwds + axisPoint: AxisConfigKwds + axisQuantitative: AxisConfigKwds + axisRight: AxisConfigKwds + axisTemporal: AxisConfigKwds + axisTop: AxisConfigKwds + axisX: AxisConfigKwds + axisXBand: AxisConfigKwds + axisXDiscrete: AxisConfigKwds + axisXPoint: AxisConfigKwds + axisXQuantitative: AxisConfigKwds + axisXTemporal: AxisConfigKwds + axisY: AxisConfigKwds + axisYBand: AxisConfigKwds + axisYDiscrete: AxisConfigKwds + axisYPoint: AxisConfigKwds + axisYQuantitative: AxisConfigKwds + axisYTemporal: AxisConfigKwds + background: ColorHex | ColorName_T + bar: BarConfigKwds + boxplot: BoxPlotConfigKwds + circle: MarkConfigKwds + concat: CompositionConfigKwds + countTitle: str + customFormatTypes: bool + errorband: ErrorBandConfigKwds + errorbar: ErrorBarConfigKwds + facet: CompositionConfigKwds + fieldTitle: Literal["verbal", "functional", "plain"] + font: str + geoshape: MarkConfigKwds + header: HeaderConfigKwds + headerColumn: HeaderConfigKwds + headerFacet: HeaderConfigKwds + headerRow: HeaderConfigKwds + image: RectConfigKwds + legend: LegendConfigKwds + line: LineConfigKwds + lineBreak: str + locale: LocaleKwds + mark: MarkConfigKwds + normalizedNumberFormat: str + normalizedNumberFormatType: str + numberFormat: str + numberFormatType: str + padding: float | Map + params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] + point: MarkConfigKwds + projection: ProjectionConfigKwds + range: RangeConfigKwds + rect: RectConfigKwds + rule: MarkConfigKwds + scale: ScaleConfigKwds + selection: SelectionConfigKwds + square: MarkConfigKwds + style: StyleConfigIndexKwds + text: MarkConfigKwds + tick: TickConfigKwds + timeFormat: str + timeFormatType: str + title: TitleConfigKwds + tooltipFormat: FormatConfigKwds + trail: LineConfigKwds + view: ViewConfigKwds + + class DateTimeKwds(TypedDict, total=False): """ DateTime ``TypedDict`` wrapper. @@ -7278,198 +7628,77 @@ class ThemeConfig(TypedDict, total=False): Parameters ---------- - arc - Arc-specific Config - area - Area-Specific Config - aria - A boolean flag indicating if ARIA default attributes should be included for marks - and guides (SVG output only). If false, the ``"aria-hidden"`` attribute will be set - for all guides, removing them from the ARIA accessibility tree and Vega-Lite will - not generate default descriptions for marks. + align + The alignment to apply to grid rows and columns. The supported string values are + ``"all"``, ``"each"``, and ``"none"``. - **Default value:** ``true``. + * For ``"none"``, a flow layout will be used, in which adjacent subviews are simply + placed one after the other. + * For ``"each"``, subviews will be aligned into a clean grid structure, but each row + or column may be of variable size. + * For ``"all"``, subviews will be aligned and each row or column will be sized + identically based on the maximum observed size. String values for this property + will be applied to both grid rows and columns. + + Alternatively, an object value of the form ``{"row": string, "column": string}`` can + be used to supply different alignments for rows and columns. + + **Default value:** ``"all"``. autosize How the visualization size should be determined. If a string, should be one of ``"pad"``, ``"fit"`` or ``"none"``. Object values can additionally specify - parameters for content sizing and automatic resizing. - - **Default value**: ``pad`` - axis - Axis configuration, which determines default properties for all ``x`` and ``y`` - `axes `__. For a full list of axis - configuration options, please see the `corresponding section of the axis - documentation `__. - axisBand - Config for axes with "band" scales. - axisBottom - Config for x-axis along the bottom edge of the chart. - axisDiscrete - Config for axes with "point" or "band" scales. - axisLeft - Config for y-axis along the left edge of the chart. - axisPoint - Config for axes with "point" scales. - axisQuantitative - Config for quantitative axes. - axisRight - Config for y-axis along the right edge of the chart. - axisTemporal - Config for temporal axes. - axisTop - Config for x-axis along the top edge of the chart. - axisX - X-axis specific config. - axisXBand - Config for x-axes with "band" scales. - axisXDiscrete - Config for x-axes with "point" or "band" scales. - axisXPoint - Config for x-axes with "point" scales. - axisXQuantitative - Config for x-quantitative axes. - axisXTemporal - Config for x-temporal axes. - axisY - Y-axis specific config. - axisYBand - Config for y-axes with "band" scales. - axisYDiscrete - Config for y-axes with "point" or "band" scales. - axisYPoint - Config for y-axes with "point" scales. - axisYQuantitative - Config for y-quantitative axes. - axisYTemporal - Config for y-temporal axes. - background - CSS color property to use as the background of the entire view. - - **Default value:** ``"white"`` - bar - Bar-Specific Config - boxplot - Box Config - circle - Circle-Specific Config - concat - Default configuration for all concatenation and repeat view composition operators - (``concat``, ``hconcat``, ``vconcat``, and ``repeat``) - countTitle - Default axis and legend title for count fields. + parameters for content sizing and automatic resizing. - **Default value:** ``'Count of Records``. - customFormatTypes - Allow the ``formatType`` property for text marks and guides to accept a custom - formatter function `registered as a Vega expression - `__. - errorband - ErrorBand Config - errorbar - ErrorBar Config - facet - Default configuration for the ``facet`` view composition operator - fieldTitle - Defines how Vega-Lite generates title for fields. There are three possible styles: + **Default value**: ``pad`` + background + CSS color property to use as the background of the entire view. - * ``"verbal"`` (Default) - displays function in a verbal style (e.g., "Sum of - field", "Year-month of date", "field (binned)"). - * ``"function"`` - displays function using parentheses and capitalized texts (e.g., - "SUM(field)", "YEARMONTH(date)", "BIN(field)"). - * ``"plain"`` - displays only the field name without functions (e.g., "field", - "date", "field"). - font - Default font for all text marks, titles, and labels. - geoshape - Geoshape-Specific Config - header - Header configuration, which determines default properties for all `headers - `__. + **Default value:** ``"white"`` + bounds + The bounds calculation method to use for determining the extent of a sub-plot. One + of ``full`` (the default) or ``flush``. - For a full list of header configuration options, please see the `corresponding - section of in the header documentation - `__. - headerColumn - Header configuration, which determines default properties for column `headers - `__. + * If set to ``full``, the entire calculated bounds (including axes, title, and + legend) will be used. + * If set to ``flush``, only the specified width and height values for the sub-view + will be used. The ``flush`` setting can be useful when attempting to place + sub-plots without axes or legends into a uniform grid structure. - For a full list of header configuration options, please see the `corresponding - section of in the header documentation - `__. - headerFacet - Header configuration, which determines default properties for non-row/column facet - `headers `__. + **Default value:** ``"full"`` + center + Boolean flag indicating if subviews should be centered relative to their respective + rows or columns. - For a full list of header configuration options, please see the `corresponding - section of in the header documentation - `__. - headerRow - Header configuration, which determines default properties for row `headers - `__. + An object value of the form ``{"row": boolean, "column": boolean}`` can be used to + supply different centering values for rows and columns. - For a full list of header configuration options, please see the `corresponding - section of in the header documentation - `__. - image - Image-specific Config - legend - Legend configuration, which determines default properties for all `legends - `__. For a full list of legend - configuration options, please see the `corresponding section of in the legend - documentation `__. - line - Line-Specific Config - lineBreak - A delimiter, such as a newline character, upon which to break text strings into - multiple lines. This property provides a global default for text marks, which is - overridden by mark or style config settings, and by the lineBreak mark encoding - channel. If signal-valued, either string or regular expression (regexp) values are - valid. - locale - Locale definitions for string parsing and formatting of number and date values. The - locale object should contain ``number`` and/or ``time`` properties with `locale - definitions `__. Locale definitions - provided in the config block may be overridden by the View constructor locale - option. - mark - Mark Config - normalizedNumberFormat - If normalizedNumberFormatType is not specified, D3 number format for axis labels, - text marks, and tooltips of normalized stacked fields (fields with ``stack: - "normalize"``). For example ``"s"`` for SI units. Use `D3's number format pattern - `__. + **Default value:** ``false`` + config + Vega-Lite configuration object. This property can only be defined at the top-level + of a specification. + description + Description of this mark for commenting purpose. + height + The height of a visualization. - If ``config.normalizedNumberFormatType`` is specified and - ``config.customFormatTypes`` is ``true``, this value will be passed as ``format`` - alongside ``datum.value`` to the ``config.numberFormatType`` function. **Default - value:** ``%`` - normalizedNumberFormatType - `Custom format type - `__ for - ``config.normalizedNumberFormat``. + * For a plot with a continuous y-field, height should be a number. + * For a plot with either a discrete y-field or no y-field, height can be either a + number indicating a fixed height or an object in the form of ``{step: number}`` + defining the height per discrete step. (No y-field is equivalent to having one + discrete step.) + * To enable responsive sizing on height, it should be set to ``"container"``. - **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is - exposed as `format in Vega-Expression - `__. **Note:** You must also - set ``customFormatTypes`` to ``true`` to use this feature. - numberFormat - If numberFormatType is not specified, D3 number format for guide labels, text marks, - and tooltips of non-normalized fields (fields *without* ``stack: "normalize"``). For - example ``"s"`` for SI units. Use `D3's number format pattern - `__. + **Default value:** Based on ``config.view.continuousHeight`` for a plot with a + continuous y-field and ``config.view.discreteHeight`` otherwise. - If ``config.numberFormatType`` is specified and ``config.customFormatTypes`` is - ``true``, this value will be passed as ``format`` alongside ``datum.value`` to the - ``config.numberFormatType`` function. - numberFormatType - `Custom format type - `__ for - ``config.numberFormat``. + **Note:** For plots with `row and column channels + `__, this represents the + height of a single view and the ``"container"`` option cannot be used. - **Default value:** ``undefined`` -- This is equilvalent to call D3-format, which is - exposed as `format in Vega-Expression - `__. **Note:** You must also - set ``customFormatTypes`` to ``true`` to use this feature. + **See also:** `height `__ + documentation. + name + Name of the visualization for later reference. padding The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an @@ -7478,144 +7707,67 @@ class ThemeConfig(TypedDict, total=False): **Default value**: ``5`` params - Dynamic variables or selections that parameterize a visualization. - point - Point-Specific Config + An array of parameters that may either be simple variables, or more complex + selections that map user input to data queries. projection - Projection configuration, which determines default properties for all `projections - `__. For a full list of - projection configuration options, please see the `corresponding section of the - projection documentation - `__. - range - An object hash that defines default range arrays or schemes for using with scales. - For a full list of scale range configuration options, please see the `corresponding - section of the scale documentation - `__. - rect - Rect-Specific Config - rule - Rule-Specific Config - scale - Scale configuration determines default properties for all `scales - `__. For a full list of scale - configuration options, please see the `corresponding section of the scale - documentation `__. - selection - An object hash for defining default properties for each type of selections. - square - Square-Specific Config - style - An object hash that defines key-value mappings to determine default properties for - marks with a given `style - `__. The keys represent - styles names; the values have to be valid `mark configuration objects - `__. - text - Text-Specific Config - tick - Tick-Specific Config - timeFormat - Default time format for raw time values (without time units) in text marks, legend - labels and header labels. - - **Default value:** ``"%b %d, %Y"`` **Note:** Axes automatically determine the format - for each label automatically so this config does not affect axes. - timeFormatType - `Custom format type - `__ for - ``config.timeFormat``. + An object defining properties of geographic projection, which will be applied to + ``shape`` path for ``"geoshape"`` marks and to ``latitude`` and ``"longitude"`` + channels for other marks. + resolve + Scale, axis, and legend resolutions for view composition specifications. + spacing + The spacing in pixels between sub-views of the composition operator. An object of + the form ``{"row": number, "column": number}`` can be used to set different spacing + values for rows and columns. - **Default value:** ``undefined`` -- This is equilvalent to call D3-time-format, - which is exposed as `timeFormat in Vega-Expression - `__. **Note:** You must - also set ``customFormatTypes`` to ``true`` and there must *not* be a ``timeUnit`` - defined to use this feature. + **Default value**: Depends on ``"spacing"`` property of `the view composition + configuration `__ + (``20`` by default) title - Title configuration, which determines default properties for all `titles - `__. For a full list of title - configuration options, please see the `corresponding section of the title - documentation `__. - tooltipFormat - Define `custom format configuration - `__ for tooltips. If - unspecified, default format config will be applied. - trail - Trail-Specific Config + Title for the plot. + usermeta + Optional metadata that will be passed to Vega. This object is completely ignored by + Vega and Vega-Lite and can be used for custom metadata. view - Default properties for `single view plots - `__. + An object defining the view background's fill and stroke. + + **Default value:** none (transparent) + width + The width of a visualization. + + * For a plot with a continuous x-field, width should be a number. + * For a plot with either a discrete x-field or no x-field, width can be either a + number indicating a fixed width or an object in the form of ``{step: number}`` + defining the width per discrete step. (No x-field is equivalent to having one + discrete step.) + * To enable responsive sizing on width, it should be set to ``"container"``. + + **Default value:** Based on ``config.view.continuousWidth`` for a plot with a + continuous x-field and ``config.view.discreteWidth`` otherwise. + + **Note:** For plots with `row and column channels + `__, this represents the + width of a single view and the ``"container"`` option cannot be used. + + **See also:** `width `__ + documentation. """ - arc: RectConfigKwds - area: AreaConfigKwds - aria: bool + align: RowCol[LayoutAlign_T, LayoutAlign_T] | LayoutAlign_T autosize: AutoSizeParamsKwds | AutosizeType_T - axis: AxisConfigKwds - axisBand: AxisConfigKwds - axisBottom: AxisConfigKwds - axisDiscrete: AxisConfigKwds - axisLeft: AxisConfigKwds - axisPoint: AxisConfigKwds - axisQuantitative: AxisConfigKwds - axisRight: AxisConfigKwds - axisTemporal: AxisConfigKwds - axisTop: AxisConfigKwds - axisX: AxisConfigKwds - axisXBand: AxisConfigKwds - axisXDiscrete: AxisConfigKwds - axisXPoint: AxisConfigKwds - axisXQuantitative: AxisConfigKwds - axisXTemporal: AxisConfigKwds - axisY: AxisConfigKwds - axisYBand: AxisConfigKwds - axisYDiscrete: AxisConfigKwds - axisYPoint: AxisConfigKwds - axisYQuantitative: AxisConfigKwds - axisYTemporal: AxisConfigKwds background: ColorHex | ColorName_T - bar: BarConfigKwds - boxplot: BoxPlotConfigKwds - circle: MarkConfigKwds - concat: CompositionConfigKwds - countTitle: str - customFormatTypes: bool - errorband: ErrorBandConfigKwds - errorbar: ErrorBarConfigKwds - facet: CompositionConfigKwds - fieldTitle: Literal["verbal", "functional", "plain"] - font: str - geoshape: MarkConfigKwds - header: HeaderConfigKwds - headerColumn: HeaderConfigKwds - headerFacet: HeaderConfigKwds - headerRow: HeaderConfigKwds - image: RectConfigKwds - legend: LegendConfigKwds - line: LineConfigKwds - lineBreak: str - locale: LocaleKwds - mark: MarkConfigKwds - normalizedNumberFormat: str - normalizedNumberFormatType: str - numberFormat: str - numberFormatType: str + bounds: Literal["full", "flush"] + center: bool | RowCol[bool, bool] + config: ConfigKwds + description: str + height: float | StepKwds | Literal["container"] + name: str padding: float | Map params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] - point: MarkConfigKwds - projection: ProjectionConfigKwds - range: RangeConfigKwds - rect: RectConfigKwds - rule: MarkConfigKwds - scale: ScaleConfigKwds - selection: SelectionConfigKwds - square: MarkConfigKwds - style: StyleConfigIndexKwds - text: MarkConfigKwds - tick: TickConfigKwds - timeFormat: str - timeFormatType: str - title: TitleConfigKwds - tooltipFormat: FormatConfigKwds - trail: LineConfigKwds - view: ViewConfigKwds + projection: ProjectionKwds + resolve: ResolveKwds + spacing: float | RowCol[float, float] + title: str | Sequence[str] | TitleParamsKwds + usermeta: Map + view: ViewBackgroundKwds + width: float | StepKwds | Literal["container"] From 0b8eda854c0f14aa4f65b0547bb7b07b940c2e6b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:40:33 +0100 Subject: [PATCH 120/139] test: Update `test_theme` to account for level correction https://github.com/vega/altair/pull/3536#issuecomment-2343859781 --- tests/vegalite/v5/test_theme.py | 1248 ++++++++++++++++--------------- 1 file changed, 642 insertions(+), 606 deletions(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 34d753b6b..f980c61df 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -5,7 +5,7 @@ import pytest import altair.vegalite.v5 as alt -from altair.vegalite.v5.schema._config import ThemeConfig +from altair.vegalite.v5.schema._config import ConfigKwds, ThemeConfig from altair.vegalite.v5.schema._typing import is_color_hex from altair.vegalite.v5.theme import VEGA_THEMES, register_theme, themes @@ -70,248 +70,267 @@ def carbonwhite_theme() -> ThemeConfig: .. _carbon: https://github.com/vega/vega-themes/blob/5f1a5c5b22cc462cf3d46894212152b71cfe964f/src/carbongen.ts """ - return { - "arc": {"fill": "#6929c4"}, - "area": {"fill": "#6929c4"}, - "axis": { - "grid": True, - "gridColor": "#e0e0e0", - "labelAngle": 0, - "labelColor": "#525252", - "labelFont": 'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif', - "labelFontSize": 12, - "labelFontWeight": 400, - "titleColor": "#161616", - "titleFontSize": 12, - "titleFontWeight": 600, - }, - "axisX": {"titlePadding": 10}, - "axisY": {"titlePadding": 2.5}, - "background": "#ffffff", - "circle": {"fill": "#6929c4"}, - "range": { - "category": [ - "#6929c4", - "#1192e8", - "#005d5d", - "#9f1853", - "#fa4d56", - "#570408", - "#198038", - "#002d9c", - "#ee538b", - "#b28600", - "#009d9a", - "#012749", - "#8a3800", - "#a56eff", - ], - "diverging": [ - "#750e13", - "#a2191f", - "#da1e28", - "#fa4d56", - "#ff8389", - "#ffb3b8", - "#ffd7d9", - "#fff1f1", - "#e5f6ff", - "#bae6ff", - "#82cfff", - "#33b1ff", - "#1192e8", - "#0072c3", - "#00539a", - "#003a6d", - ], - "heatmap": [ - "#f6f2ff", - "#e8daff", - "#d4bbff", - "#be95ff", - "#a56eff", - "#8a3ffc", - "#6929c4", - "#491d8b", - "#31135e", - "#1c0f30", - ], - }, - "rect": {"fill": "#6929c4"}, - "style": { - "guide-label": { - "fill": "#525252", - "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', - "fontWeight": 400, + return ThemeConfig( + config={ + "arc": {"fill": "#6929c4"}, + "area": {"fill": "#6929c4"}, + "axis": { + "grid": True, + "gridColor": "#e0e0e0", + "labelAngle": 0, + "labelColor": "#525252", + "labelFont": 'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif', + "labelFontSize": 12, + "labelFontWeight": 400, + "titleColor": "#161616", + "titleFontSize": 12, + "titleFontWeight": 600, }, - "guide-title": { - "fill": "#525252", + "axisX": {"titlePadding": 10}, + "axisY": {"titlePadding": 2.5}, + "background": "#ffffff", + "circle": {"fill": "#6929c4"}, + "range": { + "category": [ + "#6929c4", + "#1192e8", + "#005d5d", + "#9f1853", + "#fa4d56", + "#570408", + "#198038", + "#002d9c", + "#ee538b", + "#b28600", + "#009d9a", + "#012749", + "#8a3800", + "#a56eff", + ], + "diverging": [ + "#750e13", + "#a2191f", + "#da1e28", + "#fa4d56", + "#ff8389", + "#ffb3b8", + "#ffd7d9", + "#fff1f1", + "#e5f6ff", + "#bae6ff", + "#82cfff", + "#33b1ff", + "#1192e8", + "#0072c3", + "#00539a", + "#003a6d", + ], + "heatmap": [ + "#f6f2ff", + "#e8daff", + "#d4bbff", + "#be95ff", + "#a56eff", + "#8a3ffc", + "#6929c4", + "#491d8b", + "#31135e", + "#1c0f30", + ], + }, + "rect": {"fill": "#6929c4"}, + "style": { + "guide-label": { + "fill": "#525252", + "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', + "fontWeight": 400, + }, + "guide-title": { + "fill": "#525252", + "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', + "fontWeight": 400, + }, + }, # type: ignore[typeddict-unknown-key] + "title": { + "anchor": "start", + "color": "#161616", + "dy": -15, "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', - "fontWeight": 400, + "fontSize": 16, + "fontWeight": 600, }, - }, # type: ignore[typeddict-unknown-key] - "title": { - "anchor": "start", - "color": "#161616", - "dy": -15, - "font": 'IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif', - "fontSize": 16, - "fontWeight": 600, - }, - "view": {"fill": "#ffffff", "stroke": "#ffffff"}, - } + "view": {"fill": "#ffffff", "stroke": "#ffffff"}, + } + ) def dark_theme() -> ThemeConfig: return ThemeConfig( - axis={"domainColor": "#fff", "gridColor": "#888", "tickColor": "#fff"}, - background="#333", - style={ - "guide-label": {"fill": "#fff"}, - "guide-title": {"fill": "#fff"}, - }, # type: ignore[typeddict-unknown-key] - title={"color": "#fff", "subtitleColor": "#fff"}, - view={"stroke": "#888"}, + config=ConfigKwds( + axis={"domainColor": "#fff", "gridColor": "#888", "tickColor": "#fff"}, + background="#333", + style={ + "guide-label": {"fill": "#fff"}, + "guide-title": {"fill": "#fff"}, + }, # type: ignore[typeddict-unknown-key] + title={"color": "#fff", "subtitleColor": "#fff"}, + view={"stroke": "#888"}, + ) ) def excel_theme() -> ThemeConfig: return { - "arc": {"fill": "#4572a7"}, - "area": {"fill": "#4572a7"}, - "axis": { - "bandPosition": 0.5, - "grid": True, - "gridColor": "#000000", - "gridOpacity": 1, - "gridWidth": 0.5, - "labelPadding": 10, - "tickSize": 5, - "tickWidth": 0.5, - }, - "axisBand": {"grid": False, "tickExtra": True}, - "background": "#fff", - "legend": { - "labelBaseline": "middle", - "labelFontSize": 11, - "symbolSize": 50, - "symbolType": "square", - }, - "line": {"stroke": "#4572a7", "strokeWidth": 2}, - "range": { - "category": [ - "#4572a7", - "#aa4643", - "#8aa453", - "#71598e", - "#4598ae", - "#d98445", - "#94aace", - "#d09393", - "#b9cc98", - "#a99cbc", - ] - }, - "rect": {"fill": "#4572a7"}, + "config": { + "arc": {"fill": "#4572a7"}, + "area": {"fill": "#4572a7"}, + "axis": { + "bandPosition": 0.5, + "grid": True, + "gridColor": "#000000", + "gridOpacity": 1, + "gridWidth": 0.5, + "labelPadding": 10, + "tickSize": 5, + "tickWidth": 0.5, + }, + "axisBand": {"grid": False, "tickExtra": True}, + "background": "#fff", + "legend": { + "labelBaseline": "middle", + "labelFontSize": 11, + "symbolSize": 50, + "symbolType": "square", + }, + "line": {"stroke": "#4572a7", "strokeWidth": 2}, + "range": { + "category": [ + "#4572a7", + "#aa4643", + "#8aa453", + "#71598e", + "#4598ae", + "#d98445", + "#94aace", + "#d09393", + "#b9cc98", + "#a99cbc", + ] + }, + "rect": {"fill": "#4572a7"}, + } } def fivethirtyeight_theme() -> ThemeConfig: return { - "arc": {"fill": "#30a2da"}, - "area": {"fill": "#30a2da"}, - "axis": { - "domainColor": "#cbcbcb", - "grid": True, - "gridColor": "#cbcbcb", - "gridWidth": 1, - "labelColor": "#999", - "labelFontSize": 10, - "labelPadding": 4, - "tickColor": "#cbcbcb", - "tickSize": 10, - "titleColor": "#333", - "titleFontSize": 14, - "titlePadding": 10, - }, - "axisBand": {"grid": False}, - "background": "#f0f0f0", - "bar": {"binSpacing": 2, "fill": "#30a2da", "stroke": None}, - "legend": { - "labelColor": "#333", - "labelFontSize": 11, - "padding": 1, - "symbolSize": 30, - "symbolType": "square", - "titleColor": "#333", - "titleFontSize": 14, - "titlePadding": 10, - }, - "line": {"stroke": "#30a2da", "strokeWidth": 2}, - "point": {"filled": True, "shape": "circle"}, - "range": { - "category": [ - "#30a2da", - "#fc4f30", - "#e5ae38", - "#6d904f", - "#8b8b8b", - "#b96db8", - "#ff9e27", - "#56cc60", - "#52d2ca", - "#52689e", - "#545454", - "#9fe4f8", - ], - "diverging": [ - "#cc0020", - "#e77866", - "#f6e7e1", - "#d6e8ed", - "#91bfd9", - "#1d78b5", - ], - "heatmap": ["#d6e8ed", "#cee0e5", "#91bfd9", "#549cc6", "#1d78b5"], - }, - "rect": {"fill": "#30a2da"}, - "title": {"anchor": "start", "fontSize": 24, "fontWeight": 600, "offset": 20}, + "config": { + "arc": {"fill": "#30a2da"}, + "area": {"fill": "#30a2da"}, + "axis": { + "domainColor": "#cbcbcb", + "grid": True, + "gridColor": "#cbcbcb", + "gridWidth": 1, + "labelColor": "#999", + "labelFontSize": 10, + "labelPadding": 4, + "tickColor": "#cbcbcb", + "tickSize": 10, + "titleColor": "#333", + "titleFontSize": 14, + "titlePadding": 10, + }, + "axisBand": {"grid": False}, + "background": "#f0f0f0", + "bar": {"binSpacing": 2, "fill": "#30a2da", "stroke": None}, + "legend": { + "labelColor": "#333", + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square", + "titleColor": "#333", + "titleFontSize": 14, + "titlePadding": 10, + }, + "line": {"stroke": "#30a2da", "strokeWidth": 2}, + "point": {"filled": True, "shape": "circle"}, + "range": { + "category": [ + "#30a2da", + "#fc4f30", + "#e5ae38", + "#6d904f", + "#8b8b8b", + "#b96db8", + "#ff9e27", + "#56cc60", + "#52d2ca", + "#52689e", + "#545454", + "#9fe4f8", + ], + "diverging": [ + "#cc0020", + "#e77866", + "#f6e7e1", + "#d6e8ed", + "#91bfd9", + "#1d78b5", + ], + "heatmap": ["#d6e8ed", "#cee0e5", "#91bfd9", "#549cc6", "#1d78b5"], + }, + "rect": {"fill": "#30a2da"}, + "title": { + "anchor": "start", + "fontSize": 24, + "fontWeight": 600, + "offset": 20, + }, + } } def ggplot2_theme() -> ThemeConfig: return { - "arc": {"fill": "#000"}, - "area": {"fill": "#000"}, - "axis": { - "domain": False, - "grid": True, - "gridColor": "#FFFFFF", - "gridOpacity": 1, - "labelColor": "#7F7F7F", - "labelPadding": 4, - "tickColor": "#7F7F7F", - "tickSize": 5.67, - "titleFontSize": 16, - "titleFontWeight": "normal", - }, - "legend": {"labelBaseline": "middle", "labelFontSize": 11, "symbolSize": 40}, - "line": {"stroke": "#000"}, - "range": { - "category": [ - "#000000", - "#7F7F7F", - "#1A1A1A", - "#999999", - "#333333", - "#B0B0B0", - "#4D4D4D", - "#C9C9C9", - "#666666", - "#DCDCDC", - ] - }, - "rect": {"fill": "#000"}, + "config": { + "arc": {"fill": "#000"}, + "area": {"fill": "#000"}, + "axis": { + "domain": False, + "grid": True, + "gridColor": "#FFFFFF", + "gridOpacity": 1, + "labelColor": "#7F7F7F", + "labelPadding": 4, + "tickColor": "#7F7F7F", + "tickSize": 5.67, + "titleFontSize": 16, + "titleFontWeight": "normal", + }, + "legend": { + "labelBaseline": "middle", + "labelFontSize": 11, + "symbolSize": 40, + }, + "line": {"stroke": "#000"}, + "range": { + "category": [ + "#000000", + "#7F7F7F", + "#1A1A1A", + "#999999", + "#333333", + "#B0B0B0", + "#4D4D4D", + "#C9C9C9", + "#666666", + "#DCDCDC", + ] + }, + "rect": {"fill": "#000"}, + } } @@ -319,421 +338,438 @@ def ggplot2_theme() -> ThemeConfig: def googlecharts_theme() -> ThemeConfig: """``Padding`` definition `float | Map` needs to be stricter.""" return { - "arc": {"fill": "#3366CC"}, - "area": {"fill": "#3366CC"}, - "axis": { - "domain": False, - "grid": True, - "gridColor": "#ccc", - "tickColor": "#ccc", - }, - "background": "#fff", - "circle": {"fill": "#3366CC"}, - "padding": { - "bottom": 10, - "left": 10, - "right": 10, - "top": 10, - }, - "range": { - "category": [ - "#4285F4", - "#DB4437", - "#F4B400", - "#0F9D58", - "#AB47BC", - "#00ACC1", - "#FF7043", - "#9E9D24", - "#5C6BC0", - "#F06292", - "#00796B", - "#C2185B", - ], - "heatmap": ["#c6dafc", "#5e97f6", "#2a56c6"], - }, - "rect": {"fill": "#3366CC"}, - "style": { - "group-title": {"font": "Arial, sans-serif", "fontSize": 12}, - "guide-label": {"font": "Arial, sans-serif", "fontSize": 12}, - "guide-title": {"font": "Arial, sans-serif", "fontSize": 12}, - }, # type: ignore[typeddict-unknown-key] - "title": { - "anchor": "start", - "dy": -3, - "font": "Arial, sans-serif", - "fontSize": 14, - "fontWeight": "bold", - }, + "config": { + "arc": {"fill": "#3366CC"}, + "area": {"fill": "#3366CC"}, + "axis": { + "domain": False, + "grid": True, + "gridColor": "#ccc", + "tickColor": "#ccc", + }, + "background": "#fff", + "circle": {"fill": "#3366CC"}, + "padding": { + "bottom": 10, + "left": 10, + "right": 10, + "top": 10, + }, + "range": { + "category": [ + "#4285F4", + "#DB4437", + "#F4B400", + "#0F9D58", + "#AB47BC", + "#00ACC1", + "#FF7043", + "#9E9D24", + "#5C6BC0", + "#F06292", + "#00796B", + "#C2185B", + ], + "heatmap": ["#c6dafc", "#5e97f6", "#2a56c6"], + }, + "rect": {"fill": "#3366CC"}, + "style": { + "group-title": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-label": {"font": "Arial, sans-serif", "fontSize": 12}, + "guide-title": {"font": "Arial, sans-serif", "fontSize": 12}, + }, # type: ignore[typeddict-unknown-key] + "title": { + "anchor": "start", + "dy": -3, + "font": "Arial, sans-serif", + "fontSize": 14, + "fontWeight": "bold", + }, + } } def latimes_theme() -> ThemeConfig: return { - "arc": {"fill": "#82c6df"}, - "area": {"fill": "#82c6df"}, - "axis": { - "labelFont": "Benton Gothic, sans-serif", - "labelFontSize": 11.5, - "labelFontWeight": "normal", - "titleFont": "Benton Gothic Bold, sans-serif", - "titleFontSize": 13, - "titleFontWeight": "normal", - }, - "axisX": {"labelAngle": 0, "labelPadding": 4, "tickSize": 3}, - "axisY": { - "labelBaseline": "middle", - "maxExtent": 45, - "minExtent": 45, - "tickSize": 2, - "titleAlign": "left", - "titleAngle": 0, - "titleX": -45, - "titleY": -11, - }, - "background": "#ffffff", - "legend": { - "labelFont": "Benton Gothic, sans-serif", - "labelFontSize": 11.5, - "symbolType": "square", - "titleFont": "Benton Gothic Bold, sans-serif", - "titleFontSize": 13, - "titleFontWeight": "normal", - }, - "line": {"stroke": "#82c6df", "strokeWidth": 2}, - "range": { - "category": [ - "#ec8431", - "#829eb1", - "#c89d29", - "#3580b1", - "#adc839", - "#ab7fb4", - ], - "diverging": [ - "#e68a4f", - "#f4bb6a", - "#f9e39c", - "#dadfe2", - "#a6b7c6", - "#849eae", - ], - "heatmap": [ - "#fbf2c7", - "#f9e39c", - "#f8d36e", - "#f4bb6a", - "#e68a4f", - "#d15a40", - "#ab4232", - ], - "ordinal": [ - "#fbf2c7", - "#f9e39c", - "#f8d36e", - "#f4bb6a", - "#e68a4f", - "#d15a40", - "#ab4232", - ], - "ramp": [ - "#fbf2c7", - "#f9e39c", - "#f8d36e", - "#f4bb6a", - "#e68a4f", - "#d15a40", - "#ab4232", - ], - }, - "rect": {"fill": "#82c6df"}, - "title": { - "anchor": "start", - "color": "#000000", - "font": "Benton Gothic Bold, sans-serif", - "fontSize": 22, - "fontWeight": "normal", - }, + "config": { + "arc": {"fill": "#82c6df"}, + "area": {"fill": "#82c6df"}, + "axis": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "labelFontWeight": "normal", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal", + }, + "axisX": {"labelAngle": 0, "labelPadding": 4, "tickSize": 3}, + "axisY": { + "labelBaseline": "middle", + "maxExtent": 45, + "minExtent": 45, + "tickSize": 2, + "titleAlign": "left", + "titleAngle": 0, + "titleX": -45, + "titleY": -11, + }, + "background": "#ffffff", + "legend": { + "labelFont": "Benton Gothic, sans-serif", + "labelFontSize": 11.5, + "symbolType": "square", + "titleFont": "Benton Gothic Bold, sans-serif", + "titleFontSize": 13, + "titleFontWeight": "normal", + }, + "line": {"stroke": "#82c6df", "strokeWidth": 2}, + "range": { + "category": [ + "#ec8431", + "#829eb1", + "#c89d29", + "#3580b1", + "#adc839", + "#ab7fb4", + ], + "diverging": [ + "#e68a4f", + "#f4bb6a", + "#f9e39c", + "#dadfe2", + "#a6b7c6", + "#849eae", + ], + "heatmap": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + "ordinal": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + "ramp": [ + "#fbf2c7", + "#f9e39c", + "#f8d36e", + "#f4bb6a", + "#e68a4f", + "#d15a40", + "#ab4232", + ], + }, + "rect": {"fill": "#82c6df"}, + "title": { + "anchor": "start", + "color": "#000000", + "font": "Benton Gothic Bold, sans-serif", + "fontSize": 22, + "fontWeight": "normal", + }, + } } def powerbi_theme() -> ThemeConfig: return { - "arc": {"fill": "#118DFF"}, - "area": {"fill": "#118DFF", "line": True, "opacity": 0.6}, - "axis": { - "domain": False, - "grid": False, - "labelColor": "#605E5C", - "labelFontSize": 12, - "ticks": False, - "titleColor": "#252423", - "titleFont": "wf_standard-font, helvetica, arial, sans-serif", - "titleFontSize": 16, - "titleFontWeight": "normal", - }, - "axisBand": {"tickExtra": True}, - "axisQuantitative": { - "grid": True, - "gridColor": "#C8C6C4", - "gridDash": [1, 5], - "labelFlush": False, - "tickCount": 3, - }, - "axisX": {"labelPadding": 5}, - "axisY": {"labelPadding": 10}, - "background": "transparent", - "bar": {"fill": "#118DFF"}, - "font": "Segoe UI", - "header": { - "labelColor": "#605E5C", - "labelFont": "Segoe UI", - "labelFontSize": 13.333333333333332, - "titleColor": "#252423", - "titleFont": "wf_standard-font, helvetica, arial, sans-serif", - "titleFontSize": 16, - }, - "legend": { - "labelColor": "#605E5C", - "labelFont": "Segoe UI", - "labelFontSize": 13.333333333333332, - "symbolSize": 75, - "symbolType": "circle", - "titleColor": "#605E5C", - "titleFont": "Segoe UI", - "titleFontWeight": "bold", - }, - "line": { - "stroke": "#118DFF", - "strokeCap": "round", - "strokeJoin": "round", - "strokeWidth": 3, - }, - "point": {"fill": "#118DFF", "filled": True, "size": 75}, - "range": { - "category": [ - "#118DFF", - "#12239E", - "#E66C37", - "#6B007B", - "#E044A7", - "#744EC2", - "#D9B300", - "#D64550", - ], - "diverging": ["#DEEFFF", "#118DFF"], - "heatmap": ["#DEEFFF", "#118DFF"], - "ordinal": [ - "#DEEFFF", - "#c7e4ff", - "#b0d9ff", - "#9aceff", - "#83c3ff", - "#6cb9ff", - "#55aeff", - "#3fa3ff", - "#2898ff", - "#118DFF", - ], - }, - "rect": {"fill": "#118DFF"}, - "text": {"fill": "#605E5C", "font": "Segoe UI", "fontSize": 12}, - "view": {"stroke": "transparent"}, + "config": { + "arc": {"fill": "#118DFF"}, + "area": {"fill": "#118DFF", "line": True, "opacity": 0.6}, + "axis": { + "domain": False, + "grid": False, + "labelColor": "#605E5C", + "labelFontSize": 12, + "ticks": False, + "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16, + "titleFontWeight": "normal", + }, + "axisBand": {"tickExtra": True}, + "axisQuantitative": { + "grid": True, + "gridColor": "#C8C6C4", + "gridDash": [1, 5], + "labelFlush": False, + "tickCount": 3, + }, + "axisX": {"labelPadding": 5}, + "axisY": {"labelPadding": 10}, + "background": "transparent", + "bar": {"fill": "#118DFF"}, + "font": "Segoe UI", + "header": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "titleColor": "#252423", + "titleFont": "wf_standard-font, helvetica, arial, sans-serif", + "titleFontSize": 16, + }, + "legend": { + "labelColor": "#605E5C", + "labelFont": "Segoe UI", + "labelFontSize": 13.333333333333332, + "symbolSize": 75, + "symbolType": "circle", + "titleColor": "#605E5C", + "titleFont": "Segoe UI", + "titleFontWeight": "bold", + }, + "line": { + "stroke": "#118DFF", + "strokeCap": "round", + "strokeJoin": "round", + "strokeWidth": 3, + }, + "point": {"fill": "#118DFF", "filled": True, "size": 75}, + "range": { + "category": [ + "#118DFF", + "#12239E", + "#E66C37", + "#6B007B", + "#E044A7", + "#744EC2", + "#D9B300", + "#D64550", + ], + "diverging": ["#DEEFFF", "#118DFF"], + "heatmap": ["#DEEFFF", "#118DFF"], + "ordinal": [ + "#DEEFFF", + "#c7e4ff", + "#b0d9ff", + "#9aceff", + "#83c3ff", + "#6cb9ff", + "#55aeff", + "#3fa3ff", + "#2898ff", + "#118DFF", + ], + }, + "rect": {"fill": "#118DFF"}, + "text": {"fill": "#605E5C", "font": "Segoe UI", "fontSize": 12}, + "view": {"stroke": "transparent"}, + } } def quartz_theme() -> ThemeConfig: return { - "arc": {"fill": "#ab5787"}, - "area": {"fill": "#ab5787"}, - "axis": { - "domainColor": "#979797", - "domainWidth": 0.5, - "gridWidth": 0.2, - "labelColor": "#979797", - "tickColor": "#979797", - "tickWidth": 0.2, - "titleColor": "#979797", - }, - "axisBand": {"grid": False}, - "axisX": {"grid": True, "tickSize": 10}, - "axisY": {"domain": False, "grid": True, "tickSize": 0}, - "background": "#f9f9f9", - "legend": { - "labelFontSize": 11, - "padding": 1, - "symbolSize": 30, - "symbolType": "square", - }, - "line": {"stroke": "#ab5787"}, - "range": { - "category": [ - "#ab5787", - "#51b2e5", - "#703c5c", - "#168dd9", - "#d190b6", - "#00609f", - "#d365ba", - "#154866", - "#666666", - "#c4c4c4", - ] - }, - "rect": {"fill": "#ab5787"}, + "config": { + "arc": {"fill": "#ab5787"}, + "area": {"fill": "#ab5787"}, + "axis": { + "domainColor": "#979797", + "domainWidth": 0.5, + "gridWidth": 0.2, + "labelColor": "#979797", + "tickColor": "#979797", + "tickWidth": 0.2, + "titleColor": "#979797", + }, + "axisBand": {"grid": False}, + "axisX": {"grid": True, "tickSize": 10}, + "axisY": {"domain": False, "grid": True, "tickSize": 0}, + "background": "#f9f9f9", + "legend": { + "labelFontSize": 11, + "padding": 1, + "symbolSize": 30, + "symbolType": "square", + }, + "line": {"stroke": "#ab5787"}, + "range": { + "category": [ + "#ab5787", + "#51b2e5", + "#703c5c", + "#168dd9", + "#d190b6", + "#00609f", + "#d365ba", + "#154866", + "#666666", + "#c4c4c4", + ] + }, + "rect": {"fill": "#ab5787"}, + } } def urbaninstitute_theme() -> ThemeConfig: return { - "arc": {"fill": "#1696d2"}, - "area": {"fill": "#1696d2"}, - "axisX": { - "domain": True, - "domainColor": "#000000", - "domainWidth": 1, - "grid": False, - "labelAngle": 0, - "labelFont": "Lato", - "labelFontSize": 12, - "tickColor": "#000000", - "tickSize": 5, - "titleFont": "Lato", - "titleFontSize": 12, - "titlePadding": 10, - }, - "axisY": { - "domain": False, - "domainWidth": 1, - "grid": True, - "gridColor": "#DEDDDD", - "gridWidth": 1, - "labelFont": "Lato", - "labelFontSize": 12, - "labelPadding": 8, - "ticks": False, - "titleAngle": 0, - "titleFont": "Lato", - "titleFontSize": 12, - "titlePadding": 10, - "titleX": 18, - "titleY": -10, - }, - "background": "#FFFFFF", - "legend": { - "labelFont": "Lato", - "labelFontSize": 12, - "offset": 10, - "orient": "right", - "symbolSize": 100, - "titleFont": "Lato", - "titleFontSize": 12, - "titlePadding": 10, - }, - "line": {"color": "#1696d2", "stroke": "#1696d2", "strokeWidth": 5}, - "point": {"filled": True}, - "range": { - "category": [ - "#1696d2", - "#ec008b", - "#fdbf11", - "#000000", - "#d2d2d2", - "#55b748", - ], - "diverging": [ - "#ca5800", - "#fdbf11", - "#fdd870", - "#fff2cf", - "#cfe8f3", - "#73bfe2", - "#1696d2", - "#0a4c6a", - ], - "heatmap": [ - "#ca5800", - "#fdbf11", - "#fdd870", - "#fff2cf", - "#cfe8f3", - "#73bfe2", - "#1696d2", - "#0a4c6a", - ], - "ordinal": [ - "#cfe8f3", - "#a2d4ec", - "#73bfe2", - "#46abdb", - "#1696d2", - "#12719e", - ], - "ramp": [ - "#CFE8F3", - "#A2D4EC", - "#73BFE2", - "#46ABDB", - "#1696D2", - "#12719E", - "#0A4C6A", - "#062635", - ], - }, - "rect": {"fill": "#1696d2"}, - "style": {"bar": {"fill": "#1696d2", "stroke": None}}, - "text": { - "align": "center", - "color": "#1696d2", - "font": "Lato", - "fontSize": 11, - "fontWeight": 400, - "size": 11, - }, - "title": {"anchor": "start", "font": "Lato", "fontSize": 18}, - "trail": {"color": "#1696d2", "size": 1, "stroke": "#1696d2", "strokeWidth": 0}, - "view": {"stroke": "transparent"}, + "config": { + "arc": {"fill": "#1696d2"}, + "area": {"fill": "#1696d2"}, + "axisX": { + "domain": True, + "domainColor": "#000000", + "domainWidth": 1, + "grid": False, + "labelAngle": 0, + "labelFont": "Lato", + "labelFontSize": 12, + "tickColor": "#000000", + "tickSize": 5, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + }, + "axisY": { + "domain": False, + "domainWidth": 1, + "grid": True, + "gridColor": "#DEDDDD", + "gridWidth": 1, + "labelFont": "Lato", + "labelFontSize": 12, + "labelPadding": 8, + "ticks": False, + "titleAngle": 0, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + "titleX": 18, + "titleY": -10, + }, + "background": "#FFFFFF", + "legend": { + "labelFont": "Lato", + "labelFontSize": 12, + "offset": 10, + "orient": "right", + "symbolSize": 100, + "titleFont": "Lato", + "titleFontSize": 12, + "titlePadding": 10, + }, + "line": {"color": "#1696d2", "stroke": "#1696d2", "strokeWidth": 5}, + "point": {"filled": True}, + "range": { + "category": [ + "#1696d2", + "#ec008b", + "#fdbf11", + "#000000", + "#d2d2d2", + "#55b748", + ], + "diverging": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a", + ], + "heatmap": [ + "#ca5800", + "#fdbf11", + "#fdd870", + "#fff2cf", + "#cfe8f3", + "#73bfe2", + "#1696d2", + "#0a4c6a", + ], + "ordinal": [ + "#cfe8f3", + "#a2d4ec", + "#73bfe2", + "#46abdb", + "#1696d2", + "#12719e", + ], + "ramp": [ + "#CFE8F3", + "#A2D4EC", + "#73BFE2", + "#46ABDB", + "#1696D2", + "#12719E", + "#0A4C6A", + "#062635", + ], + }, + "rect": {"fill": "#1696d2"}, + "style": {"bar": {"fill": "#1696d2", "stroke": None}}, + "text": { + "align": "center", + "color": "#1696d2", + "font": "Lato", + "fontSize": 11, + "fontWeight": 400, + "size": 11, + }, + "title": {"anchor": "start", "font": "Lato", "fontSize": 18}, + "trail": { + "color": "#1696d2", + "size": 1, + "stroke": "#1696d2", + "strokeWidth": 0, + }, + "view": {"stroke": "transparent"}, + } } def vox_theme() -> ThemeConfig: return { - "arc": {"fill": "#3e5c69"}, - "area": {"fill": "#3e5c69"}, - "axis": { - "domainWidth": 0.5, - "grid": True, - "labelPadding": 2, - "tickSize": 5, - "tickWidth": 0.5, - "titleFontWeight": "normal", - }, - "axisBand": {"grid": False}, - "axisX": {"gridWidth": 0.2}, - "axisY": {"gridDash": [3], "gridWidth": 0.4}, - "background": "#fff", - "legend": {"labelFontSize": 11, "padding": 1, "symbolType": "square"}, - "line": {"stroke": "#3e5c69"}, - "range": { - "category": [ - "#3e5c69", - "#6793a6", - "#182429", - "#0570b0", - "#3690c0", - "#74a9cf", - "#a6bddb", - "#e2ddf2", - ] - }, - "rect": {"fill": "#3e5c69"}, + "config": { + "arc": {"fill": "#3e5c69"}, + "area": {"fill": "#3e5c69"}, + "axis": { + "domainWidth": 0.5, + "grid": True, + "labelPadding": 2, + "tickSize": 5, + "tickWidth": 0.5, + "titleFontWeight": "normal", + }, + "axisBand": {"grid": False}, + "axisX": {"gridWidth": 0.2}, + "axisY": {"gridDash": [3], "gridWidth": 0.4}, + "background": "#fff", + "legend": {"labelFontSize": 11, "padding": 1, "symbolType": "square"}, + "line": {"stroke": "#3e5c69"}, + "range": { + "category": [ + "#3e5c69", + "#6793a6", + "#182429", + "#0570b0", + "#3690c0", + "#74a9cf", + "#a6bddb", + "#e2ddf2", + ] + }, + "rect": {"fill": "#3e5c69"}, + } } def binste_altair_theme() -> ThemeConfig: """Copied from https://gist.github.com/binste/b4042fa76a89d72d45cbbb9355ec6906.""" return ThemeConfig( - { + config={ "axis": { "labelFontSize": 16, "titleFontSize": 16, @@ -805,7 +841,7 @@ def husky_theme() -> ThemeConfig: BODY_FONT_BOLD = "OpenSans-Bold" return ThemeConfig( - { + config={ "title": { "fontSize": 18, "font": HEADER_FONT, From 80b21d5dfd881da8423aaa7fb7840fdb665533e8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:46:15 +0100 Subject: [PATCH 121/139] fix(typing): Use a single `TypeVar` for `RowCol` If both properties are specified, they must always be of the same type. --- altair/vegalite/v5/schema/_config.py | 6 +++--- altair/vegalite/v5/schema/_typing.py | 14 +++++--------- tools/generate_schema_wrapper.py | 12 +++++------- tools/schemapi/utils.py | 2 +- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 76944d74d..d1943b9da 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -7753,11 +7753,11 @@ class ThemeConfig(TypedDict, total=False): documentation. """ - align: RowCol[LayoutAlign_T, LayoutAlign_T] | LayoutAlign_T + align: RowCol[LayoutAlign_T] | LayoutAlign_T autosize: AutoSizeParamsKwds | AutosizeType_T background: ColorHex | ColorName_T bounds: Literal["full", "flush"] - center: bool | RowCol[bool, bool] + center: bool | RowCol[bool] config: ConfigKwds description: str height: float | StepKwds | Literal["container"] @@ -7766,7 +7766,7 @@ class ThemeConfig(TypedDict, total=False): params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] projection: ProjectionKwds resolve: ResolveKwds - spacing: float | RowCol[float, float] + spacing: float | RowCol[float] title: str | Sequence[str] | TitleParamsKwds usermeta: Map view: ViewBackgroundKwds diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 072365ba3..815c0fe01 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -172,26 +172,22 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: return bool(pattern.fullmatch(obj)) -CT = TypeVar("CT") -RT = TypeVar("RT") - - -class RowCol(TypedDict, Generic[CT, RT], total=False): +class RowCol(TypedDict, Generic[T], total=False): """ A `Generic`_ two-item ``dict``. Parameters ---------- - column: CT - row: RT + column: T + row: T .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics """ - column: CT - row: RT + column: T + row: T VegaThemes: TypeAlias = Literal[ diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 942fc2bda..8a564019b 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -363,25 +363,23 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: return bool(pattern.fullmatch(obj)) -CT = TypeVar("CT") -RT = TypeVar("RT") -class RowCol(TypedDict, Generic[CT, RT], total=False): +class RowCol(TypedDict, Generic[T], total=False): """ A `Generic`_ two-item ``dict``. Parameters ---------- - column: CT - row: RT + column: T + row: T .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics """ - column: CT - row: RT + column: T + row: T ''' _ChannelType = Literal["field", "datum", "value"] diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index f23f8d5bf..dc939e8d6 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -577,7 +577,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: elif self.is_rowcol(): row = self.properties["row"] t = row.to_type_repr(target="annotation", use_concrete=use_concrete) - tps.add(f"RowCol[{t}, {t}]") + tps.add(f"RowCol[{t}]") elif title in REMAP_TITLE: tps.update(REMAP_TITLE[title]) elif ( From 810921c2de59b7d9fe93a939a711955f43a05526 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:02:40 +0100 Subject: [PATCH 122/139] feat(typing): Add `ThemeConfig` to `alt.typing` --- altair/typing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/altair/typing.py b/altair/typing.py index cd8cb1489..101b94d57 100644 --- a/altair/typing.py +++ b/altair/typing.py @@ -46,11 +46,13 @@ "ChartType", "EncodeKwds", "Optional", + "ThemeConfig", "is_chart_type", ] from altair.utils.schemapi import Optional from altair.vegalite.v5.api import ChartType, is_chart_type +from altair.vegalite.v5.schema._config import ThemeConfig from altair.vegalite.v5.schema.channels import ( ChannelAngle, ChannelColor, From 79fb2fb7436a6a423bb485bc3567967e904da621 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:33:48 +0100 Subject: [PATCH 123/139] feat(typing): Update all `ThemeRegistry` annotations --- altair/utils/theme.py | 9 +++++---- altair/vegalite/v5/theme.py | 22 +++++++++++----------- tests/vegalite/v5/test_theme.py | 7 ++++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/altair/utils/theme.py b/altair/utils/theme.py index 47e5da6ad..bbb7247bc 100644 --- a/altair/utils/theme.py +++ b/altair/utils/theme.py @@ -3,9 +3,10 @@ from __future__ import annotations import sys -from typing import TYPE_CHECKING, Any, Dict +from typing import TYPE_CHECKING -from .plugin_registry import Plugin, PluginRegistry +from altair.utils.plugin_registry import Plugin, PluginRegistry +from altair.vegalite.v5.schema._config import ThemeConfig if sys.version_info >= (3, 11): from typing import LiteralString @@ -16,12 +17,12 @@ from altair.utils.plugin_registry import PluginEnabler from altair.vegalite.v5.theme import AltairThemes, VegaThemes -ThemeType = Plugin[Dict[str, Any]] +ThemeType = Plugin[ThemeConfig] # HACK: See for `LiteralString` requirement in `name` # https://github.com/vega/altair/pull/3526#discussion_r1743350127 -class ThemeRegistry(PluginRegistry[ThemeType, Dict[str, Any]]): +class ThemeRegistry(PluginRegistry[ThemeType, ThemeConfig]): def enable( self, name: LiteralString | AltairThemes | VegaThemes | None = None, **options ) -> PluginEnabler: diff --git a/altair/vegalite/v5/theme.py b/altair/vegalite/v5/theme.py index 2e438679b..ba5a5ab9a 100644 --- a/altair/vegalite/v5/theme.py +++ b/altair/vegalite/v5/theme.py @@ -4,9 +4,10 @@ import sys from functools import wraps -from typing import TYPE_CHECKING, Any, Callable, Dict, Final, Literal, TypeVar, get_args +from typing import TYPE_CHECKING, Callable, Final, Literal, get_args from altair.utils.theme import ThemeRegistry +from altair.vegalite.v5.schema._config import ThemeConfig from altair.vegalite.v5.schema._typing import VegaThemes if sys.version_info >= (3, 10): @@ -16,6 +17,8 @@ if TYPE_CHECKING: + from altair.utils.plugin_registry import Plugin + if sys.version_info >= (3, 11): from typing import LiteralString else: @@ -26,7 +29,6 @@ from typing_extensions import TypeAlias P = ParamSpec("P") -R = TypeVar("R", bound=Dict[str, Any]) AltairThemes: TypeAlias = Literal["default", "opaque"] VEGA_THEMES: list[LiteralString] = list(get_args(VegaThemes)) @@ -37,7 +39,7 @@ class VegaTheme: def __init__(self, theme: str) -> None: self.theme = theme - def __call__(self) -> dict[str, dict[str, dict[str, str | int]]]: + def __call__(self) -> ThemeConfig: return { "usermeta": {"embedOptions": {"theme": self.theme}}, "config": {"view": {"continuousWidth": 300, "continuousHeight": 300}}, @@ -66,7 +68,7 @@ def __repr__(self) -> str: } }, ) -themes.register("none", dict) +themes.register("none", ThemeConfig) for theme in VEGA_THEMES: themes.register(theme, VegaTheme(theme)) @@ -78,7 +80,7 @@ def __repr__(self) -> str: # https://github.com/vega/altair/pull/3526#discussion_r1743350127 def register_theme( name: LiteralString, *, enable: bool -) -> Callable[[Callable[P, R]], Callable[P, R]]: +) -> Callable[[Plugin[ThemeConfig]], Plugin[ThemeConfig]]: """ Decorator for registering a theme function. @@ -93,14 +95,12 @@ def register_theme( -------- Register and enable a theme:: - from __future__ import annotations - - from typing import Any import altair as alt + from altair.typing import ThemeConfig @alt.register_theme("param_font_size", enable=True) - def custom_theme() -> dict[str, Any]: + def custom_theme() -> ThemeConfig: sizes = 12, 14, 16, 18, 20 return { "autosize": {"contains": "content", "resize": True}, @@ -134,13 +134,13 @@ def custom_theme() -> dict[str, Any]: """ - def decorate(func: Callable[P, R], /) -> Callable[P, R]: + def decorate(func: Plugin[ThemeConfig], /) -> Plugin[ThemeConfig]: themes.register(name, func) if enable: themes.enable(name) @wraps(func) - def wrapper(*args: P.args, **kwargs: P.kwargs) -> R: + def wrapper(*args: P.args, **kwargs: P.kwargs) -> ThemeConfig: return func(*args, **kwargs) return wrapper diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index f980c61df..59dde90eb 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -5,7 +5,8 @@ import pytest import altair.vegalite.v5 as alt -from altair.vegalite.v5.schema._config import ConfigKwds, ThemeConfig +from altair.typing import ThemeConfig +from altair.vegalite.v5.schema._config import ConfigKwds from altair.vegalite.v5.schema._typing import is_color_hex from altair.vegalite.v5.theme import VEGA_THEMES, register_theme, themes @@ -25,7 +26,7 @@ def chart() -> alt.Chart: def test_vega_themes(chart) -> None: for theme in VEGA_THEMES: - with alt.themes.enable(theme): # pyright: ignore + with alt.themes.enable(theme): dct = chart.to_dict() assert dct["usermeta"] == {"embedOptions": {"theme": theme}} assert dct["config"] == { @@ -35,7 +36,7 @@ def test_vega_themes(chart) -> None: def test_register_theme_decorator() -> None: @register_theme("unique name", enable=True) - def custom_theme() -> dict[str, int]: + def custom_theme() -> ThemeConfig: return {"height": 400, "width": 700} assert themes.active == "unique name" From c8ccb0519ad4e7d25381703e959aafda5fb6e4c6 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:37:09 +0100 Subject: [PATCH 124/139] fix(typing): Satisfy `mypy` on `utils.core.update_nested` This is due to a `TypedDict` being typed as `Mapping` instead of `MutableMapping` (like `dict`). At runtime it is a `dict`, so I'm not making any runtime changes - this will have to do --- altair/utils/core.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/altair/utils/core.py b/altair/utils/core.py index 7e8340324..0af95c49f 100644 --- a/altair/utils/core.py +++ b/altair/utils/core.py @@ -771,9 +771,21 @@ def decorate(cb: WrapsFunc[R], /) -> WrappedMethod[T, P, R] | WrappedFunc[P, R]: return decorate +@overload def update_nested( original: t.MutableMapping[Any, Any], update: t.Mapping[Any, Any], + copy: Literal[False] = ..., +) -> t.MutableMapping[Any, Any]: ... +@overload +def update_nested( + original: t.Mapping[Any, Any], + update: t.Mapping[Any, Any], + copy: Literal[True], +) -> t.MutableMapping[Any, Any]: ... +def update_nested( + original: Any, + update: t.Mapping[Any, Any], copy: bool = False, ) -> t.MutableMapping[Any, Any]: """ From 26c6edeb4d66abd040fa96245c0d755d018e6611 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:43:24 +0100 Subject: [PATCH 125/139] fix: run `generate-schema-wrapper` https://github.com/vega/altair/actions/runs/10852025793/job/30117109736?pr=3536 --- doc/user_guide/api.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user_guide/api.rst b/doc/user_guide/api.rst index eaa9cb602..40d63957d 100644 --- a/doc/user_guide/api.rst +++ b/doc/user_guide/api.rst @@ -689,5 +689,6 @@ Typing ChartType EncodeKwds Optional + ThemeConfig is_chart_type From 4933e547ae863eb247ea989f5fde37e2dce6019e Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:23:35 +0100 Subject: [PATCH 126/139] feat(typing): Adds `PaddingKwds` https://github.com/vega/altair/pull/3536#discussion_r1750768426, https://github.com/vega/altair/pull/3536/commits/e564ca5a9a163d40669a0e9f1634fe93d16d9ea5 --- altair/vegalite/v5/schema/_config.py | 4 ++-- altair/vegalite/v5/schema/_typing.py | 8 ++++++++ tools/generate_schema_wrapper.py | 10 +++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index d1943b9da..04aaf0010 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -2182,7 +2182,7 @@ class ConfigKwds(TypedDict, total=False): normalizedNumberFormatType: str numberFormat: str numberFormatType: str - padding: float | Map + padding: float | PaddingKwds params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] point: MarkConfigKwds projection: ProjectionConfigKwds @@ -7762,7 +7762,7 @@ class ThemeConfig(TypedDict, total=False): description: str height: float | StepKwds | Literal["container"] name: str - padding: float | Map + padding: float | PaddingKwds params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] projection: ProjectionKwds resolve: ResolveKwds diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 815c0fe01..8bb54d286 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -66,6 +66,7 @@ "OneOrSeq", "Orient_T", "Orientation_T", + "PaddingKwds", "ProjectionType_T", "RangeEnum_T", "ResolveMode_T", @@ -190,6 +191,13 @@ class RowCol(TypedDict, Generic[T], total=False): row: T +class PaddingKwds(TypedDict, total=False): + bottom: float + left: float + right: float + top: float + + VegaThemes: TypeAlias = Literal[ "carbong10", "carbong100", diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 8a564019b..1e56a4fdb 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -380,6 +380,13 @@ class RowCol(TypedDict, Generic[T], total=False): column: T row: T + + +class PaddingKwds(TypedDict, total=False): + bottom: float + left: float + right: float + top: float ''' _ChannelType = Literal["field", "datum", "value"] @@ -949,7 +956,7 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: } SchemaInfo._remap_title.update( - {"HexColor": ("ColorHex",), "Padding": ("float", "Map")} + {"HexColor": ("ColorHex",), "Padding": ("float", "PaddingKwds")} ) SchemaInfo._remap_title.update((k, (f"{k}{KWDS}",)) for k in relevant) config_sub: Iterator[str] = ( @@ -1100,6 +1107,7 @@ def vegalite_main(skip_download: bool = False) -> None: "ColorHex", "is_color_hex", "RowCol", + "PaddingKwds", header=HEADER, extra=TYPING_EXTRA, ) From 2847293901a56c50d549d6900511ded31e551869 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:46:23 +0100 Subject: [PATCH 127/139] refactor: Factor out `_typed_dict_doc` --- tools/generate_schema_wrapper.py | 45 ++++++++++++-------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 1e56a4fdb..a727f1645 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -239,7 +239,12 @@ def configure_{prop}(self, *args, **kwargs) -> Self: """ UNIVERSAL_TYPED_DICT = ''' class {name}(TypedDict{metaclass_kwds}):{comment} - """{doc}""" + """ + {summary} + + Parameters + ---------- + {doc}""" {typed_dict_args} ''' @@ -844,28 +849,6 @@ def _typed_dict_args( ) -def _typed_dict_doc( - info: SchemaInfo, - /, - *, - summary: str | None = None, - groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, - exclude: str | Iterable[str] | None = None, -) -> str: - args = codegen.get_args(info) - it = chain.from_iterable( - (p, f" {p_info.deep_description}") - for p, p_info in args.iter_args(groups, exclude=exclude) - ) - lines = ( - summary or f"{info.title} ``TypedDict`` wrapper.", - "", - "Parameters", - "----------", - ) - return indent_docstring(chain(lines, it), indent_level=4, lstrip=False) - - def generate_typed_dict( info: SchemaInfo, name: str, @@ -903,7 +886,13 @@ def generate_typed_dict( if override_args is None else "\n ".join(override_args) ) - td_doc = _typed_dict_doc(info, summary=summary, groups=groups, exclude=exclude) + doc = indent_docstring( + chain.from_iterable( + (p, f" {p_info.deep_description}") + for p, p_info in arg_info.iter_args(groups, exclude=exclude) + ), + indent_level=4, + ) if (kwds := arg_info.invalid_kwds) and list( arg_info.iter_args(kwds, exclude=exclude) ): @@ -917,16 +906,16 @@ def generate_typed_dict( f"{td_args}\n " f"__extra_items__: {finalize_type_reprs(kwds_all_tps, target=TARGET)}" ) - td_doc = ( - f"{td_doc}\n" - f"{EXTRA_ITEMS_MESSAGE.format(invalid_kwds=repr(sorted(kwds)))}" + doc = ( + f"{doc}\n" f"{EXTRA_ITEMS_MESSAGE.format(invalid_kwds=repr(sorted(kwds)))}" ) return UNIVERSAL_TYPED_DICT.format( name=name, metaclass_kwds=metaclass_kwds, comment=comment, - doc=td_doc, + summary=summary or f"{info.title} ``TypedDict`` wrapper.", + doc=doc, typed_dict_args=td_args, ) From f386052ea4d78076d909cd37b09d92d0ab0cf09b Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:58:36 +0100 Subject: [PATCH 128/139] refactor: Factor out `_typed_dict_args` --- tools/generate_schema_wrapper.py | 33 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index a727f1645..186705feb 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -246,7 +246,7 @@ class {name}(TypedDict{metaclass_kwds}):{comment} ---------- {doc}""" - {typed_dict_args} + {td_args} ''' ENCODE_KWDS: Literal["EncodeKwds"] = "EncodeKwds" THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" @@ -836,27 +836,14 @@ def generate_mark_args( return {"method_args": ", ".join(method_args), "dict_args": ", ".join(dict_args)} -def _typed_dict_args( - info: SchemaInfo, - /, - groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, - exclude: str | Iterable[str] | None = None, -) -> str: - args = codegen.get_args(info) - return "\n ".join( - f"{p}: {p_info.to_type_repr(target='annotation', use_concrete=True)}" - for p, p_info in args.iter_args(groups, exclude=exclude) - ) - - def generate_typed_dict( info: SchemaInfo, name: str, *, summary: str | None = None, - override_args: Iterable[str] | None = None, groups: Iterable[str] | AttrGetter[ArgInfo, set[str]] = arg_required_kwds, exclude: str | Iterable[str] | None = None, + override_args: Iterable[str] | None = None, ) -> str: """ Return a fully typed & documented ``TypedDict``. @@ -881,11 +868,15 @@ def generate_typed_dict( arg_info = codegen.get_args(info) metaclass_kwds = ", total=False" comment = "" - td_args = ( - _typed_dict_args(info, groups=groups, exclude=exclude) + args_it: Iterable[str] = ( + ( + f"{p}: {p_info.to_type_repr(target=TARGET, use_concrete=True)}" + for p, p_info in arg_info.iter_args(groups, exclude=exclude) + ) if override_args is None - else "\n ".join(override_args) + else override_args ) + args = "\n ".join(args_it) doc = indent_docstring( chain.from_iterable( (p, f" {p_info.deep_description}") @@ -902,8 +893,8 @@ def generate_typed_dict( info.to_type_repr(as_str=False, target=TARGET, use_concrete=True) for _, info in arg_info.iter_args(kwds, exclude=exclude) ) - td_args = ( - f"{td_args}\n " + args = ( + f"{args}\n " f"__extra_items__: {finalize_type_reprs(kwds_all_tps, target=TARGET)}" ) doc = ( @@ -916,7 +907,7 @@ def generate_typed_dict( comment=comment, summary=summary or f"{info.title} ``TypedDict`` wrapper.", doc=doc, - typed_dict_args=td_args, + td_args=args, ) From ed24ada5421d1852f5d539b447740d877ab3a632 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:19:17 +0100 Subject: [PATCH 129/139] docs: Update `generate_typed_dict` --- tools/generate_schema_wrapper.py | 14 ++++++++++++-- tools/schemapi/codegen.py | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 186705feb..5b7efc100 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -851,18 +851,26 @@ def generate_typed_dict( Parameters ---------- info - Schema. + JSON Schema wrapper. name Full target class name. Include a pre/post-fix if ``SchemaInfo.title`` already exists. summary When provided, used instead of generated summary line. + groups + A subset of ``ArgInfo``, or a callable that can derive one. + exclude + Property name(s) to omit if they appear during iteration. override_args - When provided, used instead of ``_typed_dict_args``. + When provided, used instead of any ``ArgInfo`` related handling. + + .. note:: + See ``EncodeKwds``. Notes ----- - Internally handles keys that are not valid python identifiers + - The union of their types will be added to ``__extra_items__`` """ TARGET: Literal["annotation"] = "annotation" arg_info = codegen.get_args(info) @@ -884,6 +892,8 @@ def generate_typed_dict( ), indent_level=4, ) + # NOTE: The RHS eager eval is used to skip `invalid_kwds`, + # if they have been marked for exclusion if (kwds := arg_info.invalid_kwds) and list( arg_info.iter_args(kwds, exclude=exclude) ): diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index cb063223e..03b03e442 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -64,17 +64,17 @@ def iter_args( *more_groups: Iterable[str] | AttrGetter[ArgInfo, set[str]], exclude: str | Iterable[str] | None = None, ) -> Iterator[tuple[str, SchemaInfo]]: - """ + r""" Yields (property_name, property_info). Useful for signatures and docstrings. Parameters ---------- - *prop_groups + group, \*more_groups Each group will independently sorted, and chained. exclude - Property name(s) to omit if they appear in any of ``prop_groups``. + Property name(s) to omit if they appear during iteration. """ props = self.schema_info.properties it = chain.from_iterable( From ddf4636fccc8cd740dc3a1cd6a07f4c3b6f05647 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:34:45 +0100 Subject: [PATCH 130/139] refactor: Reuse `ArgInfo.iter_args` in `SchemaGenerator` --- tools/schemapi/codegen.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/schemapi/codegen.py b/tools/schemapi/codegen.py index 03b03e442..5e6d3107b 100644 --- a/tools/schemapi/codegen.py +++ b/tools/schemapi/codegen.py @@ -297,17 +297,13 @@ def docstring(self, indent: int = 0) -> str: if info.properties: arg_info = self.arg_info - doc += ["", "Parameters", "----------", ""] - for prop in ( - sorted(arg_info.required) - + sorted(arg_info.kwds) - + sorted(arg_info.invalid_kwds) - ): - propinfo = info.properties[prop] - doc += [ - f"{prop} : {propinfo.to_type_repr()}", - f" {propinfo.deep_description}", - ] + it = chain.from_iterable( + (f"{p} : {p_info.to_type_repr()}", f" {p_info.deep_description}") + for p, p_info in arg_info.iter_args( + arg_info.required, arg_kwds, arg_invalid_kwds + ) + ) + doc.extend(chain(["", "Parameters", "----------", ""], it)) return indent_docstring(doc, indent_level=indent, width=100, lstrip=True) def init_code(self, indent: int = 0) -> str: From 0c8f9e2a4fbca6aa7a16fb318fb8a1351be12e32 Mon Sep 17 00:00:00 2001 From: Dan Redding <125183946+dangotbanned@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:30:07 +0100 Subject: [PATCH 131/139] chore: Removed outdated comment --- tests/vegalite/v5/test_theme.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/vegalite/v5/test_theme.py b/tests/vegalite/v5/test_theme.py index 59dde90eb..97d2fb42e 100644 --- a/tests/vegalite/v5/test_theme.py +++ b/tests/vegalite/v5/test_theme.py @@ -335,7 +335,6 @@ def ggplot2_theme() -> ThemeConfig: } -# FIXME: Support key-completion for `ThemeConfig.padding` ``Padding`` def googlecharts_theme() -> ThemeConfig: """``Padding`` definition `float | Map` needs to be stricter.""" return { From cafd6964ec4de65055f2f5ba7187004b3b8a82c7 Mon Sep 17 00:00:00 2001 From: Dan Redding <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:11:46 +0100 Subject: [PATCH 132/139] Update altair/vegalite/v5/schema/_typing.py Co-authored-by: Stefan Binder --- altair/vegalite/v5/schema/_typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 8bb54d286..a40e7f2fc 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -166,7 +166,7 @@ class Value(TypedDict, Generic[T]): def is_color_hex(obj: Any) -> TypeIs[ColorHex]: """Return ``True`` if the object is a hexadecimal color code.""" # NOTE: Extracts compiled pattern from metadata, - # to avoid defining in multiple places. + # to avoid defining in multiple places. it = iter(get_args(ColorHex)) next(it) pattern: re.Pattern[str] = next(it) From 0bb7a86a94c140bf9938681e78aa2a21dc6e932d Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:15:41 +0100 Subject: [PATCH 133/139] fix: Apply suggested fix at source https://github.com/vega/altair/pull/3536#discussion_r1761316075, https://github.com/vega/altair/actions/runs/10887770719/job/30210759548?pr=3536 --- tools/generate_schema_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 5b7efc100..ba3b48cef 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -361,7 +361,7 @@ class Value(TypedDict, Generic[T]): def is_color_hex(obj: Any) -> TypeIs[ColorHex]: """Return ``True`` if the object is a hexadecimal color code.""" # NOTE: Extracts compiled pattern from metadata, - # to avoid defining in multiple places. + # to avoid defining in multiple places. it = iter(get_args(ColorHex)) next(it) pattern: re.Pattern[str] = next(it) From ffb321454bfff19ab4ada34777ce6707c0c84755 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:28:32 +0100 Subject: [PATCH 134/139] style: Remove extra whitespace from docs --- altair/vegalite/v5/schema/_typing.py | 2 -- tools/generate_schema_wrapper.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index a40e7f2fc..ad2858f6a 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -131,7 +131,6 @@ class Value(TypedDict, Generic[T]): .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics - """ value: T @@ -184,7 +183,6 @@ class RowCol(TypedDict, Generic[T], total=False): .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics - """ column: T diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index ba3b48cef..54b7c060d 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -327,7 +327,6 @@ class Value(TypedDict, Generic[T]): .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics - """ value: T @@ -380,7 +379,6 @@ class RowCol(TypedDict, Generic[T], total=False): .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics - """ column: T From aaffebd2b2d037024a2f4af1e6d942bdd9e24174 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:51:12 +0100 Subject: [PATCH 135/139] refactor: Reuse literals, add `_typing` dicts to `_config.__all__` Trying to make this easier to maintain in the future https://github.com/vega/altair/pull/3536#discussion_r1761296104 --- altair/vegalite/v5/schema/_config.py | 8 +++++--- altair/vegalite/v5/schema/_typing.py | 4 ++-- tools/generate_schema_wrapper.py | 12 +++++++----- tools/schemapi/utils.py | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 04aaf0010..63fb1cdda 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -59,6 +59,7 @@ "MultiPolygonKwds", "NumberLocaleKwds", "OverlayMarkDefKwds", + "PaddingKwds", "PointKwds", "PointSelectionConfigKwds", "PointSelectionConfigWithoutTypeKwds", @@ -69,6 +70,7 @@ "RangeConfigKwds", "RectConfigKwds", "ResolveKwds", + "RowColKwds", "ScaleConfigKwds", "ScaleInvalidDataConfigKwds", "ScaleResolveMapKwds", @@ -7753,11 +7755,11 @@ class ThemeConfig(TypedDict, total=False): documentation. """ - align: RowCol[LayoutAlign_T] | LayoutAlign_T + align: RowColKwds[LayoutAlign_T] | LayoutAlign_T autosize: AutoSizeParamsKwds | AutosizeType_T background: ColorHex | ColorName_T bounds: Literal["full", "flush"] - center: bool | RowCol[bool] + center: bool | RowColKwds[bool] config: ConfigKwds description: str height: float | StepKwds | Literal["container"] @@ -7766,7 +7768,7 @@ class ThemeConfig(TypedDict, total=False): params: Sequence[VariableParameterKwds | TopLevelSelectionParameterKwds] projection: ProjectionKwds resolve: ResolveKwds - spacing: float | RowCol[float] + spacing: float | RowColKwds[float] title: str | Sequence[str] | TitleParamsKwds usermeta: Map view: ViewBackgroundKwds diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index ad2858f6a..3390b9515 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -70,7 +70,7 @@ "ProjectionType_T", "RangeEnum_T", "ResolveMode_T", - "RowCol", + "RowColKwds", "ScaleInterpolateEnum_T", "ScaleType_T", "SelectionResolution_T", @@ -172,7 +172,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: return bool(pattern.fullmatch(obj)) -class RowCol(TypedDict, Generic[T], total=False): +class RowColKwds(TypedDict, Generic[T], total=False): """ A `Generic`_ two-item ``dict``. diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 54b7c060d..bbd6f7527 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -250,6 +250,8 @@ class {name}(TypedDict{metaclass_kwds}):{comment} ''' ENCODE_KWDS: Literal["EncodeKwds"] = "EncodeKwds" THEME_CONFIG: Literal["ThemeConfig"] = "ThemeConfig" +PADDING_KWDS: Literal["PaddingKwds"] = "PaddingKwds" +ROW_COL_KWDS: Literal["RowColKwds"] = "RowColKwds" ENCODE_KWDS_SUMMARY: Final = ( "Encoding channels map properties of the data to visual properties of the chart." ) @@ -368,7 +370,7 @@ def is_color_hex(obj: Any) -> TypeIs[ColorHex]: -class RowCol(TypedDict, Generic[T], total=False): +class RowColKwds(TypedDict, Generic[T], total=False): """ A `Generic`_ two-item ``dict``. @@ -944,7 +946,7 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: } SchemaInfo._remap_title.update( - {"HexColor": ("ColorHex",), "Padding": ("float", "PaddingKwds")} + {"HexColor": ("ColorHex",), "Padding": ("float", PADDING_KWDS)} ) SchemaInfo._remap_title.update((k, (f"{k}{KWDS}",)) for k in relevant) config_sub: Iterator[str] = ( @@ -952,7 +954,7 @@ def generate_config_typed_dicts(fp: Path, /) -> Iterator[str]: for info in relevant.values() ) config_sub_names = (f"{nm}{KWDS}" for nm in relevant) - yield f"__all__ = {[*config_sub_names, THEME_CONFIG]}\n\n" + yield f"__all__ = {[*config_sub_names, PADDING_KWDS, ROW_COL_KWDS, THEME_CONFIG]}\n\n" yield "\n".join(config_sub) yield generate_typed_dict( SchemaInfo.from_refname(TOP_LEVEL, root), @@ -1094,8 +1096,8 @@ def vegalite_main(skip_download: bool = False) -> None: "Value", "ColorHex", "is_color_hex", - "RowCol", - "PaddingKwds", + ROW_COL_KWDS, + PADDING_KWDS, header=HEADER, extra=TYPING_EXTRA, ) diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index dc939e8d6..c5f319cb3 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -529,7 +529,7 @@ def to_type_repr( # noqa: C901 raise ValueError(msg) if use_concrete: - if tps >= {"ColorHex", "ColorName_T", "str"}: + if tps >= {"ColorHex", TypeAliasTracer.fmt.format("ColorName"), "str"}: # HACK: Remove regular `str` if HEX & CSS color codes are present as well tps.discard("str") elif len(tps) == 0 and as_str: @@ -577,7 +577,7 @@ def title_to_type_reprs(self, *, use_concrete: bool) -> set[str]: elif self.is_rowcol(): row = self.properties["row"] t = row.to_type_repr(target="annotation", use_concrete=use_concrete) - tps.add(f"RowCol[{t}]") + tps.add(f"RowColKwds[{t}]") elif title in REMAP_TITLE: tps.update(REMAP_TITLE[title]) elif ( From 12b6410b85d278a051b16cbf3054b6f0a261be83 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:07:24 +0100 Subject: [PATCH 136/139] feat: Export `_config.py` as `altair.typing.theme` https://github.com/vega/altair/pull/3536#discussion_r1761302892 --- altair/typing.py | 2 ++ doc/user_guide/api.rst | 1 + 2 files changed, 3 insertions(+) diff --git a/altair/typing.py b/altair/typing.py index 101b94d57..3c17895dd 100644 --- a/altair/typing.py +++ b/altair/typing.py @@ -48,8 +48,10 @@ "Optional", "ThemeConfig", "is_chart_type", + "theme", ] +import altair.vegalite.v5.schema._config as theme from altair.utils.schemapi import Optional from altair.vegalite.v5.api import ChartType, is_chart_type from altair.vegalite.v5.schema._config import ThemeConfig diff --git a/doc/user_guide/api.rst b/doc/user_guide/api.rst index 40d63957d..9000bce99 100644 --- a/doc/user_guide/api.rst +++ b/doc/user_guide/api.rst @@ -691,4 +691,5 @@ Typing Optional ThemeConfig is_chart_type + theme From 6e4af95becc8ff9be033535d45ce3db9b2c749a3 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:16:12 +0100 Subject: [PATCH 137/139] docs: Use `:class:` directive on `TypedDict`(s) Hopefully this will mean we can skip adding individual doc pages for each, just reuse the existing ones https://github.com/vega/altair/pull/3536#discussion_r1761539740 --- altair/vegalite/v5/schema/_config.py | 134 +++++++++++++-------------- tools/generate_schema_wrapper.py | 2 +- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 63fb1cdda..39b39ec81 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -93,7 +93,7 @@ class AreaConfigKwds(TypedDict, total=False): """ - AreaConfig ``TypedDict`` wrapper. + :class:`AreaConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -567,7 +567,7 @@ class AreaConfigKwds(TypedDict, total=False): class AutoSizeParamsKwds(TypedDict, total=False): """ - AutoSizeParams ``TypedDict`` wrapper. + :class:`AutoSizeParams` ``TypedDict`` wrapper. Parameters ---------- @@ -601,7 +601,7 @@ class AutoSizeParamsKwds(TypedDict, total=False): class AxisConfigKwds(TypedDict, total=False): """ - AxisConfig ``TypedDict`` wrapper. + :class:`AxisConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -1057,7 +1057,7 @@ class AxisConfigKwds(TypedDict, total=False): class AxisResolveMapKwds(TypedDict, total=False): """ - AxisResolveMap ``TypedDict`` wrapper. + :class:`AxisResolveMap` ``TypedDict`` wrapper. Parameters ---------- @@ -1073,7 +1073,7 @@ class AxisResolveMapKwds(TypedDict, total=False): class BarConfigKwds(TypedDict, total=False): """ - BarConfig ``TypedDict`` wrapper. + :class:`BarConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -1544,7 +1544,7 @@ class BarConfigKwds(TypedDict, total=False): class BindCheckboxKwds(TypedDict, total=False): """ - BindCheckbox ``TypedDict`` wrapper. + :class:`BindCheckbox` ``TypedDict`` wrapper. Parameters ---------- @@ -1570,7 +1570,7 @@ class BindCheckboxKwds(TypedDict, total=False): class BindDirectKwds(TypedDict, total=False): """ - BindDirect ``TypedDict`` wrapper. + :class:`BindDirect` ``TypedDict`` wrapper. Parameters ---------- @@ -1596,7 +1596,7 @@ class BindDirectKwds(TypedDict, total=False): class BindInputKwds(TypedDict, total=False): """ - BindInput ``TypedDict`` wrapper. + :class:`BindInput` ``TypedDict`` wrapper. Parameters ---------- @@ -1632,7 +1632,7 @@ class BindInputKwds(TypedDict, total=False): class BindRadioSelectKwds(TypedDict, total=False): """ - BindRadioSelect ``TypedDict`` wrapper. + :class:`BindRadioSelect` ``TypedDict`` wrapper. Parameters ---------- @@ -1665,7 +1665,7 @@ class BindRadioSelectKwds(TypedDict, total=False): class BindRangeKwds(TypedDict, total=False): """ - BindRange ``TypedDict`` wrapper. + :class:`BindRange` ``TypedDict`` wrapper. Parameters ---------- @@ -1703,7 +1703,7 @@ class BindRangeKwds(TypedDict, total=False): class BoxPlotConfigKwds(TypedDict, total=False): """ - BoxPlotConfig ``TypedDict`` wrapper. + :class:`BoxPlotConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -1783,7 +1783,7 @@ class BoxPlotConfigKwds(TypedDict, total=False): class BrushConfigKwds(TypedDict, total=False): """ - BrushConfig ``TypedDict`` wrapper. + :class:`BrushConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -1825,7 +1825,7 @@ class BrushConfigKwds(TypedDict, total=False): class CompositionConfigKwds(TypedDict, total=False): """ - CompositionConfig ``TypedDict`` wrapper. + :class:`CompositionConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -1858,7 +1858,7 @@ class CompositionConfigKwds(TypedDict, total=False): class ConfigKwds(TypedDict, total=False): """ - Config ``TypedDict`` wrapper. + :class:`Config` ``TypedDict`` wrapper. Parameters ---------- @@ -2207,7 +2207,7 @@ class ConfigKwds(TypedDict, total=False): class DateTimeKwds(TypedDict, total=False): """ - DateTime ``TypedDict`` wrapper. + :class:`DateTime` ``TypedDict`` wrapper. Parameters ---------- @@ -2255,7 +2255,7 @@ class DateTimeKwds(TypedDict, total=False): class DerivedStreamKwds(TypedDict, total=False): """ - DerivedStream ``TypedDict`` wrapper. + :class:`DerivedStream` ``TypedDict`` wrapper. Parameters ---------- @@ -2289,7 +2289,7 @@ class DerivedStreamKwds(TypedDict, total=False): class ErrorBandConfigKwds(TypedDict, total=False): """ - ErrorBandConfig ``TypedDict`` wrapper. + :class:`ErrorBandConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -2359,7 +2359,7 @@ class ErrorBandConfigKwds(TypedDict, total=False): class ErrorBarConfigKwds(TypedDict, total=False): """ - ErrorBarConfig ``TypedDict`` wrapper. + :class:`ErrorBarConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -2409,7 +2409,7 @@ class ErrorBarConfigKwds(TypedDict, total=False): class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): """ - FeatureGeometryGeoJsonProperties ``TypedDict`` wrapper. + :class:`FeatureGeometryGeoJsonProperties` ``TypedDict`` wrapper. Parameters ---------- @@ -2444,7 +2444,7 @@ class FeatureGeometryGeoJsonPropertiesKwds(TypedDict, total=False): class FormatConfigKwds(TypedDict, total=False): """ - FormatConfig ``TypedDict`` wrapper. + :class:`FormatConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -2513,7 +2513,7 @@ class FormatConfigKwds(TypedDict, total=False): class GeoJsonFeatureKwds(TypedDict, total=False): """ - GeoJsonFeature ``TypedDict`` wrapper. + :class:`GeoJsonFeature` ``TypedDict`` wrapper. Parameters ---------- @@ -2548,7 +2548,7 @@ class GeoJsonFeatureKwds(TypedDict, total=False): class GeoJsonFeatureCollectionKwds(TypedDict, total=False): """ - GeoJsonFeatureCollection ``TypedDict`` wrapper. + :class:`GeoJsonFeatureCollection` ``TypedDict`` wrapper. Parameters ---------- @@ -2568,7 +2568,7 @@ class GeoJsonFeatureCollectionKwds(TypedDict, total=False): class GeometryCollectionKwds(TypedDict, total=False): """ - GeometryCollection ``TypedDict`` wrapper. + :class:`GeometryCollection` ``TypedDict`` wrapper. Parameters ---------- @@ -2596,7 +2596,7 @@ class GeometryCollectionKwds(TypedDict, total=False): class GradientStopKwds(TypedDict, total=False): """ - GradientStop ``TypedDict`` wrapper. + :class:`GradientStop` ``TypedDict`` wrapper. Parameters ---------- @@ -2612,7 +2612,7 @@ class GradientStopKwds(TypedDict, total=False): class HeaderConfigKwds(TypedDict, total=False): """ - HeaderConfig ``TypedDict`` wrapper. + :class:`HeaderConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -2787,7 +2787,7 @@ class HeaderConfigKwds(TypedDict, total=False): class IntervalSelectionConfigKwds(TypedDict, total=False): """ - IntervalSelectionConfig ``TypedDict`` wrapper. + :class:`IntervalSelectionConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -2897,7 +2897,7 @@ class IntervalSelectionConfigKwds(TypedDict, total=False): class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): """ - IntervalSelectionConfigWithoutType ``TypedDict`` wrapper. + :class:`IntervalSelectionConfigWithoutType` ``TypedDict`` wrapper. Parameters ---------- @@ -2999,7 +2999,7 @@ class IntervalSelectionConfigWithoutTypeKwds(TypedDict, total=False): class LegendConfigKwds(TypedDict, total=False): """ - LegendConfig ``TypedDict`` wrapper. + :class:`LegendConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -3354,7 +3354,7 @@ class LegendConfigKwds(TypedDict, total=False): class LegendResolveMapKwds(TypedDict, total=False): """ - LegendResolveMap ``TypedDict`` wrapper. + :class:`LegendResolveMap` ``TypedDict`` wrapper. Parameters ---------- @@ -3397,7 +3397,7 @@ class LegendResolveMapKwds(TypedDict, total=False): class LegendStreamBindingKwds(TypedDict, total=False): """ - LegendStreamBinding ``TypedDict`` wrapper. + :class:`LegendStreamBinding` ``TypedDict`` wrapper. Parameters ---------- @@ -3410,7 +3410,7 @@ class LegendStreamBindingKwds(TypedDict, total=False): class LineConfigKwds(TypedDict, total=False): """ - LineConfig ``TypedDict`` wrapper. + :class:`LineConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -3873,7 +3873,7 @@ class LineConfigKwds(TypedDict, total=False): class LineStringKwds(TypedDict, total=False): """ - LineString ``TypedDict`` wrapper. + :class:`LineString` ``TypedDict`` wrapper. Parameters ---------- @@ -3893,7 +3893,7 @@ class LineStringKwds(TypedDict, total=False): class LinearGradientKwds(TypedDict, total=False): """ - LinearGradient ``TypedDict`` wrapper. + :class:`LinearGradient` ``TypedDict`` wrapper. Parameters ---------- @@ -3932,7 +3932,7 @@ class LinearGradientKwds(TypedDict, total=False): class LocaleKwds(TypedDict, total=False): """ - Locale ``TypedDict`` wrapper. + :class:`Locale` ``TypedDict`` wrapper. Parameters ---------- @@ -3948,7 +3948,7 @@ class LocaleKwds(TypedDict, total=False): class MarkConfigKwds(TypedDict, total=False): """ - MarkConfig ``TypedDict`` wrapper. + :class:`MarkConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -4396,7 +4396,7 @@ class MarkConfigKwds(TypedDict, total=False): class MergedStreamKwds(TypedDict, total=False): """ - MergedStream ``TypedDict`` wrapper. + :class:`MergedStream` ``TypedDict`` wrapper. Parameters ---------- @@ -4430,7 +4430,7 @@ class MergedStreamKwds(TypedDict, total=False): class MultiLineStringKwds(TypedDict, total=False): """ - MultiLineString ``TypedDict`` wrapper. + :class:`MultiLineString` ``TypedDict`` wrapper. Parameters ---------- @@ -4450,7 +4450,7 @@ class MultiLineStringKwds(TypedDict, total=False): class MultiPointKwds(TypedDict, total=False): """ - MultiPoint ``TypedDict`` wrapper. + :class:`MultiPoint` ``TypedDict`` wrapper. Parameters ---------- @@ -4470,7 +4470,7 @@ class MultiPointKwds(TypedDict, total=False): class MultiPolygonKwds(TypedDict, total=False): """ - MultiPolygon ``TypedDict`` wrapper. + :class:`MultiPolygon` ``TypedDict`` wrapper. Parameters ---------- @@ -4490,7 +4490,7 @@ class MultiPolygonKwds(TypedDict, total=False): class NumberLocaleKwds(TypedDict, total=False): """ - NumberLocale ``TypedDict`` wrapper. + :class:`NumberLocale` ``TypedDict`` wrapper. Parameters ---------- @@ -4524,7 +4524,7 @@ class NumberLocaleKwds(TypedDict, total=False): class OverlayMarkDefKwds(TypedDict, total=False): """ - OverlayMarkDef ``TypedDict`` wrapper. + :class:`OverlayMarkDef` ``TypedDict`` wrapper. Parameters ---------- @@ -5014,7 +5014,7 @@ class OverlayMarkDefKwds(TypedDict, total=False): class PointKwds(TypedDict, total=False): """ - Point ``TypedDict`` wrapper. + :class:`Point` ``TypedDict`` wrapper. Parameters ---------- @@ -5038,7 +5038,7 @@ class PointKwds(TypedDict, total=False): class PointSelectionConfigKwds(TypedDict, total=False): """ - PointSelectionConfig ``TypedDict`` wrapper. + :class:`PointSelectionConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -5146,7 +5146,7 @@ class PointSelectionConfigKwds(TypedDict, total=False): class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): """ - PointSelectionConfigWithoutType ``TypedDict`` wrapper. + :class:`PointSelectionConfigWithoutType` ``TypedDict`` wrapper. Parameters ---------- @@ -5246,7 +5246,7 @@ class PointSelectionConfigWithoutTypeKwds(TypedDict, total=False): class PolygonKwds(TypedDict, total=False): """ - Polygon ``TypedDict`` wrapper. + :class:`Polygon` ``TypedDict`` wrapper. Parameters ---------- @@ -5266,7 +5266,7 @@ class PolygonKwds(TypedDict, total=False): class ProjectionKwds(TypedDict, total=False): """ - Projection ``TypedDict`` wrapper. + :class:`Projection` ``TypedDict`` wrapper. Parameters ---------- @@ -5409,7 +5409,7 @@ class ProjectionKwds(TypedDict, total=False): class ProjectionConfigKwds(TypedDict, total=False): """ - ProjectionConfig ``TypedDict`` wrapper. + :class:`ProjectionConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -5552,7 +5552,7 @@ class ProjectionConfigKwds(TypedDict, total=False): class RadialGradientKwds(TypedDict, total=False): """ - RadialGradient ``TypedDict`` wrapper. + :class:`RadialGradient` ``TypedDict`` wrapper. Parameters ---------- @@ -5607,7 +5607,7 @@ class RadialGradientKwds(TypedDict, total=False): class RangeConfigKwds(TypedDict, total=False): """ - RangeConfig ``TypedDict`` wrapper. + :class:`RangeConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -5661,7 +5661,7 @@ class RangeConfigKwds(TypedDict, total=False): class RectConfigKwds(TypedDict, total=False): """ - RectConfig ``TypedDict`` wrapper. + :class:`RectConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -6127,7 +6127,7 @@ class RectConfigKwds(TypedDict, total=False): class ResolveKwds(TypedDict, total=False): """ - Resolve ``TypedDict`` wrapper. + :class:`Resolve` ``TypedDict`` wrapper. Parameters ---------- @@ -6146,7 +6146,7 @@ class ResolveKwds(TypedDict, total=False): class ScaleConfigKwds(TypedDict, total=False): """ - ScaleConfig ``TypedDict`` wrapper. + :class:`ScaleConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -6329,7 +6329,7 @@ class ScaleConfigKwds(TypedDict, total=False): class ScaleInvalidDataConfigKwds(TypedDict, total=False): """ - ScaleInvalidDataConfig ``TypedDict`` wrapper. + :class:`ScaleInvalidDataConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -6399,7 +6399,7 @@ class ScaleInvalidDataConfigKwds(TypedDict, total=False): class ScaleResolveMapKwds(TypedDict, total=False): """ - ScaleResolveMap ``TypedDict`` wrapper. + :class:`ScaleResolveMap` ``TypedDict`` wrapper. Parameters ---------- @@ -6460,7 +6460,7 @@ class ScaleResolveMapKwds(TypedDict, total=False): class SelectionConfigKwds(TypedDict, total=False): """ - SelectionConfig ``TypedDict`` wrapper. + :class:`SelectionConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -6488,7 +6488,7 @@ class SelectionConfigKwds(TypedDict, total=False): class StepKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] """ - Step ``TypedDict`` wrapper. + :class:`Step` ``TypedDict`` wrapper. Parameters ---------- @@ -6513,7 +6513,7 @@ class StepKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] class StyleConfigIndexKwds(TypedDict, closed=True, total=False): # type: ignore[call-arg] """ - StyleConfigIndex ``TypedDict`` wrapper. + :class:`StyleConfigIndex` ``TypedDict`` wrapper. Parameters ---------- @@ -6580,7 +6580,7 @@ class StyleConfigIndexKwds(TypedDict, closed=True, total=False): # type: ignore class TickConfigKwds(TypedDict, total=False): """ - TickConfig ``TypedDict`` wrapper. + :class:`TickConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -7039,7 +7039,7 @@ class TickConfigKwds(TypedDict, total=False): class TimeIntervalStepKwds(TypedDict, total=False): """ - TimeIntervalStep ``TypedDict`` wrapper. + :class:`TimeIntervalStep` ``TypedDict`` wrapper. Parameters ---------- @@ -7055,7 +7055,7 @@ class TimeIntervalStepKwds(TypedDict, total=False): class TimeLocaleKwds(TypedDict, total=False): """ - TimeLocale ``TypedDict`` wrapper. + :class:`TimeLocale` ``TypedDict`` wrapper. Parameters ---------- @@ -7089,7 +7089,7 @@ class TimeLocaleKwds(TypedDict, total=False): class TitleConfigKwds(TypedDict, total=False): """ - TitleConfig ``TypedDict`` wrapper. + :class:`TitleConfig` ``TypedDict`` wrapper. Parameters ---------- @@ -7197,7 +7197,7 @@ class TitleConfigKwds(TypedDict, total=False): class TitleParamsKwds(TypedDict, total=False): """ - TitleParams ``TypedDict`` wrapper. + :class:`TitleParams` ``TypedDict`` wrapper. Parameters ---------- @@ -7328,7 +7328,7 @@ class TitleParamsKwds(TypedDict, total=False): class TooltipContentKwds(TypedDict, total=False): """ - TooltipContent ``TypedDict`` wrapper. + :class:`TooltipContent` ``TypedDict`` wrapper. Parameters ---------- @@ -7341,7 +7341,7 @@ class TooltipContentKwds(TypedDict, total=False): class TopLevelSelectionParameterKwds(TypedDict, total=False): """ - TopLevelSelectionParameter ``TypedDict`` wrapper. + :class:`TopLevelSelectionParameter` ``TypedDict`` wrapper. Parameters ---------- @@ -7403,7 +7403,7 @@ class TopLevelSelectionParameterKwds(TypedDict, total=False): class VariableParameterKwds(TypedDict, total=False): """ - VariableParameter ``TypedDict`` wrapper. + :class:`VariableParameter` ``TypedDict`` wrapper. Parameters ---------- @@ -7448,7 +7448,7 @@ class VariableParameterKwds(TypedDict, total=False): class ViewBackgroundKwds(TypedDict, total=False): """ - ViewBackground ``TypedDict`` wrapper. + :class:`ViewBackground` ``TypedDict`` wrapper. Parameters ---------- @@ -7526,7 +7526,7 @@ class ViewBackgroundKwds(TypedDict, total=False): class ViewConfigKwds(TypedDict, total=False): """ - ViewConfig ``TypedDict`` wrapper. + :class:`ViewConfig` ``TypedDict`` wrapper. Parameters ---------- diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index bbd6f7527..2ff01c3ab 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -915,7 +915,7 @@ def generate_typed_dict( name=name, metaclass_kwds=metaclass_kwds, comment=comment, - summary=summary or f"{info.title} ``TypedDict`` wrapper.", + summary=summary or f"{rst_syntax_for_class(info.title)} ``TypedDict`` wrapper.", doc=doc, td_args=args, ) From d4bd6db3721adbb05aa688289ba52f9a206b7fa9 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Mon, 16 Sep 2024 21:12:40 +0100 Subject: [PATCH 138/139] fix: Define `typing` as a package to support submodules The usage I described in the description was not actually possible: >- The top-level object `ThemeConfig` is exported to `altair.typing`> - All others are accessible via `altair.typing.theme`. This resolves the `ModuleNotFoundError` that would get raised when trying this --- altair/{typing.py => typing/__init__.py} | 4 ++-- altair/typing/theme.py | 1 + altair/vegalite/v5/schema/_config.py | 2 +- tools/generate_schema_wrapper.py | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) rename altair/{typing.py => typing/__init__.py} (94%) create mode 100644 altair/typing/theme.py diff --git a/altair/typing.py b/altair/typing/__init__.py similarity index 94% rename from altair/typing.py rename to altair/typing/__init__.py index 3c17895dd..d80469f35 100644 --- a/altair/typing.py +++ b/altair/typing/__init__.py @@ -51,10 +51,10 @@ "theme", ] -import altair.vegalite.v5.schema._config as theme +from altair.typing import theme +from altair.typing.theme import ThemeConfig from altair.utils.schemapi import Optional from altair.vegalite.v5.api import ChartType, is_chart_type -from altair.vegalite.v5.schema._config import ThemeConfig from altair.vegalite.v5.schema.channels import ( ChannelAngle, ChannelColor, diff --git a/altair/typing/theme.py b/altair/typing/theme.py new file mode 100644 index 000000000..17f9a7fd2 --- /dev/null +++ b/altair/typing/theme.py @@ -0,0 +1 @@ +from altair.vegalite.v5.schema._config import * # noqa: F403 diff --git a/altair/vegalite/v5/schema/_config.py b/altair/vegalite/v5/schema/_config.py index 39b39ec81..80864718d 100644 --- a/altair/vegalite/v5/schema/_config.py +++ b/altair/vegalite/v5/schema/_config.py @@ -10,7 +10,7 @@ from typing import TypedDict else: from typing_extensions import TypedDict - +from ._typing import PaddingKwds, RowColKwds if TYPE_CHECKING: # ruff: noqa: F405 diff --git a/tools/generate_schema_wrapper.py b/tools/generate_schema_wrapper.py index 2ff01c3ab..80cfb3bb7 100644 --- a/tools/generate_schema_wrapper.py +++ b/tools/generate_schema_wrapper.py @@ -1076,6 +1076,7 @@ def vegalite_main(skip_download: bool = False) -> None: HEADER, "from typing import Any, TYPE_CHECKING, Literal, Sequence, TypedDict, Union", import_typing_extensions((3, 14), "TypedDict", include_sys=True), + f"from ._typing import {ROW_COL_KWDS}, {PADDING_KWDS}", "\n\n", import_type_checking("from ._typing import * # noqa: F403"), "\n\n", From 8db4469d474844706b66edcfc58c2f3132e15433 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:55:12 +0100 Subject: [PATCH 139/139] fix: Update `TypedDict` import in `_typing.py` https://peps.python.org/pep-0728/ --- altair/vegalite/v5/schema/_typing.py | 11 ++++++++--- tools/schemapi/utils.py | 6 ++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/altair/vegalite/v5/schema/_typing.py b/altair/vegalite/v5/schema/_typing.py index 3390b9515..e2ea00ed5 100644 --- a/altair/vegalite/v5/schema/_typing.py +++ b/altair/vegalite/v5/schema/_typing.py @@ -7,10 +7,15 @@ import sys from typing import Any, Generic, Literal, Mapping, Sequence, TypeVar, Union -if sys.version_info >= (3, 13): # `TypedDict` had multiple revisions. - from typing import TypedDict, TypeIs +if sys.version_info >= (3, 14): # https://peps.python.org/pep-0728/ + from typing import TypedDict else: - from typing_extensions import TypedDict, TypeIs + from typing_extensions import TypedDict + +if sys.version_info >= (3, 13): + from typing import TypeIs +else: + from typing_extensions import TypeIs if sys.version_info >= (3, 12): from typing import TypeAliasType diff --git a/tools/schemapi/utils.py b/tools/schemapi/utils.py index c5f319cb3..5c4a84f9c 100644 --- a/tools/schemapi/utils.py +++ b/tools/schemapi/utils.py @@ -132,11 +132,9 @@ def __init__( "from typing import Any, Generic, Literal, Mapping, TypeVar, Sequence, Union", "import re", import_typing_extensions( - (3, 13), - "TypedDict", - "TypeIs", - reason="`TypedDict` had multiple revisions.", + (3, 14), "TypedDict", reason="https://peps.python.org/pep-0728/" ), + import_typing_extensions((3, 13), "TypeIs"), import_typing_extensions((3, 12), "TypeAliasType"), import_typing_extensions((3, 11), "LiteralString"), import_typing_extensions((3, 10), "TypeAlias"),