1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric5.UtilitiesPython2.Tools</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.UtilitiesPython2.Tools</h1> |
|
23 <p> |
|
24 Module implementing tool functions. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>coding_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="#decode">decode</a></td> |
|
38 <td>Function to decode a text.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#extractLineFlags">extractLineFlags</a></td> |
|
41 <td>Function to extract flags starting and ending with '__' from a line comment.</td> |
|
42 </tr><tr> |
|
43 <td><a href="#get_coding">get_coding</a></td> |
|
44 <td>Function to get the coding of a text.</td> |
|
45 </tr><tr> |
|
46 <td><a href="#normalizeCode">normalizeCode</a></td> |
|
47 <td>Function to normalize the given code.</td> |
|
48 </tr><tr> |
|
49 <td><a href="#readEncodedFile">readEncodedFile</a></td> |
|
50 <td>Function to read a file and decode its contents into proper text.</td> |
|
51 </tr> |
|
52 </table> |
|
53 <hr /><hr /> |
|
54 <a NAME="decode" ID="decode"></a> |
|
55 <h2>decode</h2> |
|
56 <b>decode</b>(<i>text</i>) |
|
57 <p> |
|
58 Function to decode a text. |
|
59 </p><dl> |
|
60 <dt><i>text</i></dt> |
|
61 <dd> |
|
62 text to decode (string) |
|
63 </dd> |
|
64 </dl><dl> |
|
65 <dt>Returns:</dt> |
|
66 <dd> |
|
67 decoded text and encoding |
|
68 </dd> |
|
69 </dl> |
|
70 <div align="right"><a href="#top">Up</a></div> |
|
71 <hr /><hr /> |
|
72 <a NAME="extractLineFlags" ID="extractLineFlags"></a> |
|
73 <h2>extractLineFlags</h2> |
|
74 <b>extractLineFlags</b>(<i>line, startComment="</i>) |
|
75 <p> |
|
76 Function to extract flags starting and ending with '__' from a line |
|
77 comment. |
|
78 </p><dl> |
|
79 <dt><i>line</i></dt> |
|
80 <dd> |
|
81 line to extract flags from (string) |
|
82 </dd><dt><i>startComment=</i></dt> |
|
83 <dd> |
|
84 string identifying the start of the comment (string) |
|
85 </dd><dt><i>endComment=</i></dt> |
|
86 <dd> |
|
87 string identifying the end of a comment (string) |
|
88 </dd> |
|
89 </dl><dl> |
|
90 <dt>Returns:</dt> |
|
91 <dd> |
|
92 list containing the extracted flags (list of strings) |
|
93 </dd> |
|
94 </dl> |
|
95 <div align="right"><a href="#top">Up</a></div> |
|
96 <hr /><hr /> |
|
97 <a NAME="get_coding" ID="get_coding"></a> |
|
98 <h2>get_coding</h2> |
|
99 <b>get_coding</b>(<i>text</i>) |
|
100 <p> |
|
101 Function to get the coding of a text. |
|
102 </p><dl> |
|
103 <dt><i>text</i></dt> |
|
104 <dd> |
|
105 text to inspect (string) |
|
106 </dd> |
|
107 </dl><dl> |
|
108 <dt>Returns:</dt> |
|
109 <dd> |
|
110 coding string |
|
111 </dd> |
|
112 </dl> |
|
113 <div align="right"><a href="#top">Up</a></div> |
|
114 <hr /><hr /> |
|
115 <a NAME="normalizeCode" ID="normalizeCode"></a> |
|
116 <h2>normalizeCode</h2> |
|
117 <b>normalizeCode</b>(<i>codestring</i>) |
|
118 <p> |
|
119 Function to normalize the given code. |
|
120 </p><dl> |
|
121 <dt><i>codestring</i></dt> |
|
122 <dd> |
|
123 code to be normalized (string) |
|
124 </dd> |
|
125 </dl><dl> |
|
126 <dt>Returns:</dt> |
|
127 <dd> |
|
128 normalized code (string) |
|
129 </dd> |
|
130 </dl> |
|
131 <div align="right"><a href="#top">Up</a></div> |
|
132 <hr /><hr /> |
|
133 <a NAME="readEncodedFile" ID="readEncodedFile"></a> |
|
134 <h2>readEncodedFile</h2> |
|
135 <b>readEncodedFile</b>(<i>filename</i>) |
|
136 <p> |
|
137 Function to read a file and decode its contents into proper text. |
|
138 </p><dl> |
|
139 <dt><i>filename</i></dt> |
|
140 <dd> |
|
141 name of the file to read (string) |
|
142 </dd> |
|
143 </dl><dl> |
|
144 <dt>Returns:</dt> |
|
145 <dd> |
|
146 tuple of decoded text and encoding (string, string) |
|
147 </dd> |
|
148 </dl> |
|
149 <div align="right"><a href="#top">Up</a></div> |
|
150 <hr /> |
|
151 </body></html> |
|