Merge lp:~aaron-whitehouse/duplicity/08-pycodestyle into lp:~duplicity-team/duplicity/0.8-series
- 08-pycodestyle
- Merge into 0.8-series
Proposed by
Aaron Whitehouse
Status: | Merged |
---|---|
Merged at revision: | 1305 |
Proposed branch: | lp:~aaron-whitehouse/duplicity/08-pycodestyle |
Merge into: | lp:~duplicity-team/duplicity/0.8-series |
Diff against target: |
397 lines (+55/-54) 6 files modified
duplicity/backend.py (+1/-1) duplicity/backends/rsyncbackend.py (+1/-1) duplicity/backends/ssh_paramiko_backend.py (+1/-1) duplicity/selection.py (+6/-7) po/duplicity.pot (+40/-40) tox.ini (+6/-4) |
To merge this branch: | bzr merge lp:~aaron-whitehouse/duplicity/08-pycodestyle |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
duplicity-team | Pending | ||
Review via email: mp+347687@code.launchpad.net |
Commit message
* Tox changes to accommodate new pycodestyle version warnings. Ignored W504 for now and marked as a TODO. Marked W503 as a permanent ignore, as it is prefered to the (mutually exclusive) W504 under PEP8.
* Marked various regex strings as raw strings to avoid the new W605 "invalid escape sequence".
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'duplicity/backend.py' |
2 | --- duplicity/backend.py 2017-12-21 21:59:33 +0000 |
3 | +++ duplicity/backend.py 2018-06-08 10:16:55 +0000 |
4 | @@ -160,7 +160,7 @@ |
5 | """ |
6 | strip the prefix from a string e.g. par2+ftp://... -> ftp://... |
7 | """ |
8 | - return re.sub('(?i)^' + re.escape(prefix_scheme) + '\+', '', url_string) |
9 | + return re.sub(r'(?i)^' + re.escape(prefix_scheme) + r'\+', r'', url_string) |
10 | |
11 | |
12 | def is_backend_url(url_string): |
13 | |
14 | === modified file 'duplicity/backends/rsyncbackend.py' |
15 | --- duplicity/backends/rsyncbackend.py 2017-02-20 00:05:17 +0000 |
16 | +++ duplicity/backends/rsyncbackend.py 2018-06-08 10:16:55 +0000 |
17 | @@ -100,7 +100,7 @@ |
18 | |
19 | def get_rsync_path(self): |
20 | url = self.parsed_url.url_string |
21 | - m = re.search("(:\d+|)?::([^:]*)$", url) |
22 | + m = re.search(r"(:\d+|)?::([^:]*)$", url) |
23 | if m: |
24 | return m.group(2), m.group(1).lstrip(':') |
25 | raise InvalidBackendURL("Could not determine rsync path: %s" |
26 | |
27 | === modified file 'duplicity/backends/ssh_paramiko_backend.py' |
28 | --- duplicity/backends/ssh_paramiko_backend.py 2017-12-24 12:24:27 +0000 |
29 | +++ duplicity/backends/ssh_paramiko_backend.py 2018-06-08 10:16:55 +0000 |
30 | @@ -193,7 +193,7 @@ |
31 | else: |
32 | self.config.update({'port': 22}) |
33 | # parse ssh options for alternative ssh private key, identity file |
34 | - m = re.search("^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*", |
35 | + m = re.search(r"^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*", |
36 | globals.ssh_options) |
37 | if (m is not None): |
38 | keyfilename = m.group(3) if m.group(3) else m.group(1) |
39 | |
40 | === modified file 'duplicity/selection.py' |
41 | --- duplicity/selection.py 2017-12-21 21:10:02 +0000 |
42 | +++ duplicity/selection.py 2018-06-08 10:16:55 +0000 |
43 | @@ -144,9 +144,9 @@ |
44 | error_handler, Path.append, (path, filename)) |
45 | if new_path: |
46 | s = self.Select(new_path) |
47 | - if (new_path.type in ["reg", "dir"] and |
48 | - not os.access(new_path.name, os.R_OK)) and \ |
49 | - (s == 1 or s == 2): |
50 | + if (new_path.type in ["reg", "dir"] |
51 | + and not os.access(new_path.name, os.R_OK)) \ |
52 | + and (s == 1 or s == 2): |
53 | # Path is a file or folder that cannot be read, but |
54 | # should be included or scanned. |
55 | log.Warn(_("Error accessing possibly locked file %s") % |
56 | @@ -307,8 +307,7 @@ |
57 | def parse_last_excludes(self): |
58 | """Exit with error if last selection function isn't an exclude""" |
59 | # Internal. Used by ParseArgs. |
60 | - if (self.selection_functions and |
61 | - not self.selection_functions[-1].exclude): |
62 | + if (self.selection_functions and not self.selection_functions[-1].exclude): |
63 | log.FatalError(_(u"""\ |
64 | Last selection expression: |
65 | %s |
66 | @@ -509,8 +508,8 @@ |
67 | file_prefix_selection = select_fn_from_glob(glob_str, include=1)(self.rootpath) |
68 | if not file_prefix_selection: |
69 | # file_prefix_selection == 1 (include) or 2 (scan) |
70 | - raise FilePrefixError(glob_str + " glob with " + self.rootpath.name + |
71 | - " path gives " + str(file_prefix_selection)) |
72 | + raise FilePrefixError(glob_str + " glob with " + self.rootpath.name |
73 | + + " path gives " + str(file_prefix_selection)) |
74 | |
75 | return select_fn_from_glob(glob_str, include, ignore_case) |
76 | |
77 | |
78 | === modified file 'po/duplicity.pot' |
79 | --- po/duplicity.pot 2018-02-23 21:45:22 +0000 |
80 | +++ po/duplicity.pot 2018-06-08 10:16:55 +0000 |
81 | @@ -500,7 +500,7 @@ |
82 | "be used as a substitute." |
83 | msgstr "" |
84 | |
85 | -#. TRANSL: Used in usage help to represent a Unix-style path name. Example: |
86 | +#. Used in usage help to represent a Unix-style path name. Example: |
87 | #. --archive-dir <path> |
88 | #: ../duplicity/commandline.py:280 ../duplicity/commandline.py:290 |
89 | #: ../duplicity/commandline.py:311 ../duplicity/commandline.py:385 |
90 | @@ -509,11 +509,11 @@ |
91 | msgid "path" |
92 | msgstr "" |
93 | |
94 | -#. TRANSL: Used in usage help to represent an ID for a GnuPG key. Example: |
95 | +#. Used in usage help to represent an ID for a GnuPG key. Example: |
96 | #. --encrypt-key <gpg_key_id> |
97 | -#. TRANSL: Used in usage help to represent an ID for a hidden GnuPG key. Example: |
98 | +#. Used in usage help to represent an ID for a hidden GnuPG key. Example: |
99 | #. --hidden-encrypt-key <gpg_key_id> |
100 | -#. TRANSL: Used in usage help to represent an ID for a GnuPG key. Example: |
101 | +#. Used in usage help to represent an ID for a GnuPG key. Example: |
102 | #. --encrypt-key <gpg_key_id> |
103 | #: ../duplicity/commandline.py:306 ../duplicity/commandline.py:313 |
104 | #: ../duplicity/commandline.py:409 ../duplicity/commandline.py:579 |
105 | @@ -521,7 +521,7 @@ |
106 | msgid "gpg-key-id" |
107 | msgstr "" |
108 | |
109 | -#. TRANSL: Used in usage help to represent a "glob" style pattern for |
110 | +#. Used in usage help to represent a "glob" style pattern for |
111 | #. matching one or more files, as described in the documentation. |
112 | #. Example: |
113 | #. --exclude <shell_pattern> |
114 | @@ -530,7 +530,7 @@ |
115 | msgid "shell_pattern" |
116 | msgstr "" |
117 | |
118 | -#. TRANSL: Used in usage help to represent the name of a file. Example: |
119 | +#. Used in usage help to represent the name of a file. Example: |
120 | #. --log-file <filename> |
121 | #: ../duplicity/commandline.py:327 ../duplicity/commandline.py:336 |
122 | #: ../duplicity/commandline.py:343 ../duplicity/commandline.py:436 |
123 | @@ -539,12 +539,12 @@ |
124 | msgid "filename" |
125 | msgstr "" |
126 | |
127 | -#. TRANSL: Used in usage help to represent a regular expression (regexp). |
128 | +#. Used in usage help to represent a regular expression (regexp). |
129 | #: ../duplicity/commandline.py:350 ../duplicity/commandline.py:447 |
130 | msgid "regular_expression" |
131 | msgstr "" |
132 | |
133 | -#. TRANSL: Used in usage help to represent a time spec for a previous |
134 | +#. Used in usage help to represent a time spec for a previous |
135 | #. point in time, as described in the documentation. Example: |
136 | #. duplicity remove-older-than time [options] target_url |
137 | #: ../duplicity/commandline.py:354 ../duplicity/commandline.py:397 |
138 | @@ -552,7 +552,7 @@ |
139 | msgid "time" |
140 | msgstr "" |
141 | |
142 | -#. TRANSL: Used in usage help. (Should be consistent with the "Options:" |
143 | +#. Used in usage help. (Should be consistent with the "Options:" |
144 | #. header.) Example: |
145 | #. duplicity [full|incremental] [options] source_dir target_url |
146 | #: ../duplicity/commandline.py:405 ../duplicity/commandline.py:498 |
147 | @@ -568,7 +568,7 @@ |
148 | "not intended" |
149 | msgstr "" |
150 | |
151 | -#. TRANSL: Used in usage help to represent an imap mailbox |
152 | +#. Used in usage help to represent an imap mailbox |
153 | #: ../duplicity/commandline.py:432 |
154 | msgid "imap_mailbox" |
155 | msgstr "" |
156 | @@ -577,7 +577,7 @@ |
157 | msgid "file_descriptor" |
158 | msgstr "" |
159 | |
160 | -#. TRANSL: Used in usage help to represent a desired number of |
161 | +#. Used in usage help to represent a desired number of |
162 | #. something. Example: |
163 | #. --num-retries <number> |
164 | #: ../duplicity/commandline.py:461 ../duplicity/commandline.py:483 |
165 | @@ -588,7 +588,7 @@ |
166 | msgid "number" |
167 | msgstr "" |
168 | |
169 | -#. TRANSL: Used in usage help (noun) |
170 | +#. Used in usage help (noun) |
171 | #: ../duplicity/commandline.py:464 |
172 | msgid "backup name" |
173 | msgstr "" |
174 | @@ -597,7 +597,7 @@ |
175 | msgid "policy" |
176 | msgstr "" |
177 | |
178 | -#. TRANSL: noun |
179 | +#. noun |
180 | #: ../duplicity/commandline.py:563 ../duplicity/commandline.py:566 |
181 | #: ../duplicity/commandline.py:768 |
182 | msgid "command" |
183 | @@ -615,18 +615,18 @@ |
184 | msgid "path to a folder with certificate authority files" |
185 | msgstr "" |
186 | |
187 | -#. TRANSL: Used in usage help. Example: |
188 | +#. Used in usage help. Example: |
189 | #. --timeout <seconds> |
190 | -#. TRANSL: Used in usage help. Example: |
191 | +#. Used in usage help. Example: |
192 | #. --backend-retry-delay <seconds> |
193 | -#. TRANSL: Used in usage help. Example: |
194 | +#. Used in usage help. Example: |
195 | #. --timeout <seconds> |
196 | #: ../duplicity/commandline.py:600 ../duplicity/commandline.py:629 |
197 | #: ../duplicity/commandline.py:831 |
198 | msgid "seconds" |
199 | msgstr "" |
200 | |
201 | -#. TRANSL: abbreviation for "character" (noun) |
202 | +#. abbreviation for "character" (noun) |
203 | #: ../duplicity/commandline.py:606 ../duplicity/commandline.py:765 |
204 | msgid "char" |
205 | msgstr "" |
206 | @@ -650,88 +650,88 @@ |
207 | msgid "Enter 'duplicity --help' for help screen." |
208 | msgstr "" |
209 | |
210 | -#. TRANSL: Used in usage help to represent a Unix-style path name. Example: |
211 | +#. Used in usage help to represent a Unix-style path name. Example: |
212 | #. rsync://user[:password]@other_host[:port]//absolute_path |
213 | #: ../duplicity/commandline.py:753 |
214 | msgid "absolute_path" |
215 | msgstr "" |
216 | |
217 | -#. TRANSL: Used in usage help. Example: |
218 | +#. Used in usage help. Example: |
219 | #. tahoe://alias/some_dir |
220 | #: ../duplicity/commandline.py:757 |
221 | msgid "alias" |
222 | msgstr "" |
223 | |
224 | -#. TRANSL: Used in help to represent a "bucket name" for Amazon Web |
225 | +#. Used in help to represent a "bucket name" for Amazon Web |
226 | #. Services' Simple Storage Service (S3). Example: |
227 | #. s3://other.host/bucket_name[/prefix] |
228 | #: ../duplicity/commandline.py:762 |
229 | msgid "bucket_name" |
230 | msgstr "" |
231 | |
232 | -#. TRANSL: Used in usage help to represent the name of a container in |
233 | +#. Used in usage help to represent the name of a container in |
234 | #. Amazon Web Services' Cloudfront. Example: |
235 | #. cf+http://container_name |
236 | #: ../duplicity/commandline.py:773 |
237 | msgid "container_name" |
238 | msgstr "" |
239 | |
240 | -#. TRANSL: noun |
241 | +#. noun |
242 | #: ../duplicity/commandline.py:776 |
243 | msgid "count" |
244 | msgstr "" |
245 | |
246 | -#. TRANSL: Used in usage help to represent the name of a file directory |
247 | +#. Used in usage help to represent the name of a file directory |
248 | #: ../duplicity/commandline.py:779 |
249 | msgid "directory" |
250 | msgstr "" |
251 | |
252 | -#. TRANSL: Used in usage help, e.g. to represent the name of a code |
253 | +#. Used in usage help, e.g. to represent the name of a code |
254 | #. module. Example: |
255 | #. rsync://user[:password]@other.host[:port]::/module/some_dir |
256 | #: ../duplicity/commandline.py:792 |
257 | msgid "module" |
258 | msgstr "" |
259 | |
260 | -#. TRANSL: Used in usage help to represent an internet hostname. Example: |
261 | +#. Used in usage help to represent an internet hostname. Example: |
262 | #. ftp://user[:password]@other.host[:port]/some_dir |
263 | #: ../duplicity/commandline.py:806 |
264 | msgid "other.host" |
265 | msgstr "" |
266 | |
267 | -#. TRANSL: Used in usage help. Example: |
268 | +#. Used in usage help. Example: |
269 | #. ftp://user[:password]@other.host[:port]/some_dir |
270 | #: ../duplicity/commandline.py:810 |
271 | msgid "password" |
272 | msgstr "" |
273 | |
274 | -#. TRANSL: Used in usage help to represent a TCP port number. Example: |
275 | +#. Used in usage help to represent a TCP port number. Example: |
276 | #. ftp://user[:password]@other.host[:port]/some_dir |
277 | #: ../duplicity/commandline.py:818 |
278 | msgid "port" |
279 | msgstr "" |
280 | |
281 | -#. TRANSL: Used in usage help. This represents a string to be used as a |
282 | +#. Used in usage help. This represents a string to be used as a |
283 | #. prefix to names for backup files created by Duplicity. Example: |
284 | #. s3://other.host/bucket_name[/prefix] |
285 | #: ../duplicity/commandline.py:823 |
286 | msgid "prefix" |
287 | msgstr "" |
288 | |
289 | -#. TRANSL: Used in usage help to represent a Unix-style path name. Example: |
290 | +#. Used in usage help to represent a Unix-style path name. Example: |
291 | #. rsync://user[:password]@other.host[:port]/relative_path |
292 | #: ../duplicity/commandline.py:827 |
293 | msgid "relative_path" |
294 | msgstr "" |
295 | |
296 | -#. TRANSL: Used in usage help to represent the name of a single file |
297 | +#. Used in usage help to represent the name of a single file |
298 | #. directory or a Unix-style path to a directory. Example: |
299 | #. file:///some_dir |
300 | #: ../duplicity/commandline.py:842 |
301 | msgid "some_dir" |
302 | msgstr "" |
303 | |
304 | -#. TRANSL: Used in usage help to represent the name of a single file |
305 | +#. Used in usage help to represent the name of a single file |
306 | #. directory or a Unix-style path to a directory where files will be |
307 | #. coming FROM. Example: |
308 | #. duplicity [full|incremental] [options] source_dir target_url |
309 | @@ -739,14 +739,14 @@ |
310 | msgid "source_dir" |
311 | msgstr "" |
312 | |
313 | -#. TRANSL: Used in usage help to represent a URL files will be coming |
314 | +#. Used in usage help to represent a URL files will be coming |
315 | #. FROM. Example: |
316 | #. duplicity [restore] [options] source_url target_dir |
317 | #: ../duplicity/commandline.py:853 |
318 | msgid "source_url" |
319 | msgstr "" |
320 | |
321 | -#. TRANSL: Used in usage help to represent the name of a single file |
322 | +#. Used in usage help to represent the name of a single file |
323 | #. directory or a Unix-style path to a directory. where files will be |
324 | #. going TO. Example: |
325 | #. duplicity [restore] [options] source_url target_dir |
326 | @@ -754,37 +754,37 @@ |
327 | msgid "target_dir" |
328 | msgstr "" |
329 | |
330 | -#. TRANSL: Used in usage help to represent a URL files will be going TO. |
331 | +#. Used in usage help to represent a URL files will be going TO. |
332 | #. Example: |
333 | #. duplicity [full|incremental] [options] source_dir target_url |
334 | #: ../duplicity/commandline.py:864 |
335 | msgid "target_url" |
336 | msgstr "" |
337 | |
338 | -#. TRANSL: Used in usage help to represent a user name (i.e. login). |
339 | +#. Used in usage help to represent a user name (i.e. login). |
340 | #. Example: |
341 | #. ftp://user[:password]@other.host[:port]/some_dir |
342 | #: ../duplicity/commandline.py:874 |
343 | msgid "user" |
344 | msgstr "" |
345 | |
346 | -#. TRANSL: account id for b2. Example: b2://account_id@bucket/ |
347 | +#. account id for b2. Example: b2://account_id@bucket/ |
348 | #: ../duplicity/commandline.py:877 |
349 | msgid "account_id" |
350 | msgstr "" |
351 | |
352 | -#. TRANSL: application_key for b2. |
353 | +#. application_key for b2. |
354 | #. Example: b2://account_id:application_key@bucket/ |
355 | #: ../duplicity/commandline.py:881 |
356 | msgid "application_key" |
357 | msgstr "" |
358 | |
359 | -#. TRANSL: Header in usage help |
360 | +#. Header in usage help |
361 | #: ../duplicity/commandline.py:899 |
362 | msgid "Backends and their URL formats:" |
363 | msgstr "" |
364 | |
365 | -#. TRANSL: Header in usage help |
366 | +#. Header in usage help |
367 | #: ../duplicity/commandline.py:930 |
368 | msgid "Commands:" |
369 | msgstr "" |
370 | @@ -1080,7 +1080,7 @@ |
371 | msgstr[0] "" |
372 | msgstr[1] "" |
373 | |
374 | -#. TRANSL: "cleanup" is a hard-coded command, so do not translate it |
375 | +#. "cleanup" is a hard-coded command, so do not translate it |
376 | #: ../duplicity/collections.py:666 |
377 | msgid "" |
378 | "These may be deleted by running duplicity with the \"cleanup\" command." |
379 | |
380 | === modified file 'tox.ini' |
381 | --- tox.ini 2017-12-15 01:44:01 +0000 |
382 | +++ tox.ini 2018-06-08 10:16:55 +0000 |
383 | @@ -24,10 +24,12 @@ |
384 | |
385 | |
386 | [pycodestyle] |
387 | -# E722 do not use bare except |
388 | -# E731 do not assign a lambda expression, use a def |
389 | -# E741 ambiguous variable name |
390 | -ignore = E722,E731,E741 |
391 | +# W503 warnings for break before a binary operator. For new code, PEP8 prefers this and this warning should be ignored. |
392 | +# W504 warnings for break after a binary operator. For new code, PEP8 prefers before, so these should be fixed -- TODO |
393 | +# E722 do not use bare except -- TODO |
394 | +# E731 do not assign a lambda expression, use a def -- TODO |
395 | +# E741 ambiguous variable name -- TODO |
396 | +ignore = W503,W504,E722,E731,E741 |
397 | max-line-length = 120 |
398 | |
399 |