29 @type str |
29 @type str |
30 @param loc location of the issue |
30 @param loc location of the issue |
31 """ |
31 """ |
32 self.filename = filename |
32 self.filename = filename |
33 self.lineno = loc.lineno |
33 self.lineno = loc.lineno |
34 self.col = getattr(loc, "col_offset", 0) |
34 self.col = loc.col_offset |
35 |
35 |
36 def __str__(self): |
36 def __str__(self): |
37 """ |
37 """ |
38 Special method return a string representation of the instance object. |
38 Special method return a string representation of the instance object. |
39 |
39 |
86 Class defining the "Redefined While Unused" message. |
86 Class defining the "Redefined While Unused" message. |
87 """ |
87 """ |
88 |
88 |
89 message_id = "F02" |
89 message_id = "F02" |
90 message = "redefinition of unused %r from line %r" |
90 message = "redefinition of unused %r from line %r" |
91 |
|
92 def __init__(self, filename, loc, name, orig_loc): |
|
93 """ |
|
94 Constructor |
|
95 |
|
96 @param filename name of the file (string) |
|
97 @param loc location of the issue |
|
98 @param name name of the redefined object (string) |
|
99 @param orig_loc location of the original definition |
|
100 """ |
|
101 Message.__init__(self, filename, loc) |
|
102 self.message_args = (name, orig_loc.lineno) |
|
103 |
|
104 |
|
105 class RedefinedInListComp(Message): |
|
106 """ |
|
107 Class defining the "Redefined In List Comprehension" message. |
|
108 """ |
|
109 |
|
110 message_id = "F12" |
|
111 message = "list comprehension redefines %r from line %r" |
|
112 |
91 |
113 def __init__(self, filename, loc, name, orig_loc): |
92 def __init__(self, filename, loc, name, orig_loc): |
114 """ |
93 """ |
115 Constructor |
94 Constructor |
116 |
95 |
364 """ |
343 """ |
365 |
344 |
366 message_id = "F10" |
345 message_id = "F10" |
367 message = "from __future__ imports must occur at the beginning of the file" |
346 message = "from __future__ imports must occur at the beginning of the file" |
368 |
347 |
369 def __init__(self, filename, loc, names): |
348 def __init__(self, filename, loc): |
370 """ |
349 """ |
371 Constructor |
350 Constructor |
372 |
351 |
373 @param filename name of the file (string) |
352 @param filename name of the file (string) |
374 @param loc location of the issue |
353 @param loc location of the issue |
417 @param loc location of the issue |
396 @param loc location of the issue |
418 @param names names of unused variable (string) |
397 @param names names of unused variable (string) |
419 """ |
398 """ |
420 Message.__init__(self, filename, loc) |
399 Message.__init__(self, filename, loc) |
421 self.message_args = (names,) |
400 self.message_args = (names,) |
422 |
|
423 |
|
424 class ReturnWithArgsInsideGenerator(Message): |
|
425 """ |
|
426 Class defining the "Return values in generator" message. |
|
427 |
|
428 Indicates a return statement with arguments inside a generator. |
|
429 """ |
|
430 |
|
431 message_id = "F14" |
|
432 message = "'return' with argument inside generator" |
|
433 |
401 |
434 |
402 |
435 class ReturnOutsideFunction(Message): |
403 class ReturnOutsideFunction(Message): |
436 """ |
404 """ |
437 Class defining the "Return outside function" message. |
405 Class defining the "Return outside function" message. |