[SCM] morituri/master: pep8 fixes

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:42 UTC 2014


The following commit has been merged in the master branch:
commit 0fab4515c6bca18b03c6e385b6e090a51cb86899
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Nov 11 23:00:37 2012 +0000

    pep8 fixes

diff --git a/Makefile.am b/Makefile.am
index c2a8f11..f8ef69f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@ coverage: _trial_temp/coverage
 	python misc/show-coverage.py `ls _trial_temp/coverage/morituri* | grep -v morituri.test | grep -v morituri.extern`
 
 pep8:
-	python misc/pep8.py $(SOURCES)
+	for file in $(SOURCES); do python misc/pep8.py --repeat $$file; done
 
 clean-local:
 	@rm -rf _trial_temp
diff --git a/morituri/common/log.py b/morituri/common/log.py
index e48069a..cb24fb9 100644
--- a/morituri/common/log.py
+++ b/morituri/common/log.py
@@ -27,6 +27,7 @@ Logging
 from morituri.extern.log import log as externlog
 from morituri.extern.log.log import *
 
+
 def init():
     externlog.init('RIP_DEBUG')
     externlog.setPackageScrubList('morituri')
diff --git a/morituri/common/musicbrainz.py b/morituri/common/musicbrainz.py
index ee24ad2..cb519b1 100644
--- a/morituri/common/musicbrainz.py
+++ b/morituri/common/musicbrainz.py
@@ -37,6 +37,7 @@ class MusicBrainzException(Exception):
 
 
 class TrackMetadata(object):
+
     artist = None
     title = None
     duration = None # in ms
@@ -131,6 +132,8 @@ def _getMetadata(release):
 
 
 # see http://bugs.musicbrainz.org/browser/python-musicbrainz2/trunk/examples/ripper.py
+
+
 def musicbrainz(discid):
     """
     Based on a MusicBrainz disc id, get a list of DiscMetadata objects
diff --git a/morituri/common/program.py b/morituri/common/program.py
index 00e0cf1..e0b8a39 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -32,6 +32,7 @@ from morituri.result import result
 from morituri.program import cdrdao, cdparanoia
 from morituri.image import image
 
+
 def filterForPath(text):
     return "-".join(text.split("/"))
 
diff --git a/morituri/common/renamer.py b/morituri/common/renamer.py
index 38c5e53..b92f1f4 100644
--- a/morituri/common/renamer.py
+++ b/morituri/common/renamer.py
@@ -29,6 +29,7 @@ Rename files on file system and inside metafiles in a resumable way.
 
 
 class Operator(object):
+
     def __init__(self, statePath, key):
         self._todo = []
         self._done = []
@@ -70,7 +71,6 @@ class Operator(object):
         # last task done is i; check if the next one might have gotten done.
         self._resuming = True
 
-
     def save(self):
         """
         Saves the state to the given state path using the given key.
@@ -112,6 +112,7 @@ class Operator(object):
 
 
 class FileRenamer(Operator):
+
     def addRename(self, source, destination):
         """
         Add a rename operation.
@@ -124,6 +125,7 @@ class FileRenamer(Operator):
 
 
 class Operation(object):
+
     def verify(self):
         """
         Check if the operation will succeed in the current conditions.
@@ -164,6 +166,7 @@ class Operation(object):
 
 
 class RenameFile(Operation):
+
     def __init__(self, source, destination):
         self._source = source
         self._destination = destination
@@ -189,6 +192,7 @@ class RenameFile(Operation):
 
 
 class RenameInFile(Operation):
+
     def __init__(self, path, source, destination):
         self._path = path
         self._source = source
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 0794b1a..f7744e7 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -5,8 +5,11 @@ from morituri.extern.log import log
 from morituri.extern.task import task, gstreamer
 
 # log.Loggable first to get logging
+
+
 class SyncRunner(log.Loggable, task.SyncRunner):
     pass
 
+
 class GstPipelineTask(log.Loggable, gstreamer.GstPipelineTask):
     pass
