|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Utilities.FtpUtilities</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.Utilities.FtpUtilities</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing some FTP related utilities. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 |
|
37 <tr> |
|
38 <td><a href="#FtpDirLineParser">FtpDirLineParser</a></td> |
|
39 <td>Class to parse lines returned by a FTP LIST command.</td> |
|
40 </tr> |
|
41 <tr> |
|
42 <td><a href="#FtpDirLineParserError">FtpDirLineParserError</a></td> |
|
43 <td>Exception class raised, if a parser issue was detected.</td> |
|
44 </tr> |
|
45 </table> |
|
46 <h3>Functions</h3> |
|
47 |
|
48 <table> |
|
49 <tr><td>None</td></tr> |
|
50 </table> |
|
51 <hr /> |
|
52 <hr /> |
|
53 <a NAME="FtpDirLineParser" ID="FtpDirLineParser"></a> |
|
54 <h2>FtpDirLineParser</h2> |
|
55 |
|
56 <p> |
|
57 Class to parse lines returned by a FTP LIST command. |
|
58 </p> |
|
59 <h3>Derived from</h3> |
|
60 QObject |
|
61 <h3>Class Attributes</h3> |
|
62 |
|
63 <table> |
|
64 <tr><td>MonthnamesNumbers</td></tr> |
|
65 </table> |
|
66 <h3>Class Methods</h3> |
|
67 |
|
68 <table> |
|
69 <tr><td>None</td></tr> |
|
70 </table> |
|
71 <h3>Methods</h3> |
|
72 |
|
73 <table> |
|
74 |
|
75 <tr> |
|
76 <td><a href="#FtpDirLineParser.__init__">FtpDirLineParser</a></td> |
|
77 <td>Constructor</td> |
|
78 </tr> |
|
79 <tr> |
|
80 <td><a href="#FtpDirLineParser.__ignoreLine">__ignoreLine</a></td> |
|
81 <td>Private method to check, if the line should be ignored.</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#FtpDirLineParser.__parseUnixLine">__parseUnixLine</a></td> |
|
85 <td>Private method to parse a Unix style directory listing line.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#FtpDirLineParser.__parseUnixMode">__parseUnixMode</a></td> |
|
89 <td>Private method to parse a Unix mode string modifying the given URL info object.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#FtpDirLineParser.__parseUnixTime">__parseUnixTime</a></td> |
|
93 <td>Private method to parse a Unix date and time indication modifying the given URL info object.</td> |
|
94 </tr> |
|
95 <tr> |
|
96 <td><a href="#FtpDirLineParser.__parseWindowsLine">__parseWindowsLine</a></td> |
|
97 <td>Private method to parse a Windows style directory listing line.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#FtpDirLineParser.__parseWindowsTime">__parseWindowsTime</a></td> |
|
101 <td>Private method to parse a Windows date and time indication modifying the given URL info object.</td> |
|
102 </tr> |
|
103 <tr> |
|
104 <td><a href="#FtpDirLineParser.__splitUnixLine">__splitUnixLine</a></td> |
|
105 <td>Private method to split a line of a Unix like directory listing.</td> |
|
106 </tr> |
|
107 <tr> |
|
108 <td><a href="#FtpDirLineParser.parseLine">parseLine</a></td> |
|
109 <td>Public method to parse a directory listing line.</td> |
|
110 </tr> |
|
111 </table> |
|
112 <h3>Static Methods</h3> |
|
113 |
|
114 <table> |
|
115 <tr><td>None</td></tr> |
|
116 </table> |
|
117 |
|
118 <a NAME="FtpDirLineParser.__init__" ID="FtpDirLineParser.__init__"></a> |
|
119 <h4>FtpDirLineParser (Constructor)</h4> |
|
120 <b>FtpDirLineParser</b>(<i>parent=None</i>) |
|
121 |
|
122 <p> |
|
123 Constructor |
|
124 </p> |
|
125 <dl> |
|
126 |
|
127 <dt><i>parent</i></dt> |
|
128 <dd> |
|
129 reference to the parent object (QObject) |
|
130 </dd> |
|
131 </dl> |
|
132 <a NAME="FtpDirLineParser.__ignoreLine" ID="FtpDirLineParser.__ignoreLine"></a> |
|
133 <h4>FtpDirLineParser.__ignoreLine</h4> |
|
134 <b>__ignoreLine</b>(<i>line</i>) |
|
135 |
|
136 <p> |
|
137 Private method to check, if the line should be ignored. |
|
138 </p> |
|
139 <dl> |
|
140 |
|
141 <dt><i>line</i></dt> |
|
142 <dd> |
|
143 to check (string) |
|
144 </dd> |
|
145 </dl> |
|
146 <dl> |
|
147 <dt>Return:</dt> |
|
148 <dd> |
|
149 flag indicating to ignore the line (boolean) |
|
150 </dd> |
|
151 </dl> |
|
152 <a NAME="FtpDirLineParser.__parseUnixLine" ID="FtpDirLineParser.__parseUnixLine"></a> |
|
153 <h4>FtpDirLineParser.__parseUnixLine</h4> |
|
154 <b>__parseUnixLine</b>(<i>line</i>) |
|
155 |
|
156 <p> |
|
157 Private method to parse a Unix style directory listing line. |
|
158 </p> |
|
159 <dl> |
|
160 |
|
161 <dt><i>line</i></dt> |
|
162 <dd> |
|
163 directory line to be parsed (string) |
|
164 </dd> |
|
165 </dl> |
|
166 <dl> |
|
167 <dt>Return:</dt> |
|
168 <dd> |
|
169 URL info object containing the valid data (EricUrlInfo) |
|
170 </dd> |
|
171 </dl> |
|
172 <a NAME="FtpDirLineParser.__parseUnixMode" ID="FtpDirLineParser.__parseUnixMode"></a> |
|
173 <h4>FtpDirLineParser.__parseUnixMode</h4> |
|
174 <b>__parseUnixMode</b>(<i>modeString, urlInfo</i>) |
|
175 |
|
176 <p> |
|
177 Private method to parse a Unix mode string modifying the |
|
178 given URL info object. |
|
179 </p> |
|
180 <dl> |
|
181 |
|
182 <dt><i>modeString</i></dt> |
|
183 <dd> |
|
184 mode string to be parsed (string) |
|
185 </dd> |
|
186 <dt><i>urlInfo</i></dt> |
|
187 <dd> |
|
188 reference to the URL info object (EricUrlInfo) |
|
189 </dd> |
|
190 </dl> |
|
191 <dl> |
|
192 |
|
193 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
194 <dd> |
|
195 Raised if the mode cannot be parsed. |
|
196 </dd> |
|
197 </dl> |
|
198 <a NAME="FtpDirLineParser.__parseUnixTime" ID="FtpDirLineParser.__parseUnixTime"></a> |
|
199 <h4>FtpDirLineParser.__parseUnixTime</h4> |
|
200 <b>__parseUnixTime</b>(<i>monthAbbreviation, day, yearOrTime, urlInfo</i>) |
|
201 |
|
202 <p> |
|
203 Private method to parse a Unix date and time indication modifying |
|
204 the given URL info object. |
|
205 </p> |
|
206 <p> |
|
207 |
|
208 </p> |
|
209 <p> |
|
210 Date time strings in Unix-style directory listings typically |
|
211 have one of these formats: |
|
212 <ul> |
|
213 <li>"Nov 23 02:33" (month name, day of month, time)</li> |
|
214 <li>"May 26 2005" (month name, day of month, year)</li> |
|
215 </ul> |
|
216 </p> |
|
217 <dl> |
|
218 |
|
219 <dt><i>monthAbbreviation</i></dt> |
|
220 <dd> |
|
221 abbreviation of the month name (string) |
|
222 </dd> |
|
223 <dt><i>day</i></dt> |
|
224 <dd> |
|
225 day of the month (string) |
|
226 </dd> |
|
227 <dt><i>yearOrTime</i></dt> |
|
228 <dd> |
|
229 string giving the year or a time (string) |
|
230 </dd> |
|
231 <dt><i>urlInfo</i></dt> |
|
232 <dd> |
|
233 reference to the URL info object (EricUrlInfo) |
|
234 </dd> |
|
235 </dl> |
|
236 <dl> |
|
237 |
|
238 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
239 <dd> |
|
240 Raised if the month abbreviation is |
|
241 not recognized. |
|
242 </dd> |
|
243 </dl> |
|
244 <a NAME="FtpDirLineParser.__parseWindowsLine" ID="FtpDirLineParser.__parseWindowsLine"></a> |
|
245 <h4>FtpDirLineParser.__parseWindowsLine</h4> |
|
246 <b>__parseWindowsLine</b>(<i>line</i>) |
|
247 |
|
248 <p> |
|
249 Private method to parse a Windows style directory listing line. |
|
250 </p> |
|
251 <dl> |
|
252 |
|
253 <dt><i>line</i></dt> |
|
254 <dd> |
|
255 directory line to be parsed (string) |
|
256 </dd> |
|
257 </dl> |
|
258 <dl> |
|
259 <dt>Return:</dt> |
|
260 <dd> |
|
261 URL info object containing the valid data (EricUrlInfo) |
|
262 </dd> |
|
263 </dl> |
|
264 <dl> |
|
265 |
|
266 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
267 <dd> |
|
268 Raised if the line is not of a |
|
269 recognized Windows format. |
|
270 </dd> |
|
271 </dl> |
|
272 <a NAME="FtpDirLineParser.__parseWindowsTime" ID="FtpDirLineParser.__parseWindowsTime"></a> |
|
273 <h4>FtpDirLineParser.__parseWindowsTime</h4> |
|
274 <b>__parseWindowsTime</b>(<i>date, time, urlInfo</i>) |
|
275 |
|
276 <p> |
|
277 Private method to parse a Windows date and time indication modifying |
|
278 the given URL info object. |
|
279 </p> |
|
280 <p> |
|
281 Date time strings in Windows-style directory listings typically |
|
282 have the format "10-23-12 03:25PM" (month-day_of_month-two_digit_year, |
|
283 hour:minute, am/pm). |
|
284 </p> |
|
285 <dl> |
|
286 |
|
287 <dt><i>date</i></dt> |
|
288 <dd> |
|
289 date string (string) |
|
290 </dd> |
|
291 <dt><i>time</i></dt> |
|
292 <dd> |
|
293 time string (string) |
|
294 </dd> |
|
295 <dt><i>urlInfo</i></dt> |
|
296 <dd> |
|
297 reference to the URL info object (EricUrlInfo) |
|
298 </dd> |
|
299 </dl> |
|
300 <dl> |
|
301 |
|
302 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
303 <dd> |
|
304 Raised if either of the strings is not |
|
305 recognized. |
|
306 </dd> |
|
307 </dl> |
|
308 <a NAME="FtpDirLineParser.__splitUnixLine" ID="FtpDirLineParser.__splitUnixLine"></a> |
|
309 <h4>FtpDirLineParser.__splitUnixLine</h4> |
|
310 <b>__splitUnixLine</b>(<i>line</i>) |
|
311 |
|
312 <p> |
|
313 Private method to split a line of a Unix like directory listing. |
|
314 </p> |
|
315 <p> |
|
316 It splits the line into meta data, number of links, user, group, size, |
|
317 month, day, year or time and name. |
|
318 </p> |
|
319 <dl> |
|
320 |
|
321 <dt><i>line</i></dt> |
|
322 <dd> |
|
323 directory line to split (string) |
|
324 </dd> |
|
325 </dl> |
|
326 <dl> |
|
327 <dt>Return:</dt> |
|
328 <dd> |
|
329 tuple of nine strings giving the meta data, |
|
330 number of links, user, group, size, month, day, year or time |
|
331 and name |
|
332 </dd> |
|
333 </dl> |
|
334 <dl> |
|
335 |
|
336 <dt>Raises <b>FtpDirLineParserError</b>:</dt> |
|
337 <dd> |
|
338 Raised if the line is not of a |
|
339 recognized Unix format. |
|
340 </dd> |
|
341 </dl> |
|
342 <a NAME="FtpDirLineParser.parseLine" ID="FtpDirLineParser.parseLine"></a> |
|
343 <h4>FtpDirLineParser.parseLine</h4> |
|
344 <b>parseLine</b>(<i>line</i>) |
|
345 |
|
346 <p> |
|
347 Public method to parse a directory listing line. |
|
348 </p> |
|
349 <p> |
|
350 This implementation support Unix and Windows style directory |
|
351 listings. It tries Unix style first and if that fails switches |
|
352 to Windows style. If that fails as well, an exception is raised. |
|
353 </p> |
|
354 <dl> |
|
355 |
|
356 <dt><i>line</i></dt> |
|
357 <dd> |
|
358 directory line to be parsed (string) |
|
359 </dd> |
|
360 </dl> |
|
361 <dl> |
|
362 <dt>Return:</dt> |
|
363 <dd> |
|
364 URL info object containing the valid data (EricUrlInfo) |
|
365 </dd> |
|
366 </dl> |
|
367 <div align="right"><a href="#top">Up</a></div> |
|
368 <hr /> |
|
369 <hr /> |
|
370 <a NAME="FtpDirLineParserError" ID="FtpDirLineParserError"></a> |
|
371 <h2>FtpDirLineParserError</h2> |
|
372 |
|
373 <p> |
|
374 Exception class raised, if a parser issue was detected. |
|
375 </p> |
|
376 <h3>Derived from</h3> |
|
377 Exception |
|
378 <h3>Class Attributes</h3> |
|
379 |
|
380 <table> |
|
381 <tr><td>None</td></tr> |
|
382 </table> |
|
383 <h3>Class Methods</h3> |
|
384 |
|
385 <table> |
|
386 <tr><td>None</td></tr> |
|
387 </table> |
|
388 <h3>Methods</h3> |
|
389 |
|
390 <table> |
|
391 <tr><td>None</td></tr> |
|
392 </table> |
|
393 <h3>Static Methods</h3> |
|
394 |
|
395 <table> |
|
396 <tr><td>None</td></tr> |
|
397 </table> |
|
398 |
|
399 <div align="right"><a href="#top">Up</a></div> |
|
400 <hr /> |
|
401 </body></html> |