示例#1
0
文件: __init__.py 项目: erp12/Pysh
def core_instructions(type_library: PushTypeLibrary) -> Sequence[Instruction]:
    """All instructions definied by pyshgp for the given type library."""
    supported_stacks = type_library.supported_stacks()
    instrucion_modules = [numeric, text, logical, code]
    basic_instr = list(chain(*[m.instructions() for m in instrucion_modules]))
    gen_instrs = generic_instructions(type_library)
    supported_instructions = _supported(basic_instr + gen_instrs, supported_stacks)
    return supported_instructions
示例#2
0
def core_instructions(type_library: PushTypeLibrary) -> Sequence[Instruction]:
    """All instructions definied by pyshgp for the given type library."""
    supported_stacks = type_library.supported_stacks()
    instrucion_modules = [numeric, text, logical, code]
    basic_instr = list(chain(*[m.instructions() for m in instrucion_modules]))
    gen_instrs = generic_instructions(type_library)
    supported_instructions = _supported(basic_instr + gen_instrs, supported_stacks)
    return supported_instructions
示例#3
0
 def test_supported_stacks(self):
     lib = PushTypeLibrary()
     assert lib.supported_stacks() == ALL_CORE_TYPE_NAMES
示例#4
0
 def test_supported_stacks(self):
     lib = PushTypeLibrary()
     assert lib.supported_stacks() == {
         "bool", "int", "float", "char", "str", "code", "exec"
     }
示例#5
0
 def test_supported_stacks(self):
     lib = PushTypeLibrary()
     assert lib.supported_stacks() == {"bool", "int", "float", "char", "str", "code", "exec"}