本文整理匯總了Python中DIRAC.ConfigurationSystem.private.Modificator.Modificator.getOptionsDict方法的典型用法代碼示例。如果您正苦於以下問題:Python Modificator.getOptionsDict方法的具體用法?Python Modificator.getOptionsDict怎麽用?Python Modificator.getOptionsDict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.ConfigurationSystem.private.Modificator.Modificator
的用法示例。
在下文中一共展示了Modificator.getOptionsDict方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CSShellCLI
# 需要導入模塊: from DIRAC.ConfigurationSystem.private.Modificator import Modificator [as 別名]
# 或者: from DIRAC.ConfigurationSystem.private.Modificator.Modificator import getOptionsDict [as 別名]
#.........這裏部分代碼省略.........
for i in opts:
print i + " ",
print ""
def do_cd(self, line):
"""cd
Go one directory deeper in the CS"""
# Check if invariant holds
if self.connected:
assert self.root == "/" or not self.root.endswith("/")
assert self.root.startswith("/")
secs = self.modificator.getSections(self.root)
if line == "..":
self.root = os.path.dirname(self.root)
self.update_prompt()
else:
if os.path.normpath(line) in secs:
if self.root == "/":
self.root = self.root + os.path.normpath(line)
else:
self.root = self.root + "/" + os.path.normpath(line)
self.update_prompt()
else:
print "cd: no such section: " + line
def complete_cd(self, text, _line, _begidx, _endidx):
secs = self.modificator.getSections(self.root)
return [(s + "/") for s in secs if s.startswith(text)]
def do_cat(self, line):
"""cat
Read the content of an option in the CS"""
if self.connected:
opts = self.modificator.getOptionsDict(self.root)
if line in opts.keys():
print opts[line]
else:
print "cat: No such option"
def complete_cat(self, text, _line, _begidx, _endidx):
opts = self.modificator.getOptions(self.root)
return [o for o in opts if o.startswith(text)]
do_less = do_cat
complete_less = complete_cat
def do_mkdir(self, line):
"""mkdir
Create a new section in the CS"""
if self.connected:
self.modificator.createSection(self.root + "/" + line)
self.dirty = True
complete_mkdir = complete_cd
def do_rmdir(self, line):
"""rmdir
Delete a section in the CS"""
if self.connected:
self.modificator.removeSection(self.root + "/" + line)
self.dirty = True
complete_rmdir = complete_cd
def do_rm(self, line):