Improve docstrings

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2019-03-20 21:12:56 +00:00
parent 3b269e7a3b
commit e56c636fd3
26 changed files with 583 additions and 488 deletions

View File

@@ -37,13 +37,10 @@ logger = logging.getLogger(__name__)
class FileSizeError(Exception):
"""The given path does not have the expected size."""
message = None
"""
The given path does not have the expected size.
"""
def __init__(self, path, message):
self.args = (path, message)
self.path = path
@@ -51,9 +48,7 @@ class FileSizeError(Exception):
class ReturnCodeError(Exception):
"""
The program had a non-zero return code.
"""
"""The program had a non-zero return code."""
def __init__(self, returncode):
self.args = (returncode, )
@@ -88,10 +83,12 @@ class ProgressParser:
def __init__(self, start, stop):
"""
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive)
:type stop: int
Init ProgressParser.
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive)
:type stop: int
"""
self.start = start
self.stop = stop
@@ -102,9 +99,7 @@ class ProgressParser:
self._reads = {} # read count for each sector
def parse(self, line):
"""
Parse a line.
"""
"""Parse a line."""
m = _PROGRESS_RE.search(line)
if m:
# code = int(m.group('code'))
@@ -185,6 +180,7 @@ class ProgressParser:
def getTrackQuality(self):
"""
Each frame gets read twice.
More than two reads for a frame reduce track quality.
"""
frames = self.stop - self.start + 1 # + 1 since stop is inclusive
@@ -203,9 +199,7 @@ class ProgressParser:
class ReadTrackTask(task.Task):
"""
I am a task that reads a track using cdparanoia.
"""
"""Task that reads a track using cdparanoia."""
description = "Reading track"
quality = None # set at end of reading
@@ -219,22 +213,22 @@ class ReadTrackTask(task.Task):
"""
Read the given track.
:param path: where to store the ripped track
:type path: str
:param table: table of contents of CD
:type table: table.Table
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive); >= start
:type stop: int
:param path: where to store the ripped track
:type path: str
:param table: table of contents of CD
:type table: table.Table
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive); >= start
:type stop: int
:param offset: read offset, in samples
:type offset: int
:type offset: int
:param device: the device to rip from
:type device: str
:type device: str
:param action: a string representing the action; e.g. Read/Verify
:type action: str
:param what: a string representing what's being read; e.g. Track
:type what: str
:type action: str
:param what: a string representing what's being read; e.g. Track
:type what: str
"""
assert isinstance(path, str), "%r is not str" % path
@@ -395,22 +389,23 @@ class ReadTrackTask(task.Task):
class ReadVerifyTrackTask(task.MultiSeparateTask):
"""
I am a task that reads and verifies a track using cdparanoia.
I also encode the track.
Task that reads and verifies a track using cdparanoia.
It also encodes the track.
The path where the file is stored can be changed if necessary, for
example if the file name is too long.
:cvar checksum: the checksum of the track; set if they match.
:cvar testchecksum: the test checksum of the track.
:cvar copychecksum: the copy checksum of the track.
:cvar testspeed: the test speed of the track, as a multiple of
track duration.
:cvar copyspeed: the copy speed of the track, as a multiple of
track duration.
:cvar testduration: the test duration of the track, in seconds.
:cvar copyduration: the copy duration of the track, in seconds.
:cvar peak: the peak level of the track
:cvar checksum: the checksum of the track; set if they match
:cvar testchecksum: the test checksum of the track
:cvar copychecksum: the copy checksum of the track
:cvar testspeed: the test speed of the track, as a multiple of
track duration
:cvar copyspeed: the copy speed of the track, as a multiple of
track duration
:cvar testduration: the test duration of the track, in seconds
:cvar copyduration: the copy duration of the track, in seconds
:cvar peak: the peak level of the track
"""
checksum = None
@@ -429,20 +424,22 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
def __init__(self, path, table, start, stop, overread, offset=0,
device=None, taglist=None, what="track", coverArtPath=None):
"""
:param path: where to store the ripped track
:type path: str
:param table: table of contents of CD
:type table: table.Table
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive)
:type stop: int
:param offset: read offset, in samples
:type offset: int
:param device: the device to rip from
:type device: str
Init ReadVerifyTrackTask.
:param path: where to store the ripped track
:type path: str
:param table: table of contents of CD
:type table: table.Table
:param start: first frame to rip
:type start: int
:param stop: last frame to rip (inclusive)
:type stop: int
:param offset: read offset, in samples
:type offset: int
:param device: the device to rip from
:type device: str
:param taglist: a dict of tags
:type taglist: dict
:type taglist: dict
"""
task.MultiSeparateTask.__init__(self)