Format init

This commit is contained in:
Jeff Forcier 2014-02-24 17:19:38 -08:00
parent e2ac82c47c
commit a00316af15
1 changed files with 13 additions and 13 deletions

View File

@ -127,14 +127,15 @@ class Transport (threading.Thread):
def __init__(self, sock): def __init__(self, sock):
""" """
Create a new SSH session over an existing socket, or socket-like Create a new SSH session over an existing socket, or socket-like
object. This only creates the Transport object; it doesn't begin the object. This only creates the `.Transport` object; it doesn't begin the
SSH session yet. Use `connect` or `start_client` to begin a client SSH session yet. Use `connect` or `start_client` to begin a client
session, or `start_server` to begin a server session. session, or `start_server` to begin a server session.
If the object is not actually a socket, it must have the following If the object is not actually a socket, it must have the following
methods: methods:
- ``send(str)``: Writes from 1 to ``len(str)`` bytes, and
returns an int representing the number of bytes written. Returns - ``send(str)``: Writes from 1 to ``len(str)`` bytes, and returns an
int representing the number of bytes written. Returns
0 or raises ``EOFError`` if the stream has been closed. 0 or raises ``EOFError`` if the stream has been closed.
- ``recv(int)``: Reads from 1 to ``int`` bytes and returns them as a - ``recv(int)``: Reads from 1 to ``int`` bytes and returns them as a
string. Returns 0 or raises ``EOFError`` if the stream has been string. Returns 0 or raises ``EOFError`` if the stream has been
@ -146,11 +147,10 @@ class Transport (threading.Thread):
string as the ``sock`` argument. (A host string is a hostname with an string as the ``sock`` argument. (A host string is a hostname with an
optional port (separated by ``":"``) which will be converted into a optional port (separated by ``":"``) which will be converted into a
tuple of ``(hostname, port)``.) A socket will be connected to this tuple of ``(hostname, port)``.) A socket will be connected to this
address and used for communication. Exceptions from the ``socket`` call address and used for communication. Exceptions from the ``socket``
may be thrown in this case. call may be thrown in this case.
:param sock: a socket or socket-like object to create the session over. :param socket sock: a socket or socket-like object to create the session over.
:type sock: socket
""" """
if isinstance(sock, (str, unicode)): if isinstance(sock, (str, unicode)):
# convert "host:port" into (host, port) # convert "host:port" into (host, port)