diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ffb89cb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v1.24.0 + hooks: + - id: pyupgrade + + - repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black + language_version: python3.7 + # override until resolved: https://github.com/psf/black/issues/402 + files: \.pyi?$ + types: [] + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.7.8 + hooks: + - id: flake8 + additional_dependencies: [flake8-2020] + + - repo: https://github.com/pre-commit/mirrors-isort + rev: v4.3.21 + hooks: + - id: isort + language_version: python3.7 + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.4.1 + hooks: + - id: python-check-blanket-noqa + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml diff --git a/.travis.yml b/.travis.yml index 4aea714..1a5a9fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,12 @@ env: - secure: SsKJoJwtDVWrL5xxl9C/gTRy6FhfRQQNNAFOogl9mTs/WeI2t9QTYoKsxLPXOdoRdu4MvT3h/B2sjwggt7zP81fBVxQRTkg4nq0zSHlj0NqclbFa6I5lUYdGwH9gPk/HWJJwXhKRDsqn/iRw2v+qBDs/j3kIgPQ0yjM58LEPXic= matrix: + fast_finish: true include: - - python: 3.6 + - python: 3.7 env: TOXENV=lint - python: 3.7 env: TOXENV=py37 - dist: xenial - python: 3.6 env: TOXENV=py36 - python: 3.5 @@ -27,10 +27,8 @@ matrix: env: TOXENV=pypy3 - python: 3.8-dev env: TOXENV=py38dev - dist: xenial allow_failures: - env: TOXENV=pypy3 - fast_finish: true install: - travis_retry pip install --upgrade pip @@ -51,7 +49,7 @@ deploy: tags: false repo: pylast/pylast branch: master - condition: $TOXENV = py37 + condition: $TOXENV = lint user: hugovk password: secure: "OCNT7Sf7TpS6aKuqBXEWxJZjmEpdERTBp/yllOd9xnpFt2ZL96CyKtAhPA8zu5OP58QFEZSafZRfXYJoz78RDrx3gOdRXCFT00vXIMnjVvrAlieNEHCVAT0kRW9lYK1Cf5baHYsOYIs6EZf2fEAhdzvmh83G4Y1Y+FPR9tA6uy8=" @@ -62,7 +60,7 @@ deploy: tags: true repo: pylast/pylast branch: master - condition: $TOXENV = py37 + condition: $TOXENV = lint user: hugovk password: secure: "OCNT7Sf7TpS6aKuqBXEWxJZjmEpdERTBp/yllOd9xnpFt2ZL96CyKtAhPA8zu5OP58QFEZSafZRfXYJoz78RDrx3gOdRXCFT00vXIMnjVvrAlieNEHCVAT0kRW9lYK1Cf5baHYsOYIs6EZf2fEAhdzvmh83G4Y1Y+FPR9tA6uy8=" diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 7e8ad33..1d3f0ff 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -1251,7 +1251,7 @@ class _Chartable: """ Returns the weekly artist charts for the week starting from the from_date value to the to_date value. - Only for Tag or User. + Only for User. """ return self.get_weekly_charts("artist", from_date, to_date) diff --git a/tests/test_librefm.py b/tests/test_librefm.py index dba0109..7f8d54b 100755 --- a/tests/test_librefm.py +++ b/tests/test_librefm.py @@ -4,9 +4,8 @@ Integration (not unit) tests for pylast.py """ import unittest -from flaky import flaky - import pylast +from flaky import flaky from .test_pylast import PyLastTestCase, load_secrets diff --git a/tests/test_pylast.py b/tests/test_pylast.py index b417fb8..75fb379 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -7,12 +7,10 @@ import sys import time import unittest +import pylast import pytest from flaky import flaky -import pylast - - PY37 = sys.version_info[:2] == (3, 7) diff --git a/tests/unicode_test.py b/tests/unicode_test.py index 062f37f..11e7ff7 100644 --- a/tests/unicode_test.py +++ b/tests/unicode_test.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import mock -import pytest - import pylast +import pytest def mock_network(): diff --git a/tox.ini b/tox.ini index 9e62b74..a2eeafb 100644 --- a/tox.ini +++ b/tox.ini @@ -23,10 +23,6 @@ deps = ipdb commands = {posargs} [testenv:lint] -deps = - flake8 - pep8-naming - black -commands = - flake8 . - black --check --diff . +deps = pre-commit +commands = pre-commit run --all-files +skip_install = true