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


Python Resource.load方法代码示例

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


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

示例1: test_should_load_resource

# 需要导入模块: from resource import Resource [as 别名]
# 或者: from resource.Resource import load [as 别名]
	def test_should_load_resource(self):
		content = "Content"
		web = TestWeb()
		web.response = FakeResponse(content, "text/html")
		resource = Resource("Link", "Target", web)
		loaded_content = resource.load()
		self.assertEqual(loaded_content, content)
开发者ID:cessor,项目名称:scrape,代码行数:9,代码来源:test_resource.py

示例2: resources

# 需要导入模块: from resource import Resource [as 别名]
# 或者: from resource.Resource import load [as 别名]
	def resources(self):
		files = []
		anchors = self.find_links_in_content(self.markup)
		for anchor in anchors:

			resource = Resource(anchor.getText(), anchor.get('href'), self.web, "http://elearning.uni-heidelberg.de/mod/resource/")
			if resource.url == '' or resource.isOnExternalWebsite():
				continue
			
			try:
				if resource.isAPage():
					content = resource.load()
					f = Page(content, self.web).resources()
					files.append(f)
				else:
					files.append(resource)
			except urllib2.HTTPError as e:
				debug("Could not retrieve %s." % resource.url)
				continue 
				
		return deflate(files)
开发者ID:cessor,项目名称:scrape,代码行数:23,代码来源:page.py

示例3: load_xml

# 需要导入模块: from resource import Resource [as 别名]
# 或者: from resource.Resource import load [as 别名]
    def load_xml(cls, filename, id):
        '''Load the tileset from the XML in the specified file.

        Return a TileSet instance.
        '''
        return Resource.load(filename)[id]
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:8,代码来源:tile.py

示例4: load_xml

# 需要导入模块: from resource import Resource [as 别名]
# 或者: from resource.Resource import load [as 别名]
    def load_xml(cls, filename, id):
        """Load a map from the indicated XML file.

        Return a Map instance."""
        return Resource.load(filename)[id]
开发者ID:rougier,项目名称:pyglet,代码行数:7,代码来源:map.py


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