From 78c6d21a0863b0e024e2a22e169240a91e477965 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 29 Oct 2018 11:54:24 +0100 Subject: [PATCH] flake8: fix F841 (cherry picked from commit 10cdadb2f8b33cd6060d9e071fe652f743c7568a) --- scripts/glibc_check.py | 2 +- setup.cfg | 2 +- src/borg/archive.py | 4 ++-- src/borg/crypto/nonces.py | 2 +- src/borg/testsuite/__init__.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/glibc_check.py b/scripts/glibc_check.py index 02be4aac4..eb198ed56 100755 --- a/scripts/glibc_check.py +++ b/scripts/glibc_check.py @@ -41,7 +41,7 @@ def main(): overall_versions.add(requires_glibc) if verbose: print("%s %s" % (filename, format_version(requires_glibc))) - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: if verbose: print("%s errored." % filename) diff --git a/setup.cfg b/setup.cfg index e2dc79ce5..b2da05b43 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ python_files = testsuite/*.py # with existing code. if you want to change them, you should first fix all # flake8 failures that appear with your change. ignore = E122,E123,E125,E126,E127,E128,E226,E402,E722,E731,E741,F401,F405,F811, - W504,W605,F841 + W504,W605 # line length long term target: 120 max-line-length = 255 exclude = build,dist,.git,.idea,.cache,.tox,docs/conf.py diff --git a/src/borg/archive.py b/src/borg/archive.py index 78ecbbbd7..ae611179d 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -773,7 +773,7 @@ Utilization of max. archive size: {csize_max:.0%} def fetch_async_response(wait=True): try: return self.repository.async_response(wait=wait) - except Repository.ObjectNotFound as e: + except Repository.ObjectNotFound: nonlocal error # object not in repo - strange, but we wanted to delete it anyway. if forced == 0: @@ -1523,7 +1523,7 @@ class ArchiveChecker: yield Item(internal_dict=item) else: report('Did not get expected metadata dict when unpacking item metadata (%s)' % reason, chunk_id, i) - except RobustUnpacker.UnpackerCrashed as err: + except RobustUnpacker.UnpackerCrashed: report('Unpacker crashed while unpacking item metadata, trying to resync...', chunk_id, i) unpacker.resync() except Exception: diff --git a/src/borg/crypto/nonces.py b/src/borg/crypto/nonces.py index ec4700acf..c95cfe0bd 100644 --- a/src/borg/crypto/nonces.py +++ b/src/borg/crypto/nonces.py @@ -37,7 +37,7 @@ class NonceManager: def get_repo_free_nonce(self): try: return self.repository.get_free_nonce() - except InvalidRPCMethod as error: + except InvalidRPCMethod: # old server version, suppress further calls sys.stderr.write("Please upgrade to borg version 1.1+ on the server for safer AES-CTR nonce handling.\n") self.get_repo_free_nonce = lambda: None diff --git a/src/borg/testsuite/__init__.py b/src/borg/testsuite/__init__.py index b9c63e054..3dcafca55 100644 --- a/src/borg/testsuite/__init__.py +++ b/src/borg/testsuite/__init__.py @@ -111,7 +111,7 @@ def is_utime_fully_supported(): new_stats = os.stat(filepath, follow_symlinks=False) if new_stats.st_atime == 1000 and new_stats.st_mtime == 2000: return True - except OSError as err: + except OSError: pass return False @@ -133,7 +133,7 @@ def is_birthtime_fully_supported(): new_stats = os.stat(filepath, follow_symlinks=False) if new_stats.st_birthtime == birthtime and new_stats.st_mtime == mtime and new_stats.st_atime == atime: return True - except OSError as err: + except OSError: pass return False