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.
:param file_obj: a file-like object to read the config file from
:type file_obj: file
:param file file_obj: a file-like object to read the config file from
"""
host = {"host": ['*'], "config": {}}
for line in file_obj:
@ -110,10 +109,8 @@ class SSHConfig (object):
``"port"``, not ``"Port"``. The values are processed according to the
rules for substitution variable expansion in ``ssh_config``.
:param hostname: the hostname to lookup
:type hostname: str
:param str hostname: the hostname to lookup
"""
matches = [config for config in self._config if
self._allowed(hostname, config['host'])]
@ -148,10 +145,8 @@ class SSHConfig (object):
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param config: the config for the hostname
:type hostname: dict
:param hostname: the hostname that the config belongs to
:type hostname: str
:param dict config: the config for the hostname
:param str hostname: the hostname that the config belongs to
"""
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 host key or authentication key.
:param bits: number of bits the generated key should be.
:type bits: int
:param progress_func: an optional function to call at key points in
key generation (used by ``pyCrypto.PublicKey``).
:type progress_func: function
:return: new private key
:rtype: `.DSSKey`
:param int bits: number of bits the generated key should be.
:param function progress_func:
an optional function to call at key points in key generation (used
by ``pyCrypto.PublicKey``).
:return: new `.DSSKey` private key
"""
dsa = DSA.generate(bits, rng.read, progress_func)
key = DSSKey(vals=(dsa.p, dsa.q, dsa.g, dsa.y))

View File

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