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


Python BufferedFile.close方法代码示例

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


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

示例1: _close

# 需要导入模块: from paramiko.file import BufferedFile [as 别名]
# 或者: from paramiko.file.BufferedFile import close [as 别名]
 def _close(self, async_=False):
     # We allow double-close without signaling an error, because real
     # Python file objects do.  However, we must protect against actually
     # sending multiple CMD_CLOSE packets, because after we close our
     # handle, the same handle may be re-allocated by the server, and we
     # may end up mysteriously closing some random other file.  (This is
     # especially important because we unconditionally call close() from
     # __del__.)
     if self._closed:
         return
     self.sftp._log(DEBUG, "close({})".format(u(hexlify(self.handle))))
     if self.pipelined:
         self.sftp._finish_responses(self)
     BufferedFile.close(self)
     try:
         if async_:
             # GC'd file handle could be called from an arbitrary thread
             # -- don't wait for a response
             self.sftp._async_request(type(None), CMD_CLOSE, self.handle)
         else:
             self.sftp._request(CMD_CLOSE, self.handle)
     except EOFError:
         # may have outlived the Transport connection
         pass
     except (IOError, socket.error):
         # may have outlived the Transport connection
         pass
开发者ID:OmniDB,项目名称:OmniDB,代码行数:29,代码来源:sftp_file.py

示例2: close

# 需要导入模块: from paramiko.file import BufferedFile [as 别名]
# 或者: from paramiko.file.BufferedFile import close [as 别名]
 def close(self):
     """
     Close this channel file. The corresponging channel direction is shut down as well.
     """
     BufferedFile.close(self)
     if self._flags & self.FLAG_WRITE:
         self.channel.shutdown_write()
     if self._flags & self.FLAG_READ:
         self.channel.shutdown_read()
开发者ID:creckx,项目名称:paramiko,代码行数:11,代码来源:channel.py


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