|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheck</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing the syntax check for Python 3. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>VcsConflictMarkerRegExpList</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 <tr><td>None</td></tr> |
|
37 </table> |
|
38 <h3>Functions</h3> |
|
39 |
|
40 <table> |
|
41 |
|
42 <tr> |
|
43 <td><a href="#__syntaxAndPyflakesCheck">__syntaxAndPyflakesCheck</a></td> |
|
44 <td>Function to compile one Python source file to Python bytecode and to perform a pyflakes check.</td> |
|
45 </tr> |
|
46 <tr> |
|
47 <td><a href="#extractLineFlags">extractLineFlags</a></td> |
|
48 <td>Function to extract flags starting and ending with '__' from a line comment.</td> |
|
49 </tr> |
|
50 <tr> |
|
51 <td><a href="#initBatchService">initBatchService</a></td> |
|
52 <td>Initialize the batch service and return the entry point.</td> |
|
53 </tr> |
|
54 <tr> |
|
55 <td><a href="#initService">initService</a></td> |
|
56 <td>Initialize the service and return the entry point.</td> |
|
57 </tr> |
|
58 <tr> |
|
59 <td><a href="#normalizeCode">normalizeCode</a></td> |
|
60 <td>Function to normalize the given code.</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#syntaxAndPyflakesBatchCheck">syntaxAndPyflakesBatchCheck</a></td> |
|
64 <td>Module function to check syntax for a batch of files.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#syntaxAndPyflakesCheck">syntaxAndPyflakesCheck</a></td> |
|
68 <td>Function to compile one Python source file to Python bytecode and to perform a pyflakes check.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#worker">worker</a></td> |
|
72 <td>Module function acting as the parallel worker for the syntax check.</td> |
|
73 </tr> |
|
74 </table> |
|
75 <hr /> |
|
76 <hr /> |
|
77 <a NAME="__syntaxAndPyflakesCheck" ID="__syntaxAndPyflakesCheck"></a> |
|
78 <h2>__syntaxAndPyflakesCheck</h2> |
|
79 <b>__syntaxAndPyflakesCheck</b>(<i>filename, codestring, checkFlakes=True, ignoreStarImportWarnings=False</i>) |
|
80 |
|
81 <p> |
|
82 Function to compile one Python source file to Python bytecode |
|
83 and to perform a pyflakes check. |
|
84 </p> |
|
85 <dl> |
|
86 |
|
87 <dt><i>filename</i> (str)</dt> |
|
88 <dd> |
|
89 source filename |
|
90 </dd> |
|
91 <dt><i>codestring</i> (str)</dt> |
|
92 <dd> |
|
93 string containing the code to compile |
|
94 </dd> |
|
95 <dt><i>checkFlakes</i> (bool)</dt> |
|
96 <dd> |
|
97 flag indicating to do a pyflakes check |
|
98 </dd> |
|
99 <dt><i>ignoreStarImportWarnings</i> (bool)</dt> |
|
100 <dd> |
|
101 flag indicating to |
|
102 ignore 'star import' warnings |
|
103 </dd> |
|
104 </dl> |
|
105 <dl> |
|
106 <dt>Return:</dt> |
|
107 <dd> |
|
108 dictionary with the keys 'error' and 'warnings' which |
|
109 hold a list containing details about the error/ warnings |
|
110 (file name, line number, column, codestring (only at syntax |
|
111 errors), the message, a list with arguments for the message) |
|
112 </dd> |
|
113 </dl> |
|
114 <dl> |
|
115 <dt>Return Type:</dt> |
|
116 <dd> |
|
117 dict |
|
118 </dd> |
|
119 </dl> |
|
120 <div align="right"><a href="#top">Up</a></div> |
|
121 <hr /> |
|
122 <hr /> |
|
123 <a NAME="extractLineFlags" ID="extractLineFlags"></a> |
|
124 <h2>extractLineFlags</h2> |
|
125 <b>extractLineFlags</b>(<i>line, startComment="</i>) |
|
126 |
|
127 <p> |
|
128 Function to extract flags starting and ending with '__' from a line |
|
129 comment. |
|
130 </p> |
|
131 <dl> |
|
132 |
|
133 <dt><i>line</i></dt> |
|
134 <dd> |
|
135 line to extract flags from (string) |
|
136 </dd> |
|
137 <dt><i>startComment</i></dt> |
|
138 <dd> |
|
139 string identifying the start of the comment (string) |
|
140 </dd> |
|
141 <dt><i>endComment</i></dt> |
|
142 <dd> |
|
143 string identifying the end of a comment (string) |
|
144 </dd> |
|
145 <dt><i>flagsLine</i></dt> |
|
146 <dd> |
|
147 flag indicating to check for a flags only line (bool) |
|
148 </dd> |
|
149 </dl> |
|
150 <dl> |
|
151 <dt>Return:</dt> |
|
152 <dd> |
|
153 list containing the extracted flags (list of strings) |
|
154 </dd> |
|
155 </dl> |
|
156 <div align="right"><a href="#top">Up</a></div> |
|
157 <hr /> |
|
158 <hr /> |
|
159 <a NAME="initBatchService" ID="initBatchService"></a> |
|
160 <h2>initBatchService</h2> |
|
161 <b>initBatchService</b>(<i></i>) |
|
162 |
|
163 <p> |
|
164 Initialize the batch service and return the entry point. |
|
165 </p> |
|
166 <dl> |
|
167 <dt>Return:</dt> |
|
168 <dd> |
|
169 the entry point for the background client (function) |
|
170 </dd> |
|
171 </dl> |
|
172 <div align="right"><a href="#top">Up</a></div> |
|
173 <hr /> |
|
174 <hr /> |
|
175 <a NAME="initService" ID="initService"></a> |
|
176 <h2>initService</h2> |
|
177 <b>initService</b>(<i></i>) |
|
178 |
|
179 <p> |
|
180 Initialize the service and return the entry point. |
|
181 </p> |
|
182 <dl> |
|
183 <dt>Return:</dt> |
|
184 <dd> |
|
185 the entry point for the background client (function) |
|
186 </dd> |
|
187 </dl> |
|
188 <div align="right"><a href="#top">Up</a></div> |
|
189 <hr /> |
|
190 <hr /> |
|
191 <a NAME="normalizeCode" ID="normalizeCode"></a> |
|
192 <h2>normalizeCode</h2> |
|
193 <b>normalizeCode</b>(<i>codestring</i>) |
|
194 |
|
195 <p> |
|
196 Function to normalize the given code. |
|
197 </p> |
|
198 <dl> |
|
199 |
|
200 <dt><i>codestring</i></dt> |
|
201 <dd> |
|
202 code to be normalized (string) |
|
203 </dd> |
|
204 </dl> |
|
205 <dl> |
|
206 <dt>Return:</dt> |
|
207 <dd> |
|
208 normalized code (string) |
|
209 </dd> |
|
210 </dl> |
|
211 <div align="right"><a href="#top">Up</a></div> |
|
212 <hr /> |
|
213 <hr /> |
|
214 <a NAME="syntaxAndPyflakesBatchCheck" ID="syntaxAndPyflakesBatchCheck"></a> |
|
215 <h2>syntaxAndPyflakesBatchCheck</h2> |
|
216 <b>syntaxAndPyflakesBatchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>) |
|
217 |
|
218 <p> |
|
219 Module function to check syntax for a batch of files. |
|
220 </p> |
|
221 <dl> |
|
222 |
|
223 <dt><i>argumentsList</i> (list)</dt> |
|
224 <dd> |
|
225 list of arguments tuples as given for |
|
226 syntaxAndPyflakesCheck |
|
227 </dd> |
|
228 <dt><i>send</i> (func)</dt> |
|
229 <dd> |
|
230 reference to send function |
|
231 </dd> |
|
232 <dt><i>fx</i> (str)</dt> |
|
233 <dd> |
|
234 registered service name |
|
235 </dd> |
|
236 <dt><i>cancelled</i> (func)</dt> |
|
237 <dd> |
|
238 reference to function checking for a cancellation |
|
239 </dd> |
|
240 <dt><i>maxProcesses</i> (int)</dt> |
|
241 <dd> |
|
242 number of processes to be used |
|
243 </dd> |
|
244 </dl> |
|
245 <div align="right"><a href="#top">Up</a></div> |
|
246 <hr /> |
|
247 <hr /> |
|
248 <a NAME="syntaxAndPyflakesCheck" ID="syntaxAndPyflakesCheck"></a> |
|
249 <h2>syntaxAndPyflakesCheck</h2> |
|
250 <b>syntaxAndPyflakesCheck</b>(<i>filename, codestring, checkFlakes=True, ignoreStarImportWarnings=False</i>) |
|
251 |
|
252 <p> |
|
253 Function to compile one Python source file to Python bytecode |
|
254 and to perform a pyflakes check. |
|
255 </p> |
|
256 <dl> |
|
257 |
|
258 <dt><i>filename</i></dt> |
|
259 <dd> |
|
260 source filename (string) |
|
261 </dd> |
|
262 <dt><i>codestring</i></dt> |
|
263 <dd> |
|
264 string containing the code to compile (string) |
|
265 </dd> |
|
266 <dt><i>checkFlakes</i></dt> |
|
267 <dd> |
|
268 flag indicating to do a pyflakes check (boolean) |
|
269 </dd> |
|
270 <dt><i>ignoreStarImportWarnings</i></dt> |
|
271 <dd> |
|
272 flag indicating to |
|
273 ignore 'star import' warnings (boolean) |
|
274 </dd> |
|
275 </dl> |
|
276 <dl> |
|
277 <dt>Return:</dt> |
|
278 <dd> |
|
279 dictionary with the keys 'error' and 'warnings' which |
|
280 hold a list containing details about the error/ warnings |
|
281 (file name, line number, column, codestring (only at syntax |
|
282 errors), the message, a list with arguments for the message) |
|
283 </dd> |
|
284 </dl> |
|
285 <div align="right"><a href="#top">Up</a></div> |
|
286 <hr /> |
|
287 <hr /> |
|
288 <a NAME="worker" ID="worker"></a> |
|
289 <h2>worker</h2> |
|
290 <b>worker</b>(<i>inputQueue, outputQueue</i>) |
|
291 |
|
292 <p> |
|
293 Module function acting as the parallel worker for the syntax check. |
|
294 </p> |
|
295 <dl> |
|
296 |
|
297 <dt><i>inputQueue</i></dt> |
|
298 <dd> |
|
299 input queue (multiprocessing.Queue) |
|
300 </dd> |
|
301 <dt><i>outputQueue</i></dt> |
|
302 <dd> |
|
303 output queue (multiprocessing.Queue) |
|
304 </dd> |
|
305 </dl> |
|
306 <div align="right"><a href="#top">Up</a></div> |
|
307 <hr /> |
|
308 </body></html> |