|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.Utilities.FtpUtilities</title> |
|
6 <style> |
|
7 body { |
|
8 background: #EDECE6; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #85774A; } |
|
14 h2 { color: white; background: #85774A; } |
|
15 h3 { color: white; background: #9D936E; } |
|
16 h4 { color: white; background: #9D936E; } |
|
17 |
|
18 a { color: #BA6D36; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric5.Utilities.FtpUtilities</h1> |
|
24 <p> |
|
25 Module implementing some FTP related utilities. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#FtpDirLineParser">FtpDirLineParser</a></td> |
|
35 <td>Class to parse lines returned by a FTP LIST command.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#FtpDirLineParserError">FtpDirLineParserError</a></td> |
|
38 <td>Exception class raised, if a parser issue was detected.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <h3>Functions</h3> |
|
42 <table> |
|
43 <tr><td>None</td></tr> |
|
44 </table> |
|
45 <hr /><hr /> |
|
46 <a NAME="FtpDirLineParser" ID="FtpDirLineParser"></a> |
|
47 <h2>FtpDirLineParser</h2> |
|
48 <p> |
|
49 Class to parse lines returned by a FTP LIST command. |
|
50 </p> |
|
51 <h3>Derived from</h3> |
|
52 QObject |
|
53 <h3>Class Attributes</h3> |
|
54 <table> |
|
55 <tr><td>MacMode</td></tr><tr><td>MonthnamesNumbers</td></tr><tr><td>UnixMode</td></tr><tr><td>WindowsMode</td></tr> |
|
56 </table> |
|
57 <h3>Class Methods</h3> |
|
58 <table> |
|
59 <tr><td>None</td></tr> |
|
60 </table> |
|
61 <h3>Methods</h3> |
|
62 <table> |
|
63 <tr> |
|
64 <td><a href="#FtpDirLineParser.__init__">FtpDirLineParser</a></td> |
|
65 <td>Constructor</td> |
|
66 </tr><tr> |
|
67 <td><a href="#FtpDirLineParser.__ignoreLine">__ignoreLine</a></td> |
|
68 <td>Private method to check, if the line should be ignored.</td> |
|
69 </tr><tr> |
|
70 <td><a href="#FtpDirLineParser.__parseUnixLine">__parseUnixLine</a></td> |
|
71 <td>Private method to parse a Unix style directory listing line.</td> |
|
72 </tr><tr> |
|
73 <td><a href="#FtpDirLineParser.__parseUnixMode">__parseUnixMode</a></td> |
|
74 <td>Private method to parse a Unix mode string modifying the given URL info object.</td> |
|
75 </tr><tr> |
|
76 <td><a href="#FtpDirLineParser.__parseUnixTime">__parseUnixTime</a></td> |
|
77 <td>Private method to parse a Unix date and time indication modifying the given URL info object.</td> |
|
78 </tr><tr> |
|
79 <td><a href="#FtpDirLineParser.__parseWindowsLine">__parseWindowsLine</a></td> |
|
80 <td>Private method to parse a Windows style directory listing line.</td> |
|
81 </tr><tr> |
|
82 <td><a href="#FtpDirLineParser.__parseWindowsTime">__parseWindowsTime</a></td> |
|
83 <td>Private method to parse a Windows date and time indication modifying the given URL info object.</td> |
|
84 </tr><tr> |
|
85 <td><a href="#FtpDirLineParser.__splitUnixLine">__splitUnixLine</a></td> |
|
86 <td>Split a line of a Unix like directory listing into meta data, number of links, user, group, size, month, day, year or time and name.</td> |
|
87 </tr><tr> |
|
88 <td><a href="#FtpDirLineParser.parseLine">parseLine</a></td> |
|
89 <td>Private method to parse a directory listing line.</td> |
|
90 </tr> |
|
91 </table> |
|
92 <h3>Static Methods</h3> |
|
93 <table> |
|
94 <tr><td>None</td></tr> |
|
95 </table> |
|
96 <a NAME="FtpDirLineParser.__init__" ID="FtpDirLineParser.__init__"></a> |
|
97 <h4>FtpDirLineParser (Constructor)</h4> |
|
98 <b>FtpDirLineParser</b>(<i>parent=None</i>) |
|
99 <p> |
|
100 Constructor |
|
101 </p><dl> |
|
102 <dt><i>parent</i></dt> |
|
103 <dd> |
|
104 reference to the parent object (QObject) |
|
105 </dd> |
|
106 </dl><a NAME="FtpDirLineParser.__ignoreLine" ID="FtpDirLineParser.__ignoreLine"></a> |
|
107 <h4>FtpDirLineParser.__ignoreLine</h4> |
|
108 <b>__ignoreLine</b>(<i>line</i>) |
|
109 <p> |
|
110 Private method to check, if the line should be ignored. |
|
111 </p><dl> |
|
112 <dt><i>line</i></dt> |
|
113 <dd> |
|
114 to check (string) |
|
115 </dd> |
|
116 </dl><dl> |
|
117 <dt>Returns:</dt> |
|
118 <dd> |
|
119 flag indicating to ignore the line (boolean) |
|
120 </dd> |
|
121 </dl><a NAME="FtpDirLineParser.__parseUnixLine" ID="FtpDirLineParser.__parseUnixLine"></a> |
|
122 <h4>FtpDirLineParser.__parseUnixLine</h4> |
|
123 <b>__parseUnixLine</b>(<i>line</i>) |
|
124 <p> |
|
125 Private method to parse a Unix style directory listing line. |
|
126 </p><dl> |
|
127 <dt><i>line</i></dt> |
|
128 <dd> |
|
129 directory line to be parsed (string) |
|
130 </dd> |
|
131 </dl><dl> |
|
132 <dt>Returns:</dt> |
|
133 <dd> |
|
134 URL info object containing the valid data (QUrlInfo) |
|
135 </dd> |
|
136 </dl><dl> |
|
137 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
138 <dd> |
|
139 Raised if the line is not of a |
|
140 recognized Unix format. |
|
141 </dd> |
|
142 </dl><a NAME="FtpDirLineParser.__parseUnixMode" ID="FtpDirLineParser.__parseUnixMode"></a> |
|
143 <h4>FtpDirLineParser.__parseUnixMode</h4> |
|
144 <b>__parseUnixMode</b>(<i>modeString, urlInfo</i>) |
|
145 <p> |
|
146 Private method to parse a Unix mode string modifying the |
|
147 given URL info object. |
|
148 </p><dl> |
|
149 <dt><i>modeString</i></dt> |
|
150 <dd> |
|
151 mode string to be parsed (string) |
|
152 </dd><dt><i>urlInfo</i></dt> |
|
153 <dd> |
|
154 reference to the URL info object (QUrlInfo) |
|
155 </dd> |
|
156 </dl><dl> |
|
157 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
158 <dd> |
|
159 Raised if the mode cannot be parsed. |
|
160 </dd> |
|
161 </dl><a NAME="FtpDirLineParser.__parseUnixTime" ID="FtpDirLineParser.__parseUnixTime"></a> |
|
162 <h4>FtpDirLineParser.__parseUnixTime</h4> |
|
163 <b>__parseUnixTime</b>(<i>monthAbbreviation, day, yearOrTime, urlInfo</i>) |
|
164 <p> |
|
165 Private method to parse a Unix date and time indication modifying |
|
166 the given URL info object. |
|
167 </p><p> |
|
168 |
|
169 </p><p> |
|
170 Date time strings in Unix-style directory listings typically |
|
171 have one of these formats: |
|
172 <ul> |
|
173 <li>"Nov 23 02:33" (month name, day of month, time)</li> |
|
174 <li>"May 26 2005" (month name, day of month, year)</li> |
|
175 </ul> |
|
176 </p><dl> |
|
177 <dt><i>monthAbbreviation</i></dt> |
|
178 <dd> |
|
179 abbreviation of the month name (string) |
|
180 </dd><dt><i>day</i></dt> |
|
181 <dd> |
|
182 day of the month (string) |
|
183 </dd><dt><i>yearOrTime</i></dt> |
|
184 <dd> |
|
185 string giving the year or a time (string) |
|
186 </dd><dt><i>urlInfo</i></dt> |
|
187 <dd> |
|
188 reference to the URL info object (QUrlInfo) |
|
189 </dd> |
|
190 </dl><dl> |
|
191 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
192 <dd> |
|
193 Raised if the month abbreviation is |
|
194 not recognized. |
|
195 </dd> |
|
196 </dl><a NAME="FtpDirLineParser.__parseWindowsLine" ID="FtpDirLineParser.__parseWindowsLine"></a> |
|
197 <h4>FtpDirLineParser.__parseWindowsLine</h4> |
|
198 <b>__parseWindowsLine</b>(<i>line</i>) |
|
199 <p> |
|
200 Private method to parse a Windows style directory listing line. |
|
201 </p><dl> |
|
202 <dt><i>line</i></dt> |
|
203 <dd> |
|
204 directory line to be parsed (string) |
|
205 </dd> |
|
206 </dl><dl> |
|
207 <dt>Returns:</dt> |
|
208 <dd> |
|
209 URL info object containing the valid data (QUrlInfo) |
|
210 </dd> |
|
211 </dl><dl> |
|
212 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
213 <dd> |
|
214 Raised if the line is not of a |
|
215 recognized Windows format. |
|
216 </dd> |
|
217 </dl><a NAME="FtpDirLineParser.__parseWindowsTime" ID="FtpDirLineParser.__parseWindowsTime"></a> |
|
218 <h4>FtpDirLineParser.__parseWindowsTime</h4> |
|
219 <b>__parseWindowsTime</b>(<i>date, time, urlInfo</i>) |
|
220 <p> |
|
221 Private method to parse a Windows date and time indication modifying |
|
222 the given URL info object. |
|
223 </p><p> |
|
224 Date time strings in Windows-style directory listings typically |
|
225 have the format "10-23-12 03:25PM" (month-day_of_month-two_digit_year, |
|
226 hour:minute, am/pm). |
|
227 </p><dl> |
|
228 <dt><i>date</i></dt> |
|
229 <dd> |
|
230 date string (string) |
|
231 </dd><dt><i>time</i></dt> |
|
232 <dd> |
|
233 time string (string) |
|
234 </dd><dt><i>urlInfo</i></dt> |
|
235 <dd> |
|
236 reference to the URL info object (QUrlInfo) |
|
237 </dd> |
|
238 </dl><dl> |
|
239 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
240 <dd> |
|
241 Raised if either of the strings is not |
|
242 recognized. |
|
243 </dd> |
|
244 </dl><a NAME="FtpDirLineParser.__splitUnixLine" ID="FtpDirLineParser.__splitUnixLine"></a> |
|
245 <h4>FtpDirLineParser.__splitUnixLine</h4> |
|
246 <b>__splitUnixLine</b>(<i>line</i>) |
|
247 <p> |
|
248 Split a line of a Unix like directory listing into meta data, |
|
249 number of links, user, group, size, month, day, year or time |
|
250 and name. |
|
251 </p><dl> |
|
252 <dt>Returns:</dt> |
|
253 <dd> |
|
254 tuple of nine strings giving the meta data, |
|
255 number of links, user, group, size, month, day, year or time |
|
256 and name |
|
257 </dd> |
|
258 </dl><dl> |
|
259 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
260 <dd> |
|
261 Raised if the line is not of a |
|
262 recognized Unix format. |
|
263 </dd> |
|
264 </dl><a NAME="FtpDirLineParser.parseLine" ID="FtpDirLineParser.parseLine"></a> |
|
265 <h4>FtpDirLineParser.parseLine</h4> |
|
266 <b>parseLine</b>(<i>line</i>) |
|
267 <p> |
|
268 Private method to parse a directory listing line. |
|
269 </p><p> |
|
270 This implementation support Unix and Windows style directory |
|
271 listings. It tries Unix style first and if that fails switches |
|
272 to Windows style. If that fails as well, an exception is raised. |
|
273 </p><dl> |
|
274 <dt><i>line</i></dt> |
|
275 <dd> |
|
276 directory line to be parsed (string) |
|
277 </dd> |
|
278 </dl><dl> |
|
279 <dt>Returns:</dt> |
|
280 <dd> |
|
281 URL info object containing the valid data (QUrlInfo) |
|
282 </dd> |
|
283 </dl><dl> |
|
284 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
285 <dd> |
|
286 Raised if the line is not of a |
|
287 recognized format. |
|
288 </dd> |
|
289 </dl> |
|
290 <div align="right"><a href="#top">Up</a></div> |
|
291 <hr /><hr /> |
|
292 <a NAME="FtpDirLineParserError" ID="FtpDirLineParserError"></a> |
|
293 <h2>FtpDirLineParserError</h2> |
|
294 <p> |
|
295 Exception class raised, if a parser issue was detected. |
|
296 </p> |
|
297 <h3>Derived from</h3> |
|
298 Exception |
|
299 <h3>Class Attributes</h3> |
|
300 <table> |
|
301 <tr><td>None</td></tr> |
|
302 </table> |
|
303 <h3>Class Methods</h3> |
|
304 <table> |
|
305 <tr><td>None</td></tr> |
|
306 </table> |
|
307 <h3>Methods</h3> |
|
308 <table> |
|
309 <tr><td>None</td></tr> |
|
310 </table> |
|
311 <h3>Static Methods</h3> |
|
312 <table> |
|
313 <tr><td>None</td></tr> |
|
314 </table> |
|
315 |
|
316 <div align="right"><a href="#top">Up</a></div> |
|
317 <hr /> |
|
318 </body></html> |