Skip to content

Commit

Permalink
Bump black to 22.3.0 (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbluca authored Apr 4, 2022
1 parent 1b0b6f7 commit a05138d
Show file tree
Hide file tree
Showing 36 changed files with 217 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 22.3.0
hooks:
- id: black
language_version: python3
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.10-jdk11-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.10-jdk8-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.8-jdk11-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.8-jdk8-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.9-jdk11-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment-3.9-jdk8-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- adagio>=0.2.3
- antlr4-python3-runtime>=4.9.2
- black=19.10b0
- black=22.3.0
- ciso8601>=2.2.0
- dask-ml>=2022.1.22
- dask>=2021.11.1
Expand Down
9 changes: 6 additions & 3 deletions dask_sql/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def _parse_meta_command(sql):

def _meta_commands(sql: str, context: Context, client: Client) -> Union[bool, Client]:
"""
parses metacommands and prints their result
returns True if meta commands detected
parses metacommands and prints their result
returns True if meta commands detected
"""
cmd, schema_name = _parse_meta_command(sql)
available_commands = [
Expand Down Expand Up @@ -147,7 +147,10 @@ def _meta_commands(sql: str, context: Context, client: Client) -> Union[bool, Cl


def cmd_loop(
context: Context = None, client: Client = None, startup=False, log_level=None,
context: Context = None,
client: Client = None,
startup=False,
log_level=None,
): # pragma: no cover
"""
Run a REPL for answering SQL queries using ``dask-sql``.
Expand Down
3 changes: 2 additions & 1 deletion dask_sql/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,8 @@ def _register_callable(
if replace:
schema.function_lists = list(
filter(
lambda f: f.name.lower() != lower_name, schema.function_lists,
lambda f: f.name.lower() != lower_name,
schema.function_lists,
)
)
del schema.functions[lower_name]
Expand Down
6 changes: 5 additions & 1 deletion dask_sql/input_utils/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def to_dc(
maybe persist them to cluster memory before.
"""
filled_get_dask_dataframe = lambda *args: cls._get_dask_dataframe(
*args, table_name=table_name, format=format, gpu=gpu, **kwargs,
*args,
table_name=table_name,
format=format,
gpu=gpu,
**kwargs,
)

if isinstance(input_item, list):
Expand Down
5 changes: 4 additions & 1 deletion dask_sql/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ def _set_or_check_java_home():

logger.debug(f"Starting JVM from path {jvmpath}...")
jpype.startJVM(
*jvmArgs, ignoreUnrecognized=True, convertStrings=False, jvmpath=jvmpath,
*jvmArgs,
ignoreUnrecognized=True,
convertStrings=False,
jvmpath=jvmpath,
)

logger.debug("...having started JVM")
Expand Down
5 changes: 4 additions & 1 deletion dask_sql/physical/rel/custom/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def convert(
)
)
statistics = statistics.append(
pd.Series({col: col for col in columns}, name="col_name",)
pd.Series(
{col: col for col in columns},
name="col_name",
)
)

cc = ColumnContainer(statistics.columns)
Expand Down
5 changes: 4 additions & 1 deletion dask_sql/physical/rel/logical/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ def convert(

# Do all aggregates
df_result, output_column_order = self._do_aggregations(
rel, dc, group_columns, context,
rel,
dc,
group_columns,
context,
)

# SQL does not care about the index, but we do not want to have any multiindices
Expand Down
6 changes: 5 additions & 1 deletion dask_sql/physical/rel/logical/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def convert(
# The resulting dataframe will contain all (renamed) columns from the lhs and rhs
# plus the added columns
df = self._join_on_columns(
df_lhs_renamed, df_rhs_renamed, lhs_on, rhs_on, join_type,
df_lhs_renamed,
df_rhs_renamed,
lhs_on,
rhs_on,
join_type,
)
else:
# 5. We are in the complex join case
Expand Down
3 changes: 2 additions & 1 deletion dask_sql/physical/rel/logical/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def map_on_each_group(
upper_bound.is_current_row or upper_bound.offset == 0
):
windowed_group = partitioned_group.rolling(
window=lower_bound.offset + 1, min_periods=0,
window=lower_bound.offset + 1,
min_periods=0,
)
else:
lower_offset = lower_bound.offset if not lower_bound.is_current_row else 0
Expand Down
25 changes: 20 additions & 5 deletions dask_sql/physical/rex/core/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ class IsFalseOperation(Operation):
def __init__(self):
super().__init__(self.false_)

def false_(self, df: SeriesOrScalar,) -> SeriesOrScalar:
def false_(
self,
df: SeriesOrScalar,
) -> SeriesOrScalar:
"""
Returns true where `df` is false (where `df` can also be just a scalar).
Returns false on nan.
Expand All @@ -263,7 +266,10 @@ class IsTrueOperation(Operation):
def __init__(self):
super().__init__(self.true_)

def true_(self, df: SeriesOrScalar,) -> SeriesOrScalar:
def true_(
self,
df: SeriesOrScalar,
) -> SeriesOrScalar:
"""
Returns true where `df` is true (where `df` can also be just a scalar).
Returns false on nan.
Expand All @@ -280,7 +286,10 @@ class NotOperation(Operation):
def __init__(self):
super().__init__(self.not_)

def not_(self, df: SeriesOrScalar,) -> SeriesOrScalar:
def not_(
self,
df: SeriesOrScalar,
) -> SeriesOrScalar:
"""
Returns not `df` (where `df` can also be just a scalar).
"""
Expand All @@ -296,7 +305,10 @@ class IsNullOperation(Operation):
def __init__(self):
super().__init__(self.null)

def null(self, df: SeriesOrScalar,) -> SeriesOrScalar:
def null(
self,
df: SeriesOrScalar,
) -> SeriesOrScalar:
"""
Returns true where `df` is null (where `df` can also be just a scalar).
"""
Expand Down Expand Up @@ -328,7 +340,10 @@ def __init__(self):
super().__init__(self.regex)

def regex(
self, test: SeriesOrScalar, regex: str, escape: str = None,
self,
test: SeriesOrScalar,
regex: str,
escape: str = None,
) -> SeriesOrScalar:
"""
Returns true, if the string test matches the given regex
Expand Down
19 changes: 15 additions & 4 deletions dask_sql/physical/utils/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def attempt_predicate_pushdown(ddf: dd.DataFrame) -> dd.DataFrame:
# Regenerate collection with filtered IO layer
try:
return dsk.layers[name]._regenerate_collection(
dsk, new_kwargs={io_layer: {"filters": filters}},
dsk,
new_kwargs={io_layer: {"filters": filters}},
)
except ValueError as err:
# Most-likely failed to apply filters in read_parquet.
Expand Down Expand Up @@ -198,7 +199,10 @@ def __init__(self, layer, creation_info):
self.creation_info = creation_info

def _regenerate_collection(
self, dsk, new_kwargs: dict = None, _regen_cache: dict = None,
self,
dsk,
new_kwargs: dict = None,
_regen_cache: dict = None,
):
"""Regenerate a Dask collection for this layer using the
provided inputs and key-word arguments
Expand All @@ -223,7 +227,9 @@ def _regenerate_collection(
else:
inputs.append(
dsk.layers[key]._regenerate_collection(
dsk, new_kwargs=new_kwargs, _regen_cache=_regen_cache,
dsk,
new_kwargs=new_kwargs,
_regen_cache=_regen_cache,
)
)

Expand Down Expand Up @@ -334,7 +340,12 @@ def _blockwise_comparison_dnf(op, indices: list, dsk: RegenerableGraph):
right = _get_blockwise_input(1, indices, dsk)

def _inv(symbol: str):
return {">": "<", "<": ">", ">=": "<=", "<=": ">=",}.get(symbol, symbol)
return {
">": "<",
"<": ">",
">=": "<=",
"<=": ">=",
}.get(symbol, symbol)

if is_arraylike(left) and hasattr(left, "item") and left.size == 1:
left = left.item()
Expand Down
4 changes: 3 additions & 1 deletion dask_sql/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ def main(): # pragma: no cover


def _init_app(
app: FastAPI, context: Context = None, client: dask.distributed.Client = None,
app: FastAPI,
context: Context = None,
client: dask.distributed.Client = None,
):
app.c = context or Context()
app.future_list = {}
Expand Down
2 changes: 1 addition & 1 deletion docker/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ dask-ml>=2022.1.22
scikit-learn>=0.24.2
intake>=0.6.0
pre-commit>=2.11.1
black=19.10b0
black=22.3.0
isort=5.7.0
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def build(self):
"scikit-learn>=0.24.2",
"intake>=0.6.0",
"pre-commit",
"black==19.10b0",
"black==22.3.0",
"isort==5.7.0",
],
"fugue": ["fugue[sql]>=0.5.3"],
Expand All @@ -122,5 +122,9 @@ def build(self):
},
zip_safe=False,
cmdclass=cmdclass,
command_options={"build_sphinx": {"source_dir": ("setup.py", "docs"),}},
command_options={
"build_sphinx": {
"source_dir": ("setup.py", "docs"),
}
},
)
5 changes: 4 additions & 1 deletion tests/integration/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def df_wide():
def df():
np.random.seed(42)
return pd.DataFrame(
{"a": [1.0] * 100 + [2.0] * 200 + [3.0] * 400, "b": 10 * np.random.rand(700),}
{
"a": [1.0] * 100 + [2.0] * 200 + [3.0] * 400,
"b": 10 * np.random.rand(700),
}
)


Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def test_meta_commands(c, client, capsys):
assert "Schema not_exists not available\n" == captured.out

with pytest.raises(
OSError, match="Timed out .* to tcp://localhost:8787 after 5 s",
OSError,
match="Timed out .* to tcp://localhost:8787 after 5 s",
):
with dask_config.set({"distributed.comm.timeouts.connect": 5}):
client = _meta_commands("\\dsc localhost:8787", context=c, client=client)
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ def test_create_from_csv(c, df, temporary_data_file, gpu):


@pytest.mark.parametrize(
"gpu", [False, pytest.param(True, marks=pytest.mark.gpu),],
"gpu",
[
False,
pytest.param(True, marks=pytest.mark.gpu),
],
)
def test_cluster_memory(client, c, df, gpu):
client.publish_dataset(df=dd.from_pandas(df, npartitions=1))
Expand Down
Loading

0 comments on commit a05138d

Please sign in to comment.