Plugins/CheckerPlugins/SyntaxChecker/pyflakes/messages.py

changeset 5067
e2f171f08af8
parent 4631
5c1a96925da4
child 5106
1ecc6c9abca5
equal deleted inserted replaced
5065:39f27a2a2ea3 5067:e2f171f08af8
128 """ 128 """
129 Message.__init__(self, filename, loc) 129 Message.__init__(self, filename, loc)
130 self.message_args = (name, orig_loc.lineno) 130 self.message_args = (name, orig_loc.lineno)
131 131
132 132
133 class ImportStarNotPermitted(Message):
134 """
135 Class defining the "Import * not permitted" message.""
136 """
137 message_id = 'F16'
138 message = "'from %s import *' only allowed at module level"
139
140 def __init__(self, filename, loc, modname):
141 """
142 Constructor
143
144 @param filename name of the file (string)
145 @param loc location of the issue
146 @param modname name of the module (string)
147 """
148 Message.__init__(self, filename, loc)
149 self.message_args = (modname,)
150
151
133 class ImportStarUsed(Message): 152 class ImportStarUsed(Message):
134 """ 153 """
135 Class defining the "Import Star Used" message. 154 Class defining the "Import Star Used" message.
136 """ 155 """
137 message_id = 'F04' 156 message_id = 'F04'
145 @param loc location of the issue 164 @param loc location of the issue
146 @param modname name of the module imported using star import (string) 165 @param modname name of the module imported using star import (string)
147 """ 166 """
148 Message.__init__(self, filename, loc) 167 Message.__init__(self, filename, loc)
149 self.message_args = (modname,) 168 self.message_args = (modname,)
169
170
171 class ImportStarUsage(Message):
172 """
173 Class defining the "Import Star Usage" message.
174 """
175 message_id = 'F17'
176 message = "%s may be undefined, or defined from star imports: %s"
177
178 def __init__(self, filename, loc, name, from_list):
179 """
180 Constructor
181
182 @param filename name of the file (string)
183 @param loc location of the issue
184 @param name name of the variable (string)
185 @param from_list list of modules imported from with * (string)
186 """
187 Message.__init__(self, filename, loc)
188 self.message_args = (name, from_list)
150 189
151 190
152 class UndefinedName(Message): 191 class UndefinedName(Message):
153 """ 192 """
154 Class defining the "Undefined Name" message. 193 Class defining the "Undefined Name" message.
246 """ 285 """
247 Message.__init__(self, filename, loc) 286 Message.__init__(self, filename, loc)
248 self.message_args = (name,) 287 self.message_args = (name,)
249 288
250 289
290 class MultiValueRepeatedKeyLiteral(Message):
291 """
292 Class defining the multiple used dictionary key message.
293 """
294 message_id = 'F18'
295 message = 'dictionary key %r repeated with different values'
296
297 def __init__(self, filename, loc, key):
298 """
299 Constructor
300
301 @param filename name of the file (string)
302 @param loc location of the issue
303 @param key dictionary key (string)
304 """
305 Message.__init__(self, filename, loc)
306 self.message_args = (key,)
307
308
309 class MultiValueRepeatedKeyVariable(Message):
310 """
311 Class defining the multiple used dictionary key variable message.
312 """
313 message_id = 'F19'
314 message = 'dictionary key variable %s repeated with different values'
315
316 def __init__(self, filename, loc, key):
317 """
318 Constructor
319
320 @param filename name of the file (string)
321 @param loc location of the issue
322 @param key dictionary key variable (string)
323 """
324 Message.__init__(self, filename, loc)
325 self.message_args = (key,)
326
327
251 class LateFutureImport(Message): 328 class LateFutureImport(Message):
252 """ 329 """
253 Class defining the "Late Future Import" message. 330 Class defining the "Late Future Import" message.
254 """ 331 """
255 message_id = 'F10' 332 message_id = 'F10'
256 message = 'future import(s) %r after other statements' 333 message = 'from __future__ imports must occur at the beginning of the file'
257 334
258 def __init__(self, filename, loc, names): 335 def __init__(self, filename, loc, names):
259 """ 336 """
260 Constructor 337 Constructor
261 338
262 @param filename name of the file (string) 339 @param filename name of the file (string)
263 @param loc location of the issue 340 @param loc location of the issue
264 @param names names of the imported futures (string) 341 @param names names of the imported futures (string)
265 """ 342 """
266 Message.__init__(self, filename, loc) 343 Message.__init__(self, filename, loc)
267 self.message_args = (names,) 344 self.message_args = ()
345
346
347 class FutureFeatureNotDefined(Message):
348 """
349 Class defining the undefined __future__ feature message.
350 """
351 message_id = 'F20'
352 message = 'future feature %s is not defined'
353
354 def __init__(self, filename, loc, name):
355 """
356 Constructor
357
358 @param filename name of the file (string)
359 @param loc location of the issue
360 @param name name of the imported undefined future feature (string)
361 """
362 Message.__init__(self, filename, loc)
363 self.message_args = (name,)
268 364
269 365
270 class UnusedVariable(Message): 366 class UnusedVariable(Message):
271 """ 367 """
272 Class defining the "Unused Variable" message. 368 Class defining the "Unused Variable" message.
306 Indicates a return statement outside of a function/method. 402 Indicates a return statement outside of a function/method.
307 """ 403 """
308 message_id = 'F15' 404 message_id = 'F15'
309 message = '\'return\' outside function' 405 message = '\'return\' outside function'
310 406
407
408 class YieldOutsideFunction(Message):
409 """
410 Class defining the "Yield outside function" message.
411
412 Indicates a yield or yield from statement outside of a function/method.
413 """
414 message_id = 'F21'
415 message = '\'yield\' outside function'
416
417
418 # For whatever reason, Python gives different error messages for these two. We
419 # match the Python error message exactly.
420 class ContinueOutsideLoop(Message):
421 """
422 Class defining the "Continue outside loop" message.
423
424 Indicates a continue statement outside of a while or for loop.
425 """
426 message_id = 'F22'
427 message = '\'continue\' not properly in loop'
428
429
430 class BreakOutsideLoop(Message):
431 """
432 Class defining the "Break outside loop" message.
433
434 Indicates a break statement outside of a while or for loop.
435 """
436 message_id = 'F23'
437 message = '\'break\' outside loop'
438
439
440 class ContinueInFinally(Message):
441 """
442 Class defining the "Continue in finally block" message.
443
444 Indicates a continue statement in a finally block in a while or for loop.
445 """
446 message_id = 'F24'
447 message = '\'continue\' not supported inside \'finally\' clause'
448
449
450 class DefaultExceptNotLast(Message):
451 """
452 Class defining the "Default except: not being the last" message.
453
454 Indicates an except: block as not the last exception handler.
455 """
456 message_id = 'F25'
457 message = 'default \'except:\' must be last'
458
459
460 class TwoStarredExpressions(Message):
461 """
462 Class defining the "multiple starred expressions" message.
463
464 Two or more starred expressions in an assignment (a, *b, *c = d).
465 """
466 message_id = 'F26'
467 message = 'two starred expressions in assignment'
468
469
470 class TooManyExpressionsInStarredAssignment(Message):
471 """
472 Class defining the "too many starred expressions" message.
473
474 Too many expressions in an assignment with star-unpacking
475 """
476 message_id = 'F27'
477 message = 'too many expressions in star-unpacking assignment'
478
479
480 class AssertTuple(Message):
481 """
482 Class defining the "tuple assertion" message.
483
484 Assertion test is a tuple, which are always True.
485 """
486 message_id = 'F28'
487 message = 'assertion is always true, perhaps remove parentheses?'
488
311 # 489 #
312 # eflag: noqa = M702 490 # eflag: noqa = M702

eric ide

mercurial