• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python fdesc.readFromFD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.internet.fdesc.readFromFD函数的典型用法代码示例。如果您正苦于以下问题:Python readFromFD函数的具体用法?Python readFromFD怎么用?Python readFromFD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getConf

 def getConf(self):
   try:
     logger.debug("Getting config file")
     with open(self.configPath) as f:
       fd = f.fileno()
       setNonBlocking(fd)
       readFromFD(fd, self.runConf)
   except IOError, e:
     self.d.errback(e)
开发者ID:tsturzl,项目名称:hookd-old,代码行数:9,代码来源:hook.py


示例2: doRead

 def doRead(self):
     """
     Called when my standard output stream is ready for reading.
     """
     return fdesc.readFromFD(
         self.fd,
         lambda data: self.proto.childDataReceived(1, data))
开发者ID:antong,项目名称:twisted,代码行数:7,代码来源:process.py


示例3: test_readFromEmpty

 def test_readFromEmpty(self):
     """
     Verify that reading from a file descriptor with no data does not raise
     an exception and does not result in the callback function being called.
     """
     l = []
     result = fdesc.readFromFD(self.r, l.append)
     self.assertEqual(l, [])
     self.assertEqual(result, None)
开发者ID:AmirKhooj,项目名称:VTK,代码行数:9,代码来源:test_fdesc.py


示例4: get_raw_data

 def get_raw_data(cls, *args):
     if not cls.FILE_OBJ:
         cls.make_non_blocking_fdesc()
     d = Deferred()
     file_obj = cls.FILE_OBJ
     result = readFromFD(file_obj.fileno(), d.callback)
     file_obj.seek(0)
     cls.check_fdesc(result)
     return d
开发者ID:adyachok,项目名称:distributed-systems-study,代码行数:9,代码来源:report.py


示例5: read

 def read(self):
     """
     Read data from the pipe.
     """
     l = []
     res = fdesc.readFromFD(self.r, l.append)
     if res is None:
         if l:
             return l[0]
         else:
             return b""
     else:
         return res
开发者ID:AmirKhooj,项目名称:VTK,代码行数:13,代码来源:test_fdesc.py


示例6: process

    def process(self):

        self.setHeader('Content-Type', 'text/html')

        if self.path[-1] == '/':
            self.path+="index.html"

        cwd = os.path.abspath(os.curdir)
        requested_path = os.path.relpath(self.path[1:], cwd)
        requested_path = os.path.abspath(requested_path)

        if (os.path.commonprefix([requested_path, cwd])!=cwd):
            self.setResponseCode(http.NOT_FOUND)
            self.write("<h1>404 Not Found</h1>")
            return

        if (os.path.islink(s.path[1:])):
            self.setResponseCode(http.NOT_FOUND)
            self.write("<h1>404 Not Found</h1>")
            return

        try:
            self.setResponseCode(200)
            f = open(self.path[1:])
            d = Deferred()
            fd = f.fileno()
            fdesc.setNonBlocking(fd)
            d.addCallback(lambda data: self.write(data))
            fdesc.readFromFD(fd, d.callback)


        except IOError:
            self.setResponseCode(http.NOT_FOUND)
            self.write("<h1>404 Not Found</h1>")

        self.finish()
开发者ID:carminedamico,项目名称:HTTP-Server-Examples,代码行数:36,代码来源:server.py


示例7: read_whitelist

 def read_whitelist(self):
     fd = os.open(Conf.static_whitelist, os.O_RDONLY | os.O_CREAT)
     fdesc.readFromFD(fd, self.process_whitelist)
开发者ID:Ames-Laboratory-Cyber-Group,项目名称:Cydime,代码行数:3,代码来源:Server.py


示例8: get_threshold

 def get_threshold(self):
     '''
     get threshold from file
     '''
     fd = os.open(Conf.data_dir + '/' + Conf.threshold_file, os.O_RDONLY | os.O_CREAT)
     fdesc.readFromFD(fd, self.process_threshold)
开发者ID:Ames-Laboratory-Cyber-Group,项目名称:Cydime,代码行数:6,代码来源:Server.py


示例9: doRead

 def doRead(self):
     # TODO move this back out as soon as such versio of Twisted is
     # packaged.
     from twisted.internet import fdesc
     return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)
开发者ID:tv42,项目名称:mc-foo,代码行数:5,代码来源:mousecontrol.py


示例10: doRead

 def doRead(self):
     self.trigger()
     return fdesc.readFromFD(self.fp.fileno(), self.dataRead)
开发者ID:JvanDalfsen,项目名称:calvin-base,代码行数:3,代码来源:filedescriptor.py


示例11: doRead

 def doRead(self):
     return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived)
开发者ID:buben19,项目名称:twistedinput,代码行数:2,代码来源:device.py


示例12: doRead

	def doRead(self):
		try:
			setBlocking(False,0)
			return fdesc.readFromFD(0, self.dataReceived)
		finally:
			fdesc.setBlocking(True,0)
开发者ID:smurfix,项目名称:HomEvenT,代码行数:6,代码来源:twist.py


示例13: doRead

 def doRead(self):
   fdesc.readFromFD(self._fd, self.protocol.dataReceived)
开发者ID:tuck182,项目名称:syslog-ng-mod-lumberjack-py,代码行数:2,代码来源:file_descriptor.py


示例14: doRead

 def doRead(self):
     """
     Read some data from the observed file descriptors
     """
     fdesc.readFromFD(self._fd, self._doRead)
开发者ID:0004c,项目名称:VTK,代码行数:5,代码来源:inotify.py


示例15: doRead

 def doRead(self):
     """
     Read some bytes from the pipe and discard them.
     """
     fdesc.readFromFD(self.fileno(), lambda data: None)
开发者ID:hensing,项目名称:twisted,代码行数:5,代码来源:posixbase.py


示例16: doRead

 def doRead(self):
     print '~~~~~~~~~~~~~~~~~~~~~~~~~'
     fdesc.readFromFD(self.tunfd, self._doRead)
     print '~~~~~~~~~~~~~~~~~~~~~~~~~'
开发者ID:alexsunday,项目名称:pyvpn,代码行数:4,代码来源:server.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fdesc.setNonBlocking函数代码示例发布时间:2022-05-27
下一篇:
Python fdesc._setCloseOnExec函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap