Skip to content

Commit

Permalink
Fix black (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
limdauto authored Dec 1, 2020
1 parent 802687a commit d24adde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pylint:
cd package && isort
black package/kedro_viz package/tests package/features
pylint -j 0 --disable=bad-continuation,unnecessary-pass,ungrouped-imports package/kedro_viz
pylint -j 0 --disable=bad-continuation,missing-docstring,redefined-outer-name,no-self-use,invalid-name,too-few-public-methods,no-member package/tests
pylint -j 0 --disable=missing-docstring,no-name-in-module package/features
pylint -j 0 --disable=bad-continuation,missing-docstring,redefined-outer-name,no-self-use,invalid-name,too-few-public-methods,no-member,unused-argument package/tests
pylint -j 0 --disable=missing-docstring,no-name-in-module,unused-argument package/features
flake8 package

secret-scan:
Expand Down
2 changes: 1 addition & 1 deletion package/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _setup_context_with_venv(context, venv_dir):
"pip>=20.0",
"setuptools>=38.0",
"wheel",
"botocore"
"botocore",
],
env=context.env,
)
Expand Down
13 changes: 6 additions & 7 deletions package/kedro_viz/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,9 @@ def nodes_metadata(node_id):


@app.errorhandler(404)
def resource_not_found(e):
return jsonify(error=str(e)), 404
def resource_not_found(error):
"""Returns HTTP 404 on resource not found."""
return jsonify(error=str(error)), 404


def _get_task_metadata(node):
Expand Down Expand Up @@ -642,7 +643,7 @@ def viz(host, port, browser, load_file, save_file, pipeline, env):
raise KedroCliError(str(ex))


# pylint: disable=too-many-arguments,too-many-branches
# pylint: disable=import-outside-toplevel,too-many-arguments,too-many-branches
def _call_viz(
host=None,
port=None,
Expand All @@ -663,13 +664,11 @@ def _call_viz(

_DATA = _load_from_file(load_file)
else:
# pylint: disable=import-outside-toplevel
if KEDRO_VERSION.match(">=0.16.0"):
from kedro.framework.context import KedroContextError
else:
from kedro.context import ( # pylint: disable=no-name-in-module,import-error
KedroContextError,
)
# pylint: disable=no-name-in-module,import-error
from kedro.context import KedroContextError

try:
if project_path is not None:
Expand Down
14 changes: 5 additions & 9 deletions package/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,7 @@ def test_node_metadata_endpoint_data_input(cli_runner, client, tmp_path):
assert response.status_code == 200
data = json.loads(response.data.decode())
assert data["filepath"] == str(tmp_path)
assert (
data["type"]
== f"{PickleDataSet.__module__}.{PickleDataSet.__qualname__}"
)
assert data["type"] == f"{PickleDataSet.__module__}.{PickleDataSet.__qualname__}"


@pytest.mark.usefixtures("patched_get_project_context")
Expand All @@ -435,10 +432,7 @@ def test_node_metadata_endpoint_data_kedro15(cli_runner, client, tmp_path, mocke
data = json.loads(response.data.decode())

assert data["filepath"] == str(tmp_path)
assert (
data["type"]
== f"{PickleDataSet.__module__}.{PickleDataSet.__qualname__}"
)
assert data["type"] == f"{PickleDataSet.__module__}.{PickleDataSet.__qualname__}"


@pytest.mark.usefixtures("patched_get_project_context")
Expand All @@ -454,7 +448,9 @@ def test_node_metadata_endpoint_parameters(cli_runner, client):

@pytest.mark.usefixtures("patched_get_project_context")
def test_node_metadata_endpoint_param_prefix(cli_runner, client):
"""Test `/api/nodes/param_id` with param prefix endpoint is functional and returns an empty JSON."""
"""Test `/api/nodes/param_id` with param prefix endpoint is functional
and returns an empty JSON.
"""
cli_runner.invoke(server.commands, ["viz", "--port", "8000"])
param_id = "c38d4c6a"
response = client.get(f"/api/nodes/{param_id}")
Expand Down

0 comments on commit d24adde

Please sign in to comment.