本文整理汇总了Python中Tinker.key_error方法的典型用法代码示例。如果您正苦于以下问题:Python Tinker.key_error方法的具体用法?Python Tinker.key_error怎么用?Python Tinker.key_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinker
的用法示例。
在下文中一共展示了Tinker.key_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_dict
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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
示例2: parse_string
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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 key_error [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: check_ratio
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [as 别名]
def check_ratio(cls, d):
ratio = d.get("ratio")
if(ratio is None):
Tinker.key_error("ratio", Tinker.tostr_dict(d))
if(ratio not in cls._C_CLOCK_RATIOS):
Tinker.value_error_xml("ratio", ratio, str(list(cls._C_CLOCK_RATIOS)),
Tinker.tostr_dict(d))
示例5: parse_string
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [as 别名]
def parse_string(e, k):
s = e.get(k)
if(s is None):
Tinker.key_error(k, ET.tostring(e))
elif(not Tinker.is_string(s)):
Tinker.value_error_xml(k, s, "Strings", ET.tostring(e))
return s
示例6: check_ports
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [as 别名]
def check_ports(cls, d):
ports = d.get("ports")
if(ports is None):
Tinker.key_error("ports", Tinker.tostr_dict(d))
for p in ports:
if(p not in cls._C_PORT_TYPES):
Tinker.value_error_xml("ports", p, str(list(cls._C_PORT_TYPES)),
Tinker.tostr_dict(d))
示例7: parse_int
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例8: check_oct_pin
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [as 别名]
def check_oct_pin(cls, d):
oct_pin = d.get("oct_pin")
oct_pins = d.get("oct_pins")
if(oct_pin is None):
Tinker.key_error("oct_pin", Tinker.tostr_dict(d))
if(oct_pin is None):
Tinker.key_error("oct_pins", Tinker.tostr_dict(d))
if(oct_pin not in self["oct_pins"]):
Tinker.value_error_map("oct_pin", role, str(oct_pins),
Tinker.tostr_dict(d))
示例9: check_fphy_frequency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例10: check_latency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例11: check_bandwidth_bs
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例12: check_frequency
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例13: check_dq_pins
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例14: check_size
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [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))
示例15: check_resources
# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import key_error [as 别名]
def check_resources(cls, d):
rs = d.get("resources")
r_min = cls._C_RESOURCE_RANGE[0]
r_max = cls._C_RESOURCE_RANGE[1]
for rt in cls._C_RESOURCE_TYPES:
r = rs.get(rt, None)
if(r is None):
Tinker.key_error(rt, Tinker.tostr_dict(d))
if(not Tinker.is_in_range(r, r_min, r_max)):
Tinker.value_error_map(rt, str(hex(r)),
"Range(0x%x, 0x%x)" % (r_min, r_max),
Tinker.tostr_dict(d))