54 Class defining the "Unused Import" message. |
58 Class defining the "Unused Import" message. |
55 """ |
59 """ |
56 message_id = 'F01' |
60 message_id = 'F01' |
57 message = '%r imported but unused' |
61 message = '%r imported but unused' |
58 |
62 |
59 def __init__(self, filename, lineno, name): |
63 def __init__(self, filename, loc, name): |
60 """ |
64 """ |
61 Constructor |
65 Constructor |
62 |
66 |
63 @param filename name of the file (string) |
67 @param filename name of the file (string) |
64 @param lineno line number (integer) |
68 @param loc location of the issue |
65 @param name name of the unused import (string) |
69 @param name name of the unused import (string) |
66 """ |
70 """ |
67 Message.__init__(self, filename, lineno) |
71 Message.__init__(self, filename, loc) |
68 self.message_args = (name,) |
72 self.message_args = (name,) |
69 |
73 |
70 |
74 |
71 class RedefinedWhileUnused(Message): |
75 class RedefinedWhileUnused(Message): |
72 """ |
76 """ |
73 Class defining the "Redefined While Unused" message. |
77 Class defining the "Redefined While Unused" message. |
74 """ |
78 """ |
75 message_id = 'F02' |
79 message_id = 'F02' |
76 message = 'redefinition of unused %r from line %r' |
80 message = 'redefinition of unused %r from line %r' |
77 |
81 |
78 def __init__(self, filename, lineno, name, orig_lineno): |
82 def __init__(self, filename, loc, name, orig_loc): |
79 """ |
83 """ |
80 Constructor |
84 Constructor |
81 |
85 |
82 @param filename name of the file (string) |
86 @param filename name of the file (string) |
83 @param lineno line number (integer) |
87 @param loc location of the issue |
84 @param name name of the redefined object (string) |
88 @param name name of the redefined object (string) |
85 @param orig_lineno line number of the original definition (integer) |
89 @param orig_loc location of the original definition |
86 """ |
90 """ |
87 Message.__init__(self, filename, lineno) |
91 Message.__init__(self, filename, loc) |
88 self.message_args = (name, orig_lineno) |
92 self.message_args = (name, orig_loc.lineno) |
|
93 |
|
94 |
|
95 class RedefinedInListComp(Message): |
|
96 """ |
|
97 Class defining the "Redefined In List Comprehension" message. |
|
98 """ |
|
99 message_id = 'F12' |
|
100 message = 'list comprehension redefines %r from line %r' |
|
101 |
|
102 def __init__(self, filename, loc, name, orig_loc): |
|
103 """ |
|
104 Constructor |
|
105 |
|
106 @param filename name of the file (string) |
|
107 @param loc location of the issue |
|
108 @param name name of the redefined object (string) |
|
109 @param orig_loc location of the original definition |
|
110 """ |
|
111 Message.__init__(self, filename, loc) |
|
112 self.message_args = (name, orig_loc.lineno) |
89 |
113 |
90 |
114 |
91 class ImportShadowedByLoopVar(Message): |
115 class ImportShadowedByLoopVar(Message): |
92 """ |
116 """ |
93 Class defining the "Import Shadowed By Loop Var" message. |
117 Class defining the "Import Shadowed By Loop Var" message. |
94 """ |
118 """ |
95 message_id = 'F03' |
119 message_id = 'F03' |
96 message = 'import %r from line %r shadowed by loop variable' |
120 message = 'import %r from line %r shadowed by loop variable' |
97 |
121 |
98 def __init__(self, filename, lineno, name, orig_lineno): |
122 def __init__(self, filename, loc, name, orig_loc): |
99 """ |
123 """ |
100 Constructor |
124 Constructor |
101 |
125 |
102 @param filename name of the file (string) |
126 @param filename name of the file (string) |
103 @param lineno line number (integer) |
127 @param loc location of the issue |
104 @param name name of the shadowed import (string) |
128 @param name name of the shadowed import (string) |
105 @param orig_lineno line number of the import (integer) |
129 @param orig_loc location of the import |
106 """ |
130 """ |
107 Message.__init__(self, filename, lineno) |
131 Message.__init__(self, filename, loc) |
108 self.message_args = (name, orig_lineno) |
132 self.message_args = (name, orig_loc.lineno) |
109 |
133 |
110 |
134 |
111 class ImportStarUsed(Message): |
135 class ImportStarUsed(Message): |
112 """ |
136 """ |
113 Class defining the "Import Star Used" message. |
137 Class defining the "Import Star Used" message. |
114 """ |
138 """ |
115 message_id = 'F04' |
139 message_id = 'F04' |
116 message = "'from %s import *' used; unable to detect undefined names" |
140 message = "'from %s import *' used; unable to detect undefined names" |
117 |
141 |
118 def __init__(self, filename, lineno, modname): |
142 def __init__(self, filename, loc, modname): |
119 """ |
143 """ |
120 Constructor |
144 Constructor |
121 |
145 |
122 @param filename name of the file (string) |
146 @param filename name of the file (string) |
123 @param lineno line number (integer) |
147 @param loc location of the issue |
124 @param modname name of the module imported using star import (string) |
148 @param modname name of the module imported using star import (string) |
125 """ |
149 """ |
126 Message.__init__(self, filename, lineno) |
150 Message.__init__(self, filename, loc) |
127 self.message_args = (modname,) |
151 self.message_args = (modname,) |
128 |
152 |
129 |
153 |
130 class UndefinedName(Message): |
154 class UndefinedName(Message): |
131 """ |
155 """ |
132 Class defining the "Undefined Name" message. |
156 Class defining the "Undefined Name" message. |
133 """ |
157 """ |
134 message_id = 'F05' |
158 message_id = 'F05' |
135 message = 'undefined name %r' |
159 message = 'undefined name %r' |
136 |
160 |
137 def __init__(self, filename, lineno, name): |
161 def __init__(self, filename, loc, name): |
138 """ |
162 """ |
139 Constructor |
163 Constructor |
140 |
164 |
141 @param filename name of the file (string) |
165 @param filename name of the file (string) |
142 @param lineno line number (integer) |
166 @param loc location of the issue |
143 @param name undefined name (string) |
167 @param name undefined name (string) |
144 """ |
168 """ |
145 Message.__init__(self, filename, lineno) |
169 Message.__init__(self, filename, loc) |
146 self.message_args = (name,) |
170 self.message_args = (name,) |
|
171 |
|
172 |
|
173 class DoctestSyntaxError(Message): |
|
174 """ |
|
175 Class defining the "Doctest syntax Error" message. |
|
176 """ |
|
177 message_id = 'F13' |
|
178 message = 'syntax error in doctest' |
|
179 |
|
180 def __init__(self, filename, loc, position=None): |
|
181 """ |
|
182 Constructor |
|
183 |
|
184 @param filename name of the file (string) |
|
185 @param loc location of the issue |
|
186 @param position position of the syntax error |
|
187 """ |
|
188 Message.__init__(self, filename, loc) |
|
189 if position: |
|
190 (self.lineno, self.col) = position |
|
191 self.message_args = () |
147 |
192 |
148 |
193 |
149 class UndefinedExport(Message): |
194 class UndefinedExport(Message): |
150 """ |
195 """ |
151 Class defining the "Undefined Export" message. |
196 Class defining the "Undefined Export" message. |
152 """ |
197 """ |
153 message_id = 'F06' |
198 message_id = 'F06' |
154 message = 'undefined name %r in __all__' |
199 message = 'undefined name %r in __all__' |
155 |
200 |
156 def __init__(self, filename, lineno, name): |
201 def __init__(self, filename, loc, name): |
157 """ |
202 """ |
158 Constructor |
203 Constructor |
159 |
204 |
160 @param filename name of the file (string) |
205 @param filename name of the file (string) |
161 @param lineno line number (integer) |
206 @param loc location of the issue |
162 @param name undefined exported name (string) |
207 @param name undefined exported name (string) |
163 """ |
208 """ |
164 Message.__init__(self, filename, lineno) |
209 Message.__init__(self, filename, loc) |
165 self.message_args = (name,) |
210 self.message_args = (name,) |
166 |
211 |
167 |
212 |
168 class UndefinedLocal(Message): |
213 class UndefinedLocal(Message): |
169 """ |
214 """ |
171 """ |
216 """ |
172 message_id = 'F07' |
217 message_id = 'F07' |
173 message = "local variable %r (defined in enclosing scope on line %r)" \ |
218 message = "local variable %r (defined in enclosing scope on line %r)" \ |
174 " referenced before assignment" |
219 " referenced before assignment" |
175 |
220 |
176 def __init__(self, filename, lineno, name, orig_lineno): |
221 def __init__(self, filename, loc, name, orig_loc): |
177 """ |
222 """ |
178 Constructor |
223 Constructor |
179 |
224 |
180 @param filename name of the file (string) |
225 @param filename name of the file (string) |
181 @param lineno line number (integer) |
226 @param loc location of the issue |
182 @param name name of the prematurely referenced variable (string) |
227 @param name name of the prematurely referenced variable (string) |
183 @param orig_lineno line number of the variable definition (integer) |
228 @param orig_loc location of the variable definition |
184 """ |
229 """ |
185 Message.__init__(self, filename, lineno) |
230 Message.__init__(self, filename, loc) |
186 self.message_args = (name, orig_lineno) |
231 self.message_args = (name, orig_loc.lineno) |
187 |
232 |
188 |
233 |
189 class DuplicateArgument(Message): |
234 class DuplicateArgument(Message): |
190 """ |
235 """ |
191 Class defining the "Duplicate Argument" message. |
236 Class defining the "Duplicate Argument" message. |
192 """ |
237 """ |
193 message_id = 'F08' |
238 message_id = 'F08' |
194 message = 'duplicate argument %r in function definition' |
239 message = 'duplicate argument %r in function definition' |
195 |
240 |
196 def __init__(self, filename, lineno, name): |
241 def __init__(self, filename, loc, name): |
197 """ |
242 """ |
198 Constructor |
243 Constructor |
199 |
244 |
200 @param filename name of the file (string) |
245 @param filename name of the file (string) |
201 @param lineno line number (integer) |
246 @param loc location of the issue |
202 @param name name of the duplicate argument (string) |
247 @param name name of the duplicate argument (string) |
203 """ |
248 """ |
204 Message.__init__(self, filename, lineno) |
249 Message.__init__(self, filename, loc) |
205 self.message_args = (name,) |
250 self.message_args = (name,) |
206 |
251 |
207 |
252 |
208 class RedefinedFunction(Message): |
253 class Redefined(Message): |
209 """ |
254 """ |
210 Class defining the "Redefined Function" message. |
255 Class defining the "Redefined" message. |
211 """ |
256 """ |
212 message_id = 'F09' |
257 message_id = 'F09' |
213 message = 'redefinition of function %r from line %r' |
258 message = 'redefinition of %r from line %r' |
214 |
259 |
215 def __init__(self, filename, lineno, name, orig_lineno): |
260 def __init__(self, filename, loc, name, orig_loc): |
216 """ |
261 """ |
217 Constructor |
262 Constructor |
218 |
263 |
219 @param filename name of the file (string) |
264 @param filename name of the file (string) |
220 @param lineno line number (integer) |
265 @param loc location of the issue |
221 @param name name of the redefined function (string) |
266 @param name name of the redefined function (string) |
222 @param orig_lineno line number of the original definition (integer) |
267 @param orig_loc location of the original definition |
223 """ |
268 """ |
224 Message.__init__(self, filename, lineno) |
269 Message.__init__(self, filename, loc) |
225 self.message_args = (name, orig_lineno) |
270 self.message_args = (name, orig_loc.lineno) |
226 |
271 |
227 |
272 |
228 class LateFutureImport(Message): |
273 class LateFutureImport(Message): |
229 """ |
274 """ |
230 Class defining the "Late Future Import" message. |
275 Class defining the "Late Future Import" message. |
231 """ |
276 """ |
232 message_id = 'F10' |
277 message_id = 'F10' |
233 message = 'future import(s) %r after other statements' |
278 message = 'future import(s) %r after other statements' |
234 |
279 |
235 def __init__(self, filename, lineno, names): |
280 def __init__(self, filename, loc, names): |
236 """ |
281 """ |
237 Constructor |
282 Constructor |
238 |
283 |
239 @param filename name of the file (string) |
284 @param filename name of the file (string) |
240 @param lineno line number (integer) |
285 @param loc location of the issue |
241 @param names names of the imported futures (string) |
286 @param names names of the imported futures (string) |
242 """ |
287 """ |
243 Message.__init__(self, filename, lineno) |
288 Message.__init__(self, filename, loc) |
244 self.message_args = (names,) |
289 self.message_args = (names,) |
245 |
290 |
246 |
291 |
247 class UnusedVariable(Message): |
292 class UnusedVariable(Message): |
248 """ |
293 """ |