From 45ad2dcaf97a373a6b62b78b115ae3c8eb4c47a1 Mon Sep 17 00:00:00 2001 From: John Dewey Date: Tue, 25 Jan 2011 18:09:02 -0800 Subject: Fixing documentation strings. Second attempt at pep8. Many of the files under nova/image/*.py do not appear to follow the same documentation string rules. --- nova/image/local.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/nova/image/local.py b/nova/image/local.py index c4b7b9ad5..177e81a30 100644 --- a/nova/image/local.py +++ b/nova/image/local.py @@ -27,8 +27,8 @@ from nova.image import service class LocalImageService(service.BaseImageService): """Image service storing images to local disk. - - It assumes that image_ids are integers.""" + It assumes that image_ids are integers. + """ def __init__(self): self._path = tempfile.mkdtemp() @@ -53,41 +53,37 @@ class LocalImageService(service.BaseImageService): raise exception.NotFound def create(self, context, data): - """ - Store the image data and return the new image id. - """ + """Store the image data and return the new image id.""" id = random.randint(0, 2 ** 31 - 1) data['id'] = id self.update(context, id, data) return id def update(self, context, image_id, data): - """ - Replace the contents of the given image with the new data. - """ + """Replace the contents of the given image with the new data.""" try: pickle.dump(data, open(self._path_to(image_id), 'w')) except IOError: raise exception.NotFound def delete(self, context, image_id): + """Delete the given image. + Raises OSError if the image does not exist. """ - Delete the given image. Raises OSError if the image does not exist. - """ + try: os.unlink(self._path_to(image_id)) except IOError: raise exception.NotFound def delete_all(self): - """ - Clears out all images in local directory. - """ + """Clears out all images in local directory.""" for id in self._ids(): os.unlink(self._path_to(id)) def delete_imagedir(self): + """Deletes the local directory. + Raises OSError if directory is not empty. """ - Deletes the local directory. Raises OSError if directory is not empty. - """ + os.rmdir(self._path) -- cgit