More info field updates

This commit is contained in:
Jeff Forcier 2014-02-26 12:44:58 -08:00
parent 01f365a3e1
commit 79a69e88c3
3 changed files with 26 additions and 48 deletions

View File

@ -51,8 +51,7 @@ class SSHConfig (object):
""" """
Read an OpenSSH config from the given file object. Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from :param file file_obj: a file-like object to read the config file from
:type file_obj: file
""" """
host = {"host": ['*'], "config": {}} host = {"host": ['*'], "config": {}}
for line in file_obj: for line in file_obj:
@ -110,10 +109,8 @@ class SSHConfig (object):
``"port"``, not ``"Port"``. The values are processed according to the ``"port"``, not ``"Port"``. The values are processed according to the
rules for substitution variable expansion in ``ssh_config``. rules for substitution variable expansion in ``ssh_config``.
:param hostname: the hostname to lookup :param str hostname: the hostname to lookup
:type hostname: str
""" """
matches = [config for config in self._config if matches = [config for config in self._config if
self._allowed(hostname, config['host'])] self._allowed(hostname, config['host'])]
@ -148,10 +145,8 @@ class SSHConfig (object):
Please refer to man ``ssh_config`` for the parameters that Please refer to man ``ssh_config`` for the parameters that
are replaced. are replaced.
:param config: the config for the hostname :param dict config: the config for the hostname
:type hostname: dict :param str hostname: the hostname that the config belongs to
:param hostname: the hostname that the config belongs to
:type hostname: str
""" """
if 'hostname' in config: if 'hostname' in config:

View File

@ -153,13 +153,11 @@ class DSSKey (PKey):
Generate a new private DSS key. This factory function can be used to Generate a new private DSS key. This factory function can be used to
generate a new host key or authentication key. generate a new host key or authentication key.
:param bits: number of bits the generated key should be. :param int bits: number of bits the generated key should be.
:type bits: int :param function progress_func:
:param progress_func: an optional function to call at key points in an optional function to call at key points in key generation (used
key generation (used by ``pyCrypto.PublicKey``). by ``pyCrypto.PublicKey``).
:type progress_func: function :return: new `.DSSKey` private key
:return: new private key
:rtype: `.DSSKey`
""" """
dsa = DSA.generate(bits, rng.read, progress_func) dsa = DSA.generate(bits, rng.read, progress_func)
key = DSSKey(vals=(dsa.p, dsa.q, dsa.g, dsa.y)) key = DSSKey(vals=(dsa.p, dsa.q, dsa.g, dsa.y))

View File

@ -64,8 +64,6 @@ class BufferedFile (object):
its own iterator. its own iterator.
:raises ValueError: if the file is closed. :raises ValueError: if the file is closed.
:rtype: iterator
""" """
if self._closed: if self._closed:
raise ValueError('I/O operation on closed file') raise ValueError('I/O operation on closed file')
@ -95,8 +93,7 @@ class BufferedFile (object):
:raises StopIteration: when the end of the file is reached. :raises StopIteration: when the end of the file is reached.
:return: a line read from the file. :return: a line (`str`) read from the file.
:rtype: str
""" """
line = self.readline() line = self.readline()
if not line: if not line:
@ -109,11 +106,10 @@ class BufferedFile (object):
file first). If the ``size`` argument is negative or omitted, read all file first). If the ``size`` argument is negative or omitted, read all
the remaining data in the file. the remaining data in the file.
:param size: maximum number of bytes to read :param int size: maximum number of bytes to read
:type size: int :return:
:return: data read from the file, or an empty string if EOF was data read from the file (as a `str`), or an empty string if EOF was
encountered immediately encountered immediately
:rtype: str
""" """
if self._closed: if self._closed:
raise IOError('File is closed') raise IOError('File is closed')
@ -170,12 +166,10 @@ class BufferedFile (object):
Unlike stdio's ``fgets``, the returned string contains null Unlike stdio's ``fgets``, the returned string contains null
characters (``'\\0'``) if they occurred in the input. characters (``'\\0'``) if they occurred in the input.
:param size: maximum length of returned string. :param int size: maximum length of returned string.
:type size: int
:return: :return:
next line of the file, or an empty string if the end of the file next line of the file (`str`), or an empty string if the end of the
has been reached. file has been reached.
:rtype: str
""" """
# it's almost silly how complex this function is. # it's almost silly how complex this function is.
if self._closed: if self._closed:
@ -245,10 +239,8 @@ class BufferedFile (object):
to EOF, whole lines totalling approximately sizehint bytes (possibly to EOF, whole lines totalling approximately sizehint bytes (possibly
after rounding up to an internal buffer size) are read. after rounding up to an internal buffer size) are read.
:param sizehint: desired maximum number of bytes to read. :param int sizehint: desired maximum number of bytes to read.
:type sizehint: int :return: `list` of lines read from the file.
:return: list of lines read from the file.
:rtype: list
""" """
lines = [] lines = []
bytes = 0 bytes = 0
@ -271,12 +263,11 @@ class BufferedFile (object):
operations will be undone at the next write (as the file position operations will be undone at the next write (as the file position
will move back to the end of the file). will move back to the end of the file).
:param offset: position to move to within the file, relative to :param int offset:
``whence``. position to move to within the file, relative to ``whence``.
:type offset: int :param int whence:
:param whence: type of movement: 0 = absolute; 1 = relative to the type of movement: 0 = absolute; 1 = relative to the current
current position; 2 = relative to the end of the file. position; 2 = relative to the end of the file.
:type whence: int
:raises IOError: if the file doesn't support random access. :raises IOError: if the file doesn't support random access.
""" """
@ -288,8 +279,7 @@ class BufferedFile (object):
useful if the underlying file doesn't support random access, or was useful if the underlying file doesn't support random access, or was
opened in append mode. opened in append mode.
:return: file position (in bytes). :return: file position (`number <int>` of bytes).
:rtype: int
""" """
return self._pos return self._pos
@ -300,8 +290,7 @@ class BufferedFile (object):
written yet. (Use `flush` or `close` to force buffered data to be written yet. (Use `flush` or `close` to force buffered data to be
written out.) written out.)
:param data: data to write. :param str data: data to write
:type data: str
""" """
if self._closed: if self._closed:
raise IOError('File is closed') raise IOError('File is closed')
@ -334,8 +323,7 @@ class BufferedFile (object):
name is intended to match `readlines`; `writelines` does not add line name is intended to match `readlines`; `writelines` does not add line
separators.) separators.)
:param sequence: an iterable sequence of strings. :param iterable sequence: an iterable sequence of strings.
:type sequence: sequence
""" """
for line in sequence: for line in sequence:
self.write(line) self.write(line)
@ -345,9 +333,6 @@ class BufferedFile (object):
""" """
Identical to ``iter(f)``. This is a deprecated file interface that Identical to ``iter(f)``. This is a deprecated file interface that
predates Python iterator support. predates Python iterator support.
:return: an iterator.
:rtype: iterator
""" """
return self return self