本文整理汇总了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)
示例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())
示例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())
示例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)
示例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)
示例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)
示例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())