本文整理汇总了Python中DIRAC.ConfigurationSystem.private.Modificator.Modificator.mergeFromFile方法的典型用法代码示例。如果您正苦于以下问题:Python Modificator.mergeFromFile方法的具体用法?Python Modificator.mergeFromFile怎么用?Python Modificator.mergeFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.ConfigurationSystem.private.Modificator.Modificator
的用法示例。
在下文中一共展示了Modificator.mergeFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CSCLI
# 需要导入模块: from DIRAC.ConfigurationSystem.private.Modificator import Modificator [as 别名]
# 或者: from DIRAC.ConfigurationSystem.private.Modificator.Modificator import mergeFromFile [as 别名]
#.........这里部分代码省略.........
Note that if a file extension is specified, it is replaced by .cfg suffix.
If not it is added automatically
"""
try:
if len( args ) == 0:
print "Filename to write must be specified!"
return
filename = args.split()[0].strip()
filename = _appendExtensionIfMissing( filename )
self.modificator.dumpToFile( filename )
except Exception as x:
print "Couldn't write to file %s: %s" % ( filename, str( x ) )
def do_readFromFile( self, args ):
"""
Reads data from filename to be used. Actual data will be replaced!
Usage: readFromFile <filename>.cfg
Note that if a file extension is specified, it is replaced by .cfg suffix.
If not it is added automatically
"""
try:
if len( args ) == 0:
print "Filename to read must be specified!"
return
filename = args.split()[0].strip()
filename = _appendExtensionIfMissing( filename )
self.modificator.loadFromFile( filename )
self.modifiedData = True
except Exception as x:
print "Couldn't read from file %s: %s" % ( filename, str( x ) )
def do_mergeFromFile( self, args ):
"""
Reads data from filename and merges it with current data.
Data read from file has more precedence that current one.
Usage: mergeFromFile <filename>.cfg
Note that if a file extension is specified, it is replaced by .cfg suffix.
If not it is added automatically
"""
try:
if len( args ) == 0:
print "Filename to read must be specified!"
return
filename = args.split()[0].strip()
filename = _appendExtensionIfMissing( filename )
self.modificator.mergeFromFile( filename )
self.modifiedData = True
except Exception as x:
_showTraceback()
print "Couldn't read from file %s: %s" % ( filename, str( x ) )
def do_showData( self, dummy ):
"""
Shows the current modified configuration
Usage: showData
"""
print self.modificator
def do_showHistory( self, args ):
"""
Shows the last commit history
Usage: showHistory <update limit>