Update docstrings for _read_data(), _handle_io(), and _collect_output().

feature/documentation-builds-html
Isis Lovecruft 2013-04-15 00:55:45 +00:00
parent d2b1ae62c2
commit 6c0370efaa
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 4 additions and 7 deletions

View File

@ -361,7 +361,7 @@ class GPG(object):
result.stderr = ''.join(lines) result.stderr = ''.join(lines)
def _read_data(self, stream, result): def _read_data(self, stream, result):
# Read the contents of the file from GPG's stdout """Read the contents of the file from GPG's stdout."""
chunks = [] chunks = []
while True: while True:
data = stream.read(1024) data = stream.read(1024)
@ -369,15 +369,14 @@ class GPG(object):
break break
logger.debug("chunk: %r" % data[:256]) logger.debug("chunk: %r" % data[:256])
chunks.append(data) chunks.append(data)
if _py3k: if util._py3k:
# Join using b'' or '', as appropriate # Join using b'' or '', as appropriate
result.data = type(data)().join(chunks) result.data = type(data)().join(chunks)
else: else:
result.data = ''.join(chunks) result.data = ''.join(chunks)
def _collect_output(self, process, result, writer=None, stdin=None): def _collect_output(self, process, result, writer=None, stdin=None):
""" """Drain the subprocesses output streams, writing the collected output
Drain the subprocesses output streams, writing the collected output
to the result. If a writer thread (writing to the subprocess) is given, to the result. If a writer thread (writing to the subprocess) is given,
make sure it's joined before returning. If a stdin stream is given, make sure it's joined before returning. If a stdin stream is given,
close it before returning. close it before returning.
@ -408,9 +407,7 @@ class GPG(object):
stdout.close() stdout.close()
def _handle_io(self, args, file, result, passphrase=False, binary=False): def _handle_io(self, args, file, result, passphrase=False, binary=False):
""" """Handle a call to GPG - pass input data, collect output data."""
Handle a call to GPG - pass input data, collect output data.
"""
p = self._open_subprocess(args, passphrase) p = self._open_subprocess(args, passphrase)
if not binary: if not binary:
stdin = codecs.getwriter(self.encoding)(p.stdin) stdin = codecs.getwriter(self.encoding)(p.stdin)