Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py

changeset 6742
7cb30f7f94f6
parent 6645
ad476851d7e0
child 6766
c722fcfb5f62
--- a/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py	Wed Feb 13 18:59:31 2019 +0100
+++ b/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py	Wed Feb 13 22:12:58 2019 +0100
@@ -252,8 +252,10 @@
     Class defining the "Undefined Local Variable" message.
     """
     message_id = 'F07'
-    message = ('local variable %r (defined in enclosing scope on line %r) '
-               'referenced before assignment')
+    message = 'local variable %r {0} referenced before assignment'
+
+    default = 'defined in enclosing scope on line %r'
+    builtin = 'defined as a builtin'
 
     def __init__(self, filename, loc, name, orig_loc):
         """
@@ -265,7 +267,14 @@
         @param orig_loc location of the variable definition
         """
         Message.__init__(self, filename, loc)
-        self.message_args = (name, orig_loc.lineno)
+        if orig_loc is None:
+            self.message = self.message.format(self.builtin)
+            self.message_args = (name,)
+            self.message_id = 'F07B'
+        else:
+            self.message = self.message.format(self.default)
+            self.message_args = (name, orig_loc.lineno)
+            self.message_id = 'F07A'
 
 
 class DuplicateArgument(Message):
@@ -508,6 +517,20 @@
         self.message_args = (annotation,)
 
 
+class CommentAnnotationSyntaxError(Message):
+    """
+    Class defining the "Comment Annotation Syntax Error" message.
+    
+    Indicates a syntax error in a type comment.
+    """
+    message_id = 'F31'
+    message = 'syntax error in type comment %r'
+
+    def __init__(self, filename, loc, annotation):
+        Message.__init__(self, filename, loc)
+        self.message_args = (annotation,)
+
+
 class RaiseNotImplemented(Message):
     """
     Class defining the "raise not implemented" message.
@@ -517,5 +540,25 @@
     message_id = 'F30'
     message = "'raise NotImplemented' should be 'raise NotImplementedError'"
 
+
+class InvalidPrintSyntax(Message):
+    """
+    Class defining the "Invalid Print Syntax" message.
+    
+    Indicates the use of >> with a print function.
+    """
+    message_id = 'F32'
+    message = 'use of >> is invalid with print function'
+
+
+class IsLiteral(Message):
+    """
+    Class defining the "Is Literal" message.
+    
+    Indicates the use of "is" or "is not" against str, int and bytes.
+    """
+    message_id = 'F33'
+    message = 'use ==/!= to compare str, bytes, and int literals'
+
 #
 # eflag: noqa = M702

eric ide

mercurial