Skip to content

Commit

Permalink
MAINT: Reformat codebase with new style of ruff 0.3.0 (#3345)
Browse files Browse the repository at this point in the history
  • Loading branch information
binste authored Mar 1, 2024
1 parent e58e8cb commit a724353
Show file tree
Hide file tree
Showing 17 changed files with 1,480 additions and 2,914 deletions.
1 change: 1 addition & 0 deletions altair/_magics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Magic functions for rendering vega-lite specifications
"""

__all__ = ["vegalite"]

import json
Expand Down
1 change: 1 addition & 0 deletions altair/expr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tools for creating transform & filter expressions with a python syntax"""

# ruff: noqa
from typing import Any

Expand Down
6 changes: 2 additions & 4 deletions altair/utils/_transformed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ def transformed_data(
chart: Union[Chart, FacetChart],
row_limit: Optional[int] = None,
exclude: Optional[Iterable[str]] = None,
) -> Optional[DataFrameLike]:
...
) -> Optional[DataFrameLike]: ...


@overload
def transformed_data(
chart: Union[LayerChart, HConcatChart, VConcatChart, ConcatChart],
row_limit: Optional[int] = None,
exclude: Optional[Iterable[str]] = None,
) -> List[DataFrameLike]:
...
) -> List[DataFrameLike]: ...


def transformed_data(chart, row_limit=None, exclude=None):
Expand Down
4 changes: 2 additions & 2 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Utility routines
"""

from collections.abc import Mapping, MutableMapping
from copy import deepcopy
import json
Expand Down Expand Up @@ -48,8 +49,7 @@
class DataFrameLike(Protocol):
def __dataframe__(
self, nan_as_null: bool = False, allow_copy: bool = True
) -> DfiDataFrame:
...
) -> DfiDataFrame: ...


TYPECODE_MAP = {
Expand Down
12 changes: 5 additions & 7 deletions altair/utils/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def validate_jsonschema(
rootschema: Optional[Dict[str, Any]] = ...,
*,
raise_error: Literal[True] = ...,
) -> None:
...
) -> None: ...


@overload
Expand All @@ -111,8 +110,7 @@ def validate_jsonschema(
rootschema: Optional[Dict[str, Any]] = ...,
*,
raise_error: Literal[False],
) -> Optional[jsonschema.exceptions.ValidationError]:
...
) -> Optional[jsonschema.exceptions.ValidationError]: ...


def validate_jsonschema(
Expand Down Expand Up @@ -388,9 +386,9 @@ def _group_errors_by_validator(errors: ValidationErrorList) -> GroupedValidation
was set although no additional properties are allowed then "validator" is
`"additionalProperties`, etc.
"""
errors_by_validator: DefaultDict[
str, ValidationErrorList
] = collections.defaultdict(list)
errors_by_validator: DefaultDict[str, ValidationErrorList] = (
collections.defaultdict(list)
)
for err in errors:
# Ignore mypy error as err.validator as it wrongly sees err.validator
# as of type Optional[Validator] instead of str which it is according
Expand Down
1 change: 1 addition & 0 deletions altair/utils/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This is adapted from the mpld3 package; see
https://github.com/mpld3/mpld3/blob/master/mpld3/_server.py
"""

import sys
import threading
import webbrowser
Expand Down
1 change: 1 addition & 0 deletions altair/vegalite/schema.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Altair schema wrappers"""

# ruff: noqa
from .v5.schema import *
Loading

0 comments on commit a724353

Please sign in to comment.