本文整理汇总了Python中twitter.common.config.Properties.load方法的典型用法代码示例。如果您正苦于以下问题:Python Properties.load方法的具体用法?Python Properties.load怎么用?Python Properties.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.common.config.Properties
的用法示例。
在下文中一共展示了Properties.load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_publish_properties
# 需要导入模块: from twitter.common.config import Properties [as 别名]
# 或者: from twitter.common.config.Properties import load [as 别名]
def get_publish_properties(target):
publish_properties = props_by_repo.get(target.provides.repo)
if not publish_properties:
publish_properties = Properties()
with open(target.provides.repo.push_db) as props:
publish_properties.load(props)
props_by_repo[target.provides.repo] = publish_properties
return publish_properties
示例2: _find_checkstyle_suppressions
# 需要导入模块: from twitter.common.config import Properties [as 别名]
# 或者: from twitter.common.config.Properties import load [as 别名]
def _find_checkstyle_suppressions(props, root_dir):
props = Properties.load(props)
# Magic - we know the root.dir property is defined elsewhere, so we seed it.
props['root.dir'] = root_dir
def resolve_props(value):
def replace_symbols(matchobj):
return props[matchobj.group(1)]
symbol_parser = re.compile("\${([^}]+)\}")
while symbol_parser.match(value):
value = symbol_parser.sub(replace_symbols, value)
return value
files = resolve_props(props['checkstyle.suppression.files'])
return files.split(',')
示例3: load
# 需要导入模块: from twitter.common.config import Properties [as 别名]
# 或者: from twitter.common.config.Properties import load [as 别名]
def load(path):
"""Loads a pushdb maintained in a properties file at the given path."""
with open(path, 'r') as props:
properties = Properties.load(props)
return PushDb(properties)
示例4: get_publish_properties
# 需要导入模块: from twitter.common.config import Properties [as 别名]
# 或者: from twitter.common.config.Properties import load [as 别名]
def get_publish_properties(target):
if target.provides.repo not in props_by_repo:
with open(target.provides.repo.push_db) as props:
props_by_repo[target.provides.repo] = Properties.load(props)
return props_by_repo.get(target.provides.repo)
示例5: assertLoaded
# 需要导入模块: from twitter.common.config import Properties [as 别名]
# 或者: from twitter.common.config.Properties import load [as 别名]
def assertLoaded(self, contents, expected):
self.assertEquals(expected, Properties.load(contents))