pylint clean ups

This commit is contained in:
John Schember 2009-01-20 20:54:36 -05:00
parent eba26565b8
commit 02e4e537e4
3 changed files with 8 additions and 8 deletions

View File

@ -51,10 +51,10 @@ class CYBOOKG3(USBMS):
return size return size
return os.path.getsize(obj) return os.path.getsize(obj)
sizes = map(get_size, files) sizes = [get_size(f) for f in files]
size = sum(sizes) size = sum(sizes)
if on_card and size > self.free_space()[2] - 1024*1024: if on_card and size > self.free_space()[2] - 1024*1024:
raise FreeSpaceError(_("There is insufficient free space on the storage card")) raise FreeSpaceError(_("There is insufficient free space on the storage card"))
if not on_card and size > self.free_space()[0] - 2*1024*1024: if not on_card and size > self.free_space()[0] - 2*1024*1024:
raise FreeSpaceError(_("There is insufficient free space in main memory")) raise FreeSpaceError(_("There is insufficient free space in main memory"))

View File

@ -191,7 +191,6 @@ class Device(_Device):
self._main_prefix = drives['main'] if 'main' in drives.keys() else None self._main_prefix = drives['main'] if 'main' in drives.keys() else None
self._card_prefix = drives['card'] if 'card' in drives.keys() else None self._card_prefix = drives['card'] if 'card' in drives.keys() else None
@classmethod
def get_osx_mountpoints(self, raw=None): def get_osx_mountpoints(self, raw=None):
if raw is None: if raw is None:
ioreg = '/usr/sbin/ioreg' ioreg = '/usr/sbin/ioreg'
@ -226,11 +225,11 @@ class Device(_Device):
dev_pat = r'/dev/%s(\w*)\s+on\s+([^\(]+)\s+' dev_pat = r'/dev/%s(\w*)\s+on\s+([^\(]+)\s+'
if 'main' not in names.keys(): if 'main' not in names.keys():
raise DeviceError(_('Unable to detect the %s disk drive. Try rebooting.')%self.__class__.__name__) raise DeviceError(_('Unable to detect the %s disk drive. Try rebooting.')%self.__class__.__name__)
main_pat = dev_pat%names['main'] main_pat = dev_pat % names['main']
self._main_prefix = re.search(main_pat, mount).group(2) + os.sep self._main_prefix = re.search(main_pat, mount).group(2) + os.sep
card_pat = names['card'] if 'card' in names.keys() else None card_pat = names['card'] if 'card' in names.keys() else None
if card_pat is not None: if card_pat is not None:
card_pat = dev_pat%card_pat card_pat = dev_pat % card_pat
self._card_prefix = re.search(card_pat, mount).group(2) + os.sep self._card_prefix = re.search(card_pat, mount).group(2) + os.sep
def open_linux(self): def open_linux(self):

View File

@ -34,7 +34,7 @@ class USBMS(Device):
SUPPORTS_SUB_DIRS = False SUPPORTS_SUB_DIRS = False
def __init__(self, key='-1', log_packets=False, report_progress=None): def __init__(self, key='-1', log_packets=False, report_progress=None):
pass Device.__init__(self, key, log_packets, report_progress)
def get_device_information(self, end_session=True): def get_device_information(self, end_session=True):
""" """
@ -54,7 +54,8 @@ class USBMS(Device):
# Get all books in all directories under the root ebook_dir directory # Get all books in all directories under the root ebook_dir directory
for path, dirs, files in os.walk(os.path.join(prefix, ebook_dir)): for path, dirs, files in os.walk(os.path.join(prefix, ebook_dir)):
# Filter out anything that isn't in the list of supported ebook types # Filter out anything that isn't in the list of supported ebook
# types
for book_type in self.FORMATS: for book_type in self.FORMATS:
for filename in fnmatch.filter(files, '*.%s' % (book_type)): for filename in fnmatch.filter(files, '*.%s' % (book_type)):
title, author, mime = self.__class__.extract_book_metadata_by_filename(filename) title, author, mime = self.__class__.extract_book_metadata_by_filename(filename)
@ -80,7 +81,7 @@ class USBMS(Device):
return size return size
return os.path.getsize(obj) return os.path.getsize(obj)
sizes = map(get_size, files) sizes = [get_size(f) for f in files]
size = sum(sizes) size = sum(sizes)
if on_card and size > self.free_space()[2] - 1024*1024: if on_card and size > self.free_space()[2] - 1024*1024: