当前位置: 首页>>代码示例>>Python>>正文


Python Tinker.tostr_dict方法代码示例

本文整理汇总了Python中Tinker.tostr_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Tinker.tostr_dict方法的具体用法?Python Tinker.tostr_dict怎么用?Python Tinker.tostr_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinker的用法示例。


在下文中一共展示了Tinker.tostr_dict方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_dict

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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
开发者ID:drichmond,项目名称:tinker,代码行数:9,代码来源:Interface.py

示例2: check_interfaces

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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")
开发者ID:drichmond,项目名称:tinker,代码行数:28,代码来源:GroupMemoryInterface.py

示例3: parse_string

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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
开发者ID:drichmond,项目名称:tinker,代码行数:9,代码来源:Interface.py

示例4: verify

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [as 别名]
    def verify(self):
        """

        Verify that this object can implement the high level description


        Arguments:

        d -- A Description object, containing the complete description
        of a the IP configuration
        
        """
        
        if0 = self[self["interfaces"][0]]
        if0.check_width(if0)
        w = if0["width"]
        if0.check_burst(if0)
        b = if0["burst"]
        for i in self["interfaces"]:
            self[i].verify()
            if(self[i]["width"] != w):
                Tinker.value_error("width", self[i]["width"], str(w),
                                   Tinker.tostr_dict(self))
            if(self[i]["burst"] != b):
                Tinker.value_error("burst", self[i]["burst"], str(b),
                                   Tinker.tostr_dict(self))
        self.check_size(self)
        self.check_frequency(self)
        self.check_roles(self)
        self.check_interfaces(self)
        self.check_role(self)
开发者ID:drichmond,项目名称:tinker,代码行数:33,代码来源:GroupMemoryInterface.py

示例5: check_ratio

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:9,代码来源:Phy.py

示例6: parse_list

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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
开发者ID:drichmond,项目名称:tinker,代码行数:9,代码来源:Interface.py

示例7: check_ports

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:10,代码来源:Memory.py

示例8: parse_int

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:10,代码来源:Interface.py

示例9: parse_interface_keys

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [as 别名]
 def parse_interface_keys(cls, desc):
     k = set(desc.keys())
     err = (k - cls._C_MEMORY_KEYS)
     if(err != set()):
         print "In description:"
         Tinker.tostr_dict(desc)
         sys.exit("Error! Unknown keys: %s" % str(list(err)))
     return k
开发者ID:drichmond,项目名称:tinker,代码行数:10,代码来源:GroupMemoryInterface.py

示例10: check_latency

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:Memory.py

示例11: check_bandwidth_bs

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:Phy.py

示例12: check_dq_pins

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:Phy.py

示例13: check_fphy_frequency

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:Phy.py

示例14: check_oct_pin

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:Phy.py

示例15: check_frequency

# 需要导入模块: import Tinker [as 别名]
# 或者: from Tinker import tostr_dict [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))
开发者ID:drichmond,项目名称:tinker,代码行数:12,代码来源:GroupMemoryInterface.py


注:本文中的Tinker.tostr_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。