summaryrefslogtreecommitdiff
path: root/pyflakes/messages.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2022-06-12 17:07:21 -0400
committerGitHub <noreply@github.com>2022-06-12 17:07:21 -0400
commit2246217295dc8cb30ef4a7b9d8dc449ce32e603a (patch)
tree11a8fb153af9229c058f55bb10d0d454f86a2bee /pyflakes/messages.py
parentbecbab65bae84e3e19fc388a42dfabcff0c323c8 (diff)
downloadpyflakes-2246217295dc8cb30ef4a7b9d8dc449ce32e603a.tar.gz
burn the bridges with python 2.x (#707)
* pyupgrade --py36-plus * remove handling of PY2 * remove handling of PY35_PLUS * remove handling of PY36_PLUS * remove obsolete version_info checks in pyflakes/ * adjust skips in tests for 3.6+ * is_py3_func -> has_annotations (specifically for lambda) * remove references to py 2 * remove references to unichr * clean up version-specific getattrs * remove unused ReturnWithArgsInsideGenerator * remove unused ast handlers * remove unused RedefinedInListComp
Diffstat (limited to 'pyflakes/messages.py')
-rw-r--r--pyflakes/messages.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/pyflakes/messages.py b/pyflakes/messages.py
index 5a2f0ce..2d08112 100644
--- a/pyflakes/messages.py
+++ b/pyflakes/messages.py
@@ -3,18 +3,18 @@ Provide the class Message and its subclasses.
"""
-class Message(object):
+class Message:
message = ''
message_args = ()
def __init__(self, filename, loc):
self.filename = filename
self.lineno = loc.lineno
- self.col = getattr(loc, 'col_offset', 0)
+ self.col = loc.col_offset
def __str__(self):
- return '%s:%s:%s: %s' % (self.filename, self.lineno, self.col+1,
- self.message % self.message_args)
+ return '{}:{}:{}: {}'.format(self.filename, self.lineno, self.col+1,
+ self.message % self.message_args)
class UnusedImport(Message):
@@ -33,14 +33,6 @@ class RedefinedWhileUnused(Message):
self.message_args = (name, orig_loc.lineno)
-class RedefinedInListComp(Message):
- message = 'list comprehension redefines %r from line %r'
-
- def __init__(self, filename, loc, name, orig_loc):
- Message.__init__(self, filename, loc)
- self.message_args = (name, orig_loc.lineno)
-
-
class ImportShadowedByLoopVar(Message):
message = 'import %r from line %r shadowed by loop variable'
@@ -168,13 +160,6 @@ class UnusedVariable(Message):
self.message_args = (names,)
-class ReturnWithArgsInsideGenerator(Message):
- """
- Indicates a return statement with arguments inside a generator.
- """
- message = '\'return\' with argument inside generator'
-
-
class ReturnOutsideFunction(Message):
"""
Indicates a return statement outside of a function/method.