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