Add docstring for _util._write_passphrase() function.

testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-18 04:37:30 +00:00
parent f1a6526b5c
commit 6874f7b838
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 8 additions and 0 deletions

View File

@ -342,6 +342,14 @@ def _which(executable, flags=os.X_OK):
return result
def _write_passphrase(stream, passphrase, encoding):
"""Write the passphrase from memory to the GnuPG process' stdin.
:type stream: file, :class:BytesIO, or :class:StringIO
:param stream: The input file descriptor to write the password to.
:param str passphrase: The passphrase for the secret key material.
:param str encoding: The data encoding expected by GnuPG. Usually, this
is ``sys.getfilesystemencoding()``.
"""
passphrase = '%s\n' % passphrase
passphrase = passphrase.encode(encoding)
stream.write(passphrase)