当前位置: 首页>>代码示例>>Python>>正文


Python BufferedPipe.empty方法代码示例

本文整理汇总了Python中paramiko.buffered_pipe.BufferedPipe.empty方法的典型用法代码示例。如果您正苦于以下问题:Python BufferedPipe.empty方法的具体用法?Python BufferedPipe.empty怎么用?Python BufferedPipe.empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在paramiko.buffered_pipe.BufferedPipe的用法示例。


在下文中一共展示了BufferedPipe.empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Channel

# 需要导入模块: from paramiko.buffered_pipe import BufferedPipe [as 别名]
# 或者: from paramiko.buffered_pipe.BufferedPipe import empty [as 别名]

#.........这里部分代码省略.........
        `.ServerInterface.check_channel_request` when determining whether to
        accept a channel request in server mode.
        """
        return self.chanid

    def set_combine_stderr(self, combine):
        """
        Set whether stderr should be combined into stdout on this channel.
        The default is ``False``, but in some cases it may be convenient to
        have both streams combined.

        If this is ``False``, and `exec_command` is called (or ``invoke_shell``
        with no pty), output to stderr will not show up through the `recv`
        and `recv_ready` calls.  You will have to use `recv_stderr` and
        `recv_stderr_ready` to get stderr output.

        If this is ``True``, data will never show up via `recv_stderr` or
        `recv_stderr_ready`.

        :param bool combine:
            ``True`` if stderr output should be combined into stdout on this
            channel.
        :return: the previous setting (a `bool`).

        .. versionadded:: 1.1
        """
        data = bytes()
        self.lock.acquire()
        try:
            old = self.combine_stderr
            self.combine_stderr = combine
            if combine and not old:
                # copy old stderr buffer into primary buffer
                data = self.in_stderr_buffer.empty()
        finally:
            self.lock.release()
        if len(data) > 0:
            self._feed(data)
        return old

    ###  socket API

    def settimeout(self, timeout):
        """
        Set a timeout on blocking read/write operations.  The ``timeout``
        argument can be a nonnegative float expressing seconds, or ``None``.  If
        a float is given, subsequent channel read/write operations will raise
        a timeout exception if the timeout period value has elapsed before the
        operation has completed.  Setting a timeout of ``None`` disables
        timeouts on socket operations.

        ``chan.settimeout(0.0)`` is equivalent to ``chan.setblocking(0)``;
        ``chan.settimeout(None)`` is equivalent to ``chan.setblocking(1)``.

        :param float timeout:
            seconds to wait for a pending read/write operation before raising
            ``socket.timeout``, or ``None`` for no timeout.
        """
        self.timeout = timeout

    def gettimeout(self):
        """
        Returns the timeout in seconds (as a float) associated with socket
        operations, or ``None`` if no timeout is set.  This reflects the last
        call to `setblocking` or `settimeout`.
        """
开发者ID:steffentemplin,项目名称:paramiko,代码行数:70,代码来源:channel.py

示例2: Channel

# 需要导入模块: from paramiko.buffered_pipe import BufferedPipe [as 别名]
# 或者: from paramiko.buffered_pipe.BufferedPipe import empty [as 别名]

#.........这里部分代码省略.........
        `.ServerInterface.check_channel_request` when determining whether to
        accept a channel request in server mode.
        """
        return self.chanid
    
    def set_combine_stderr(self, combine):
        """
        Set whether stderr should be combined into stdout on this channel.
        The default is ``False``, but in some cases it may be convenient to
        have both streams combined.
        
        If this is ``False``, and `exec_command` is called (or ``invoke_shell``
        with no pty), output to stderr will not show up through the `recv`
        and `recv_ready` calls.  You will have to use `recv_stderr` and
        `recv_stderr_ready` to get stderr output.
        
        If this is ``True``, data will never show up via `recv_stderr` or
        `recv_stderr_ready`.
        
        :param bool combine:
            ``True`` if stderr output should be combined into stdout on this
            channel.
        :return: the previous setting (a `bool`).
        
        .. versionadded:: 1.1
        """
        data = ''
        self.lock.acquire()
        try:
            old = self.combine_stderr
            self.combine_stderr = combine
            if combine and not old:
                # copy old stderr buffer into primary buffer
                data = self.in_stderr_buffer.empty()
        finally:
            self.lock.release()
        if len(data) > 0:
            self._feed(data)
        return old

    
    ###  socket API


    def settimeout(self, timeout):
        """
        Set a timeout on blocking read/write operations.  The ``timeout``
        argument can be a nonnegative float expressing seconds, or ``None``.  If
        a float is given, subsequent channel read/write operations will raise
        a timeout exception if the timeout period value has elapsed before the
        operation has completed.  Setting a timeout of ``None`` disables
        timeouts on socket operations.

        ``chan.settimeout(0.0)`` is equivalent to ``chan.setblocking(0)``;
        ``chan.settimeout(None)`` is equivalent to ``chan.setblocking(1)``.

        :param float timeout:
            seconds to wait for a pending read/write operation before raising
            ``socket.timeout``, or ``None`` for no timeout.
        """
        self.timeout = timeout

    def gettimeout(self):
        """
        Returns the timeout in seconds (as a float) associated with socket
        operations, or ``None`` if no timeout is set.  This reflects the last
开发者ID:bandrel,项目名称:paramiko,代码行数:70,代码来源:channel.py

示例3: Channel

# 需要导入模块: from paramiko.buffered_pipe import BufferedPipe [as 别名]
# 或者: from paramiko.buffered_pipe.BufferedPipe import empty [as 别名]

#.........这里部分代码省略.........
        @rtype: int
        """
        return self.chanid
    
    def set_combine_stderr(self, combine):
        """
        Set whether stderr should be combined into stdout on this channel.
        The default is C{False}, but in some cases it may be convenient to
        have both streams combined.
        
        If this is C{False}, and L{exec_command} is called (or C{invoke_shell}
        with no pty), output to stderr will not show up through the L{recv}
        and L{recv_ready} calls.  You will have to use L{recv_stderr} and
        L{recv_stderr_ready} to get stderr output.
        
        If this is C{True}, data will never show up via L{recv_stderr} or
        L{recv_stderr_ready}.
        
        @param combine: C{True} if stderr output should be combined into
            stdout on this channel.
        @type combine: bool
        @return: previous setting.
        @rtype: bool
        
        @since: 1.1
        """
        data = ''
        self.lock.acquire()
        try:
            old = self.combine_stderr
            self.combine_stderr = combine
            if combine and not old:
                # copy old stderr buffer into primary buffer
                data = self.in_stderr_buffer.empty()
        finally:
            self.lock.release()
        if len(data) > 0:
            self._feed(data)
        return old

    
    ###  socket API


    def settimeout(self, timeout):
        """
        Set a timeout on blocking read/write operations.  The C{timeout}
        argument can be a nonnegative float expressing seconds, or C{None}.  If
        a float is given, subsequent channel read/write operations will raise
        a timeout exception if the timeout period value has elapsed before the
        operation has completed.  Setting a timeout of C{None} disables
        timeouts on socket operations.

        C{chan.settimeout(0.0)} is equivalent to C{chan.setblocking(0)};
        C{chan.settimeout(None)} is equivalent to C{chan.setblocking(1)}.

        @param timeout: seconds to wait for a pending read/write operation
            before raising C{socket.timeout}, or C{None} for no timeout.
        @type timeout: float
        """
        self.timeout = timeout

    def gettimeout(self):
        """
        Returns the timeout in seconds (as a float) associated with socket
        operations, or C{None} if no timeout is set.  This reflects the last
开发者ID:myelin,项目名称:bbm-tools,代码行数:70,代码来源:channel.py

示例4: Channel

# 需要导入模块: from paramiko.buffered_pipe import BufferedPipe [as 别名]
# 或者: from paramiko.buffered_pipe.BufferedPipe import empty [as 别名]

#.........这里部分代码省略.........
        @rtype: int
        """
        return self.chanid

    def set_combine_stderr(self, combine):
        """
        Set whether stderr should be combined into stdout on this channel.
        The default is C{False}, but in some cases it may be convenient to
        have both streams combined.

        If this is C{False}, and L{exec_command} is called (or C{invoke_shell}
        with no pty), output to stderr will not show up through the L{recv}
        and L{recv_ready} calls.  You will have to use L{recv_stderr} and
        L{recv_stderr_ready} to get stderr output.

        If this is C{True}, data will never show up via L{recv_stderr} or
        L{recv_stderr_ready}.

        @param combine: C{True} if stderr output should be combined into
            stdout on this channel.
        @type combine: bool
        @return: previous setting.
        @rtype: bool

        @since: 1.1
        """
        data = ""
        self.lock.acquire()
        try:
            old = self.combine_stderr
            self.combine_stderr = combine
            if combine and not old:
                # copy old stderr buffer into primary buffer
                data = self.in_stderr_buffer.empty()
        finally:
            self.lock.release()
        if len(data) > 0:
            self._feed(data)
        return old

    ###  socket API

    def settimeout(self, timeout):
        """
        Set a timeout on blocking read/write operations.  The C{timeout}
        argument can be a nonnegative float expressing seconds, or C{None}.  If
        a float is given, subsequent channel read/write operations will raise
        a timeout exception if the timeout period value has elapsed before the
        operation has completed.  Setting a timeout of C{None} disables
        timeouts on socket operations.

        C{chan.settimeout(0.0)} is equivalent to C{chan.setblocking(0)};
        C{chan.settimeout(None)} is equivalent to C{chan.setblocking(1)}.

        @param timeout: seconds to wait for a pending read/write operation
            before raising C{socket.timeout}, or C{None} for no timeout.
        @type timeout: float
        """
        self.timeout = timeout

    def gettimeout(self):
        """
        Returns the timeout in seconds (as a float) associated with socket
        operations, or C{None} if no timeout is set.  This reflects the last
        call to L{setblocking} or L{settimeout}.
开发者ID:StefanKjartansson,项目名称:paramiko,代码行数:69,代码来源:channel.py


注:本文中的paramiko.buffered_pipe.BufferedPipe.empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。