本文整理汇总了Python中neurokernel.pattern.Interface.is_compatible方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.is_compatible方法的具体用法?Python Interface.is_compatible怎么用?Python Interface.is_compatible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neurokernel.pattern.Interface
的用法示例。
在下文中一共展示了Interface.is_compatible方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_compatible_with_nulls
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_with_nulls(self):
"""
Interfaces can be compatible even if some of their ports do not have a
set input or output status.
"""
i = Interface('/foo[0:3]')
i['/foo[0:2]', 'interface', 'io'] = [0, 'out']
i['/foo[2]', 'interface'] = 0
j = Interface('/foo[0:3]')
j['/foo[0:2]', 'interface', 'io'] = [1, 'in']
j['/foo[2]', 'interface'] = 1
assert i.is_compatible(0, j, 1)
示例2: test_is_compatible_with_nulls_types
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_with_nulls_types(self):
"""
Interfaces can be compatible even if some of their ports do not have a
set type.
"""
i = Interface('/foo[0:3]')
i['/foo[0:2]'] = [0, 'out', 'gpot']
i['/foo[2]', 'interface'] = 0
j = Interface('/foo[0:3]')
j['/foo[0:2]'] = [1, 'in', 'gpot']
j['/foo[2]', 'interface'] = 1
assert i.is_compatible(0, j, 1)
示例3: test_is_compatible_both_dirs_types
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_both_dirs_types(self):
"""
It should be possible to define compatible interfaces containing both
input and output ports with specified types.
"""
i = Interface('/foo[0:4]')
i['/foo[0:2]'] = [0, 'out', 'gpot']
i['/foo[2:4]'] = [0, 'in', 'spike']
j = Interface('/foo[0:4]')
j['/foo[0:2]'] = [1, 'in', 'gpot']
j['/foo[2:4]'] = [1, 'out', 'spike']
assert i.is_compatible(0, j, 1)
示例4: test_is_compatible_both_dirs
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_both_dirs(self):
"""
It should be possible to define compatible interfaces containing both
input and output ports.
"""
i = Interface('/foo[0:4]')
i['/foo[0:2]', 'interface', 'io'] = [0, 'out']
i['/foo[2:4]', 'interface', 'io'] = [0, 'in']
j = Interface('/foo[0:4]')
j['/foo[0:2]', 'interface', 'io'] = [1, 'in']
j['/foo[2:4]', 'interface', 'io'] = [1, 'out']
assert i.is_compatible(0, j, 1)
示例5: test_is_compatible_sel_order
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_sel_order(self):
"""
Interfaces with individually compatible ports that are ordered in
different ways should still be deemed compatible.
"""
# Selectors with multiple levels:
i = Interface('/foo[0:2],/bar[0:2]')
i['/foo[0:2]', 'interface', 'io'] = [0, 'in']
i['/bar[0:2]', 'interface', 'io'] = [0, 'out']
j = Interface('/bar[0:2],/foo[0:2]')
j['/bar[0:2]', 'interface', 'io'] = [1, 'in']
j['/foo[0:2]', 'interface', 'io'] = [1, 'out']
assert i.is_compatible(0, j, 1)
# Selectors with single level:
i = Interface('/foo,/bar,/baz,/qux')
i['/[foo,bar]', 'interface', 'io'] = [0, 'in']
i['/[baz,qux]', 'interface', 'io'] = [0, 'out']
j = Interface('/bar,/foo,/qux,/baz')
j['/[baz,qux]', 'interface', 'io'] = [1, 'in']
j['/[foo,bar]', 'interface', 'io'] = [1, 'out']
assert i.is_compatible(0, j, 1)
示例6: test_is_compatible_subsets_with_null_types
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_subsets_with_null_types(self):
"""
Interfaces that both share a subset of compatible ports can be deemed
compatible by setting the `allow_subsets` option of the compatibility
test even when the types are null.
"""
i = Interface('/foo[0:6]')
i['/foo[0:3]'] = [0, 'out']
i['/foo[3:6]'] = [0, 'out']
j = Interface('/foo[0:6]')
j['/foo[0:2]'] = [1, 'in']
j['/foo[3:5]'] = [1, 'in']
k = Interface('/foo[0:6]')
assert i.is_compatible(0, j, 1, True)
assert i.is_compatible(0, k, 1, True) == False
示例7: test_is_compatible_one_dir_types
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_one_dir_types(self):
i = Interface('/foo[0:2]')
i['/foo[0:2]'] = [0, 'out', 'spike']
j = Interface('/foo[0:2]')
j['/foo[0:2]'] = [1, 'in', 'spike']
assert i.is_compatible(0, j, 1)
示例8: test_is_compatible_one_dir
# 需要导入模块: from neurokernel.pattern import Interface [as 别名]
# 或者: from neurokernel.pattern.Interface import is_compatible [as 别名]
def test_is_compatible_one_dir(self):
i = Interface('/foo[0:2]')
i['/foo[0:2]', 'interface', 'io'] = [0, 'out']
j = Interface('/foo[0:2]')
j['/foo[0:2]', 'interface', 'io'] = [1, 'in']
assert i.is_compatible(0, j, 1)