# Path: harpoon/dockerpty/io.py
# def set_blocking(fd, blocking=True):
# def select(read_streams, write_streams, timeout=0):
#     def __init__(self, fd):
#     def fileno(self):
#     def set_blocking(self, value):
#     def read(self, n=4096):
#     def write(self, data):
#     def do_write(self):
#     def needs_write(self):
#     def close(self):
#     def __repr__(self):
#     def __init__(self, stream):
#     def fileno(self):
#     def set_blocking(self, value):
#     def read(self, n=4096):
#     def write(self, data):
#     def needs_write(self):
#     def do_write(self):
#     def close(self):
#     def _next_packet_size(self, n=0):
#     def __repr__(self):
#     def __init__(self, from_stream, to_stream, wait_for_output=True, propagate_close=True):
#     def fileno(self):
#     def set_blocking(self, value):
#     def flush(self, n=4096):
#     def is_done(self):
#     def __repr__(self):
# class Stream(object):
# class Demuxer(object):
# class Pump(object):
#     ERRNO_RECOVERABLE = [errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK]
# 
# Path: harpoon/dockerpty/tty.py
# def size(fd):
#     def __init__(self, fd, raw=True):
#     def __enter__(self):
#     def __exit__(self, *_):
#     def israw(self):
#     def start(self):
#     def stop(self):
#     def __repr__(self):
# class Terminal(object):


import sys
import signal
from ssl import SSLError
from harpoon.dockerpty import io
from harpoon.dockerpty import tty
        """
        Returns True if the PTY should operate in raw mode.

        If the container was not started with tty=True, this will return False.
        """

        if self.raw is None:
            info = self.container_info()
            self.raw = self.stdout.isatty() and info["Config"]["Tty"]

        return self.raw

    def sockets(self):
        """
        Returns a tuple of sockets connected to the pty (stdin,stdout,stderr).

        If any of the sockets are not attached in the container, `None` is
        returned in the tuple.
        """

        info = self.container_info()

        def attach_socket(key):
            if info["Config"]["Attach{0}".format(key.capitalize())]:
                socket = self.client.attach_socket(self.container, {key: 1, "stream": 1, "logs": 1})
                stream = io.Stream(socket)

                if info["Config"]["Tty"]:
                    return stream
                else:

# Path: harpoon/dockerpty/io.py
# def set_blocking(fd, blocking=True):
# def select(read_streams, write_streams, timeout=0):
#     def __init__(self, fd):
#     def fileno(self):
#     def set_blocking(self, value):
#     def read(self, n=4096):
#     def write(self, data):
#     def do_write(self):
#     def needs_write(self):
#     def close(self):
#     def __repr__(self):
#     def __init__(self, stream):
#     def fileno(self):
#     def set_blocking(self, value):
#     def read(self, n=4096):
#     def write(self, data):
#     def needs_write(self):
#     def do_write(self):
#     def close(self):
#     def _next_packet_size(self, n=0):
#     def __repr__(self):
#     def __init__(self, from_stream, to_stream, wait_for_output=True, propagate_close=True):
#     def fileno(self):
#     def set_blocking(self, value):
#     def flush(self, n=4096):
#     def is_done(self):
#     def __repr__(self):
# class Stream(object):
# class Demuxer(object):
# class Pump(object):
#     ERRNO_RECOVERABLE = [errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK]
# 
# Path: harpoon/dockerpty/tty.py
# def size(fd):
#     def __init__(self, fd, raw=True):
#     def __enter__(self):
#     def __exit__(self, *_):
#     def israw(self):
#     def start(self):
#     def stop(self):
#     def __repr__(self):
# class Terminal(object):


# Path: harpoon/dockerpty/pty.py
import sys
import signal
from ssl import SSLError
from harpoon.dockerpty import io
from harpoon.dockerpty import tty

        """
        Returns True if the PTY should operate in raw mode.

        If the container was not started with tty=True, this will return False.
        """

        if self.raw is None:
            info = self.container_info()
            self.raw = self.stdout.isatty() and info["Config"]["Tty"]

        return self.raw

    def sockets(self):
        """
        Returns a tuple of sockets connected to the pty (stdin,stdout,stderr).

        If any of the sockets are not attached in the container, `None` is
        returned in the tuple.
        """

        info = self.container_info()

        def attach_socket(key):
            if info["Config"]["Attach{0}".format(key.capitalize())]:
                socket = self.client.attach_socket(self.container, {key: 1, "stream": 1, "logs": 1})
                stream = io.Stream(socket)

                if info["Config"]["Tty"]:
                    return stream
                else:

                    return io.Demuxer(stream)