From e3537d5b86edf4b59dfe69a5a56b1cf11528d7c5 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 11 May 2018 10:22:58 +0300 Subject: [PATCH 1/4] Switch lint to flake8 --- tox.ini | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index e5ca35d..e4006c2 100644 --- a/tox.ini +++ b/tox.ini @@ -25,13 +25,9 @@ commands = {posargs} [testenv:lint] deps = - pycodestyle - pyflakes + flake8 commands = - pyflakes pylast - pyflakes tests - pycodestyle pylast - pycodestyle tests + flake8 . [testenv:py2lint] deps = From d35daaaeba2617d3cbb7ac292a703ef9dffc6ecc Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 11 May 2018 10:24:28 +0300 Subject: [PATCH 2/4] Four-space indents --- tox.ini | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tox.ini b/tox.ini index e4006c2..3c933f5 100644 --- a/tox.ini +++ b/tox.ini @@ -10,13 +10,13 @@ setenv = PYLAST_API_SECRET={env:PYLAST_API_SECRET:} deps = # Workaround for yaml/pyyaml#126 - py27,py36,py35,py34,pypy,pypy3,py36dev: pyyaml - py37dev: git+https://github.com/yaml/pyyaml@master#egg=pyyaml - pytest - mock - ipdb - pytest-cov - flaky + py27,py36,py35,py34,pypy,pypy3,py36dev: pyyaml + py37dev: git+https://github.com/yaml/pyyaml@master#egg=pyyaml + pytest + mock + ipdb + pytest-cov + flaky commands = pytest -v -s -W all --cov pylast --cov-report term-missing {posargs} [testenv:venv] @@ -25,14 +25,14 @@ commands = {posargs} [testenv:lint] deps = - flake8 + flake8 commands = flake8 . [testenv:py2lint] deps = {[testenv:lint]deps} - clonedigger + clonedigger commands = {[testenv:lint]commands} ./clonedigger.sh From 7ac0cbb898de56a1d323efd14f47daedb623af70 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 11 May 2018 10:31:24 +0300 Subject: [PATCH 3/4] Add pep8-naming to flake8 linting --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 3c933f5..94deaf7 100644 --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,7 @@ commands = {posargs} [testenv:lint] deps = flake8 + pep8-naming commands = flake8 . From 1d5e965183002f497112df369589da544b5d5578 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 11 May 2018 10:39:16 +0300 Subject: [PATCH 4/4] Fix pep8-naming --- pylast/__init__.py | 6 +++--- tests/test_pylast.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index a53d632..bb8a34a 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -108,6 +108,9 @@ SCROBBLE_MODE_LOVED = "L" SCROBBLE_MODE_BANNED = "B" SCROBBLE_MODE_SKIPPED = "S" +# Delay time in seconds from section 4.4 of https://www.last.fm/api/tos +DELAY_TIME = 0.2 + # Python >3.4 and >2.7.9 has sane defaults SSL_CONTEXT = ssl.create_default_context() @@ -254,9 +257,6 @@ class _Network(object): """ Makes sure that web service calls are at least 0.2 seconds apart. """ - - # Delay time in seconds from section 4.4 of https://www.last.fm/api/tos - DELAY_TIME = 0.2 now = time.time() time_since_last = now - self.last_call_time diff --git a/tests/test_pylast.py b/tests/test_pylast.py index aba7688..2bee953 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -54,11 +54,11 @@ class TestPyLastWithLastFm(PyLastTestCase): self.username = self.__class__.secrets["username"] password_hash = self.__class__.secrets["password_hash"] - API_KEY = self.__class__.secrets["api_key"] - API_SECRET = self.__class__.secrets["api_secret"] + api_key = self.__class__.secrets["api_key"] + api_secret = self.__class__.secrets["api_secret"] self.network = pylast.LastFMNetwork( - api_key=API_KEY, api_secret=API_SECRET, + api_key=api_key, api_secret=api_secret, username=self.username, password_hash=password_hash) def helper_is_thing_hashable(self, thing):