本文整理汇总了Python中Tinker.print_description方法的典型用法代码示例。如果您正苦于以下问题:Python Tinker.print_description方法的具体用法?Python Tinker.print_description怎么用?Python Tinker.print_description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinker
的用法示例。
在下文中一共展示了Tinker.print_description方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_keys
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import print_description [as 别名]
def parse_keys(cls,desc):
k = set(desc.keys())
ifs = set(cls.parse_interfaces(desc))
err = (k - ifs - cls._C_DESCRIPTION_KEYS)
if(err != set()):
print "In description:"
Tinker.print_description(desc)
sys.exit("Error! Unknown keys: %s" % str(list(err)))
return k | ifs
示例2: parse_keys
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import print_description [as 别名]
def parse_keys(cls,desc):
k = set(desc.keys())
if("interfaces" not in desc):
ifs = set([])
else:
ifs = set(cls.parse_interfaces(desc))
err = (k - ifs - cls._C_INTERFACE_KEYS)
if(err != set()):
print "In description:"
Tinker.print_description(desc)
sys.exit("Error! Unknown keys: %s" % str(list(err)))
return k | ifs
示例3: parse_interfaces
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import print_description [as 别名]
def parse_interfaces(cls, desc):
ifs = parse_list(desc, "interfaces")
if(ifs == []):
print "In description:"
Tinker.print_description(d)
sys.exit("Error! A Global Memory must have more than one interface!")
for i in ifs:
if(ifs.count(i) > 1):
sys.exit("Error! Interface \"%s\" was not unique in list %s"
% (i, str(ifs)))
parse_dict(desc, i)
return ifs
示例4: parse_interfaces
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import print_description [as 别名]
def parse_interfaces(cls, d):
ifs = d.get("interfaces",None)
if(ifs is None):
Tinker.key_error("interfaces",str(d))
if(isinstance(ifs, basestring)):
print "In description:"
Tinker.print_description(d)
Tinker.value_error("interfaces", str(ifs), "List")
for i in ifs:
if(ifs.count(i) > 1):
sys.exit("Error! Interface \"%s\" was not unique in list %s"
% (i, str(ifs)))
if(d.get(i,None) is None):
Tinker.key_error(i,str(d))
return ifs
示例5: check_roles
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import print_description [as 别名]
def check_roles(cls, d):
cls.check_interfaces(d)
ifs = d["interfaces"]
pid = None
spec = (d[ifs[0]].get("role") != None)
for i in ifs:
r = d[i].get("role")
if(r is None and spec is True):
Tinker.key_error("role",str(d[i]))
elif(r != None and spec is False):
print "In description:"
Tinker.print_description(d)
sys.exit("Roles must be specified for all Memory Interfaces, or none of them.")
elif(r != None and r not in cls._C_INTERFACE_ROLES):
Tinker.value_error_map("role", str(r), str(cls._C_INTERFACE_ROLES),
Tinker.tostr_dict())
elif(r != None and r == "primary" and pid != None):
print "In description:"
Tinker.print_description(d)
sys.exit("Error! Two primary interfaces \"%s\" and \"%s\" found."
% (pid, i))
elif(r == "primary"):
pid = i