diff --git a/paramiko/__init__.py b/paramiko/__init__.py index bfd28f2..f081de2 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -19,7 +19,7 @@ import sys if sys.version_info < (2, 5): - raise RuntimeError('You need python 2.5+ for this module.') + raise RuntimeError('You need Python 2.5+ for this module.') __author__ = "Jeff Forcier " diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index e12859a..0c9efa1 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -167,7 +167,7 @@ class AuthHandler (object): e = self.transport.get_exception() if e is None: e = AuthenticationException('Authentication failed.') - # this is horrible. python Exception isn't yet descended from + # this is horrible. Python Exception isn't yet descended from # object, so type(e) won't work. :( if issubclass(e.__class__, PartialAuthentication): return e.allowed_types diff --git a/paramiko/channel.py b/paramiko/channel.py index a7816a3..630a60c 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -44,7 +44,7 @@ class Channel (object): """ A secure tunnel across an SSH `.Transport`. A Channel is meant to behave like a socket, and has an API that should be indistinguishable from the - python socket API. + Python socket API. Because SSH2 has a windowing kind of flow control, if you stop reading data from a Channel and its buffer fills up, the server will be unable to send @@ -788,7 +788,7 @@ class Channel (object): .. note:: If the channel is closed while only part of the data hase been sent, there is no way to determine how much data (if any) was sent. - This is irritating, but identically follows python's API. + This is irritating, but identically follows Python's API. """ while s: if self.closed: @@ -826,9 +826,9 @@ class Channel (object): """ Return a file-like object associated with this channel. The optional ``mode`` and ``bufsize`` arguments are interpreted the same way as by - the built-in ``file()`` function in python. + the built-in ``file()`` function in Python. - :return: object which can be used for python file I/O. + :return: object which can be used for Python file I/O. :rtype: `.ChannelFile` """ return ChannelFile(*([self] + list(params))) @@ -840,11 +840,11 @@ class Channel (object): without a pty will ever have data on the stderr stream. The optional ``mode`` and ``bufsize`` arguments are interpreted the - same way as by the built-in ``file()`` function in python. For a + same way as by the built-in ``file()`` function in Python. For a client, it only makes sense to open this file for reading. For a server, it only makes sense to open this file for writing. - :return: object which can be used for python file I/O. + :return: object which can be used for Python file I/O. :rtype: `.ChannelFile` .. versionadded:: 1.1 @@ -854,7 +854,7 @@ class Channel (object): def fileno(self): """ Returns an OS-level file descriptor which can be used for polling, but - but not for reading or writing. This is primaily to allow python's + but not for reading or writing. This is primaily to allow Python's ``select`` module to work. The first time ``fileno`` is called on a channel, a pipe is created to diff --git a/paramiko/client.py b/paramiko/client.py index 17e942d..8646131 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -301,12 +301,12 @@ class SSHClient (object): """ Execute a command on the SSH server. A new `.Channel` is opened and the requested command is executed. The command's input and output - streams are returned as python ``file``-like objects representing + streams are returned as Python ``file``-like objects representing stdin, stdout, and stderr. :param command: the command to execute :type command: str - :param bufsize: interpreted the same way as by the built-in ``file()`` function in python + :param bufsize: interpreted the same way as by the built-in ``file()`` function in Python :type bufsize: int :param timeout: set command's channel timeout. See `Channel.settimeout`.settimeout :type timeout: int @@ -529,7 +529,7 @@ class RejectPolicy (MissingHostKeyPolicy): class WarningPolicy (MissingHostKeyPolicy): """ - Policy for logging a python-style warning for an unknown host key, but + Policy for logging a Python-style warning for an unknown host key, but accepting it. This is used by `.SSHClient`. """ def missing_host_key(self, client, hostname, key): diff --git a/paramiko/file.py b/paramiko/file.py index f843f93..2f8499e 100644 --- a/paramiko/file.py +++ b/paramiko/file.py @@ -21,7 +21,7 @@ from cStringIO import StringIO class BufferedFile (object): """ - Reusable base class to implement python-style file buffering around a + Reusable base class to implement Python-style file buffering around a simpler stream. """ @@ -344,7 +344,7 @@ class BufferedFile (object): def xreadlines(self): """ Identical to ``iter(f)``. This is a deprecated file interface that - predates python iterator support. + predates Python iterator support. :return: an iterator. :rtype: iterator diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py index 7b6b1f1..1eed350 100644 --- a/paramiko/hostkeys.py +++ b/paramiko/hostkeys.py @@ -298,7 +298,7 @@ class HostKeys (UserDict.DictMixin): self._entries.append(HostKeyEntry([hostname], entry[key_type])) def keys(self): - # python 2.4 sets would be nice here. + # Python 2.4 sets would be nice here. ret = [] for e in self._entries: for h in e.hostnames: diff --git a/paramiko/logging22.py b/paramiko/logging22.py index e68c52c..34a9a93 100644 --- a/paramiko/logging22.py +++ b/paramiko/logging22.py @@ -17,7 +17,7 @@ # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. """ -Stub out logging on python < 2.3. +Stub out logging on Python < 2.3. """ diff --git a/paramiko/message.py b/paramiko/message.py index 3937938..55a8eb4 100644 --- a/paramiko/message.py +++ b/paramiko/message.py @@ -29,7 +29,7 @@ from paramiko import util class Message (object): """ An SSH2 Message is a stream of bytes that encodes some combination of - strings, integers, bools, and infinite-precision integers (known in python + strings, integers, bools, and infinite-precision integers (known in Python as longs). This class builds or breaks down such a byte stream. Normally you don't need to deal with anything this low-level, but it's diff --git a/paramiko/packet.py b/paramiko/packet.py index efdb2d0..0f8152f 100644 --- a/paramiko/packet.py +++ b/paramiko/packet.py @@ -103,7 +103,7 @@ class Packetizer (object): def set_log(self, log): """ - Set the python log object to use for logging. + Set the Python log object to use for logging. """ self.__logger = log diff --git a/paramiko/pkey.py b/paramiko/pkey.py index 655eb3e..21995bf 100644 --- a/paramiko/pkey.py +++ b/paramiko/pkey.py @@ -178,7 +178,7 @@ class PKey (object): Create a key object by reading a private key file. If the private key is encrypted and ``password`` is not ``None``, the given password will be used to decrypt the key (otherwise `.PasswordRequiredException` - is thrown). Through the magic of python, this factory method will + is thrown). Through the magic of Python, this factory method will exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but is useless on the abstract PKey class. diff --git a/paramiko/resource.py b/paramiko/resource.py index 32947c5..8e8d9ee 100644 --- a/paramiko/resource.py +++ b/paramiko/resource.py @@ -28,7 +28,7 @@ class ResourceManager (object): A registry of objects and resources that should be closed when those objects are deleted. - This is meant to be a safer alternative to python's ``__del__`` method, + This is meant to be a safer alternative to Python's ``__del__`` method, which can cause reference cycles to never be collected. Objects registered with the ResourceManager can be collected but still free resources when they die. @@ -47,7 +47,7 @@ class ResourceManager (object): """ Register a resource to be closed with an object is collected. - When the given ``obj`` is garbage-collected by the python interpreter, + When the given ``obj`` is garbage-collected by the Python interpreter, the ``resource`` will be closed by having its ``close()`` method called. Any exceptions are ignored. diff --git a/paramiko/server.py b/paramiko/server.py index e38fcbb..9ff7243 100644 --- a/paramiko/server.py +++ b/paramiko/server.py @@ -626,7 +626,7 @@ class SubsystemHandler (threading.Thread): underlying `.Transport` is closed. This can be done by checking `Transport.is_active` or noticing an EOF on the `.Channel`. If this method loops forever without checking - for this case, your python interpreter may refuse to exit because + for this case, your Python interpreter may refuse to exit because this thread will still be running. :param name: name of the requested subsystem. diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py index e524837..d1d6223 100644 --- a/paramiko/sftp_client.py +++ b/paramiko/sftp_client.py @@ -196,30 +196,30 @@ class SFTPClient (BaseSFTP): def open(self, filename, mode='r', bufsize=-1): """ Open a file on the remote server. The arguments are the same as for - python's built-in ``file`` (aka ``open``). A file-like object is - returned, which closely mimics the behavior of a normal python file + Python's built-in ``file`` (aka ``open``). A file-like object is + returned, which closely mimics the behavior of a normal Python file object, including the ability to be used as a context manager. The mode indicates how the file is to be opened: ``'r'`` for reading, ``'w'`` for writing (truncating an existing file), ``'a'`` for appending, ``'r+'`` for reading/writing, ``'w+'`` for reading/writing (truncating an - existing file), ``'a+'`` for reading/appending. The python ``'b'`` flag + existing file), ``'a+'`` for reading/appending. The Python ``'b'`` flag is ignored, since SSH treats all files as binary. The ``'U'`` flag is supported in a compatible way. Since 1.5.2, an ``'x'`` flag indicates that the operation should only succeed if the file was created and did not previously exist. This has - no direct mapping to python's file flags, but is commonly known as the + no direct mapping to Python's file flags, but is commonly known as the ``O_EXCL`` flag in posix. - The file will be buffered in standard python style by default, but + The file will be buffered in standard Python style by default, but can be altered with the ``bufsize`` parameter. ``0`` turns off buffering, ``1`` uses line buffering, and any number greater than 1 (``>1``) uses that specific buffer size. :param filename: name of the file to open :type filename: str - :param mode: mode (python-style) to open in + :param mode: mode (Python-style) to open in :type mode: str :param bufsize: desired buffering (-1 = default buffer size) :type bufsize: int @@ -249,7 +249,7 @@ class SFTPClient (BaseSFTP): self._log(DEBUG, 'open(%r, %r) -> %s' % (filename, mode, hexlify(handle))) return SFTPFile(self, handle, mode, bufsize) - # python continues to vacillate about "open" vs "file"... + # Python continues to vacillate about "open" vs "file"... file = open def remove(self, path): @@ -317,11 +317,11 @@ class SFTPClient (BaseSFTP): """ Retrieve information about a file on the remote system. The return value is an object whose attributes correspond to the attributes of - python's ``stat`` structure as returned by ``os.stat``, except that it + Python's ``stat`` structure as returned by ``os.stat``, except that it contains fewer fields. An SFTP server may return as much or as little info as it wants, so the results may vary from server to server. - Unlike a python ``stat`` object, the result may not be accessed as a + Unlike a Python ``stat`` object, the result may not be accessed as a tuple. This is mostly due to the author's slack factor. The fields supported are: ``st_mode``, ``st_size``, ``st_uid``, ``st_gid``, @@ -376,7 +376,7 @@ class SFTPClient (BaseSFTP): def chmod(self, path, mode): """ Change the mode (permissions) of a file. The permissions are - unix-style and identical to those used by python's ``os.chmod`` + unix-style and identical to those used by Python's ``os.chmod`` function. :param path: path of the file to change the permissions of @@ -393,7 +393,7 @@ class SFTPClient (BaseSFTP): def chown(self, path, uid, gid): """ Change the owner (``uid``) and group (``gid``) of a file. As with - python's ``os.chown`` function, you must pass both arguments, so if you + Python's ``os.chown`` function, you must pass both arguments, so if you only want to change one, use `stat` first to retrieve the current owner and group. @@ -416,7 +416,7 @@ class SFTPClient (BaseSFTP): ``times`` is ``None``, then the file's access and modified times are set to the current time. Otherwise, ``times`` must be a 2-tuple of numbers, of the form ``(atime, mtime)``, which is used to set the access and - modified times, respectively. This bizarre API is mimicked from python + modified times, respectively. This bizarre API is mimicked from Python for the sake of consistency -- I apologize. :param path: path of the file to modify @@ -437,7 +437,7 @@ class SFTPClient (BaseSFTP): """ Change the size of the file specified by ``path``. This usually extends or shrinks the size of the file, just like the ``truncate()`` method on - python file objects. + Python file objects. :param path: path of the file to modify :type path: str diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py index 770fa12..fa026ec 100644 --- a/paramiko/sftp_file.py +++ b/paramiko/sftp_file.py @@ -240,7 +240,7 @@ class SFTPFile (BufferedFile): def chmod(self, mode): """ Change the mode (permissions) of this file. The permissions are - unix-style and identical to those used by python's ``os.chmod`` + unix-style and identical to those used by Python's ``os.chmod`` function. :param mode: new permissions @@ -254,7 +254,7 @@ class SFTPFile (BufferedFile): def chown(self, uid, gid): """ Change the owner (``uid``) and group (``gid``) of this file. As with - python's ``os.chown`` function, you must pass both arguments, so if you + Python's ``os.chown`` function, you must pass both arguments, so if you only want to change one, use `stat` first to retrieve the current owner and group. @@ -274,7 +274,7 @@ class SFTPFile (BufferedFile): ``times`` is ``None``, then the file's access and modified times are set to the current time. Otherwise, ``times`` must be a 2-tuple of numbers, of the form ``(atime, mtime)``, which is used to set the access and - modified times, respectively. This bizarre API is mimicked from python + modified times, respectively. This bizarre API is mimicked from Python for the sake of consistency -- I apologize. :param times: ``None`` or a tuple of (access time, modified time) in @@ -292,7 +292,7 @@ class SFTPFile (BufferedFile): """ Change the size of this file. This usually extends or shrinks the size of the file, just like the ``truncate()`` method on - python file objects. + Python file objects. :param size: the new size of the file :type size: int or long diff --git a/paramiko/sftp_handle.py b/paramiko/sftp_handle.py index 9b609da..7e1389a 100644 --- a/paramiko/sftp_handle.py +++ b/paramiko/sftp_handle.py @@ -72,16 +72,16 @@ class SFTPHandle (object): def read(self, offset, length): """ Read up to ``length`` bytes from this file, starting at position - ``offset``. The offset may be a python long, since SFTP allows it + ``offset``. The offset may be a Python long, since SFTP allows it to be 64 bits. If the end of the file has been reached, this method may return an empty string to signify EOF, or it may also return `.SFTP_EOF`. The default implementation checks for an attribute on ``self`` named - ``readfile``, and if present, performs the read operation on the python + ``readfile``, and if present, performs the read operation on the Python file-like object found there. (This is meant as a time saver for the - common case where you are wrapping a python file object.) + common case where you are wrapping a Python file object.) :param offset: position in the file to start reading from. :type offset: int or long @@ -109,13 +109,13 @@ class SFTPHandle (object): def write(self, offset, data): """ Write ``data`` into this file at position ``offset``. Extending the - file past its original end is expected. Unlike python's normal + file past its original end is expected. Unlike Python's normal ``write()`` methods, this method cannot do a partial write: it must write all of ``data`` or else return an error. The default implementation checks for an attribute on ``self`` named ``writefile``, and if present, performs the write operation on the - python file-like object found there. The attribute is named + Python file-like object found there. The attribute is named differently from ``readfile`` to make it easy to implement read-only (or write-only) files, but if both attributes are present, they should refer to the same file. diff --git a/paramiko/sftp_server.py b/paramiko/sftp_server.py index d45bc0f..c7e80c1 100644 --- a/paramiko/sftp_server.py +++ b/paramiko/sftp_server.py @@ -296,7 +296,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler): self._send_packet(CMD_EXTENDED_REPLY, str(msg)) def _convert_pflags(self, pflags): - "convert SFTP-style open() flags to python's os.open() flags" + "convert SFTP-style open() flags to Python's os.open() flags" if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): flags = os.O_RDWR elif pflags & SFTP_FLAG_WRITE: diff --git a/paramiko/sftp_si.py b/paramiko/sftp_si.py index 4078b30..b2debd3 100644 --- a/paramiko/sftp_si.py +++ b/paramiko/sftp_si.py @@ -94,7 +94,7 @@ class SFTPServerInterface (object): the client didn't specify them. .. note:: The SFTP protocol defines all files to be in "binary" mode. - There is no equivalent to python's "text" mode. + There is no equivalent to Python's "text" mode. :param path: the requested path (relative or absolute) of the file to be opened. @@ -265,7 +265,7 @@ class SFTPServerInterface (object): specific folder, you probably don't want this method to reveal path names outside that folder. - You may find the python methods in ``os.path`` useful, especially + You may find the Python methods in ``os.path`` useful, especially ``os.path.normpath`` and ``os.path.realpath``. The default implementation returns ``os.path.normpath('/' + path)``. diff --git a/paramiko/util.py b/paramiko/util.py index 63f86f7..0a75da7 100644 --- a/paramiko/util.py +++ b/paramiko/util.py @@ -34,7 +34,7 @@ from paramiko.common import * from paramiko.config import SSHConfig -# Change by RogerB - python < 2.3 doesn't have enumerate so we implement it +# Change by RogerB - Python < 2.3 doesn't have enumerate so we implement it if sys.version_info < (2,3): class enumerate: def __init__ (self, sequence): @@ -217,7 +217,7 @@ def lookup_ssh_host_config(hostname, config): return config.lookup(hostname) def mod_inverse(x, m): - # it's crazy how small python can make this function. + # it's crazy how small Python can make this function. u1, u2, u3 = 1, 0, m v1, v2, v3 = 0, 1, x