Skip to content

Commit 7e3ab17

Browse files
authored
Py2 (#249)
* Migrated output classes from namedtuples to slotted objects * Updated changelog * Updated docs
1 parent 94b5617 commit 7e3ab17

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

Changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Change Log
22
============
33

4+
2.3.2
5+
+++++
6+
7+
Fixes
8+
-----
9+
10+
* Client output implementation Python 2 support.
11+
12+
413
2.3.1
514
+++++
615

doc/index.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
Parallel-SSH Documentation
33
===========================
44

5-
.. image:: https://img.shields.io/badge/License-LGPL%20v2-blue.svg
5+
.. image:: https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg
66
:target: https://pypi.python.org/pypi/parallel-ssh
77
:alt: License
88
.. image:: https://img.shields.io/pypi/v/parallel-ssh.svg
99
:target: https://pypi.python.org/pypi/parallel-ssh
1010
:alt: Latest Version
11-
.. image:: https://travis-ci.org/ParallelSSH/parallel-ssh.svg?branch=master
12-
:target: https://travis-ci.org/ParallelSSH/parallel-ssh
13-
.. image:: https://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python?svg=true&branch=master
14-
:target: https://ci.appveyor.com/project/pkittenis/ssh2-python
11+
.. image:: https://circleci.com/gh/ParallelSSH/parallel-ssh/tree/master.svg?style=svg
12+
:target: https://circleci.com/gh/ParallelSSH/parallel-ssh
1513
.. image:: https://codecov.io/gh/ParallelSSH/parallel-ssh/branch/master/graph/badge.svg
1614
:target: https://codecov.io/gh/ParallelSSH/parallel-ssh
1715
.. image:: https://img.shields.io/pypi/wheel/parallel-ssh.svg

pssh/output.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,37 @@
1818

1919
"""Output module of ParallelSSH"""
2020

21-
from collections import namedtuple
2221
from os import linesep
2322

2423
from . import logger
2524

2625

27-
HostOutputBuffers = namedtuple('HostOutputBuffers', ['stdout', 'stderr'], )
28-
HostOutputBuffers.__doc__ = """
29-
:param stdout: Stdout data
30-
:type stdout: :py:class:`BufferData`
31-
:param stderr: Stderr data
32-
:type stderr: :py:class:`BufferData`
33-
"""
34-
HostOutputBuffers.stdout.__doc__ = "Stdout :py:class:`BufferData`"
35-
HostOutputBuffers.stderr.__doc__ = "Stderr :py:class:`BufferData`"
36-
37-
BufferData = namedtuple('BufferData', ['reader', 'rw_buffer'])
38-
BufferData.__doc__ = """
39-
:param reader: Reader
40-
:type reader: :py:class:`gevent.Greenlet`
41-
:param rw_bufffer: Read/write buffer
42-
:type rw_buffer: :py:class:`pssh.clients.reader.ConcurrentRWBuffer`
43-
"""
44-
BufferData.rw_buffer.__doc__ = "Read/write buffer"
45-
BufferData.reader.__doc__ = "Greenlet reading data from channel and writing to rw_buffer"
26+
class HostOutputBuffers(object):
27+
__slots__ = ('stdout', 'stderr')
28+
29+
def __init__(self, stdout, stderr):
30+
"""
31+
:param stdout: Stdout data
32+
:type stdout: :py:class:`BufferData`
33+
:param stderr: Stderr data
34+
:type stderr: :py:class:`BufferData`
35+
"""
36+
self.stdout = stdout
37+
self.stderr = stderr
38+
39+
40+
class BufferData(object):
41+
__slots__ = ('reader', 'rw_buffer')
42+
43+
def __init__(self, reader, rw_buffer):
44+
"""
45+
:param reader: Greenlet reading data from channel and writing to rw_buffer
46+
:type reader: :py:class:`gevent.Greenlet`
47+
:param rw_bufffer: Read/write buffer
48+
:type rw_buffer: :py:class:`pssh.clients.reader.ConcurrentRWBuffer`
49+
"""
50+
self.reader = reader
51+
self.rw_buffer = rw_buffer
4652

4753

4854
class HostOutput(object):

0 commit comments

Comments
 (0)