@@ -761,13 +761,12 @@ def generate_vegalite_schema_wrapper(fp: Path, /) -> ModuleDef[str]:
761761 all_ = [* sorted (it ), "Root" , "VegaLiteSchema" , "SchemaBase" , "load_schema" ]
762762 contents = [
763763 HEADER ,
764- "from collections.abc import Iterator, Sequence" ,
765- "from typing import Any, Literal, Union, Protocol, TYPE_CHECKING" ,
764+ "from typing import Any, Literal, Union" ,
766765 "import pkgutil" ,
767766 "import json\n " ,
768- "import narwhals.stable.v1 as nw\n " ,
769767 "from altair.utils.schemapi import SchemaBase, Undefined, UndefinedType, _subclasses # noqa: F401\n " ,
770768 import_type_checking (
769+ "from collections.abc import Iterator, Sequence" ,
771770 "from datetime import date, datetime" ,
772771 "from altair import Parameter" ,
773772 "from altair.typing import Optional" ,
@@ -880,13 +879,11 @@ def generate_vegalite_channel_wrappers(fp: Path, /) -> ModuleDef[list[str]]:
880879 all_ = sorted (chain (it , COMPAT_EXPORTS ))
881880 imports = [
882881 "import sys" ,
883- "from collections.abc import Sequence" ,
884- "from typing import Any, overload, Literal, Union, TYPE_CHECKING, TypedDict" ,
885- import_typing_extensions ((3 , 10 ), "TypeAlias" ),
882+ "from typing import Any, overload, Literal, Union, TypedDict" ,
886883 "import narwhals.stable.v1 as nw" ,
887- "from altair.utils.schemapi import Undefined, with_property_setters" ,
888884 "from altair.utils import infer_encoding_types as _infer_encoding_types" ,
889885 "from altair.utils import parse_shorthand" ,
886+ "from altair.utils.schemapi import Undefined, with_property_setters" ,
890887 "from . import core" ,
891888 "from ._typing import * # noqa: F403" ,
892889 ]
@@ -906,12 +903,16 @@ def generate_vegalite_channel_wrappers(fp: Path, /) -> ModuleDef[list[str]]:
906903 CHANNEL_MYPY_IGNORE_STATEMENTS ,
907904 * imports ,
908905 import_type_checking (
909- "from datetime import date, datetime " ,
906+ "from collections.abc import Sequence " ,
910907 "from altair import Parameter, SchemaBase" ,
911908 "from altair.typing import Optional" ,
912909 f"from altair.vegalite.v5.schema.core import { ', ' .join (TYPING_CORE )} " ,
913910 f"from altair.vegalite.v5.api import { ', ' .join (TYPING_API )} " ,
914- textwrap .indent (import_typing_extensions ((3 , 11 ), "Self" ), " " ),
911+ textwrap .indent (
912+ import_typing_extensions ((3 , 11 ), "Self" )
913+ + import_typing_extensions ((3 , 10 ), "TypeAlias" ),
914+ " " ,
915+ ),
915916 ),
916917 f"\n __all__ = { all_ } \n " ,
917918 CHANNEL_MIXINS ,
@@ -1234,7 +1235,6 @@ def vegalite_main(skip_download: bool = False) -> None:
12341235 fp_mixins = schemapath / "mixins.py"
12351236 print (f"Generating\n { schemafile !s} \n ->{ fp_mixins !s} " )
12361237 mixins_imports = (
1237- "from collections.abc import Sequence" ,
12381238 "from typing import Any, Literal, Union" ,
12391239 "from altair.utils import use_signature, Undefined, SchemaBase" ,
12401240 "from . import core" ,
@@ -1249,6 +1249,7 @@ def vegalite_main(skip_download: bool = False) -> None:
12491249 "\n \n " ,
12501250 import_type_checking (
12511251 "import sys" ,
1252+ "from collections.abc import Sequence" ,
12521253 textwrap .indent (import_typing_extensions ((3 , 11 ), "Self" ), " " ),
12531254 "from altair.typing import Optional" ,
12541255 "from ._typing import * # noqa: F403" ,
@@ -1265,12 +1266,14 @@ def vegalite_main(skip_download: bool = False) -> None:
12651266 fp_theme_config : Path = schemapath / "_config.py"
12661267 content_theme_config = [
12671268 HEADER ,
1268- "from collections.abc import Sequence" ,
1269- "from typing import Any, TYPE_CHECKING, Literal, TypedDict, Union" ,
1270- import_typing_extensions ((3 , 14 ), "TypedDict" , include_sys = True ),
1269+ "from typing import Any, Literal, TypedDict, Union" ,
1270+ "import sys" ,
12711271 f"from ._typing import { ROW_COL_KWDS } , { PADDING_KWDS } " ,
1272- "\n \n " ,
1273- import_type_checking ("from ._typing import * # noqa: F403" ),
1272+ import_type_checking (
1273+ "from collections.abc import Sequence" ,
1274+ "from ._typing import * # noqa: F403" ,
1275+ ),
1276+ import_typing_extensions ((3 , 14 ), "TypedDict" ),
12741277 "\n \n " ,
12751278 * generate_config_typed_dicts (schemafile ),
12761279 ]
0 commit comments