From 713a5d14fd03c11a4fcdfc3f414f57abdd0eb2f2 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 22 May 2009 20:29:09 +0000 Subject: [PATCH] * morituri/common/common.py: * morituri/common/renamer.py: Pychecker fixes. --- ChangeLog | 6 ++++++ morituri/common/common.py | 16 ++++++++-------- morituri/common/renamer.py | 6 +++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e1afa6..516417e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-05-22 Thomas Vander Stichele + + * morituri/common/common.py: + * morituri/common/renamer.py: + Pychecker fixes. + 2009-05-22 Thomas Vander Stichele * RELEASE: diff --git a/morituri/common/common.py b/morituri/common/common.py index c922fb7..d90b2c8 100644 --- a/morituri/common/common.py +++ b/morituri/common/common.py @@ -90,7 +90,7 @@ class Persister(object): self._unpickle(default) - def persist(self, object=None): + def persist(self, obj=None): """ Persist the given object, if we have a persistence path and the object changed. @@ -99,27 +99,27 @@ class Persister(object): If object is given, only persist if it was changed. """ # don't pickle if it's already ok - if object and object == self.object: + if obj and obj == self.object: return # store the object on ourselves if not None - if object is not None: - self.object = object + if obj is not None: + self.object = obj # don't pickle if there is no path if not self._path: return # default to pickling our object again - if object is None: - object = self.object + if obj is None: + obj = self.object # pickle - self.object = object + self.object = obj (fd, path) = tempfile.mkstemp(suffix='.morituri.pickle') handle = os.fdopen(fd, 'wb') import pickle - pickle.dump(object, handle, 2) + pickle.dump(obj, handle, 2) handle.close() # do an atomic move shutil.move(path, self._path) diff --git a/morituri/common/renamer.py b/morituri/common/renamer.py index 6bf5e49..ae14526 100644 --- a/morituri/common/renamer.py +++ b/morituri/common/renamer.py @@ -200,13 +200,13 @@ class RenameInFile(Operation): # check if the source exists in the given file def do(self): - input = open(self._path) + handle = open(self._path) (fd, name) = tempfile.mkstemp(suffix='.morituri') - for s in input: + for s in handle: os.write(fd, s.replace(self._source, self._destination)) - input.close() + handle.close() os.close(fd) os.rename(name, self._path)