From 3b2e0d650d7f03a467bc5b9628ce37804353bb33 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Thu, 4 Jul 2013 08:38:53 +0300 Subject: [PATCH] bmap-tools: make one-line comments comply with PEP257 Change-Id: Ib40a22d44a56e1c7274e415a2ee67db99efc992f Signed-off-by: Artem Bityutskiy --- bmaptool | 3 --- bmaptools/BmapCreate.py | 3 --- bmaptools/BmapHelpers.py | 2 -- bmaptools/Fiemap.py | 2 -- bmaptools/TransRead.py | 8 -------- 5 files changed, 18 deletions(-) diff --git a/bmaptool b/bmaptool index fef8325..5482f98 100755 --- a/bmaptool +++ b/bmaptool @@ -185,7 +185,6 @@ def copy_command_open_all(args, log): def copy_command(args, log): """Copy an image to a block device or a regular file using bmap.""" - image_obj, dest_obj, bmap_obj, bmap_path, image_size, dest_is_blkdev = \ copy_command_open_all(args, log) try: @@ -313,7 +312,6 @@ def create_command(args, log): def parse_arguments(): """A helper function which parses the input arguments.""" - text = "Create block map (bmap) and copy files using bmap. The " \ "documentation can be found here: " \ "source.tizen.org/documentation/reference/bmaptool" @@ -408,7 +406,6 @@ def setup_logger(loglevel): def main(): """Script entry point.""" - args = parse_arguments() if args.quiet: diff --git a/bmaptools/BmapCreate.py b/bmaptools/BmapCreate.py index 394fa8a..3b7c2da 100644 --- a/bmaptools/BmapCreate.py +++ b/bmaptools/BmapCreate.py @@ -108,7 +108,6 @@ class BmapCreate: def _open_image_file(self): """Open the image file.""" - try: self._f_image = open(self._image_path, 'rb') except IOError as err: @@ -119,7 +118,6 @@ class BmapCreate: def _open_bmap_file(self): """Open the bmap file.""" - try: self._f_bmap = open(self._bmap_path, 'w+') except IOError as err: @@ -318,7 +316,6 @@ class BmapCreate: def __del__(self): """The class destructor which closes the opened files.""" - if self._f_image_needs_close: self._f_image.close() if self._f_bmap_needs_close: diff --git a/bmaptools/BmapHelpers.py b/bmaptools/BmapHelpers.py index c0cf8af..21ae05f 100644 --- a/bmaptools/BmapHelpers.py +++ b/bmaptools/BmapHelpers.py @@ -15,7 +15,6 @@ This module contains various shared helper functions. def human_size(size): """Transform size in bytes into a human-readable form.""" - if size == 1: return "1 byte" @@ -31,7 +30,6 @@ def human_size(size): def human_time(seconds): """Transform time in seconds to the HH:MM:SS format.""" - (minutes, seconds) = divmod(seconds, 60) (hours, minutes) = divmod(minutes, 60) diff --git a/bmaptools/Fiemap.py b/bmaptools/Fiemap.py index 46c2858..0889df1 100644 --- a/bmaptools/Fiemap.py +++ b/bmaptools/Fiemap.py @@ -61,7 +61,6 @@ class Fiemap: def _open_image_file(self): """Open the image file.""" - try: self._f_image = open(self._image_path, 'rb') except IOError as err: @@ -132,7 +131,6 @@ class Fiemap: def __del__(self): """The class destructor which closes the opened files.""" - if self._f_image_needs_close: self._f_image.close() diff --git a/bmaptools/TransRead.py b/bmaptools/TransRead.py index 512403d..d2f31c3 100644 --- a/bmaptools/TransRead.py +++ b/bmaptools/TransRead.py @@ -113,17 +113,14 @@ class _CompressedFile: def seek(self, offset, whence=os.SEEK_SET): """The 'seek()' method, similar to the one file objects have.""" - self._pos = _fake_seek_forward(self, self._pos, offset, whence) def tell(self): """The 'tell()' method, similar to the one file objects have.""" - return self._pos def _read_from_buffer(self, length): """Read from the internal buffer.""" - buffer_len = len(self._buffer) if buffer_len - self._buffer_pos > length: data = self._buffer[self._buffer_pos:self._buffer_pos + length] @@ -394,7 +391,6 @@ class TransRead: def _create_local_copy(self): """Create a local copy of a remote or compressed file.""" - import tempfile try: @@ -471,7 +467,6 @@ class TransRead: def __del__(self): """The class destructor which closes opened files.""" - if self._transfile_obj: self._transfile_obj.close() if self._file_obj: @@ -481,7 +476,6 @@ class TransRead: def seek(self, offset, whence=os.SEEK_SET): """The 'seek()' method, similar to the one file objects have.""" - if self._force_fake_seek or not hasattr(self._transfile_obj, "seek"): self._pos = _fake_seek_forward(self._transfile_obj, self._pos, \ offset, whence) @@ -490,7 +484,6 @@ class TransRead: def tell(self): """The 'tell()' method, similar to the one file objects have.""" - if self._force_fake_seek or not hasattr(self._transfile_obj, "tell"): return self._pos else: @@ -498,7 +491,6 @@ class TransRead: def close(self): """Close the file-like object.""" - self.__del__() def __getattr__(self, name): -- 2.7.4