summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Waldmann <tw@waldmann-edv.de>2015-02-27 18:27:46 +0100
committerLars Wirzenius <liw@liw.fi>2015-03-22 14:07:22 +0200
commitbece5d28349ac226713537bef07f85af65b96a26 (patch)
treec3003da386da80106f1ac0a3ea55dde2e3eb75a0
parent787478a81bbc7c1c74ed5c0f2d5ef26022ec4e42 (diff)
downloadobnam-bece5d28349ac226713537bef07f85af65b96a26.tar.gz
avoid shadowing builtins
-rw-r--r--obnamlib/encryption.py4
-rw-r--r--obnamlib/fmt_6/clientmetadatatree.py4
-rw-r--r--obnamlib/fmt_simple/simple.py8
-rw-r--r--obnamlib/plugins/show_plugin.py6
-rw-r--r--obnamlib/structurederror.py4
-rw-r--r--obnamlib/vfs_local_tests.py4
-rwxr-xr-xsetup.py10
7 files changed, 20 insertions, 20 deletions
diff --git a/obnamlib/encryption.py b/obnamlib/encryption.py
index 775e008a..ddd50fd7 100644
--- a/obnamlib/encryption.py
+++ b/obnamlib/encryption.py
@@ -38,9 +38,9 @@ def generate_symmetric_key(numbits, filename='/dev/random'):
tracing.trace('numbits=%d', numbits)
- bytes = (numbits + 7) / 8
+ count = (numbits + 7) / 8
f = open(filename, 'rb')
- key = f.read(bytes)
+ key = f.read(count)
f.close()
return key.encode('hex')
diff --git a/obnamlib/fmt_6/clientmetadatatree.py b/obnamlib/fmt_6/clientmetadatatree.py
index a652fb44..ac977504 100644
--- a/obnamlib/fmt_6/clientmetadatatree.py
+++ b/obnamlib/fmt_6/clientmetadatatree.py
@@ -88,11 +88,11 @@ class ClientMetadataTree(obnamlib.RepositoryTree):
def default_file_id(self, filename):
'''Return hash of filename suitable for use as main key.'''
tracing.trace(repr(filename))
- def hash(s):
+ def shorthash(s):
return hashlib.md5(s).digest()[:4]
dirname = os.path.dirname(filename)
basename = os.path.basename(filename)
- return hash(dirname) + hash(basename)
+ return shorthash(dirname) + shorthash(basename)
def _bad_default_file_id(self, filename):
'''For use by unit tests.'''
diff --git a/obnamlib/fmt_simple/simple.py b/obnamlib/fmt_simple/simple.py
index 663d8333..bc6f996a 100644
--- a/obnamlib/fmt_simple/simple.py
+++ b/obnamlib/fmt_simple/simple.py
@@ -420,11 +420,11 @@ class SimpleClient(SimpleToplevel):
generations = self._data.get('generations', [])
ids = [int(gen['id']) for gen in generations]
if ids:
- newest = ids[-1]
- next = newest + 1
+ newest_id = ids[-1]
+ next_id = newest_id + 1
else:
- next = 1
- return str(next)
+ next_id = 1
+ return str(next_id)
def remove_generation(self, gen_number):
self._require_lock()
diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py
index 7efe124e..d9d481d7 100644
--- a/obnamlib/plugins/show_plugin.py
+++ b/obnamlib/plugins/show_plugin.py
@@ -199,9 +199,9 @@ class ShowPlugin(obnamlib.ObnamPlugin):
ended = self.format_time(ended)
hdr('Generation %s (%s - %s)\n' %
(self.repo.make_generation_spec(gen_id), started, ended))
- for file in args:
- file = self.remove_trailing_slashes(file)
- self.show_objects(cb, gen_id, file)
+ for filename in args:
+ filename = self.remove_trailing_slashes(filename)
+ self.show_objects(cb, gen_id, filename)
self.repo.close()
diff --git a/obnamlib/structurederror.py b/obnamlib/structurederror.py
index 18c13e5a..16051743 100644
--- a/obnamlib/structurederror.py
+++ b/obnamlib/structurederror.py
@@ -100,8 +100,8 @@ class StructuredError(Exception):
summer = hashlib.md5()
summer.update(self.__class__.__name__)
summer.update(self.__class__.__module__)
- hash = summer.hexdigest()[:5]
- return 'R{0}X'.format(hash.upper())
+ shorthash = summer.hexdigest()[:5]
+ return 'R{0}X'.format(shorthash.upper())
def _format_msg(self, template):
# In case template is a docstring, remove leading whitespace
diff --git a/obnamlib/vfs_local_tests.py b/obnamlib/vfs_local_tests.py
index e709d79a..eb497d2f 100644
--- a/obnamlib/vfs_local_tests.py
+++ b/obnamlib/vfs_local_tests.py
@@ -69,13 +69,13 @@ class XAttrTests(unittest.TestCase):
# attribute with the command line tool.
try:
- exit, out, err = cliapp.runcmd_unchecked(
+ exitcode, out, err = cliapp.runcmd_unchecked(
['setfattr', '-n', 'user.foo', 'bar', self.other])
except OSError:
# Either xattr aren't supported, or setfattr isn't
# installed and we can't test.
return False
- return exit == 0
+ return exitcode == 0
def test_empty_list(self):
'''A new file has no extended attributes.'''
diff --git a/setup.py b/setup.py
index 9b541810..15f37f91 100755
--- a/setup.py
+++ b/setup.py
@@ -192,8 +192,8 @@ class Check(Command):
os.remove('.coverage')
def run_yarn(self):
- for format in self.get_wanted_formats():
- self.run_yarn_for_repo_format(format)
+ for repo_format in self.get_wanted_formats():
+ self.run_yarn_for_repo_format(repo_format)
def get_wanted_formats(self):
if 'REPOSITORY_FORMAT' in os.environ:
@@ -201,11 +201,11 @@ class Check(Command):
else:
return ['6', 'simple']
- def run_yarn_for_repo_format(self, format):
- print 'run yarn for repository format %s' % format
+ def run_yarn_for_repo_format(self, repo_format):
+ print 'run yarn for repository format %s' % repo_format
runcmd(
['yarn', '-s', 'yarns/obnam.sh'] +
- ['--env', 'REPOSITORY_FORMAT=' + format] +
+ ['--env', 'REPOSITORY_FORMAT=' + repo_format] +
glob.glob('yarns/*.yarn'))
def run_lock_test(self, num_clients, num_generations):