本文整理汇总了Python中DIRAC.ConfigurationSystem.private.Modificator.Modificator.getComment方法的典型用法代码示例。如果您正苦于以下问题:Python Modificator.getComment方法的具体用法?Python Modificator.getComment怎么用?Python Modificator.getComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ConfigurationSystem.private.Modificator.Modificator
的用法示例。
在下文中一共展示了Modificator.getComment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CSCLI
# 需要导入模块: from DIRAC.ConfigurationSystem.private.Modificator import Modificator [as 别名]
# 或者: from DIRAC.ConfigurationSystem.private.Modificator.Modificator import getComment [as 别名]
#.........这里部分代码省略.........
else:
self._setStatus( False )
else:
splitted = args.split()
if len( splitted ) == 0:
print "Must specify witch url to connect"
self._setStatus( False )
else:
self.masterURL = splitted[0].strip()
self._tryConnection()
def do_sections( self, args ):
"""
Shows all sections with their comments.
If no section is specified, root is taken.
Usage: sections <section>
"""
try:
argList = args.split()
if argList:
baseSection = argList[0].strip()
else:
baseSection = "/"
if not self.modificator.existsSection( baseSection ):
print "Section %s does not exist" % baseSection
return
sectionList = self.modificator.getSections( baseSection )
if not sectionList:
print "Section %s is empty" % baseSection
return
for section in sectionList:
section = "%s/%s" % ( baseSection, section )
self.printPair( section, self.modificator.getComment( section ) , " #" )
except:
_showTraceback()
def do_options( self, args ):
"""
Shows all options and values of a specified section
Usage: options <section>
"""
try:
argList = args.split()
if argList:
section = argList[0].strip()
else:
print "Which section?"
return
if not self.modificator.existsSection( section ):
print "Section %s does not exist" % section
return
optionsList = self.modificator.getOptions( section )
if not optionsList:
print "Section %s has no options" % section
return
for option in optionsList:
_printComment( self.modificator.getComment( "%s/%s" % ( section, option ) ) )
self.printPair( option, self.modificator.getValue( "%s/%s" % ( section, option ) ), "=" )
except:
_showTraceback()
def do_get( self, args ):
"""
Shows value and comment for specified option in section