def gen():
    for model_name in strings.MODELS_NAMES:
        if not os.path.exists("docs/imgs/examples/{}/".format(model_name)):
            os.makedirs("docs/imgs/examples/{}/".format(model_name), exist_ok=True)
        print(model_name)
        process("docs/imgs/input/", "docs/imgs/examples/{}/".format(model_name), model_name)
    return True
Ejemplo n.º 2
0
    def testNoMode(self):
        class ns: pass
        ns.called=False
        def usage_cb(_): ns.called=True

        main.process(['main'], usage_cb)
        
        self.assert_(ns.called)
Ejemplo n.º 3
0
    def get(self):
        is_approved = parse_approved_filter()
        filter_date = parse_filter_date()

        process('circo', is_approved, filter_date)
        with open('circograph.json', 'r', encoding='utf-8') as f:
            data = json.load(f)
            return data
Ejemplo n.º 4
0
    def get(self):
        is_approved = parse_approved_filter()
        filter_date = parse_filter_date()

        process('sfdp', is_approved, filter_date, is_multilevel=True)
        with open('graph_by_levels.json', 'r', encoding='utf-8') as f:
            data = json.load(f)
            return data
Ejemplo n.º 5
0
    def test_process(self):
        try:
            process()
        except Exception as e:
            pass


        """
Ejemplo n.º 6
0
    def testModeName(self):
        class ns: pass

        ns.called = False
        def callback(params=[]): ns.called = True
        test_mode = main.mode("foo", callback)

        main.process(["main", "foo"])

        self.assertTrue(ns.called)
Ejemplo n.º 7
0
def getImage():
      longtitude=request.args.get('longtitude')
      latitude=request.args.get('latitude')
      DIR = "{}_{}".format(longtitude, latitude)
      process(longtitude, latitude)
      candidates =[i for i in os.listdir(os.path.join('static',DIR)) if i[0].isdigit() ]
     
      # return render_template('result.html',image=os.path.join(DIR,'result.png' ),
                              # candidates = [os.path.join(DIR,i) for i in candidates])
      return jsonify([os.path.join('static',DIR,i) for i in candidates])
Ejemplo n.º 8
0
 def process(self, body):
     import main
     metadata = json.load(open(os.path.join(HERE, 'metadata.json')))
     d = json.loads(body)
     d['worker'] = os.uname()[1]
     body = json.dumps(d)
     t_start = time.time()
     main.process(json.loads(body))
     t_end = time.time()
     return t_end - t_start
Ejemplo n.º 9
0
 def process(self, body):
     import main
     metadata = json.load(open(os.path.join(HERE, 'metadata.json')))
     d = json.loads(body)
     d['worker'] = os.uname()[1]
     body = json.dumps(d)
     t_start = time.time()
     main.process(json.loads(body))
     t_end = time.time()
     return t_end - t_start
Ejemplo n.º 10
0
    def testOption(self):
        class ns: pass
        ns.params=None
        
        def callback(params): ns.params = params
        test_mode = main.mode("foo", callback)
        test_mode.option("bar")

        main.process(["main", "foo","--bar=qux"])
        
        self.assert_(ns.params, "No params object was created")
Ejemplo n.º 11
0
def start_radon_transform():
    main.radon_angle = int(app.radon_angle.get())
    main.n_detectors = int(app.detectors_number.get())
    main.step_angle = float(app.step_angle.get())
    main.emission_angle = int(app.emission_angle.get())
    app.reset_progressbar()
    try:
        main.process(main.image, on_transform_change,
                     on_inverse_transform_change, on_finish)
    except Exception as e:
        app.error.set(e)
    else:
        app.error.set('')
Ejemplo n.º 12
0
    def testSubModeCallback(self):
        class ns: pass
        ns.outer = False
        ns.inner = False
        def outercb(params): ns.outer = True
        def innercb(params): ns.inner = True

        mode = main.mode("foo", outercb)
        submode = mode.mode("bar", innercb)
        
        main.process(["main", "foo", "bar"])

        self.assertFalse(ns.outer)
        self.assert_(ns.inner)
Ejemplo n.º 13
0
def run(test, i, o, m, prep, postp):
    try:
        process(i, o, m, prep, postp)
    except BaseException as e:
        test.fail("TESTING FAILED!\n"
                  "PARAMS:\n"
                  "model_name: {}\n"
                  "input_path: {}\n"
                  "output_path: {}\n"
                  "preprocessing_method: {}\n"
                  "postprocessing_method: {}\n"
                  "Error: {}\n".format(m, i, o, prep, postp, str(e)))
        exit(1)
    exit(0)
Ejemplo n.º 14
0
    def testSubModeWithOptions(self):
        class ns: pass
        ns.params = None

        def cb(params): ns.params = params
        m = main.mode("foo", None)
        m.option("qux")
        s = m.mode("bar", cb)
        s.option("abed")

        main.process(["main", "foo", "bar", "--qux=23", "--abed=not"])

        self.assert_(ns.params, "No params object was created")
        self.assertEqual(ns.params['qux'].value, "23")
        self.assertEqual(ns.params['abed'].value, "not")
Ejemplo n.º 15
0
 def test_0():
     configs = [
         "Case_1.xlsx",
         "Challenger_1.xlsx",
         "Deutz Fahr.xlsx",
         "Freightliner.xlsx",
         "MAN.xlsx",
         "New Holland.xlsx",
         "tmp1.xlsx",
         "tmp2.xlsx",
         "Камаз_1.xlsx",
     ]
     for config in configs:
         process(r"../configurations/Real/" + config,
                 config.split(".")[0] + "/")
Ejemplo n.º 16
0
    async def on_message(self,msg):
        if msg.author == client.user:
            return

        response = process(msg.content)
        if response:
            await msg.channel.send(response)
Ejemplo n.º 17
0
def test_single_bid_pays_reserve():
    raw_events = [
        '10|1|SELL|toaster_1|10.00|20', '13|5|BID|toaster_1|12.50', '22'
    ]

    results = process(raw_events)

    assert list(results) == [
        '20|toaster_1|5|SOLD|10.00|1|12.50|12.50',
    ]
Ejemplo n.º 18
0
def gen():
    for model_name in strings.MODELS_NAMES:
        for preprocess_method_name in strings.PREPROCESS_METHODS:
            for postprocess_method_name in strings.POSTPROCESS_METHODS:
                if not os.path.exists("docs/imgs/examples/{}/{}/{}".format(
                        model_name, preprocess_method_name,
                        postprocess_method_name)):
                    os.makedirs("docs/imgs/examples/{}/{}/{}".format(
                        model_name, preprocess_method_name,
                        postprocess_method_name),
                                exist_ok=True)
                print(model_name, preprocess_method_name,
                      postprocess_method_name)
                process(
                    "docs/imgs/input/", "docs/imgs/examples/{}/{}/{}".format(
                        model_name, preprocess_method_name,
                        postprocess_method_name), model_name,
                    preprocess_method_name, postprocess_method_name)
    return True
Ejemplo n.º 19
0
def worker_thread(window, inputfiles, model):
    print('processing started ...')
    count = 0
    for inputfile in inputfiles:
      count += 1
      (inputfilepath, inputfilename) = os.path.split(inputfile)      
      outputfile = os.path.join(
        inputfilepath,
        'bg-removed',
        # only support PNG files as of now
        os.path.splitext(inputfilename)[0] + '.png'
      )
      window.evaluate_js(
        "window.app.fileUploadButton.textContent = 'Processing "
          + str(count) + ' of ' + str(len(inputfiles)) + " ...'"
      )
      process(inputfile, outputfile, model)
    window.evaluate_js("window.app.fileUploadButton.textContent = 'Select photos'")
    print('processing complete')
    open_folder(os.path.join(inputfilepath, 'bg-removed'))
Ejemplo n.º 20
0
def parse_request():
    data = request.data
    route = './out.jpeg'
    if (data):
        img_stream = cv2.imread(data)
        route = data
    result = process()
    cv2.imwrite('./new_out.jpeg', result)
    return jsonify(
        '"imageroute": "C:\PyCHarmProj\PyCharmProj\Bill_Recognition\new_out.jpeg"'
    )
Ejemplo n.º 21
0
def test_earlier_bid_wins():
    raw_events = [
        '10|1|SELL|toaster_1|10.00|20', '13|5|BID|toaster_1|12.50',
        '14|6|BID|toaster_1|12.50', '20'
    ]

    results = process(raw_events)

    assert list(results) == [
        '20|toaster_1|5|SOLD|10.00|1|12.50|12.50',
    ]
Ejemplo n.º 22
0
def test_no_bids():
    raw_events = [
        '10|1|SELL|toaster_1|10.00|20', '15|8|SELL|tv_1|250.00|20', '20'
    ]

    results = process(raw_events)

    assert list(results) == [
        '20|toaster_1||UNSOLD|0.00|0|0.00|0.00',
        '20|tv_1||UNSOLD|0.00|0|0.00|0.00'
    ]
Ejemplo n.º 23
0
def run_file(file):
    print("Processing file: %s" % file)

    tmp_file = tmp_file_name(file)

    with open(file, "r") as input_file, open(tmp_file, "w") as out:
        try:
            main.process(input_file, out)
        except BaseException as e:
            if isinstance(e, KeyboardInterrupt):
                raise e
            else:
                traceback.print_exc()

    out_file = out_file_name(file)
    if os.path.exists(out_file):
        os.remove(out_file)
    os.rename(tmp_file, out_file)

    print("File processed: %s" % file)
Ejemplo n.º 24
0
def worker_thread(win, input_files, model, preprocessing_method, postprocessing_method):
    logger.debug('Processing started ...')
    for i, file in enumerate(input_files):
        (file_path, file_name) = os.path.split(file)
        output_file = os.path.join(
            file_path,
            'bg-removed',
            # only support PNG files as of now
            os.path.splitext(file_name)[0] + '.png'
        )
        win.evaluate_js(
            "window.app.fileUploadButton.textContent = 'Processing "
            + str(i + 1) + ' of ' + str(len(input_files)) + " ...'"
        )
        try:
            process(file, output_file, model, preprocessing_method, postprocessing_method)
        except BaseException as e:
            show_error(win, e)
    win.evaluate_js("window.app.fileUploadButton.textContent = 'Select photos'")
    logger.debug('Processing complete')
    # noinspection PyUnboundLocalVariable
    open_folder(os.path.join(file_path, 'bg-removed'))
Ejemplo n.º 25
0
def test_given_scenario():
    raw_events = [
        '10|1|SELL|toaster_1|10.00|20', '12|8|BID|toaster_1|7.50',
        '13|5|BID|toaster_1|12.50', '15|8|SELL|tv_1|250.00|20', '16',
        '17|8|BID|toaster_1|20.00', '18|1|BID|tv_1|150.00',
        '19|3|BID|tv_1|200.00', '20', '21|3|BID|tv_1|300.00'
    ]

    results = process(raw_events)

    assert list(results) == [
        '20|toaster_1|8|SOLD|12.50|3|20.00|7.50',
        '20|tv_1||UNSOLD|0.00|2|200.00|150.00'
    ]
Ejemplo n.º 26
0
def analyze(event, context):
    p = params(event)
    try:
        fname = "/tmp/"+p["key"]+".mp3"
        wait_and_download(p["key"], fname)
        sha256 = hashlib.sha256(open(fname, "rb").read()).hexdigest()

        try:
            s3.download_file(bucket, sha256+".json", fname+".json")
        except botocore.exceptions.ClientError as e:
            if e.response["Error"]["Code"] == "404":
                body = process(fname, 200)
                if len(body["results"]) > 40:
                    with open(fname+".json", "w") as f:
                        json.dump(body, f)
                    s3.upload_file(fname+".json", bucket, sha256+".json")
            else:
                raise
        else:
            with open(fname+".json") as f:
                body = json.loads(f.read())

        return {
            "statusCode": 200,
            "headers": {
                "Access-Control-Allow-Origin" : "*",
                "Access-Control-Allow-Credentials": True
            },
            "body": json.dumps({
                "success": True,
                "message": "Processed file.",
                "data": body
            }, separators=(",", ":"))
        }
    except Exception as e:
        print("Unexpected error:", p["key"])
        traceback.print_exc()

        return {
            "statusCode": 500,
            "headers": {
                "Access-Control-Allow-Origin" : "*",
                "Access-Control-Allow-Credentials": True
            },
            "body": json.dumps({
                "success": False,
                "message": "Encountered error on server. {0}".format(e)
            })
        }
Ejemplo n.º 27
0
def upload_file():
    if request.method =="POST":
        directory =r"D:\PascalVOC-to-Images"
        os.chdir(directory)
        for f in request.files.getlist('file_name'):
            # f= request.files['file_name']
            f.save(os.path.join(app.config['UPLOAD_PATH'],f.filename))
            file_name, file_extension = os.path.splitext(f.filename)
            print(file_extension)
            if file_extension == ".xml":
                filePath=process(file_name)
                print(filePath)
                path = os.getcwd()
                # print(os.path.dirname(path)+'\data'+path)
                pic1 = os.path.join(app.config['SHOW_FOLDER'], 'savedImage.jpg')
                print(pic1)
        return render_template("index.html", user_image=pic1)  
    return render_template("index.html",msg="please choose the file")
Ejemplo n.º 28
0
def test():
    #берем тесты из csv-файла
    tests = []
    for row in csv.reader(open('test-set.csv'), delimiter=';'):
        tests.append(tuple([r.decode('utf8') for r in row]))

    TP = 0
    TN = 0
    FP = 0
    FN = 0

    #try:
    for i, t in enumerate(tests[351:]):
        # print i
        # print t[0]
        # print t[1]

        r = u'''{"orig": {"lang": "en", "text": "%s"}, "target": {"lang": "ru", "text": "%s"}}''' % (
            t[0].replace(u'"', u''), t[1].replace(u'"', u''))
        print str(i + 351)

        print u'\n'.join(main.debug(r))
        print u'\n'

        res = json.loads(main.process(r))
        if res != int(t[2]):
            pass

        if res == 0 and int(t[2]) == 0:
            TN += 1
        if res == 1 and int(t[2]) == 1:
            TP += 1
        if res == 1 and int(t[2]) == 0:
            FP += 1
        if res == 0 and int(t[2]) == 1:
            FN += 1

    #except:
    print u'TP = %s ; TN = %s;  FP = %s, FN = %s' % (TP, TN, FP, FN)
Ejemplo n.º 29
0
def questions():
    global m, pm2, model, qNum, questionList, isTrue, result, started
    if not started:
        return redirect(url_for('start'))
    if request.args:
        if request.args['otvet'] == isTrue:
            result += 1
    if qNum < 10:
        qNum += 1
    else:
        return redirect(url_for('end'))
    p = random.randint(0, 1)
    res = process(''.join(questionList[qNum - 1]), model, pm2)
    if p == 0:
        isTrue = "no"
    else:
        res = ''.join(questionList[qNum - 1])
        isTrue = "yes"
    temp = res.strip().split('\n')
    for i in range(len(temp) - 2):
        temp[i] = temp[i][0].upper() + temp[i][1:]
    res = '<br>'.join(temp)
    return render_template("questions.html", res=res, qNum=qNum)
Ejemplo n.º 30
0
        frame = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
        processed_frame = main.remove_green(frame, coef, bg)

        stframe.image(processed_frame, width=682)
elif text == 'webcam':
    bg = cv.imread(bg.name)
    bg = cv.cvtColor(bg, cv.COLOR_BGR2RGB)

    vf = cv.VideoCapture(0)

    stframe = st.empty()
    coef = main.load_model()
    while vf.isOpened():
        ret, frame = vf.read()
        # if frame is read correctly ret is True
        if not ret:
            print("Can't receive frame (stream end?). Exiting ...")
            break

        frame = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
        processed_frame = main.remove_green(frame, coef, bg)

        stframe.image(processed_frame, width=682)

    vf.release()
    cv.destroyAllWindows()

else:
    image = main.process(fg.name, bg.name, 'image')
    st.image(image, width=682)
Ejemplo n.º 31
0
 def test_process_simple_html_yields_rows(self):
     with open(join(SAMPLE_DIR, 'simple.html'), 'r') as f:
         row_generator = process(f)
         self.assertIsInstance(row_generator.next(), OrderedDict)
Ejemplo n.º 32
0
#!/usr/bin/env python3

import argparse
import os
import sys
from pathlib import Path

from main import process, Metrics

parser = argparse.ArgumentParser(description="Testbench", add_help=True)
parser.add_argument("PROGRAM",
                    type=str,
                    help="path to program you want to test")
args = parser.parse_args()

dataset_path = Path(
    os.path.dirname(os.path.realpath(__file__)) + "/basic_testcases")
program = Path(args.PROGRAM)

metrics = Metrics(comment='')
process(program, dataset_path, metrics, 1)

positive = len(metrics.filter(lambda k, v: v["return_code"] == 0))
negative = len(metrics.filter(lambda k, v: v["return_code"] == 255))
errors = len(metrics.filter(lambda k, v: v["return_code"] not in [0, 255]))
print("positive/negative/errors: %d/%d/%d" % (positive, negative, errors))

if negative != 0 or errors != 0:
    print("Some tests are not passing")
    sys.exit(1)
Ejemplo n.º 33
0
def test_errors():
    raw_events = ['gasdfs', '20']

    results = process(raw_events)

    assert list(results) == [[{'error': 'gasdfs'}]]
Ejemplo n.º 34
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Will Brennan'


# Built-in Modules
import logging
# Standard Modules
import cv2
import numpy
# Custom Modules
import main
import scripts


if __name__ == '__main__':
    args = scripts.get_args(from_file=False)
    logger = scripts.get_logger(quite=args.quite, debug=args.debug)
    cam = cv2.VideoCapture(0)
    while True:
        ret, img_col = cam.read()
        img_msk = main.process(img_col, args=args)
        if not args.display:
            scripts.display('img_col', img_col)
            scripts.display('img_msk', img_msk)
            scripts.display('img_skn', cv2.bitwise_and(img_col, img_col, mask=img_msk))
            cv2.waitKey(5)
Ejemplo n.º 35
0
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""


from main import process
from controller import bots

# 用来出错重启前,先清理出错时间段内的通知

while True:
    for bot in bots:
        process(bot, True)
Ejemplo n.º 36
0
def run_file(file):
    with open(file, "r") as input_file, open(out_file_name(file), "w") as out:
        main.process(input_file, out)
Ejemplo n.º 37
0
cache_path = config.get('posmon', 'cache')
sde_db_uri = config.get('posmon', 'sde_db_uri')
try:
    sentry_uri = config.get('posmon', 'sentry.uri')
except ConfigParser.NoOptionError:
    sentry_uri = None

# Set up logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
if sentry_uri:
    from raven.handlers.logging import SentryHandler
    sentry_handler = SentryHandler(sentry_uri)
    sentry_handler.setLevel(logging.WARNING)
    logging.getLogger().addHandler(sentry_handler)

sde.initialize(sde_db_uri)

# Run!
cache=SqliteCache(cache_path)
fmt = sys.argv[1] if len(sys.argv) > 1 else 'text'
for key_id, vcode in keys:
    api_key = API(api_key=(key_id, vcode), cache=cache)
    try:
        process(api_key, format=fmt, config=config)
    except Exception as e:
        if fmt == 'text':
            print "error processing key: %s" % (str(e),)
        else:
            print json.dumps({'error': str(e)})
        logging.exception(str(e))
Ejemplo n.º 38
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#this is the main file

import main

main.process()
Ejemplo n.º 39
0
import main
import os
import aboutme

while True:
    os.system('cls')
    print('1.开始使用', '\n', '2.作者信息', '\n', 'y4exit')
    choice = str(input('输入数字1/2'))
    if choice == '1':
        main.process()
    elif choice == '2':
        aboutme.main()
    elif choice == 'y' or choice == 'Y':
        break
    input('按任意键继续!')
Ejemplo n.º 40
0
cache_path = config.get('posmon', 'cache')
try:
    sentry_uri = config.get('posmon', 'sentry.uri')
except ConfigParser.NoOptionError:
    sentry_uri = None

# Set up logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
if sentry_uri:
    from raven.handlers.logging import SentryHandler
    sentry_handler = SentryHandler(sentry_uri)
    sentry_handler.setLevel(logging.WARNING)
    logging.getLogger().addHandler(sentry_handler)

# Run!
cache=ShelveCache(cache_path)
fmt = sys.argv[1] if len(sys.argv) > 1 else 'text'
try:
    for key_id, vcode in keys:
        api_key = API(api_key=(key_id, vcode), cache=cache)
        try:
            process(api_key, format=fmt)
        except Exception as e:
            if fmt == 'text':
                print "error processing key: %s" % (str(e),)
            else:
                print json.dumps({'error': str(e)})
            logging.exception(str(e))
finally:
    cache.cache.close()
Ejemplo n.º 41
0
    def processDrawEquation(self, bexp):
        if self.DelayRadioButton.isChecked():
            option = 0
        elif self.GatesRadioButton.isChecked():
            option = 1
        a = 0
        self.InsertExpressionEdit.setText(bexp)
        self.ProgressBar.setVisible(True)
        self.ProgressBar.setValue(0)
        self.result.append("a")

        process(bexp)
        DisplayData()
        DisplayCircuits()
        self.ProgressBar.setValue(25)
        sleep(1)
        number = random.randint(30, 70)
        self.ProgressBar.setValue(number)
        sbol.SBOL_File(self.spinBox.value(), self.doubleSpinBox.value(),
                       option, self.CircuitSpinBox.value())  #create SBOl files
        number = random.randint(75, 90)
        self.ProgressBar.setValue(number)
        sleep(0.1)
        logic.Logical_Representation(
            self.spinBox.value(), self.doubleSpinBox.value(), option,
            self.CircuitSpinBox.value())  #Create Logical Representation images
        visual.SBOLv(self.spinBox.value(), self.doubleSpinBox.value(), option,
                     self.CircuitSpinBox.value()
                     )  #create SBOL visual Representation images
        self.ProgressBar.setValue(100)

        bexp = Convert(bexp)
        bexp = "".join(bexp.split())
        #bexp = bexp.strip() #Remove spaces in the expression
        finalexp = []
        exp = bexp.split("+")  #change the notations
        for i in range(len(exp)):
            term = exp[i].split(".")
            finalterm = []
            for j in range(len(term)):
                if term[j][-1] == "'":
                    finalterm.append("not(" + term[j][:-1] + ")")
                else:
                    finalterm.append(term[j])
            finalexp.append("(" + " and ".join(finalterm) + ")")
        bexp = " or ".join(finalexp)
        code = compile(bexp, '', 'eval')  #evaluation of expression
        TruthTable_Input = code.co_names  # Generates the number of inputs in an expression. In a.b there are 2 inputs 'a' and 'b'
        for values1 in product(
                range(2),
                repeat=len(TruthTable_Input)):  # generate the values of entrid
            header_count = 2**(len(values1))
            List_TruthTable_Input = [[] for i in range(1, header_count + 1)]
        self.TruthList.clear()
        for BexpIndex in range(
                len(TruthTable_Input)
        ):  #make the list for TruthTable_Input to show on main window
            self.ttList.append(TruthTable_Input[BexpIndex])
            self.ttList.append("   ")
        self.ttList.append(":   ")
        self.ttList.append(bexp)
        s = [str(i) for i in self.ttList]
        res = " ".join(s)
        self.TruthList.addItem(res)
        self.ttList.clear()
        for values in product(range(2), repeat=len(
                TruthTable_Input)):  # put inputs of espression together
            for w in range(len(values)):
                List_TruthTable_Input[a].append(str(values[w]))
            a += 1
            env = dict(
                zip(TruthTable_Input,
                    values))  #put the TruthTable_Input and values togather
            pk = int(eval(code, env))  #generate the output of truthtable

            for v in values:  #append the list to show on main window
                self.ttList.append(v)
                self.ttList.append("     ")
            self.ttList.append(":       ")
            self.ttList.append(pk)
            s = [str(i) for i in self.ttList]
            res = " ".join(s)
            self.TruthList.addItem(res)
            self.ttList.clear()
        if len(self.result
               ) > 0:  #Call these functions only if there is an expression
            self.CreateCircuitList()
            self.CreateXMLList()
            self.result.clear()