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


Python File.next方法代码示例

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


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

示例1: __init__

# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import next [as 别名]
class IMDBScraper:
	def __init__(self, file_name):
		self.open_file = File(file_name)
		self.open_file.skipToData()
		
	def next(self):
		actor = Actor("init", "actor")
		for line in self.open_file.next():
			if (line.containsActorName()):
				yield actor
				actor, film = line.getActorAndFilm()
				actor.addFilm(film)
			else:
				film = line.getFilm()
				if not film is None:
					actor.addFilm(film)
开发者ID:aayush03,项目名称:IMDB-Scraper,代码行数:18,代码来源:IMDBScraper.py

示例2: __init__

# 需要导入模块: from file import File [as 别名]
# 或者: from file.File import next [as 别名]
class Plugin:

	def __init__(self):
		self.windowsManager = WM.WindowsManager(self)
		self.coqManager = CM.CoqManager(self.windowsManager)
		self.instance = None
		self.launched = False

	def launch(self): 
		# Don't relaunched if it is already running !
		if self.launched == True:
			return False
		self.launched = True
		vim.command(":call MapVcoq()")
		self.windowsManager.setupWindows()
		self.coqManager.launchCoqtopProcess()
		self.instance = File(self, (self.windowsManager.windowBuffers['__Edit__'],
			self.windowsManager.windowBuffers['__Compiled__']))
		self.windowsManager.focusWindow("__Edit__")
	
	def shutdown(self):
		self.launched = False
		error("Stopping vcoq ...")
		vim.command('windo bd') # Close every windows

	def next(self):
		if self.instance != None:
			self.instance.next()

	def prev(self):
		if self.instance != None:
			self.instance.prev()

	################
	## Vim events ##
	################

	def onBufferFocus(self, entered, buffer):
		""" This function is called when the user enter or leave a buffer.
		It setups (and removes) the special maps for this buffer.
		It also perform extra actions, depending on the buffer. """
		if self.launched == False:
			return 0
		if buffer == '__Input__':
			cmd = 'imap <buffer> <CR> <Esc>:py vcoq.main.coqManager.sendQueryCommand()<CR>a' if entered else 'mapclear <buffer>'
			vim.command(cmd)
		return 1

	def onVimResized(self):
		if self.launched == False: return 0
		self.windowsManager.updateWindows()
		return 0

	def onEnter(self, buffer):
		if self.launched == False: return 0
		self.windowsManager.onEnter(buffer)
		return 0

	def onWrite(self, filename):
		if self.launched == False: 
			error("Vcoq isn't running", prompt=False)
			return 0
		self.instance.write(filename)
		return 0

	def onOpen(self, filename):
		if self.launched == False: 
			error("Vcoq isn't running", prompt=False)
			return 0
		self.instance.open(filename)
		return 0
开发者ID:QuanticPotato,项目名称:vcoq,代码行数:73,代码来源:vcoq.py


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