Skip to content

Commit 7eb7025

Browse files
authored
ci(uv): bump ruff==0.9.5 (#3799)
1 parent 9c0488e commit 7eb7025

File tree

6 files changed

+57
-49
lines changed

6 files changed

+57
-49
lines changed

altair/vegalite/v5/schema/_config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
import sys
77
from typing import TYPE_CHECKING, Any, Literal, TypedDict
88

9-
if sys.version_info >= (3, 14):
10-
from typing import TypedDict
11-
else:
12-
from typing_extensions import TypedDict
139
from ._typing import PaddingKwds, RowColKwds
1410

1511
if TYPE_CHECKING:
@@ -19,6 +15,12 @@
1915
from ._typing import * # noqa: F403
2016

2117

18+
if sys.version_info >= (3, 14):
19+
from typing import TypedDict
20+
else:
21+
from typing_extensions import TypedDict
22+
23+
2224
__all__ = [
2325
"AreaConfigKwds",
2426
"AutoSizeParamsKwds",

altair/vegalite/v5/schema/channels.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010
# sense if there are multiple ones
1111
# However, we need these overloads due to how the propertysetter works
1212
# mypy: disable-error-code="no-overload-impl, empty-body, misc"
13-
import sys
1413
from typing import TYPE_CHECKING, Any, Literal, TypedDict, Union, overload
1514

16-
if sys.version_info >= (3, 10):
17-
from typing import TypeAlias
18-
else:
19-
from typing_extensions import TypeAlias
2015
import narwhals.stable.v1 as nw
2116

2217
from altair.utils import infer_encoding_types as _infer_encoding_types
@@ -28,6 +23,7 @@
2823

2924
if TYPE_CHECKING:
3025
# ruff: noqa: F405
26+
import sys
3127
from collections.abc import Sequence
3228

3329
from altair import Parameter, SchemaBase
@@ -48,6 +44,10 @@
4844
from typing import Self
4945
else:
5046
from typing_extensions import Self
47+
if sys.version_info >= (3, 10):
48+
from typing import TypeAlias
49+
else:
50+
from typing_extensions import TypeAlias
5151

5252

5353
__all__ = [

altair/vegalite/v5/schema/mixins.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99

1010
from . import core
1111

12-
if TYPE_CHECKING:
13-
from collections.abc import Sequence
14-
1512
if TYPE_CHECKING:
1613
# ruff: noqa: F405
1714
import sys
15+
from collections.abc import Sequence
1816

1917
if sys.version_info >= (3, 11):
2018
from typing import Self

tools/generate_schema_wrapper.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
]

tools/schemapi/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,12 @@ def unwrap_literal(tp: str, /) -> str:
12511251
def import_type_checking(*imports: str) -> str:
12521252
"""Write an `if TYPE_CHECKING` block."""
12531253
imps = "\n".join(f" {s}" for s in imports)
1254-
return f"\nif TYPE_CHECKING:\n # ruff: noqa: F405\n{imps}\n"
1254+
return (
1255+
f"from typing import TYPE_CHECKING\n\n"
1256+
f"if TYPE_CHECKING:\n"
1257+
f" # ruff: noqa: F405\n"
1258+
f"{imps}\n"
1259+
)
12551260

12561261

12571262
def import_typing_extensions(

uv.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)