diff --git a/morituri/configure/installed.py.in b/morituri/configure/installed.py.in
index 0396985..8a78ae0 100644
--- a/morituri/configure/installed.py.in
+++ b/morituri/configure/installed.py.in
@@ -1,6 +1,7 @@
 # -*- Mode: Python -*-
 # vi:si:et:sw=4:sts=4:ts=4
 
+
 def get():
     return {
         'isinstalled': True,
diff --git a/morituri/configure/uninstalled.py.in b/morituri/configure/uninstalled.py.in
index 9269c60..4078f80 100644
--- a/morituri/configure/uninstalled.py.in
+++ b/morituri/configure/uninstalled.py.in
@@ -1,6 +1,7 @@
 # -*- Mode: Python -*-
 # vi:si:et:sw=4:sts=4:ts=4
 
+
 def get():
     return {
         'isinstalled': False,
diff --git a/morituri/extern/asyncsub.py b/morituri/extern/asyncsub.py
index f4a9b42..bb7f372 100644
--- a/morituri/extern/asyncsub.py
+++ b/morituri/extern/asyncsub.py
@@ -19,7 +19,9 @@ else:
     import select
     import fcntl
 
+
 class Popen(subprocess.Popen):
+
     def recv(self, maxsize=None):
         return self._recv('stdout', maxsize)
 
@@ -41,6 +43,7 @@ class Popen(subprocess.Popen):
         setattr(self, which, None)
 
     if subprocess.mswindows:
+
         def send(self, input):
             if not self.stdin:
                 return None
@@ -81,6 +84,7 @@ class Popen(subprocess.Popen):
             return read
 
     else:
+
         def send(self, input):
             if not self.stdin:
                 return None
@@ -123,6 +127,7 @@ class Popen(subprocess.Popen):
 
 message = "Other end disconnected!"
 
+
 def recv_some(p, t=.1, e=1, tr=5, stderr=0):
     if tr < 1:
         tr = 1
@@ -145,6 +150,7 @@ def recv_some(p, t=.1, e=1, tr=5, stderr=0):
             time.sleep(max((x-time.time())/tr, 0))
     return ''.join(y)
 
+
 def send_all(p, data):
     while len(data):
         sent = p.send(data)
diff --git a/morituri/image/cue.py b/morituri/image/cue.py
index d41a9c1..686c966 100644
--- a/morituri/image/cue.py
+++ b/morituri/image/cue.py
@@ -218,6 +218,7 @@ class File:
     """
     I represent a FILE line in a cue file.
     """
+
     def __init__(self, path, format):
         """
         @type  path: unicode
diff --git a/morituri/image/image.py b/morituri/image/image.py
index f363526..788b888 100644
--- a/morituri/image/image.py
+++ b/morituri/image/image.py
@@ -31,6 +31,7 @@ from morituri.image import cue, table
 
 from morituri.extern.task import task, gstreamer
 
+
 class Image(object, log.Loggable):
     """
     @ivar table: The Table of Contents for this image.
@@ -90,7 +91,8 @@ class Image(object, log.Loggable):
             tracks.append(t)
             # FIXME: this probably only works for non-compliant .CUE files
             # where pregap is put at end of previous file
-            t.index(1, absolute=offset, path=self.cue.table.tracks[i].getIndex(1).path,
+            t.index(1, absolute=offset,
+                path=self.cue.table.tracks[i].getIndex(1).path,
                 relative=0)
 
             offset += length
@@ -135,6 +137,7 @@ class AccurateRipChecksumTask(log.Loggable, task.MultiSeparateTask):
         self.checksums = [t.checksum for t in self.tasks]
         task.MultiSeparateTask.stop(self)
 
+
 class AudioLengthTask(log.Loggable, gstreamer.GstPipelineTask):
     """
     I calculate the length of a track in audio frames.
@@ -147,7 +150,6 @@ class AudioLengthTask(log.Loggable, gstreamer.GstPipelineTask):
 
     playing = False
 
-
     def __init__(self, path):
         """
         @type  path: unicode
@@ -186,6 +188,7 @@ class AudioLengthTask(log.Loggable, gstreamer.GstPipelineTask):
         self.pipeline.set_state(self.gst.STATE_NULL)
         self.stop()
 
+
 class ImageVerifyTask(log.Loggable, task.MultiSeparateTask):
     """
     I verify a disk image and get the necessary track lengths.
@@ -235,6 +238,7 @@ class ImageVerifyTask(log.Loggable, task.MultiSeparateTask):
 
         task.MultiSeparateTask.stop(self)
 
+
 class ImageEncodeTask(log.Loggable, task.MultiSeparateTask):
     """
     I encode a disk image to a different format.
diff --git a/morituri/image/table.py b/morituri/image/table.py
index d5f6974..ee8caa5 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -117,6 +117,7 @@ class Track:
 
         return self.indexes[1].absolute - self.indexes[0].absolute
 
+
 class Index:
     """
     @ivar counter: counter for the index source; distinguishes between
@@ -142,9 +143,10 @@ class Index:
         self.counter = counter
 
     def __repr__(self):
-        return '<Index %02d, absolute %r, path %r, relative %r, counter %r>' % (
+        return '<Index %02d absolute %r path %r relative %r counter %r>' % (
             self.number, self.absolute, self.path, self.relative, self.counter)
 
+
 class Table(object, log.Loggable):
     """
     I represent a table of indexes on a CD.
@@ -232,7 +234,6 @@ class Table(object, log.Loggable):
         """
         return len([t for t in self.tracks if not t.audio]) > 0
 
-
     def _cddbSum(self, i):
         ret = 0
         while i > 0:
@@ -287,8 +288,6 @@ class Table(object, log.Loggable):
         self.debug('CDDB values: %r', result)
         return result
 
-
-
     def getCDDBValues(self):
         """
         Get all CDDB values needed to calculate disc id and lookup URL.
@@ -353,7 +352,6 @@ class Table(object, log.Loggable):
 
         return result
 
-
     def getCDDBDiscId(self):
         """
         Calculate the CDDB disc ID.
@@ -364,7 +362,6 @@ class Table(object, log.Loggable):
         values = self.getCDDBValues()
         return "%08x" % values[0]
 
-
     def getMusicBrainzDiscId(self):
         """
         Calculate the MusicBrainz disc ID.
@@ -507,7 +504,6 @@ class Table(object, log.Loggable):
         self.debug('Musicbrainz values: %r', result)
         return result
 
-
     def getAccurateRipIds(self):
         """
         Calculate the two AccurateRip ID's.
@@ -622,6 +618,7 @@ class Table(object, log.Loggable):
         return "\n".join(lines)
 
     ### methods that modify the table
+
     def clearFiles(self):
         """
         Clear all file backings.
@@ -645,7 +642,6 @@ class Table(object, log.Loggable):
             except IndexError:
                 break
 
-
     def setFile(self, track, index, path, length, counter=None):
         """
         Sets the given file as the source from the given index on.
@@ -763,6 +759,7 @@ class Table(object, log.Loggable):
         return gap
 
     ### lookups
+
     def getNextTrackIndex(self, track, index):
         """
         Return the next track and index.
@@ -790,8 +787,8 @@ class Table(object, log.Loggable):
 
         return track, indexes[0]
 
-
     # various tests for types of Table
+
     def hasTOC(self):
         """
         Check if the Table has a complete TOC.
diff --git a/morituri/image/toc.py b/morituri/image/toc.py
index aba2410..3b16476 100644
--- a/morituri/image/toc.py
+++ b/morituri/image/toc.py
@@ -86,7 +86,9 @@ _INDEX_RE = re.compile(r"""
     \s(?P<offset>.+)$ # start offset
 """, re.VERBOSE)
 
+
 class TocFile(object, log.Loggable):
+
     def __init__(self, path):
         """
         @type  path: unicode
@@ -355,10 +357,12 @@ class TocFile(object, log.Loggable):
 
         raise KeyError("Cannot find file for %r" % path)
 
+
 class File:
     """
     I represent a FILE line in a .toc file.
     """
+
     def __init__(self, path, start, length):
         """
         @type  path: unicode
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index d620f5a..0bfe298 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -33,6 +33,7 @@ from morituri.common import log, common
 from morituri.extern import asyncsub
 from morituri.extern.task import task
 
+
 class FileSizeError(Exception):
 
     message = None
@@ -40,15 +41,18 @@ class FileSizeError(Exception):
     """
     The given path does not have the expected size.
     """
+
     def __init__(self, path, message):
         self.args = (path, message)
         self.path = path
         self.message = message
 
+
 class ReturnCodeError(Exception):
     """
     The program had a non-zero return code.
     """
+
     def __init__(self, returncode):
         self.args = (returncode, )
         self.returncode = returncode
@@ -69,6 +73,7 @@ _ERROR_RE = re.compile("^scsi_read error:")
 # from reading cdparanoia source code, it looks like offset is reported in
 # number of single-channel samples, ie. 2 bytes per unit, and absolute
 
+
 class ProgressParser(object):
     read = 0 # last [read] frame
     wrote = 0 # last [wrote] frame
@@ -92,7 +97,6 @@ class ProgressParser(object):
 
         self._reads = {} # read count for each sector
 
-
     def parse(self, line):
         """
         Parse a line.
@@ -188,6 +192,8 @@ class ProgressParser(object):
 
 
 # FIXME: handle errors
+
+
 class ReadTrackTask(log.Loggable, task.Task):
     """
     I am a task that reads a track using cdparanoia.
@@ -366,6 +372,7 @@ class ReadTrackTask(log.Loggable, task.Task):
         self.stop()
         return
 
+
 class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
     """
     I am a task that reads and verifies a track using cdparanoia.
@@ -460,7 +467,8 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
         # we chain up should be handled by a parent class function ?
         try:
             if not self.exception:
-                self.quality = max(self.tasks[0].quality, self.tasks[2].quality)
+                self.quality = max(self.tasks[0].quality,
+                    self.tasks[2].quality)
                 self.peak = self.tasks[4].peak
                 self.debug('peak: %r', self.peak)
 
diff --git a/morituri/program/cdrdao.py b/morituri/program/cdrdao.py
index a97c36c..0b1fb7b 100644
--- a/morituri/program/cdrdao.py
+++ b/morituri/program/cdrdao.py
@@ -38,6 +38,7 @@ class ProgramError(Exception):
     """
     The program had a fatal error.
     """
+
     def __init__(self, errorMessage):
         self.args = (errorMessage, )
         self.errorMessage = errorMessage
@@ -80,6 +81,7 @@ class LineParser(object, log.Loggable):
     Parse incoming bytes into lines
     Calls 'parse' on owner for each parsed line.
     """
+
     def __init__(self, owner):
         self._buffer = ""     # accumulate characters
         self._lines = []      # accumulate lines
@@ -132,7 +134,8 @@ class OutputParser(object, log.Loggable):
         # find counter in LEADOUT state; only when we read full toc
         self.log('state: %s, buffer bytes: %d', self._state, len(self._buffer))
         if self._buffer and self._state == 'LEADOUT':
-            # split on lines that end in \r, which reset cursor to counter start
+            # split on lines that end in \r, which reset cursor to counter
+            # start
             # this misses the first one, but that's ok:
             # length 03:40:71...\n00:01:00
             times = self._buffer.split('\r')
@@ -183,7 +186,6 @@ class OutputParser(object, log.Loggable):
             self._parse(lines)
             self._lines.extend(lines)
 
-
     def _parse(self, lines):
         for line in lines:
             #print 'parsing', len(line), line
@@ -207,7 +209,6 @@ class OutputParser(object, log.Loggable):
             error = m.group('error')
             self._task.errors.append(error)
 
-
     def _parse_TRACK(self, line):
         if line.startswith('---'):
             return
@@ -382,7 +383,6 @@ class DiscInfoTask(CDRDAOTask):
     def readbyteserr(self, bytes):
         self.parser.read(bytes)
 
-
     def parse(self, line):
         # called by parser
         if line.startswith('Sessions'):
@@ -572,12 +572,14 @@ class ReadTOCTask(ReadAllSessionsTask):
 
 
 class DeviceOpenException(Exception):
+
     def __init__(self, msg):
         self.msg = msg
         self.args = (msg, )
 
 
 class ProgramFailedException(Exception):
+
     def __init__(self, code):
         self.code = code
         self.args = (code, )
diff --git a/morituri/result/logger.py b/morituri/result/logger.py
index 7df4eca..7ae1871 100644
--- a/morituri/result/logger.py
+++ b/morituri/result/logger.py
@@ -25,13 +25,13 @@ import time
 from morituri.common import common
 from morituri.configure import configure
 
+
 class MorituriLogger(object):
 
     def log(self, ripResult, epoch=time.time()):
         lines = self.logRip(ripResult, epoch=epoch)
         return '\n'.join(lines)
 
-
     def logRip(self, ripResult, epoch):
 
         lines = []
diff --git a/morituri/result/result.py b/morituri/result/result.py
index c94e87e..e6efe72 100644
--- a/morituri/result/result.py
+++ b/morituri/result/result.py
@@ -24,6 +24,7 @@ import time
 
 from morituri.result import logger
 
+
 class TrackResult:
     """
     @type filename:          unicode
@@ -70,6 +71,7 @@ class TrackResult:
 
     classVersion = 2
 
+
 class RipResult:
     """
     I hold information about the result for rips.
@@ -104,6 +106,7 @@ class RipResult:
 
         return None
 
+
 class Logger(object):
     """
     I log the result of a rip.
@@ -120,5 +123,6 @@ class Logger(object):
         """
         raise NotImplementedError
 
+
 def getLogger():
     return logger.MorituriLogger()
diff --git a/morituri/rip/accurip.py b/morituri/rip/accurip.py
index d6dd864..bda12d0 100644
--- a/morituri/rip/accurip.py
+++ b/morituri/rip/accurip.py
@@ -22,7 +22,9 @@
 
 from morituri.common import logcommand, accurip
 
+
 class Show(logcommand.LogCommand):
+
     summary = "show accuraterip data"
 
     def do(self, args):
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 334a355..e9e6320 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -201,6 +201,7 @@ See  http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
             prog.result.model = 'Unknown'
 
         # FIXME: turn this into a method
+
         def ripIfNotRipped(number):
             # we can have a previous result
             trackResult = prog.result.getTrackResult(number)
@@ -364,6 +365,7 @@ See  http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
 
 
 class CD(logcommand.LogCommand):
+
     summary = "handle CD's"
 
     subCommandClasses = [Rip, ]
diff --git a/morituri/rip/debug.py b/morituri/rip/debug.py
index edf48cd..ff7dda2 100644
--- a/morituri/rip/debug.py
+++ b/morituri/rip/debug.py
@@ -24,6 +24,7 @@ from morituri.common import logcommand
 
 from morituri.common import task
 
+
 class Checksum(logcommand.LogCommand):
 
     summary = "run a checksum task"
@@ -46,7 +47,6 @@ class Checksum(logcommand.LogCommand):
         self.stdout.write('Checksum: %08x\n' % checksumtask.checksum)
 
 
-
 class Encode(logcommand.LogCommand):
 
     summary = "run an encode task"
@@ -85,11 +85,11 @@ class Encode(logcommand.LogCommand):
 
         runner.run(encodetask)
 
+
 class MusicBrainzNGS(logcommand.LogCommand):
 
     summary = "examine MusicBrainz NGS info"
 
-
     def do(self, args):
         try:
             discId = unicode(args[0])
@@ -112,7 +112,9 @@ class MusicBrainzNGS(logcommand.LogCommand):
                     j + 1, track.artist.encode('utf-8'),
                     track.title.encode('utf-8')))
 
+
 class Debug(logcommand.LogCommand):
+
     summary = "debug internals"
 
     subCommandClasses = [Checksum, Encode, MusicBrainzNGS]
diff --git a/morituri/rip/drive.py b/morituri/rip/drive.py
index 4e8d354..cae3873 100644
--- a/morituri/rip/drive.py
+++ b/morituri/rip/drive.py
@@ -22,7 +22,9 @@
 
 from morituri.common import logcommand, drive
 
+
 class List(logcommand.LogCommand):
+
     summary = "list drives"
 
     def do(self, args):
@@ -52,6 +54,7 @@ class List(logcommand.LogCommand):
 
 
 class Drive(logcommand.LogCommand):
+
     summary = "handle drives"
 
     subCommandClasses = [List, ]
diff --git a/morituri/rip/image.py b/morituri/rip/image.py
index bde5e8a..589fbfc 100644
--- a/morituri/rip/image.py
+++ b/morituri/rip/image.py
@@ -30,6 +30,7 @@ from morituri.extern.task import task
 
 
 class Encode(logcommand.LogCommand):
+
     summary = "encode image"
 
     def addOptions(self):
@@ -49,7 +50,6 @@ class Encode(logcommand.LogCommand):
                 default, "', '".join(encode.ALL_PROFILES.keys())),
             default=default)
 
-
     def do(self, args):
         prog = program.Program()
         prog.outdir = (self.options.output_directory or os.getcwd())
@@ -98,7 +98,9 @@ class Encode(logcommand.LogCommand):
                         outm3u.write('%s' % root)
                 outm3u.close()
 
+
 class Retag(logcommand.LogCommand):
+
     summary = "retag image files"
 
     def do(self, args):
@@ -135,7 +137,9 @@ class Retag(logcommand.LogCommand):
                     print '%s already tagged correctly' % path
             print
 
+
 class Verify(logcommand.LogCommand):
+
     summary = "verify image"
 
     def do(self, args):
@@ -163,7 +167,9 @@ class Verify(logcommand.LogCommand):
 
             print "\n".join(prog.getAccurateRipResults()) + "\n"
 
+
 class Image(logcommand.LogCommand):
+
     summary = "handle images"
 
     description = """
diff --git a/morituri/rip/main.py b/morituri/rip/main.py
index ee4be17..523ccef 100644
--- a/morituri/rip/main.py
+++ b/morituri/rip/main.py
@@ -10,6 +10,7 @@ from morituri.rip import cd, offset, drive, image, accurip, debug
 from morituri.extern.command import command
 from morituri.extern.task import task
 
+
 def main(argv):
     c = Rip()
     try:
@@ -53,6 +54,7 @@ cdrdao says:
 
     return ret
 
+
 class Rip(logcommand.LogCommand):
     usage = "%prog %command"
     description = """Rip rips CD's.
diff --git a/morituri/rip/offset.py b/morituri/rip/offset.py
index 377fe2e..5106093 100644
--- a/morituri/rip/offset.py
+++ b/morituri/rip/offset.py
@@ -45,6 +45,7 @@ OFFSETS = "+6, +48, +102, +667, +12, +30, +618, +594, +738, -472, " + \
           "-495, -494, +975, +935, +87, +668, +1776, +1364, +1336, " + \
           "+1127"
 
+
 class Find(logcommand.LogCommand):
     summary = "find drive read offset"
     description = """Find drive's read offset by ripping tracks from a
@@ -85,7 +86,6 @@ CD in the AccurateRip database."""
 
         # this can be a symlink to another device
 
-
     def do(self, args):
         prog = program.Program()
         runner = task.SyncRunner()
@@ -214,6 +214,7 @@ CD in the AccurateRip database."""
         os.unlink(path)
         return "%08x" % t.checksum
 
+
 class Offset(logcommand.LogCommand):
     summary = "handle drive offsets"
 

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list