Revert "Convert docstrings to reStructuredText"

This reverts commit 3b1bd242d0.
This commit is contained in:
Samantha Baldwin
2018-03-01 21:54:43 -05:00
parent f8fbfb591c
commit 09de58852e
32 changed files with 723 additions and 1064 deletions

View File

@@ -18,9 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with whipper. If not, see <http://www.gnu.org/licenses/>.
"""Reading .toc files.
"""
Reading .toc files
The .toc file format is described in the man page of cdrdao.
The .toc file format is described in the man page of cdrdao
"""
import re
@@ -92,40 +93,29 @@ _INDEX_RE = re.compile(r"""
class Sources:
"""I represent the list of sources used in the .toc file.
"""
I represent the list of sources used in the .toc file.
Each SILENCE and each FILE is a source.
If the filename for FILE doesn't change, the counter is not increased.
ivar sources:
vartype sources:
"""
def __init__(self):
self._sources = []
def append(self, counter, offset, source):
"""Append tuple containing source information to sources.
This method also logs the event.
:param counter: the source counter; updates for each different
data source (silence or different file path).
:type counter: int
:param offset: the absolute disc offset where this source starts.
:type offset:
:param source:
:type source:
"""
@param counter: the source counter; updates for each different
data source (silence or different file path)
@type counter: int
@param offset: the absolute disc offset where this source starts
"""
logger.debug('Appending source, counter %d, abs offset %d, '
'source %r' % (counter, offset, source))
self._sources.append((counter, offset, source))
def get(self, offset):
"""Retrieve the source used at the given offset.
:param offset:
:type offset:
"""
Retrieve the source used at the given offset.
"""
for i, (c, o, s) in enumerate(self._sources):
if offset < o:
@@ -134,10 +124,8 @@ class Sources:
return self._sources[-1]
def getCounterStart(self, counter):
"""Retrieve the absolute offset of the first source for this counter.
:param counter:
:type counter:
"""
Retrieve the absolute offset of the first source for this counter
"""
for i, (c, o, s) in enumerate(self._sources):
if c == counter:
@@ -147,21 +135,11 @@ class Sources:
class TocFile(object):
"""I represent a .toc file.
:ivar path:
:vartype path: unicode
:ivar messages:
:vartype messages:
:ivar table:
:vartype table:
:ivar logName:
:vartype logName:
:ivar sources:
:vartype sources:
"""
def __init__(self, path):
"""
@type path: unicode
"""
assert type(path) is unicode, "%r is not unicode" % path
self._path = path
self._messages = []
@@ -400,22 +378,17 @@ class TocFile(object):
logger.debug('parse: leadout: %r', self.table.leadout)
def message(self, number, message):
"""Add a message about a given line in the cue file.
"""
Add a message about a given line in the cue file.
:param number: line number, counting from 0.
:type number:
:param message:
:type message:
@param number: line number, counting from 0.
"""
self._messages.append((number + 1, message))
def getTrackLength(self, track):
"""Compute the length of the given track.
The lenght is computed from its INDEX 01 to the next track's INDEX 01.
:param track:
:type track:
"""
Returns the length of the given track, from its INDEX 01 to the next
track's INDEX 01
"""
# returns track length in frames, or -1 if can't be determined and
# complete file should be assumed
@@ -437,26 +410,26 @@ class TocFile(object):
return -1
def getRealPath(self, path):
"""Translate the .toc's FILE to an existing path.
"""
Translate the .toc's FILE to an existing path.
:param path:
:type path: unicode
@type path: unicode
"""
return common.getRealPath(self._path, path)
class File:
"""I represent a FILE line in a .toc file.
:ivar path:
:vartype path: C{unicode}
:ivar start: starting point for the track in this file, in frames.
:vartype start: C{int}
:ivar length: length for the track in this file, in frames.
:vartype length:
"""
I represent a FILE line in a .toc file.
"""
def __init__(self, path, start, length):
"""
@type path: C{unicode}
@type start: C{int}
@param start: starting point for the track in this file, in frames
@param length: length for the track in this file, in frames
"""
assert type(path) is unicode, "%r is not unicode" % path
self.path = path