Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated Pyflakes to include new error messages

  • Loading branch information...
commit fb03f83d181b0825048581eff8fc102877e33261 1 parent 45cb314
@dcramer authored
Showing with 24 additions and 7 deletions.
  1. +24 −7 Support/bin/pyflakes/messages.py
View
31 Support/bin/pyflakes/messages.py
@@ -22,54 +22,67 @@ class UnusedImport(Message):
def __init__(self, filename, loc, name):
Message.__init__(self, filename, loc, use_column=False, message_args=(name,))
+ self.name = name
class RedefinedWhileUnused(Message):
message = 'redefinition of unused %r from line %r'
def __init__(self, filename, loc, name, orig_loc):
Message.__init__(self, filename, loc, message_args=(name, orig_loc.lineno))
+ self.name = name
+ self.orig_loc = orig_loc
class ImportShadowedByLoopVar(Message):
message = 'import %r from line %r shadowed by loop variable'
def __init__(self, filename, loc, name, orig_loc):
Message.__init__(self, filename, loc, message_args=(name, orig_loc.lineno))
+ self.name = name
+ self.orig_loc = orig_loc
class ImportStarUsed(Message):
message = "'from %s import *' used; unable to detect undefined names"
def __init__(self, filename, loc, modname):
Message.__init__(self, filename, loc, message_args=(modname,))
+ self.name = modname
class UndefinedName(Message):
message = 'undefined name %r'
def __init__(self, filename, loc, name):
- Message.__init__(self, filename, loc, message_args=(name,))
+ Message.__init__(self, filename, loc, level='E', message_args=(name,))
+ self.name = name
class UndefinedExport(Message):
message = 'undefined name %r in __all__'
def __init__(self, filename, loc, name):
- Message.__init__(self, filename, loc, message_args=(name,))
+ Message.__init__(self, filename, loc, level='E', message_args=(name,))
+ self.name = name
class UndefinedLocal(Message):
message = "local variable %r (defined in enclosing scope on line %r) referenced before assignment"
def __init__(self, filename, loc, name, orig_loc):
- Message.__init__(self, filename, loc, message_args=(name, orig_loc.lineno))
+ Message.__init__(self, filename, loc, level='E', message_args=(name, orig_loc.lineno))
+ self.name = name
+ self.orig_loc = orig_loc
class DuplicateArgument(Message):
message = 'duplicate argument %r in function definition'
def __init__(self, filename, loc, name):
- Message.__init__(self, filename, loc, message_args=(name,))
+ Message.__init__(self, filename, loc, level='E', message_args=(name,))
+ self.name = name
class RedefinedFunction(Message):
message = 'redefinition of function %r from line %r'
def __init__(self, filename, loc, name, orig_loc):
Message.__init__(self, filename, loc, message_args=(name, orig_loc.lineno))
+ self.name = name
+ self.orig_loc = orig_loc
class CouldNotCompile(Message):
def __init__(self, filename, loc, msg=None, line=None):
@@ -79,13 +92,16 @@ def __init__(self, filename, loc, msg=None, line=None):
else:
self.message = 'could not compile'
message_args = ()
- Message.__init__(self, filename, loc, 'E', message_args=message_args)
+ Message.__init__(self, filename, loc, level='E', message_args=message_args)
+ self.msg = msg
+ self.line = line
class LateFutureImport(Message):
message = 'future import(s) %r after other statements'
def __init__(self, filename, loc, names):
Message.__init__(self, filename, loc, message_args=(names,))
+ self.names = names
class UnusedVariable(Message):
"""
@@ -95,5 +111,6 @@ class UnusedVariable(Message):
message = 'local variable %r is assigned to but never used'
- def __init__(self, filename, loc, names):
- Message.__init__(self, filename, loc, message_args=(names,))
+ def __init__(self, filename, loc, name):
+ Message.__init__(self, filename, loc, message_args=(name,))
+ self.name = name
Please sign in to comment.
Something went wrong with that request. Please try again.