Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade linters for py36 build #307

Merged
merged 10 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion databricks_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def initialize_cli_for_databricks_notebooks():
from databricksCli import init_databricks_cli_config_provider
init_databricks_cli_config_provider(PythonShell.IPython.get_ipython().user_ns.entry_point)


try:
# Initialize custom config provider which is available in Databricks notebooks.
initialize_cli_for_databricks_notebooks()
except:
except: # noqa
pass
2 changes: 1 addition & 1 deletion databricks_cli/stack/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _put_job(self, job_settings, headers=None):
if len(jobs_same_name) > 1:
raise StackError('Multiple jobs with the same name "{}" already exist, aborting'
' stack deployment'.format(job_name))
elif len(jobs_same_name) == 1:
if len(jobs_same_name) == 1:
existing_job = jobs_same_name[0]
creator_name = existing_job.get('creator_user_name')
timestamp = existing_job.get('created_time') / MS_SEC # Convert to readable date.
Expand Down
3 changes: 2 additions & 1 deletion databricks_cli/workspace/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
@profile_option
@eat_exceptions
@provide_api_client
def ls_cli(api_client, l, absolute, workspace_path):
def ls_cli(api_client, l, absolute, workspace_path): # noqa
"""
List objects in the Databricks Workspace.
"""
Expand Down Expand Up @@ -199,6 +199,7 @@ def workspace_group():
"""
pass


workspace_group.add_command(ls_cli, name='ls')
workspace_group.add_command(ls_cli, name='list')
workspace_group.add_command(mkdirs_cli, name='mkdirs')
Expand Down
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
set -ex

FWDIR="$(cd "`dirname $0`"; pwd)"
cd "$FWDIR"
Expand Down
7 changes: 4 additions & 3 deletions prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ pylint:
- protected-access
- too-many-arguments
- inconsistent-return-statements
- import-outside-toplevel
- consider-using-set-comprehension
- useless-object-inheritance
- unnecessary-pass

mccabe:
disable:
- MC0001

pyroma:
run: true
2 changes: 1 addition & 1 deletion tests/clusters/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ def test_cluster_events_output_table(cluster_api_mock):
stdout_lines = stdout.split('\n')
# Check that the timestamp 1559334105421 gets converted to the right time! It's hard to do an
# exact match because of time zones.
assert any(['2019-05-31' in l for l in stdout_lines])
assert any(['2019-05-31' in l for l in stdout_lines]) # noqa
3 changes: 1 addition & 2 deletions tests/stack/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def get_job(self, job_id, headers=None):
if job_id not in self.jobs_in_databricks:
# Job created is not found.
raise HTTPError('Job not Found')
else:
return self.jobs_in_databricks[job_id]
return self.jobs_in_databricks[job_id]

def reset_job(self, data, headers=None):
if data[api.JOBS_RESOURCE_JOB_ID] not in self.jobs_in_databricks:
Expand Down
13 changes: 13 additions & 0 deletions tox-requirements-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Test reqs
prospector[with_pyroma]==1.3.0
pylint==2.5.3
pep8-naming==0.5.0
pytest==3.8.1
mock==2.0.0
decorator==4.2.1
rstcheck==3.2
pytest-cov==2.5.1
# Pin docutils version to address https://sourceforge.net/p/docutils/bugs/365/
docutils==0.14
codecov
requests_mock==1.5.2
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ envlist = py27, py36
[testenv]
# https://github.com/codecov/codecov-python/blob/5b9d539a6a09bc84501b381b563956295478651a/README.md#using-tox
passenv = TOXENV CI TRAVIS TRAVIS_*
deps = -rtox-requirements.txt
deps =
py27: -rtox-requirements.txt
py36: -rtox-requirements-3.txt
commands =
pytest tests --cov=./
./lint.sh
Expand Down