Update docstring for GPG.encrypt_file().

feature/documentation-builds-html
Isis Lovecruft 2013-04-15 01:09:32 +00:00
parent 4a719cec79
commit af996b8a69
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 32 additions and 3 deletions

View File

@ -786,9 +786,38 @@ class GPG(object):
# ENCRYPTION
#
def encrypt_file(self, file, recipients, sign=None,
always_trust=False, passphrase=None,
armor=True, output=None, symmetric=False):
"""Encrypt the message read from the file-like object :param:file ."""
always_trust=False, passphrase=None,
armor=True, output=None, symmetric=False):
"""Encrypt the message read from ``file``.
:type file: file or :class:BytesIO
:param file: The file or bytestream to encrypt.
:type recipients: str or list or tuple
:param recipients: The recipients to encrypt to. Recipients may be
specified by UID or keyID/fingerprint.
:param str sign: The keyID to use for signing, i.e.
"gpg --sign --default-key A3ADB67A2CDB8B35 ..."
:param bool always_trust: If True, ignore trust warnings on recipient
keys. If False, display trust warnings.
(default: False)
:param bool passphrase: If True, use the stored passphrase for our
secret key.
:param bool armor: If True, ascii armor the encrypted output; if False,
the encrypted output will be in binary
format. (default: True)
:param str output: The output file to write to. If not specified, the
encrypted output is returned, and thus should be
stored as an object in Python. For example:
>>> gpg = gnupg.GPG(gpghome='./tmp_test')
"""
if output: # write the output to a file with the specified name
if os.path.exists(output):
os.remove(output) # to avoid overwrite confirmation message
args.append('--output "%s"' % output)
args = ['--encrypt']
if symmetric:
args = ['--symmetric']