From 71e3598b48ddbbc212d486dbef148ae44b69fe6f Mon Sep 17 00:00:00 2001 From: Mattijn van Hoek Date: Fri, 27 Oct 2023 21:01:15 +0200 Subject: [PATCH] ruff format changes --- altair/_magics.py | 5 +++-- altair/utils/core.py | 27 +++++++++++++++------------ altair/utils/schemapi.py | 2 +- sphinxext/utils.py | 5 +++-- tests/test_magics.py | 4 +--- tools/schemapi/schemapi.py | 2 +- 6 files changed, 24 insertions(+), 21 deletions(-) diff --git a/altair/_magics.py b/altair/_magics.py index 7fe613118..55b5b97e2 100644 --- a/altair/_magics.py +++ b/altair/_magics.py @@ -58,8 +58,9 @@ def _get_variable(name): ) if name not in ip.user_ns: raise NameError( - "argument '{}' does not match the " - "name of any defined variable".format(name) + "argument '{}' does not match the " "name of any defined variable".format( + name + ) ) return ip.user_ns[name] diff --git a/altair/utils/core.py b/altair/utils/core.py index 28601db3c..4d2f9c7a5 100644 --- a/altair/utils/core.py +++ b/altair/utils/core.py @@ -380,18 +380,21 @@ def to_list_if_array(val): # geopandas >=0.6.1 uses the dtype geometry. Continue here # otherwise it will give an error on np.issubdtype(dtype, np.integer) continue - elif dtype_name in { - "Int8", - "Int16", - "Int32", - "Int64", - "UInt8", - "UInt16", - "UInt32", - "UInt64", - "Float32", - "Float64", - }: # nullable integer datatypes (since 24.0) and nullable float datatypes (since 1.2.0) + elif ( + dtype_name + in { + "Int8", + "Int16", + "Int32", + "Int64", + "UInt8", + "UInt16", + "UInt32", + "UInt64", + "Float32", + "Float64", + } + ): # nullable integer datatypes (since 24.0) and nullable float datatypes (since 1.2.0) # https://pandas.pydata.org/pandas-docs/version/0.25/whatsnew/v0.24.0.html#optional-integer-na-support col = df[col_name].astype(object) df[col_name] = col.where(col.notnull(), None) diff --git a/altair/utils/schemapi.py b/altair/utils/schemapi.py index f38424681..f4b2e6b57 100644 --- a/altair/utils/schemapi.py +++ b/altair/utils/schemapi.py @@ -1079,7 +1079,7 @@ def from_json( cls, json_string: str, validate: bool = True, - **kwargs: Any + **kwargs: Any, # Type hints for this method would get rather complicated # if we want to provide a more specific return type ) -> Any: diff --git a/sphinxext/utils.py b/sphinxext/utils.py index 44b5074b2..f9dc181e9 100644 --- a/sphinxext/utils.py +++ b/sphinxext/utils.py @@ -122,8 +122,9 @@ def get_docstring_and_rest(filename): if not isinstance(node, ast.Module): raise TypeError( - "This function only supports modules. " - "You provided {}".format(node.__class__.__name__) + "This function only supports modules. " "You provided {}".format( + node.__class__.__name__ + ) ) try: # In python 3.7 module knows its docstring. diff --git a/tests/test_magics.py b/tests/test_magics.py index db24ff480..4dd69ba7b 100644 --- a/tests/test_magics.py +++ b/tests/test_magics.py @@ -31,9 +31,7 @@ import pandas as pd table = pd.DataFrame.from_records({}) the_data = table -""".format( - DATA_RECORDS - ) +""".format(DATA_RECORDS) ) diff --git a/tools/schemapi/schemapi.py b/tools/schemapi/schemapi.py index af98fbe8c..f3e00e26a 100644 --- a/tools/schemapi/schemapi.py +++ b/tools/schemapi/schemapi.py @@ -1077,7 +1077,7 @@ def from_json( cls, json_string: str, validate: bool = True, - **kwargs: Any + **kwargs: Any, # Type hints for this method would get rather complicated # if we want to provide a more specific return type ) -> Any: