Documentation/Source/eric5.Utilities.SyntaxCheck.html

branch
Py2 comp.
changeset 2571
e6bb19eb87ea
child 3066
76a310bc7bba
equal deleted inserted replaced
2552:1e893ea4e366 2571:e6bb19eb87ea
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric5.Utilities.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><a NAME="top" ID="top"></a>
22 <h1>eric5.Utilities.SyntaxCheck</h1>
23 <p>
24 Module implementing the syntax check for Python 2/3.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>codingBytes_regexps</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr><td>None</td></tr>
33 </table>
34 <h3>Functions</h3>
35 <table>
36 <tr>
37 <td><a href="#compile_and_check">compile_and_check</a></td>
38 <td>Function to compile one Python source file to Python bytecode and to perform a pyflakes check.</td>
39 </tr><tr>
40 <td><a href="#decode">decode</a></td>
41 <td>Function to decode some byte text into a string.</td>
42 </tr><tr>
43 <td><a href="#extractLineFlags">extractLineFlags</a></td>
44 <td>Function to extract flags starting and ending with '__' from a line comment.</td>
45 </tr><tr>
46 <td><a href="#get_codingBytes">get_codingBytes</a></td>
47 <td>Function to get the coding of a bytes text.</td>
48 </tr><tr>
49 <td><a href="#normalizeCode">normalizeCode</a></td>
50 <td>Function to normalize the given code.</td>
51 </tr><tr>
52 <td><a href="#readEncodedFile">readEncodedFile</a></td>
53 <td>Function to read a file and decode it's contents into proper text.</td>
54 </tr>
55 </table>
56 <hr /><hr />
57 <a NAME="compile_and_check" ID="compile_and_check"></a>
58 <h2>compile_and_check</h2>
59 <b>compile_and_check</b>(<i>file_, codestring="", checkFlakes=True, ignoreStarImportWarnings=False</i>)
60 <p>
61 Function to compile one Python source file to Python bytecode
62 and to perform a pyflakes check.
63 </p><dl>
64 <dt><i>file_</i></dt>
65 <dd>
66 source filename (string)
67 </dd><dt><i>codestring</i></dt>
68 <dd>
69 string containing the code to compile (string)
70 </dd><dt><i>checkFlakes=</i></dt>
71 <dd>
72 flag indicating to do a pyflakes check (boolean)
73 </dd><dt><i>ignoreStarImportWarnings=</i></dt>
74 <dd>
75 flag indicating to
76 ignore 'star import' warnings (boolean)
77 </dd>
78 </dl><dl>
79 <dt>Returns:</dt>
80 <dd>
81 A tuple indicating status (True = an error was found), the
82 file name, the line number, the index number, the code string
83 and the error message (boolean, string, string, string, string,
84 string). If checkFlakes is True, a list of strings containing the
85 warnings (marker, file name, line number, message)
86 The values are only valid, if the status is True.
87 </dd>
88 </dl>
89 <div align="right"><a href="#top">Up</a></div>
90 <hr /><hr />
91 <a NAME="decode" ID="decode"></a>
92 <h2>decode</h2>
93 <b>decode</b>(<i>text</i>)
94 <p>
95 Function to decode some byte text into a string.
96 </p><dl>
97 <dt><i>text</i></dt>
98 <dd>
99 byte text to decode (bytes)
100 </dd>
101 </dl><dl>
102 <dt>Returns:</dt>
103 <dd>
104 tuple of decoded text and encoding (string, string)
105 </dd>
106 </dl>
107 <div align="right"><a href="#top">Up</a></div>
108 <hr /><hr />
109 <a NAME="extractLineFlags" ID="extractLineFlags"></a>
110 <h2>extractLineFlags</h2>
111 <b>extractLineFlags</b>(<i>line, startComment="</i>)
112 <p>
113 Function to extract flags starting and ending with '__' from a line comment.
114 </p><dl>
115 <dt><i>line</i></dt>
116 <dd>
117 line to extract flags from (string)
118 </dd><dt><i>startComment=</i></dt>
119 <dd>
120 string identifying the start of the comment (string)
121 </dd><dt><i>endComment=</i></dt>
122 <dd>
123 string identifying the end of a comment (string)
124 </dd>
125 </dl><dl>
126 <dt>Returns:</dt>
127 <dd>
128 list containing the extracted flags (list of strings)
129 </dd>
130 </dl>
131 <div align="right"><a href="#top">Up</a></div>
132 <hr /><hr />
133 <a NAME="get_codingBytes" ID="get_codingBytes"></a>
134 <h2>get_codingBytes</h2>
135 <b>get_codingBytes</b>(<i>text</i>)
136 <p>
137 Function to get the coding of a bytes text.
138 </p><dl>
139 <dt><i>text</i></dt>
140 <dd>
141 bytes text to inspect (bytes)
142 </dd>
143 </dl><dl>
144 <dt>Returns:</dt>
145 <dd>
146 coding string
147 </dd>
148 </dl>
149 <div align="right"><a href="#top">Up</a></div>
150 <hr /><hr />
151 <a NAME="normalizeCode" ID="normalizeCode"></a>
152 <h2>normalizeCode</h2>
153 <b>normalizeCode</b>(<i>codestring</i>)
154 <p>
155 Function to normalize the given code.
156 </p><dl>
157 <dt><i>codestring</i></dt>
158 <dd>
159 code to be normalized (string)
160 </dd>
161 </dl><dl>
162 <dt>Returns:</dt>
163 <dd>
164 normalized code (string)
165 </dd>
166 </dl>
167 <div align="right"><a href="#top">Up</a></div>
168 <hr /><hr />
169 <a NAME="readEncodedFile" ID="readEncodedFile"></a>
170 <h2>readEncodedFile</h2>
171 <b>readEncodedFile</b>(<i>filename</i>)
172 <p>
173 Function to read a file and decode it's contents into proper text.
174 </p><dl>
175 <dt><i>filename</i></dt>
176 <dd>
177 name of the file to read (string)
178 </dd>
179 </dl><dl>
180 <dt>Returns:</dt>
181 <dd>
182 tuple of decoded text and encoding (string, string)
183 </dd>
184 </dl>
185 <div align="right"><a href="#top">Up</a></div>
186 <hr />
187 </body></html>

eric ide

mercurial