本文整理汇总了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):