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


Python Node.fetch方法代码示例

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


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

示例1: test_fetch

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_fetch(self):
     vec = array(range(100), uint32)
     n = Node()
     n['a'] = vec
     na = n.fetch('a')
     na_val = na.value()
     self.assertEqual(na_val[99], 99)
开发者ID:fedepad,项目名称:conduit,代码行数:9,代码来源:t_python_conduit_node.py

示例2: test_total_bytes

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_total_bytes(self):
     vec = array(range(100), uint32)
     n = Node()
     n['a'] = vec
     self.assertEqual(n.total_bytes(),4 * 100)
     self.assertEqual(n.total_bytes_compact(),4 * 100)
     # TODO: check if n.is_compact() should pass as well?
     # it doesn't currently
     self.assertTrue(n.fetch('a').is_compact())
开发者ID:fedepad,项目名称:conduit,代码行数:11,代码来源:t_python_conduit_node.py

示例3: test_simple

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_simple(self):
     a_val = uint32(10)
     b_val = uint32(20)
     c_val = float64(30.0)
     n = Node()
     n['a'] = a_val
     n['b'] = b_val
     n['c'] = c_val
     s = n.schema();
     self.assertTrue(s.is_root())
     self.assertFalse(n.fetch('a').schema().is_root())
开发者ID:LLNL,项目名称:conduit,代码行数:13,代码来源:t_python_conduit_schema.py

示例4: test_simple

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
    def test_simple(self):
        a_val = uint32(10)
        b_val = uint32(20)
        c_val = float64(30.0)

        n = Node()
        n['a'] = a_val
        n['b'] = b_val
        n['c'] = c_val
        print(n)
        d = n.fetch('a').dtype()
        self.assertEqual(d.id(),DataType.name_to_id("uint32"))
        print(d)
开发者ID:fedepad,项目名称:conduit,代码行数:15,代码来源:t_python_conduit_datatype.py

示例5: test_base64

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_base64(self):
     n = default_node()
     print(n)
     n_schema = n.to_json("base64_json");
     print("result base64 json", n_schema)
     g = Generator(n_schema,"base64_json");
     ng = Node();
     g.walk(node=ng);
     print("Generator result")
     print(ng)
     for p in ["a","b","c"]:
         orig = n.fetch(p).value()
         curr = ng.fetch(p).value()
         print(ng)
         print(p, orig, curr)
         orig = n[p]
         curr = ng[p]
         print(ng)
         print(p, orig, curr)
         self.assertEqual(orig,curr)
开发者ID:gzagaris,项目名称:conduit,代码行数:22,代码来源:t_python_conduit_generator.py

示例6: test_simple

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_simple(self):
     n = default_node()
     n_schema = n.to_json("conduit");
     print("result detailed json", n_schema)
     g = Generator(json_schema=n_schema);
     ng = Node();
     sg = Schema()
     g.walk(node=ng);
     g.walk(schema=sg);
     print(ng)
     print(sg)
     for p in ["a","b","c"]:
         orig = n.fetch(p).value()
         curr = ng.fetch(p).value()
         print(ng)
         print(p, orig, curr)
         orig = n[p]
         curr = ng[p]
         print(ng)
         print(p, orig, curr)
         self.assertEqual(orig,curr)
开发者ID:gzagaris,项目名称:conduit,代码行数:23,代码来源:t_python_conduit_generator.py

示例7: test_parent

# 需要导入模块: from conduit import Node [as 别名]
# 或者: from conduit.Node import fetch [as 别名]
 def test_parent(self):
     vec = array(range(100), uint32)
     n = Node()
     n['a'] = vec
     na = n.fetch('a')
     self.assertFalse(na.is_root())
开发者ID:fedepad,项目名称:conduit,代码行数:8,代码来源:t_python_conduit_node.py


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