Skip to content

Commit

Permalink
ruff format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijn committed Oct 27, 2023
1 parent 6ff2b2e commit 71e3598
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 21 deletions.
5 changes: 3 additions & 2 deletions altair/_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
27 changes: 15 additions & 12 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion altair/utils/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions sphinxext/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions tests/test_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
import pandas as pd
table = pd.DataFrame.from_records({})
the_data = table
""".format(
DATA_RECORDS
)
""".format(DATA_RECORDS)
)


Expand Down
2 changes: 1 addition & 1 deletion tools/schemapi/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 71e3598

Please sign in to comment.