--- a/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py Wed Jul 27 13:56:37 2016 +0200 +++ b/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py Wed Jul 27 15:28:26 2016 +0200 @@ -130,6 +130,25 @@ self.message_args = (name, orig_loc.lineno) +class ImportStarNotPermitted(Message): + """ + Class defining the "Import * not permitted" message."" + """ + message_id = 'F16' + message = "'from %s import *' only allowed at module level" + + def __init__(self, filename, loc, modname): + """ + Constructor + + @param filename name of the file (string) + @param loc location of the issue + @param modname name of the module (string) + """ + Message.__init__(self, filename, loc) + self.message_args = (modname,) + + class ImportStarUsed(Message): """ Class defining the "Import Star Used" message. @@ -149,6 +168,26 @@ self.message_args = (modname,) +class ImportStarUsage(Message): + """ + Class defining the "Import Star Usage" message. + """ + message_id = 'F17' + message = "%s may be undefined, or defined from star imports: %s" + + def __init__(self, filename, loc, name, from_list): + """ + Constructor + + @param filename name of the file (string) + @param loc location of the issue + @param name name of the variable (string) + @param from_list list of modules imported from with * (string) + """ + Message.__init__(self, filename, loc) + self.message_args = (name, from_list) + + class UndefinedName(Message): """ Class defining the "Undefined Name" message. @@ -248,12 +287,50 @@ self.message_args = (name,) +class MultiValueRepeatedKeyLiteral(Message): + """ + Class defining the multiple used dictionary key message. + """ + message_id = 'F18' + message = 'dictionary key %r repeated with different values' + + def __init__(self, filename, loc, key): + """ + Constructor + + @param filename name of the file (string) + @param loc location of the issue + @param key dictionary key (string) + """ + Message.__init__(self, filename, loc) + self.message_args = (key,) + + +class MultiValueRepeatedKeyVariable(Message): + """ + Class defining the multiple used dictionary key variable message. + """ + message_id = 'F19' + message = 'dictionary key variable %s repeated with different values' + + def __init__(self, filename, loc, key): + """ + Constructor + + @param filename name of the file (string) + @param loc location of the issue + @param key dictionary key variable (string) + """ + Message.__init__(self, filename, loc) + self.message_args = (key,) + + class LateFutureImport(Message): """ Class defining the "Late Future Import" message. """ message_id = 'F10' - message = 'future import(s) %r after other statements' + message = 'from __future__ imports must occur at the beginning of the file' def __init__(self, filename, loc, names): """ @@ -264,7 +341,26 @@ @param names names of the imported futures (string) """ Message.__init__(self, filename, loc) - self.message_args = (names,) + self.message_args = () + + +class FutureFeatureNotDefined(Message): + """ + Class defining the undefined __future__ feature message. + """ + message_id = 'F20' + message = 'future feature %s is not defined' + + def __init__(self, filename, loc, name): + """ + Constructor + + @param filename name of the file (string) + @param loc location of the issue + @param name name of the imported undefined future feature (string) + """ + Message.__init__(self, filename, loc) + self.message_args = (name,) class UnusedVariable(Message): @@ -308,5 +404,87 @@ message_id = 'F15' message = '\'return\' outside function' + +class YieldOutsideFunction(Message): + """ + Class defining the "Yield outside function" message. + + Indicates a yield or yield from statement outside of a function/method. + """ + message_id = 'F21' + message = '\'yield\' outside function' + + +# For whatever reason, Python gives different error messages for these two. We +# match the Python error message exactly. +class ContinueOutsideLoop(Message): + """ + Class defining the "Continue outside loop" message. + + Indicates a continue statement outside of a while or for loop. + """ + message_id = 'F22' + message = '\'continue\' not properly in loop' + + +class BreakOutsideLoop(Message): + """ + Class defining the "Break outside loop" message. + + Indicates a break statement outside of a while or for loop. + """ + message_id = 'F23' + message = '\'break\' outside loop' + + +class ContinueInFinally(Message): + """ + Class defining the "Continue in finally block" message. + + Indicates a continue statement in a finally block in a while or for loop. + """ + message_id = 'F24' + message = '\'continue\' not supported inside \'finally\' clause' + + +class DefaultExceptNotLast(Message): + """ + Class defining the "Default except: not being the last" message. + + Indicates an except: block as not the last exception handler. + """ + message_id = 'F25' + message = 'default \'except:\' must be last' + + +class TwoStarredExpressions(Message): + """ + Class defining the "multiple starred expressions" message. + + Two or more starred expressions in an assignment (a, *b, *c = d). + """ + message_id = 'F26' + message = 'two starred expressions in assignment' + + +class TooManyExpressionsInStarredAssignment(Message): + """ + Class defining the "too many starred expressions" message. + + Too many expressions in an assignment with star-unpacking + """ + message_id = 'F27' + message = 'too many expressions in star-unpacking assignment' + + +class AssertTuple(Message): + """ + Class defining the "tuple assertion" message. + + Assertion test is a tuple, which are always True. + """ + message_id = 'F28' + message = 'assertion is always true, perhaps remove parentheses?' + # # eflag: noqa = M702