From 58afaf07a52df2b53bb2f8990cd06005cd063d9e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 25 Jul 2016 15:02:10 -0400 Subject: [PATCH] Switch to new `noqa` syntax for flake8 3.0 Apparently, `# noqa ignore=X` worked before, but now the syntax is more terse, like this: `# noqa: X`. See the changelog here: http://flake8.pycqa.org/en/latest/release-notes/3.0.0.html --- beets/library.py | 2 +- beets/util/__init__.py | 5 +++-- beets/util/confit.py | 6 +++--- beetsplug/bpd/gstplayer.py | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/beets/library.py b/beets/library.py index 18764b6f0..3d18a1be0 100644 --- a/beets/library.py +++ b/beets/library.py @@ -40,7 +40,7 @@ import beets # `memoryview`, depending on the Python version, tells it that we # actually mean non-text data. if six.PY2: - BLOB_TYPE = buffer # noqa ignore=F821 + BLOB_TYPE = buffer # noqa: F821 else: BLOB_TYPE = memoryview diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 472f693b6..17cfc4f0e 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -658,9 +658,10 @@ def as_string(value): """Convert a value to a Unicode object for matching with a query. None becomes the empty string. Bytestrings are silently decoded. """ - buffer_types = memoryview if six.PY2: - buffer_types = (buffer, memoryview) # noqa ignore=F821 + buffer_types = buffer, memoryview # noqa: F821 + else: + buffer_types = memoryview if value is None: return u'' diff --git a/beets/util/confit.py b/beets/util/confit.py index f2a919cd4..18f7c1e16 100644 --- a/beets/util/confit.py +++ b/beets/util/confit.py @@ -44,9 +44,9 @@ REDACTED_TOMBSTONE = 'REDACTED' # Utilities. PY3 = sys.version_info[0] == 3 -STRING = str if PY3 else unicode # noqa ignore=F821 -BASESTRING = str if PY3 else basestring # noqa ignore=F821 -NUMERIC_TYPES = (int, float) if PY3 else (int, float, long) # noqa ignore=F821 +STRING = str if PY3 else unicode # noqa: F821 +BASESTRING = str if PY3 else basestring # noqa: F821 +NUMERIC_TYPES = (int, float) if PY3 else (int, float, long) # noqa: F821 def iter_first(sequence): diff --git a/beetsplug/bpd/gstplayer.py b/beetsplug/bpd/gstplayer.py index 6972a2722..471f204fb 100644 --- a/beetsplug/bpd/gstplayer.py +++ b/beetsplug/bpd/gstplayer.py @@ -30,7 +30,7 @@ from beets import ui import gi gi.require_version('Gst', '1.0') -from gi.repository import GLib, Gst # noqa ignore=E402 +from gi.repository import GLib, Gst # noqa: E402 Gst.init(None)