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


Python config.Properties类代码示例

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


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

示例1: get_publish_properties

 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
开发者ID:DikangGu,项目名称:commons,代码行数:8,代码来源:doc.py

示例2: test_dump

  def test_dump(self):
    props = OrderedDict()
    props['a'] = 1
    props['b'] = '''2
'''
    props['c'] =' 3 : ='
    out = Compatibility.StringIO()
    Properties.dump(props, out)
    self.assertEquals('a=1\nb=2\\\n\nc=\\ 3\\ \\:\\ \\=\n', out.getvalue())
开发者ID:BabyDuncan,项目名称:commons,代码行数:9,代码来源:properties_test.py

示例3: _find_checkstyle_suppressions

  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(',')
开发者ID:adamsxu,项目名称:commons,代码行数:17,代码来源:ide.py

示例4: dump

 def dump(self, path):
   """Saves the pushdb as a properties file to the given path."""
   with open(path, 'w') as props:
     Properties.dump(self._props, props)
开发者ID:alandge,项目名称:twitter-commons,代码行数:4,代码来源:jar_publish.py

示例5: load

 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)
开发者ID:alandge,项目名称:twitter-commons,代码行数:5,代码来源:jar_publish.py

示例6: get_publish_properties

 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)
开发者ID:alaattinturyan,项目名称:commons,代码行数:5,代码来源:doc.py

示例7: assertLoaded

 def assertLoaded(self, contents, expected):
   self.assertEquals(expected, Properties.load(contents))
开发者ID:adamsxu,项目名称:commons,代码行数:2,代码来源:properties_test.py


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