def main():
    print("""

    ꧁༒☬𝓢𝓽𝓾𝓭𝓮𝓷𝓽'𝓼 𝓗𝓮𝓵𝓹𝓮𝓻☬༒꧂
    1. Calculator
    2. Dna to mRNA converter
    3. Exit
    """)


    menu = input("Option:")

    if menu == "1": # go to calculator
        main_func = True
        calculator.main()
        
    elif menu == "2":
        main_func = True
        converter.main()

    elif menu == "3":
        exit()
        
    else:
        print("Invalid input. Please try again.")
Пример #2
0
    def convert_insn2int(self, data_batch):
        # ------------start(convert insn2int )---------------------------------------
        # **********start(get mat_length/label )*********************
        self.instrunction_length = int(data_batch['length'])
        # print "data of instrunction_length:", self.instrunction_length

        # print "************label of {}**********".format(self.func_name)
        # print "type of data_batch['label']:", type(data_batch['label'])
        # print "data of data_batch['label']:", data_batch['label']
        # print "************label of {}**********".format(self.func_name)
        self.real_arg_num = np.argmax(data_batch['label'])
        # print "data of real_arg_num:", self.real_arg_num
        # ********** end (get mat_length/label )*********************

        # original instruction string data
        inst_asm_list = data_batch['inst_strings']
        self.inst_asm_array = np.asarray(inst_asm_list).reshape(
            self.instrunction_length, 1)
        # print "type of inst_strings", type(self.inst_asm_array)
        # print "shape of inst_strings", self.inst_asm_array.shape
        # print "data of inst_strings", self.inst_asm_array

        # original embedding data
        # print "type of data_batch['data']", type(data_batch['data'][0])
        # print "shape of data_batch['data']", len(data_batch['data'][0])
        # print "data of data_batch['data']", data_batch['data'][0]
        self.embed_data_array = data_batch['data'][0]
        # print "type of self.embed_data_array", type(self.embed_data_array)
        # print "data of self.embed_data_array", self.embed_data_array
        # self.embed_data_array[0].fill(0)
        # print "data of self.embed_data_array", self.embed_data_array

        # original hex data
        # print "type of data_batch['inst_types']", type(data_batch['inst_bytes'][0])
        # print "shape of data_batch['inst_bytes']", len(
        #     data_batch['inst_bytes'][0])
        # print "data of data_batch['inst_bytex']", data_batch['inst_bytes'][0]
        hex_data_list = data_batch['inst_bytes'][0]
        # print "type of hex_data_list", type(hex_data_list)
        # print "data of hex_data_list", hex_data_list
        self.hex_data_array = np.asarray(hex_data_list)
        # self.hex_data_array = np.array(hex_data_list)
        # self.hex_data_array = np.array([np.array(x) for x in hex_data_list])
        # print "data of self.hex_data_array", self.hex_data_array

        # int of hex data
        int2insn_map, int_data_list = converter.main(hex_data_list)
        # print "type of int_data_list:", type(int_data_list)
        # print "int data of int_data_list:", int_data_list
        # print "type of int2insn_map:", type(int2insn_map)
        # print "data of int2insn_map:", int2insn_map
        self.int_data_array = np.asarray(int_data_list)
Пример #3
0
def main():
  args = sys.argv[1:]
  parser = argparse.ArgumentParser(
      description="ONNX-Tensorflow Command Line Interface")
  parser.add_argument(
      "command",
      choices=["convert"],
      help="Available commands.")

  if len(args) == 0:
    parser.parse_args(["-h"])
  cli_tool = parser.parse_args([args[0]])
  if cli_tool.command == "convert":
    return converter.main(args[1:])
Пример #4
0
 def test_many_args(self):
     ''' Тестирование при множественном вводе аргументов '''
     self.assertEqual(main(['converter.py', '213', '12332']), 2)
Пример #5
0
 def test_empty_args(self):
     ''' Тестирование при отсутствии аргумента '''
     self.assertEqual(main(['converter.py']), 1)
Пример #6
0
 def test_correct_args(self):
     self.assertEqual(main([
         'converter.py',
         '2000',
     ]), 0)
Пример #7
0
 def test_huge_number_args(self):
     ''' Тестирование при большом значении аргументе '''
     self.assertEqual(
         main(['converter.py', '5532535232366632622636233265544554']), 0)
Пример #8
0
 def test_small_number_args(self):
     ''' Тестирование при малом значении аргумента '''
     self.assertEqual(main(['converter.py', '0.001']), 0)
Пример #9
0
 def test_negative_args(self):
     ''' Тестирование при отрицательном аргументе '''
     self.assertEqual(main(['converter.py', '-123']), 4)
Пример #10
0
 def test_incorrect_args(self):
     ''' Тестирование при некорректном (не числовом) аргументе '''
     self.assertEqual(main(['converter.py', '2w13']), 3)
Пример #11
0
#!/usr/bin/python
## Copyright 2015 Knossos authors, see NOTICE file
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##     http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

from __future__ import absolute_import, print_function
import sys
import logging

logging.basicConfig(
    level=logging.INFO,
    format='%(levelname)s:%(threadName)s:%(module)s.%(funcName)s: %(message)s')
logging.getLogger().addHandler(logging.FileHandler('converter.log'))

import converter

if __name__ == '__main__':
    converter.main(sys.argv[1:])
Пример #12
0
#!/usr/bin/python

'''
This script is like a link. It calls converter from *.ini input
into modified JSON. For syntax call:

python ini2json.py --help

Conversion of the INI file is described by the template file:
"ini2json/converter_root/converter/ini_to_json_template.txt"

The program can also merge a *.mtr file into created JSON file.
However, this is hardwired in 
"ini2json/converter_root/converter/materials.py"

'''

import sys, os

conv_path= sys.path[0] + os.sep +"ini2json" + os.sep + "converter_root" + os.sep + "converter"
print conv_path

sys.path.append(conv_path)
import converter 

converter.main()
Пример #13
0
#!/usr/bin/python
'''
This script is like a link. It calls converter from *.ini input
into modified JSON. For syntax call:

python ini2json.py --help

Conversion of the INI file is described by the template file:
"ini2json/converter_root/converter/ini_to_json_template.txt"

The program can also merge a *.mtr file into created JSON file.
However, this is hardwired in 
"ini2json/converter_root/converter/materials.py"

'''

import sys, os

conv_path = sys.path[
    0] + os.sep + "ini2json" + os.sep + "converter_root" + os.sep + "converter"
print conv_path

sys.path.append(conv_path)
import converter

converter.main()
Пример #14
0
#!/usr/bin/python
## Copyright 2015 Knossos authors, see NOTICE file
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##     http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.

from __future__ import absolute_import, print_function
import sys
import logging

logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(threadName)s:%(module)s.%(funcName)s: %(message)s')
logging.getLogger().addHandler(logging.FileHandler('converter.log'))

import converter

if __name__ == '__main__':
    converter.main(sys.argv[1:])