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