Beispiel #1
0
    def _proxy(self, target, width=None, isatty=None):
        '''
        Set a thread-local stream.

        :param file target: the target stream.
        :param int width: the stream width, in characters.
        :param bool isatty: whether the target stream is a tty stream.
        '''

        self._proxies[threading.current_thread().ident] = (
            make_ansi_stream(target), width, isatty)
Beispiel #2
0
    def _proxy(self, target, **kwargs):
        '''
        Set a thread-local stream.

        :param file target: the target stream.
        :param int width: the stream width, in characters.
        :param bool isatty: whether the target stream is a tty stream.
        '''

        self._proxies[threading.current_thread().ident] = make_ansi_stream(
            target, **kwargs
        )
Beispiel #3
0
    def __init__(self, target, width=None, isatty=None):
        '''
        :param file target: the original target stream (typically either
            :attr:`sys.stdout`, :attr:`sys.stderr`, and :attr:`sys.stdin`).
        :param int width: the width of the stream in characters, this attribute
            determines if word wrapping is enabled and how wide the lines are.
        :param bool isatty: whether the underlying stream is a tty stream,
            which supports ANSI escape cdes.
        '''

        #: A tuple of: (target, width, isatty)
        self._target = (make_ansi_stream(target), width, isatty)
        self._proxies = {}
Beispiel #4
0
    def __init__(self, target, width=None, isatty=None):
        '''
        :param file target: the original target stream (typically either
            :attr:`sys.stdout`, :attr:`sys.stderr`, and :attr:`sys.stdin`).
        :param int width: the width of the stream in characters, this attribute
            determines if word wrapping is enabled and how wide the lines are.
        :param bool isatty: whether the underlying stream is a tty stream,
            which supports ANSI escape cdes.
        '''

        #: A tuple of: (target, width, isatty)
        self._target = (make_ansi_stream(target), width, isatty)
        self._proxies = {}
Beispiel #5
0
    def __init__(self, target, **kwargs):
        '''
        :param file target: the original target stream (typically either
            :attr:`sys.stdout`, :attr:`sys.stderr`, and :attr:`sys.stdin`).
        :param int width: the width of the stream in characters, this attribute
            determines if word wrapping is enabled and how wide the lines are.
        :param bool isatty: whether the underlying stream is a tty stream,
            which supports ANSI escape cdes.
        '''

        if ThreadLocalStream.DefaultAnsiStreamKwargs:
            kw = dict(ThreadLocalStream.DefaultAnsiStreamKwargs)
            kw.update(kwargs)
            kwargs = kw

        self._target = make_ansi_stream(target, **kwargs)
        self._proxies = {}
Beispiel #6
0
    def __init__(self, target, **kwargs):
        '''
        :param file target: the original target stream (typically either
            :attr:`sys.stdout`, :attr:`sys.stderr`, and :attr:`sys.stdin`).
        :param int width: the width of the stream in characters, this attribute
            determines if word wrapping is enabled and how wide the lines are.
        :param bool isatty: whether the underlying stream is a tty stream,
            which supports ANSI escape cdes.
        '''

        if ThreadLocalStream.DefaultAnsiStreamKwargs:
            kw = dict(ThreadLocalStream.DefaultAnsiStreamKwargs)
            kw.update(kwargs)
            kwargs = kw

        self._target = make_ansi_stream(target, **kwargs)
        self._proxies = {}