本文整理汇总了Python中Tinker.value_error_map方法的典型用法代码示例。如果您正苦于以下问题:Python Tinker.value_error_map方法的具体用法?Python Tinker.value_error_map怎么用?Python Tinker.value_error_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinker
的用法示例。
在下文中一共展示了Tinker.value_error_map方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_interfaces
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_interfaces(cls,d):
cls.check_quantity(d)
p = None
q = d["quantity"]
if("interfaces" not in d):
ifs = None
else:
ifs = parse_list(d,"interfaces")
if(ifs is not None and len(ifs) != q):
Tinker.value_error_map("quantity", str(q), str(len(ifs)),
Tinker.tostr_dict(d))
elif(ifs is None or set(ifs) & set(d.keys()) == set()):
pass
elif((set(ifs) < set(d.keys()))):
for i in ifs:
d[i].validate(d[i])
d[i].check_role(d[i])
if(d[i]["role"] == "primary" ):
if(p != None):
Tinker.value_error_map("role", d[i]["role"],
"Non-primary role",
Tinker.tostr_dict(cls))
p = i
else:
sys.exit("Error! interfaces cannot be partially enumerated subset")
示例2: parse_string
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def parse_string(d, k):
s = d.get(k)
if(s is None):
Tinker.key_error(k, Tinker.tostr_dict(d))
elif(not Tinker.is_string(s)):
Tinker.value_error_map(k, s, "Strings", Tinker.tostr_dict(d))
return s
示例3: parse_list
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def parse_list(d, k):
l = d.get(k)
if(l is None):
Tinker.key_error(k, Tinker.tostr_dict(d))
elif(not Tinker.is_list(l)):
Tinker.value_error_map(k, l, "Lists", Tinker.tostr_dict(d))
return l
示例4: parse_dict
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def parse_dict(d, k):
dct = d.get(k)
if(dct is None):
Tinker.key_error(k, Tinker.tostr_dict(d))
elif(not Tinker.is_dict(dct)):
Tinker.value_error_map(k, dct, "Dictionary", Tinker.tostr_dict(d))
return dct
示例5: parse_int
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def parse_int(d, k):
i = d.get(k)
if(i is None):
Tinker.key_error(k, Tinker.tostr_dict(d))
try:
return int(i)
except ValueError:
Tinker.value_error_map(k, i, "Integers", Tinker.tostr_dict(d))
示例6: check_quantity
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_quantity(cls, d):
super(GlobalMemoryInterface,cls).check_quantity(d)
cls.check_interfaces(d)
ifs = cls.parse_interfaces(d)
q = parse_int(d, "quantity")
if(q != len(ifs)):
Tinker.value_error_map("quantity",str(q),str(ifs),
Tinker.tostr_dict(d))
示例7: check_latency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_latency(cls, d):
l = d.get("latency")
l_min = cls._C_LATENCY_RANGE[0]
l_max = cls._C_LATENCY_RANGE[1]
if(l is None):
Tinker.key_error("latency", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(l, l_min, l_max)):
Tinker.value_error_map("latency", str(hex(l)),
"Range(0x%x, 0x%x)" % (l_min, l_max),
Tinker.tostr_dict(d))
示例8: check_bandwidth_bs
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_bandwidth_bs(cls, d):
bw = d.get("bandwidth_bs")
bw_min = cls._C_BANDWIDTH_BS_RANGE[0]
bw_max = cls._C_BANDWIDTH_BS_RANGE[1]
if(bw is None):
Tinker.key_error("bandwidth_bs", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(bw,bw_min,bw_max)):
Tinker.value_error_map("bandwidth_bs", str(hex(bw)),
"Range(0x%x, 0x%x)" % (bw_min, bw_max),
Tinker.tostr_dict(d))
示例9: check_dq_pins
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_dq_pins(cls, d):
p = d.get("dq_pins")
dq_min = cls._C_DQ_PIN_RANGE[0]
dq_max = cls._C_DQ_PIN_RANGE[1]
if(p is None):
Tinker.key_error("dq_pins", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(p, dq_min, dq_max)):
Tinker.value_error_map("dq_pins", str(p),
"Range(0x%x, 0x%x)" % (dq_min, dq_max),
Tinker.tostr_dict(d))
示例10: check_fphy_frequency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_fphy_frequency(cls, d):
fphy = d.get("fphy_mhz")
fphy_min = cls._C_FPHY_MHZ_RANGE[0]
fphy_max = cls._C_FPHY_MHZ_RANGE[1]
if(fphy is None):
Tinker.key_error("fphy_mhz", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(fphy, fphy_min, fphy_max)):
Tinker.value_error_map("fphy_mhz", str(fphy),
"Range(0x%x, 0x%x)" % (fphy_min, fphy_max),
Tinker.tostr_dict(d))
示例11: check_frequency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_frequency(cls, d):
freq = d.get("freq_mhz")
freq_min = cls._C_INTERFACE_MHZ_RANGE[0]
freq_max = cls._C_INTERFACE_MHZ_RANGE[1]
if(freq is None):
Tinker.key_error("freq_mhz", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(freq, freq_min, freq_max)):
Tinker.value_error_map("freq_mhz", str(freq),
"Range(0x%x, 0x%x)" % (freq_min, freq_max),
Tinker.tostr_dict(d))
示例12: parse_burst
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def parse_burst(cls,d):
b = parse_int(d, "burst")
if(not Tinker.is_in_range(b,cls._C_INTERFACE_BURST_RANGE[0],
cls._C_INTERFACE_BURST_RANGE[1])):
Tinker.value_error_map("burst", str(b),
"range(%d, %d)"
% (cls._C_INTERFACE_BURST_RANGE[0],
cls._C_INTERFACE_BURST_RANGE[1]),
Tinker.tostr_dict(d))
return b
示例13: check_width
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_width(cls,d):
w = parse_int(d, "width")
if(not Tinker.is_in_range(w,
cls._C_INTERFACE_WIDTH_RANGE[0],
cls._C_INTERFACE_WIDTH_RANGE[1])):
Tinker.value_error_map("width", str(w),
"range(%d, %d)"
% (cls._C_INTERFACE_WIDTH_RANGE[0],
cls._C_INTERFACE_WIDTH_RANGE[1]),
Tinker.tostr_dict(d))
示例14: check_name
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_name(cls, d):
n = cls.parse_string(d, "name")
if(not Tinker.is_valid_verilog_name(n)):
Tinker.value_error_map("name", n, "Valid Verilog Names",
Tinker.tostr_dict(d))
if(len(n) > cls._C_):
Tinker.value_error_map("name", n, "Strings less than 32 characters",
Tinker.tostr_dict(d))
return n
示例15: check_size
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import value_error_map [as 别名]
def check_size(cls, d):
sz = d.get("size")
sz_min = cls._C_INTERFACE_SIZE_RANGE[0]
sz_max = cls._C_INTERFACE_SIZE_RANGE[1]
if(sz is None):
Tinker.key_error("size", Tinker.tostr_dict(d))
if(not Tinker.is_in_range(sz, sz_min, sz_max)):
Tinker.value_error_map("size", str(hex(sz)),
"Range(0x%x, 0x%x)" % (sz_min, sz_max),
Tinker.tostr_dict(d))