duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #04767
[Merge] lp:~aaron-whitehouse/duplicity/08-pycodestyle into lp:duplicity
Aaron Whitehouse has proposed merging lp:~aaron-whitehouse/duplicity/08-pycodestyle into lp:duplicity.
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".
Requested reviews:
duplicity-team (duplicity-team)
For more details, see:
https://code.launchpad.net/~aaron-whitehouse/duplicity/08-pycodestyle/+merge/347687
--
Your team duplicity-team is requested to review the proposed merge of lp:~aaron-whitehouse/duplicity/08-pycodestyle into lp:duplicity.
=== modified file 'duplicity/backend.py'
--- duplicity/backend.py 2017-12-21 21:59:33 +0000
+++ duplicity/backend.py 2018-06-08 10:16:55 +0000
@@ -160,7 +160,7 @@
"""
strip the prefix from a string e.g. par2+ftp://... -> ftp://...
"""
- return re.sub('(?i)^' + re.escape(prefix_scheme) + '\+', '', url_string)
+ return re.sub(r'(?i)^' + re.escape(prefix_scheme) + r'\+', r'', url_string)
def is_backend_url(url_string):
=== modified file 'duplicity/backends/rsyncbackend.py'
--- duplicity/backends/rsyncbackend.py 2017-02-20 00:05:17 +0000
+++ duplicity/backends/rsyncbackend.py 2018-06-08 10:16:55 +0000
@@ -100,7 +100,7 @@
def get_rsync_path(self):
url = self.parsed_url.url_string
- m = re.search("(:\d+|)?::([^:]*)$", url)
+ m = re.search(r"(:\d+|)?::([^:]*)$", url)
if m:
return m.group(2), m.group(1).lstrip(':')
raise InvalidBackendURL("Could not determine rsync path: %s"
=== modified file 'duplicity/backends/ssh_paramiko_backend.py'
--- duplicity/backends/ssh_paramiko_backend.py 2017-12-24 12:24:27 +0000
+++ duplicity/backends/ssh_paramiko_backend.py 2018-06-08 10:16:55 +0000
@@ -193,7 +193,7 @@
else:
self.config.update({'port': 22})
# parse ssh options for alternative ssh private key, identity file
- m = re.search("^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*",
+ m = re.search(r"^(?:.+\s+)?(?:-oIdentityFile=|-i\s+)(([\"'])([^\\2]+)\\2|[\S]+).*",
globals.ssh_options)
if (m is not None):
keyfilename = m.group(3) if m.group(3) else m.group(1)
=== modified file 'duplicity/selection.py'
--- duplicity/selection.py 2017-12-21 21:10:02 +0000
+++ duplicity/selection.py 2018-06-08 10:16:55 +0000
@@ -144,9 +144,9 @@
error_handler, Path.append, (path, filename))
if new_path:
s = self.Select(new_path)
- if (new_path.type in ["reg", "dir"] and
- not os.access(new_path.name, os.R_OK)) and \
- (s == 1 or s == 2):
+ if (new_path.type in ["reg", "dir"]
+ and not os.access(new_path.name, os.R_OK)) \
+ and (s == 1 or s == 2):
# Path is a file or folder that cannot be read, but
# should be included or scanned.
log.Warn(_("Error accessing possibly locked file %s") %
@@ -307,8 +307,7 @@
def parse_last_excludes(self):
"""Exit with error if last selection function isn't an exclude"""
# Internal. Used by ParseArgs.
- if (self.selection_functions and
- not self.selection_functions[-1].exclude):
+ if (self.selection_functions and not self.selection_functions[-1].exclude):
log.FatalError(_(u"""\
Last selection expression:
%s
@@ -509,8 +508,8 @@
file_prefix_selection = select_fn_from_glob(glob_str, include=1)(self.rootpath)
if not file_prefix_selection:
# file_prefix_selection == 1 (include) or 2 (scan)
- raise FilePrefixError(glob_str + " glob with " + self.rootpath.name +
- " path gives " + str(file_prefix_selection))
+ raise FilePrefixError(glob_str + " glob with " + self.rootpath.name
+ + " path gives " + str(file_prefix_selection))
return select_fn_from_glob(glob_str, include, ignore_case)
=== modified file 'po/duplicity.pot'
--- po/duplicity.pot 2018-02-23 21:45:22 +0000
+++ po/duplicity.pot 2018-06-08 10:16:55 +0000
@@ -500,7 +500,7 @@
"be used as a substitute."
msgstr ""
-#. TRANSL: Used in usage help to represent a Unix-style path name. Example:
+#. Used in usage help to represent a Unix-style path name. Example:
#. --archive-dir <path>
#: ../duplicity/commandline.py:280 ../duplicity/commandline.py:290
#: ../duplicity/commandline.py:311 ../duplicity/commandline.py:385
@@ -509,11 +509,11 @@
msgid "path"
msgstr ""
-#. TRANSL: Used in usage help to represent an ID for a GnuPG key. Example:
+#. Used in usage help to represent an ID for a GnuPG key. Example:
#. --encrypt-key <gpg_key_id>
-#. TRANSL: Used in usage help to represent an ID for a hidden GnuPG key. Example:
+#. Used in usage help to represent an ID for a hidden GnuPG key. Example:
#. --hidden-encrypt-key <gpg_key_id>
-#. TRANSL: Used in usage help to represent an ID for a GnuPG key. Example:
+#. Used in usage help to represent an ID for a GnuPG key. Example:
#. --encrypt-key <gpg_key_id>
#: ../duplicity/commandline.py:306 ../duplicity/commandline.py:313
#: ../duplicity/commandline.py:409 ../duplicity/commandline.py:579
@@ -521,7 +521,7 @@
msgid "gpg-key-id"
msgstr ""
-#. TRANSL: Used in usage help to represent a "glob" style pattern for
+#. Used in usage help to represent a "glob" style pattern for
#. matching one or more files, as described in the documentation.
#. Example:
#. --exclude <shell_pattern>
@@ -530,7 +530,7 @@
msgid "shell_pattern"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a file. Example:
+#. Used in usage help to represent the name of a file. Example:
#. --log-file <filename>
#: ../duplicity/commandline.py:327 ../duplicity/commandline.py:336
#: ../duplicity/commandline.py:343 ../duplicity/commandline.py:436
@@ -539,12 +539,12 @@
msgid "filename"
msgstr ""
-#. TRANSL: Used in usage help to represent a regular expression (regexp).
+#. Used in usage help to represent a regular expression (regexp).
#: ../duplicity/commandline.py:350 ../duplicity/commandline.py:447
msgid "regular_expression"
msgstr ""
-#. TRANSL: Used in usage help to represent a time spec for a previous
+#. Used in usage help to represent a time spec for a previous
#. point in time, as described in the documentation. Example:
#. duplicity remove-older-than time [options] target_url
#: ../duplicity/commandline.py:354 ../duplicity/commandline.py:397
@@ -552,7 +552,7 @@
msgid "time"
msgstr ""
-#. TRANSL: Used in usage help. (Should be consistent with the "Options:"
+#. Used in usage help. (Should be consistent with the "Options:"
#. header.) Example:
#. duplicity [full|incremental] [options] source_dir target_url
#: ../duplicity/commandline.py:405 ../duplicity/commandline.py:498
@@ -568,7 +568,7 @@
"not intended"
msgstr ""
-#. TRANSL: Used in usage help to represent an imap mailbox
+#. Used in usage help to represent an imap mailbox
#: ../duplicity/commandline.py:432
msgid "imap_mailbox"
msgstr ""
@@ -577,7 +577,7 @@
msgid "file_descriptor"
msgstr ""
-#. TRANSL: Used in usage help to represent a desired number of
+#. Used in usage help to represent a desired number of
#. something. Example:
#. --num-retries <number>
#: ../duplicity/commandline.py:461 ../duplicity/commandline.py:483
@@ -588,7 +588,7 @@
msgid "number"
msgstr ""
-#. TRANSL: Used in usage help (noun)
+#. Used in usage help (noun)
#: ../duplicity/commandline.py:464
msgid "backup name"
msgstr ""
@@ -597,7 +597,7 @@
msgid "policy"
msgstr ""
-#. TRANSL: noun
+#. noun
#: ../duplicity/commandline.py:563 ../duplicity/commandline.py:566
#: ../duplicity/commandline.py:768
msgid "command"
@@ -615,18 +615,18 @@
msgid "path to a folder with certificate authority files"
msgstr ""
-#. TRANSL: Used in usage help. Example:
+#. Used in usage help. Example:
#. --timeout <seconds>
-#. TRANSL: Used in usage help. Example:
+#. Used in usage help. Example:
#. --backend-retry-delay <seconds>
-#. TRANSL: Used in usage help. Example:
+#. Used in usage help. Example:
#. --timeout <seconds>
#: ../duplicity/commandline.py:600 ../duplicity/commandline.py:629
#: ../duplicity/commandline.py:831
msgid "seconds"
msgstr ""
-#. TRANSL: abbreviation for "character" (noun)
+#. abbreviation for "character" (noun)
#: ../duplicity/commandline.py:606 ../duplicity/commandline.py:765
msgid "char"
msgstr ""
@@ -650,88 +650,88 @@
msgid "Enter 'duplicity --help' for help screen."
msgstr ""
-#. TRANSL: Used in usage help to represent a Unix-style path name. Example:
+#. Used in usage help to represent a Unix-style path name. Example:
#. rsync://user[:password]@other_host[:port]//absolute_path
#: ../duplicity/commandline.py:753
msgid "absolute_path"
msgstr ""
-#. TRANSL: Used in usage help. Example:
+#. Used in usage help. Example:
#. tahoe://alias/some_dir
#: ../duplicity/commandline.py:757
msgid "alias"
msgstr ""
-#. TRANSL: Used in help to represent a "bucket name" for Amazon Web
+#. Used in help to represent a "bucket name" for Amazon Web
#. Services' Simple Storage Service (S3). Example:
#. s3://other.host/bucket_name[/prefix]
#: ../duplicity/commandline.py:762
msgid "bucket_name"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a container in
+#. Used in usage help to represent the name of a container in
#. Amazon Web Services' Cloudfront. Example:
#. cf+http://container_name
#: ../duplicity/commandline.py:773
msgid "container_name"
msgstr ""
-#. TRANSL: noun
+#. noun
#: ../duplicity/commandline.py:776
msgid "count"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a file directory
+#. Used in usage help to represent the name of a file directory
#: ../duplicity/commandline.py:779
msgid "directory"
msgstr ""
-#. TRANSL: Used in usage help, e.g. to represent the name of a code
+#. Used in usage help, e.g. to represent the name of a code
#. module. Example:
#. rsync://user[:password]@other.host[:port]::/module/some_dir
#: ../duplicity/commandline.py:792
msgid "module"
msgstr ""
-#. TRANSL: Used in usage help to represent an internet hostname. Example:
+#. Used in usage help to represent an internet hostname. Example:
#. ftp://user[:password]@other.host[:port]/some_dir
#: ../duplicity/commandline.py:806
msgid "other.host"
msgstr ""
-#. TRANSL: Used in usage help. Example:
+#. Used in usage help. Example:
#. ftp://user[:password]@other.host[:port]/some_dir
#: ../duplicity/commandline.py:810
msgid "password"
msgstr ""
-#. TRANSL: Used in usage help to represent a TCP port number. Example:
+#. Used in usage help to represent a TCP port number. Example:
#. ftp://user[:password]@other.host[:port]/some_dir
#: ../duplicity/commandline.py:818
msgid "port"
msgstr ""
-#. TRANSL: Used in usage help. This represents a string to be used as a
+#. Used in usage help. This represents a string to be used as a
#. prefix to names for backup files created by Duplicity. Example:
#. s3://other.host/bucket_name[/prefix]
#: ../duplicity/commandline.py:823
msgid "prefix"
msgstr ""
-#. TRANSL: Used in usage help to represent a Unix-style path name. Example:
+#. Used in usage help to represent a Unix-style path name. Example:
#. rsync://user[:password]@other.host[:port]/relative_path
#: ../duplicity/commandline.py:827
msgid "relative_path"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a single file
+#. Used in usage help to represent the name of a single file
#. directory or a Unix-style path to a directory. Example:
#. file:///some_dir
#: ../duplicity/commandline.py:842
msgid "some_dir"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a single file
+#. Used in usage help to represent the name of a single file
#. directory or a Unix-style path to a directory where files will be
#. coming FROM. Example:
#. duplicity [full|incremental] [options] source_dir target_url
@@ -739,14 +739,14 @@
msgid "source_dir"
msgstr ""
-#. TRANSL: Used in usage help to represent a URL files will be coming
+#. Used in usage help to represent a URL files will be coming
#. FROM. Example:
#. duplicity [restore] [options] source_url target_dir
#: ../duplicity/commandline.py:853
msgid "source_url"
msgstr ""
-#. TRANSL: Used in usage help to represent the name of a single file
+#. Used in usage help to represent the name of a single file
#. directory or a Unix-style path to a directory. where files will be
#. going TO. Example:
#. duplicity [restore] [options] source_url target_dir
@@ -754,37 +754,37 @@
msgid "target_dir"
msgstr ""
-#. TRANSL: Used in usage help to represent a URL files will be going TO.
+#. Used in usage help to represent a URL files will be going TO.
#. Example:
#. duplicity [full|incremental] [options] source_dir target_url
#: ../duplicity/commandline.py:864
msgid "target_url"
msgstr ""
-#. TRANSL: Used in usage help to represent a user name (i.e. login).
+#. Used in usage help to represent a user name (i.e. login).
#. Example:
#. ftp://user[:password]@other.host[:port]/some_dir
#: ../duplicity/commandline.py:874
msgid "user"
msgstr ""
-#. TRANSL: account id for b2. Example: b2://account_id@bucket/
+#. account id for b2. Example: b2://account_id@bucket/
#: ../duplicity/commandline.py:877
msgid "account_id"
msgstr ""
-#. TRANSL: application_key for b2.
+#. application_key for b2.
#. Example: b2://account_id:application_key@bucket/
#: ../duplicity/commandline.py:881
msgid "application_key"
msgstr ""
-#. TRANSL: Header in usage help
+#. Header in usage help
#: ../duplicity/commandline.py:899
msgid "Backends and their URL formats:"
msgstr ""
-#. TRANSL: Header in usage help
+#. Header in usage help
#: ../duplicity/commandline.py:930
msgid "Commands:"
msgstr ""
@@ -1080,7 +1080,7 @@
msgstr[0] ""
msgstr[1] ""
-#. TRANSL: "cleanup" is a hard-coded command, so do not translate it
+#. "cleanup" is a hard-coded command, so do not translate it
#: ../duplicity/collections.py:666
msgid ""
"These may be deleted by running duplicity with the \"cleanup\" command."
=== modified file 'tox.ini'
--- tox.ini 2017-12-15 01:44:01 +0000
+++ tox.ini 2018-06-08 10:16:55 +0000
@@ -24,10 +24,12 @@
[pycodestyle]
-# E722 do not use bare except
-# E731 do not assign a lambda expression, use a def
-# E741 ambiguous variable name
-ignore = E722,E731,E741
+# W503 warnings for break before a binary operator. For new code, PEP8 prefers this and this warning should be ignored.
+# W504 warnings for break after a binary operator. For new code, PEP8 prefers before, so these should be fixed -- TODO
+# E722 do not use bare except -- TODO
+# E731 do not assign a lambda expression, use a def -- TODO
+# E741 ambiguous variable name -- TODO
+ignore = W503,W504,E722,E731,E741
max-line-length = 120
Follow ups