Esempio n. 1
0
def detect(request):
    ENCODING = 'utf-8'
    feature = 'circles'
    request_json = request.get_json()
    print(request_json)
    try:
        img = base64.b64decode(request_json['image'])
        shape = request.json['shape']
    except:
        return f'jong World!'

    pilImage = Image.open(io.BytesIO(img))
    my_string = ""
    with open("./sample_circles/comp.jpg", "rb") as img_file:
        my_string = base64.b64encode(img_file.read())
    npImage = np.array(pilImage)
    img = Image.fromarray(npImage)
    score, image = backend(npImage, shape)
    if image == "no":
        return(200,{"score": str(score)})
    if score == -1000:
        return (200,my_string.decode('utf-8'))
    encoded_image = base64.b64encode(image.getvalue())
    print(encoded_image)
    base64_string = encoded_image.decode(ENCODING)
    status = 200
    print(str(score))
    body = json.dumps({"score": str(score), "image": base64_string})
    return (body,status)
    if request.args and 'message' in request.args:
        return request.args.get('message')
    elif request_json and 'message' in request_json:
        return request_json['message']
    else:
        return f'Hello World!'
Esempio n. 2
0
	def do_POST(self):
		try:
			tpe, dct = cgi.parse_header(self.headers.getheader('content-type'))
			if tpe == 'multipart/form-data':
				query = cgi.parse_multipart(self.rfile, dct)
			q = query.get('query')
			print q
			#lst = search(q[0]+" site:wordpress.com", 64)
			t1 = time.time();
			b = backend()
			print "start backend process..."
			b.search(q[0])
			print "start iteration..."
			b.limitIteration(10)
			lst1 = b.originList
			lst2 = b.modifiedList()
			
			g = generator()
			g.setDefaultResult(lst1)
			g.setImprovedResult(lst2)
			ret = g.generate()
			self.send_response(200)
			self.send_header('Content-type', 'text/html')
			self.end_headers()
			print "\n---------", ret, "\n----------"
			self.wfile.write(ret)
			t2 = time.time();
			t = t2 - t1
			print t
		except:
			self.send_error(501, 'Server Error')
Esempio n. 3
0
def main():
    if "M" in options.debug:
        import pdb
        pdb.set_trace()
    if not options.filelist:
        options.parser.print_help()
        return
    if options.output == "-":
        fp = sys.stdout
    elif options.output:
        fp = open(options.output, "w")
    else:
        fp = None
    if fp:
        print_header(fp)

    nerrors = 0
    for i, options.filename in enumerate(options.filelist):
        try:
            if options.verbose:
                print(i, options.filename)
            if not options.filename.endswith(".m"):
                print("\tIgnored: '%s' (unexpected file type)" %
                      options.filename)
                continue
            if basename(options.filename) in options.xfiles:
                if options.verbose:
                    print("\tExcluded: '%s'" % options.filename)
                continue
            buf = open(options.filename).read()
            buf = buf.replace("\r\n", "\n")
            # FIXME buf = buf.decode("ascii", errors="ignore")
            stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')

            if not stmt_list:
                continue
            if not options.no_resolve:
                G = resolve.resolve(stmt_list)
            if not options.no_backend:
                s = backend.backend(stmt_list)
            if not options.output:
                f = splitext(basename(options.filename))[0] + ".py"
                with open(f, "w") as fp:
                    print_header(fp)
                    fp.write(s)
            else:
                fp.write(s)
                #fp.close()

        except KeyboardInterrupt:
            break
        except:
            nerrors += 1
            traceback.print_exc(file=sys.stdout)
            if options.strict:
                break
        finally:
            pass
    if nerrors:
        print("Errors:", nerrors)
Esempio n. 4
0
 def thread_work(self):
     """
     Runs in the background
     :return: None
     """
     self.output = backend(*self.input)
     self.update = True
Esempio n. 5
0
def test_driver():
    back = backend()
    list_of_objects = []
    current_json = ""
    decoder = json.JSONDecoder()
    while True:
        data = sys.stdin.readline()
        if not data:
            break
        current_json = current_json + data.rstrip('\n').lstrip()
        number_of_objects = 0
        try:
            posn = 0
            while posn < len(current_json):
                ## raw_decode finds the first special json object present in the string
                ## returns a tuple
                ## txt is the Python representation of the JSON (dict, int/float, Unicode string)
                ## posn is the index at which the special json object stops
                txt, posn = decoder.raw_decode(current_json)
                list_of_objects.append(txt)
                number_of_objects+=1
                current_json = current_json[posn:].lstrip()
                posn = 0
                if number_of_objects == 10:
                    break
        except JSONDecodeError:  ## continue on to read next line
            continue
    list_of_objects = back.sort(list_of_objects)
    print(json.dumps(list_of_objects), separators=(",",":"))
Esempio n. 6
0
 def __init__(self):
     self.backend = backend()
     self.list_of_objects = []
     self.lol_of_ten = []
     self.lol_sorted = []
     self.readJson()
     self.divideJson()
     self.printJson()
Esempio n. 7
0
def main():
    tar = None
    if not options.filelist:
        options.parser.print_help()
        return
    if (len(options.filelist) == 1 and options.filelist[0].endswith(".tar")):
        tar = tarfile.open(options.filelist[0])
        options.filelist = tar.getnames()
    if options.output == "-":
        fp = sys.stdout
    elif options.output:
        fp = open(options.output, "w")
    else:
        assert not options.output
        filename, filetype = splitext(basename(options.filelist[0]))
        options.output = filename + ".py"
        fp = open(options.output, "w")

    print >> fp, "# Autogenerated with SMOP " + version.__version__
    #print >> fp, "from __future__ import division"
    print >> fp, "from smop.core import *"
    if options.link:
        print >> fp, "from %s import *" % options.link
    print >> fp, "#", options.filename

    for i, options.filename in enumerate(options.filelist):
        try:
            if not options.filename.endswith((".m")):
                if options.verbose:
                    print "\tIgnored: '%s' (unexpected file type)" % options.filename
                continue
            if os.path.basename(options.filename) in options.xfiles:
                print "\tExcluded: '%s'" % options.filename
                continue
            if options.verbose:
                print options.filename
            if tar:
                buf = tar.extractfile(options.filename).read()
            else:
                buf = open(options.filename).read()
            buf = buf.replace("\r\n", "\n")
            buf = buf.decode("ascii", errors="ignore")
            stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')
            #assert None not in stmt_list
            if not stmt_list:
                return
            if not options.no_resolve:
                G = resolve.resolve(stmt_list)
            if not options.no_backend:
                s = backend.backend(stmt_list)
                print >> fp, s
        except Exception as e:
            print "\tFailed: ", options.filename
            if not options.ignore:
                raise
            options.ignore -= 1
Esempio n. 8
0
 def openUserFiles(self) -> True:
     #opening the file dialog for selecting the file
     fname = QFileDialog.getOpenFileName(self, 'Open File', 'c:\\', "Video Files(*.wav)")
     print(fname[0])
     if fname[0] != '':
         self.script, self.pscript = be.backend(fname[0])
         self.summ = be.sumThis(self.pscript)
         self.questions, self.keywords = be.genQ(self.script, self.pscript)
         return True
     self.textEdit.setText(script)
Esempio n. 9
0
def main(output_format: str = OUTPUT_FORMAT) -> None:
    """ Run generate on all modules """
    front = frontend()
    s3_events, process_medias = lambda_stack()
    output_backend = backend()
    output_cli = cli()

    if output_format == "svg":
        clean_svg()

    print(front, s3_events, process_medias, output_backend, output_cli)
    def call(self, x, mask=None):
        b, xb = 0., 0.
        if self.data_format == 'channels_first':
            kernel_sum_axes = [1, 2, 3]
            if self.use_bias:
                b = K.reshape(self.b, (self.filters, 1, 1, 1))
                xb = 1.
        elif self.data_format == 'channels_last':
            kernel_sum_axes = [0, 1, 2]
            if self.use_bias:
                b = K.reshape(self.b, (1, 1, 1, self.filters))
                xb = 1.

        Wnorm = K.sqrt(
            K.sum(K.square(self.W), axis=kernel_sum_axes, keepdims=True) +
            K.square(b) + K.epsilon())
        xnorm = K.sqrt(
            K.conv2d(K.square(x),
                     self.kernel_norm,
                     strides=self.strides,
                     padding=self.padding,
                     data_format=self.data_format,
                     filter_shape=self.kernel_norm_shape) + xb + K.epsilon())

        W = self.W / Wnorm

        output = K.conv2d(x,
                          W,
                          strides=self.strides,
                          padding=self.padding,
                          data_format=self.data_format,
                          filter_shape=self.kernel_shape)

        if K.backend() == 'theano':
            xnorm = K.pattern_broadcast(xnorm, [False, True, False, False])

        output /= xnorm

        if self.use_bias:
            b /= Wnorm
            if self.data_format == 'channels_first':
                b = K.reshape(b, (1, self.filters, 1, 1))
            elif self.data_format == 'channels_last':
                b = K.reshape(b, (1, 1, 1, self.filters))
            else:
                raise ValueError('Invalid data_format:', self.data_format)
            b /= xnorm
            output += b
        output = self.activation(output)
        return output
Esempio n. 11
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        MainWindow.setStyleSheet("background-color: rgb(78, 154, 6);")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(580, 70, 161, 61))
        self.pushButton.setStyleSheet("border-right-color: rgb(239, 41, 41);\n"
                                      "background-color: rgb(252, 175, 62);")
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(self.pushOutput)
        ######################

        self.tableWidget = QtWidgets.QGridLayout(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(100, 200, 1000, 192))
        self.tableWidget.setObjectName("tableWidget")

        ######################
        self.mybackend = backend()
        ########################
        self.countryBox = QtWidgets.QComboBox(self.centralwidget)
        self.countryBox.setGeometry(QtCore.QRect(35, 60, 131, 41))
        self.countryBox.setStyleSheet("background-color: rgb(233, 185, 110);")
        self.countryBox.setObjectName("comboBox")
        self.countryBox.currentTextChanged.connect(self.printCountry)

        #####################

        self.cityBox = QtWidgets.QComboBox(self.centralwidget)
        self.cityBox.setGeometry(QtCore.QRect(185, 60, 131, 41))
        self.cityBox.setStyleSheet("background-color: rgb(233, 185, 110);")
        self.cityBox.setObjectName("comboBox")
        #self.cityBox.currentTextChanged.connect(self.printCountry)
        self.countryOptions()
        self.cityOptions()

        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setAutoFillBackground(False)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Esempio n. 12
0
File: main.py Progetto: yenchih/smop
def main():
    #args = options.parser.parse_args()
    #for key in dir(args):
    #    if not key.startswith("_"):
    #        setattr(options,key,getattr(args,key))
    if not options.filelist:
        options.parser.print_help()
        return
    #assert options.filelist
    #xfiles = options.exclude.split(",") if options.exclude else []
    if not options.output:
        options.output = "a.py"
    fp = open(options.output,"w") if options.output != "-" else sys.stdout

    print >> fp, "# Autogenerated with SMOP "# + options.version
    # for key in dir(options.args):
    #     if not key.startswith("_"):
    #         value = getattr(options,key)
    #         print >> fp, '# %s=%s' % (key,value)
    print >> fp, "from __future__ import division"
    print >> fp, "from core import *"

    #if options.callgraph:
    #    C = nx.DiGraph()
    for options.filename in options.filelist:
        try:
            #for options.filename in glob.glob(os.path.expanduser(pattern)):
            print >> fp, "#", options.filename
            if not options.filename.endswith((".m",".tst")):
                print "\tIgnored file: '%s'" % options.filename
                continue
            if os.path.basename(options.filename) in options.xfiles:
                print "\tExcluded file: '%s'" % options.filename
                continue
            if options.verbose:
                print options.filename
            buf = open(options.filename).read().replace("\r\n","\n")
            stmt_list=parse.parse(buf if buf[-1]=='\n' else buf+'\n')
            #assert None not in stmt_list                  
            if not stmt_list and options.strict:
                return
            if options.enumerate:
                for i,stmt_obj in enumerate(stmt_list): 
                    #stmt_class = stmt_obj.__class__.__name__
                    print i, stmt_obj
            #     if i == options.debug_index:
            #         import pdb ; pdb.set_trace()
            #     if stmt_class == "func_stmt":
            #         func_name = stmt_obj.ident.name 
            #         if options.verbose:
            #             print "\t",func_name
            #     else:
            #         func_name = ""
            if not options.no_resolve:
                G = resolve.resolve(stmt_list)
            if not options.no_backend:
                s = backend.backend(stmt_list)
                print >> fp, s
        except Exception as e:
            print e
            if options.strict:
                raise
Esempio n. 13
0
import configargparse
import appframework
import backend
import frontend  #not needed for pure cli apps
import os.path as op

cfgObj = configargparse.ArgParser(default_config_files=["cfg.ini"])
cfgObj.add_argument('--batchmode',
                    help='pass this flag to skip the gui',
                    action="store_true")

cfg = vars(cfgObj.parse_args())
be = backend.backend(cfg)
fe = frontend.frontend(cfg)  #use fe=None if you want only a command line IF.
cli = cfg["batchmode"] or fe is None

if cli: app = appframework.cli(cfg, be)
else: app = appframework.gui(cfg, be, fe)

app.initialize()
app.run()
Esempio n. 14
0
def graphics():

    # create the range of possible years from selected year column max and min values
    if session["year_min"] and session["year_max"]:
        year_options = list(range(session["year_min"],
                                  session["year_max"] + 1))
    else:
        year_options = None

    # set initial values of year_to and year_from ONLY IF year_options != None
    if session["year_from"] == None and year_options:
        session["year_from"] = year_options[0]

    if session["year_to"] == None and year_options:
        session["year_to"] = year_options[-1]

    # ------------------
    # update variables from HTML
    # ------------------

    args = request.args

    # "tab" variables from HTML
    if "tab" in args:
        session["tab"] = args["tab"]

    # year variables from
    if "year_from" in args:
        session["year_from"] = int(args["year_from"])
        session["d"] = backend.backend(
            session["file"],
            session["row_indices"],
            session["column_indices_backend"],
            session["year"],
            session["year_from"],
            session["year_to"],
        )

    # year variables from
    if "year_to" in args:
        session["year_to"] = int(args["year_to"])
        session["d"] = backend.backend(
            session["file"],
            session["row_indices"],
            session["column_indices_backend"],
            session["year"],
            session["year_from"],
            session["year_to"],
        )

    # year variables from
    if "index" in args:
        temp = args["index"].replace("_____", " ")
        session["indices"].append(temp)
        print("\n\n", session["indices"], "\n\n")

    if "crumb" in args:
        if args["crumb"] == "All Populations":
            session["indices"] = []
        else:
            r = session["indices"].index(args["crumb"].replace("_____", " "))
            session["indices"] = session["indices"][0:r + 1]

    if "order" in args:
        session["order"] = args["order"]

    # get data from backend
    if not session["d"]:
        session["d"] = backend.backend(
            session["file"],
            session["row_indices"],
            session["column_indices_backend"],
            session["year"],
            session["year_from"],
            session["year_to"],
        )

    #  #output json file for testing
    # with open('data.json', 'w') as f:
    # json.dump(session["d"], f)

    # Create the plot
    graph = Graphic()
    graph.get_data(session["d"], session["indices"])
    graph.generate(session["tab"], by=session["order"])

    # generate extra variables
    if year_options:
        year_from_options = year_options[0:year_options.
                                         index(int(session["year_to"])) + 1]
        year_to_options = year_options[year_options.
                                       index(int(session["year_from"])):]
    else:
        year_from_options = None
        year_to_options = None

    # generate ordered version of sub-pop dictionary
    colours = graph.get_colours()
    subs = graph.get_subs()
    ordered_subs = [s for s in subs if colours[s] != "lightgrey"
                    ] + [s for s in subs if colours[s] == "lightgrey"]

    # Embed plot into HTML via Flask Render
    script, div = components(graph.plot)
    return render_template(
        "graphics.html",
        script=script,
        div=div,
        tab_options=["all", "positive", "negative"],
        tab_current=session["tab"],
        year_options=year_options,
        year_from_options=year_from_options,
        year_to_options=year_to_options,
        year_from=session["year_from"],
        year_to=session["year_to"],
        subs=ordered_subs,
        crumbs=session["indices"],  # navigation index level as list
        order=session["order"],
        order_options=["ascending", "descending"],
        colours=colours,
        totals=graph.get_totals()
        # subs = ordered_subs
    )
 def __init__(self):
     self.b = backend("55555", "g15")
Esempio n. 16
0
import V004 as view4
import V005 as view5
import V006 as view6
# import V007 as view7
import V008 as view8
# import V009 as view9
import V010 as view10
# import V011 as view11

user_id = 1

user = users.users(user_id=user_id)
language = user.user_language_preference()

layout = frontend.frontend(language=language)
control = backend.backend(user=user, language=language)

#materialize-v1.0.0/materialize/css/materialize.css'
# external_stylesheets = ['https://fonts.googleapis.com/icon?family=Material+Icons',
#                         'starter-template/css/materialize.css',
#                         'starter-template/css/style.css']
external_stylesheets = [
    'https://fonts.googleapis.com/icon?family=Material+Icons'
]

app = dash.Dash(__name__,
                external_stylesheets=external_stylesheets,
                meta_tags=[{
                    'name':
                    'viewport',
                    'content':
Esempio n. 17
0
def main():
    tar = None
    if "M" in options.debug:
        import pdb
        pdb.set_trace()
    if not options.filelist:
        if options.archive:
            tar = tarfile.open(options.archive)
            options.filelist = tar.getnames()
        elif options.code:
            tmp = tempfile.NamedTemporaryFile(suffix=".m")
            tmp.file.write(options.code)
            tmp.file.flush()
            options.filelist = [tmp.name]
            if options.output:
                print "Conflicting options -c and -o"
                return
            options.output = "-"
        else:
            options.parser.print_help()
            return
    if options.output == "-":
        fp = sys.stdout
    elif options.output:
        fp = open(options.output, "w")
    else:
        fp = None
    if fp:
        print_header(fp)
    if options.glob_pattern:
        options.filelist = fnmatch.filter(options.filelist,
                                          options.glob_pattern)
    nerrors = 0
    for i, options.filename in enumerate(options.filelist):
        try:
            if options.verbose:
                print i, options.filename
            if not options.filename.endswith(".m"):
                if options.verbose:
                    print("\tIgnored: '%s' (unexpected file type)" %
                          options.filename)
                continue
            if basename(options.filename) in options.xfiles:
                if options.verbose:
                    print "\tExcluded: '%s'" % options.filename
                continue
            if tar:
                buf = tar.extractfile(options.filename).read()
            else:
                buf = open(options.filename).read()
            buf = buf.replace("\r\n", "\n")
            buf = buf.decode("ascii", errors="ignore")
            stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')
            #assert None not in stmt_list
            if not stmt_list:
                continue
            if not options.no_resolve:
                G = resolve.resolve(stmt_list)
            if not options.no_backend:
                s = backend.backend(stmt_list)
            if not options.output:
                f = splitext(basename(options.filename))[0] + ".py"
                with open(f, "w") as fp:
                    print_header(fp)
                    fp.write(s)
                try:
                    py_compile.compile(f,doraise=True)
                    if options.execfile:
                        execfile(f)
                except:
                    if options.delete-on-error:
                        os.unlink(f)
                        if options.verbose:
                            print "Removed",f
                    raise
            else:
                fp.write(s)
        except KeyboardInterrupt:
            break
        except:
            nerrors += 1
            traceback.print_exc(file=sys.stdout)
            if options.strict:
                break
        finally:
            print "Errors:", nerrors
Esempio n. 18
0
def sort(list_of_lists):
    # Sort each sub-list using the backend
    for i in range(len(list_of_lists)):
        sorted_list = backend().sort(list_of_lists[i])
        list_of_lists[i] = sorted_list
    return json.dumps(list_of_lists)
Esempio n. 19
0
                        symtab[func_name] = func_obj
                        print "\t",func_name
                    except AttributeError:
                        if verbose:
                            print "\tJunk ignored"
                        if strict:
                            return
                        continue
                    if options.do_resolve:
                        resolve.resolve(func_obj)

                if options.do_typeof:
                    for func_obj in func_list:
                        t = func_obj.apply([],symtab)

                if options.do_rewrite:
                    for func_obj in func_list:
                        rewrite.rewrite(func_obj)

                for func_obj in func_list:
                    s = backend.backend(func_obj)
                    print >> fp, s
            except Exception as ex:
                print repr(ex)
                if strict:
                    return


if __name__ == "__main__":
    main()
Esempio n. 20
0
File: main.py Progetto: kem1/smop
def main():
    if "M" in options.debug:
        import pdb
        pdb.set_trace()
    if not options.filelist:
        options.parser.print_help()
        return
    if options.output == "-":
        fp = sys.stdout
    elif options.output:
        fp = open(options.output, "w")
    else:
        fp = None

    nerrors = 0
    for i, options.filename in enumerate(options.filelist):
        try:
            if options.verbose:
                print(i, options.filename)
            if not options.filename.endswith(".m"):
                print("\tIgnored: '%s' (unexpected file type)" %
                      options.filename)
                continue
            if basename(options.filename) in options.xfiles:
                if options.verbose:
                    print("\tExcluded: '%s'" % options.filename)
                continue
            buf = open(options.filename).read()
            buf = buf.replace("\r\n", "\n")
            stmt_list = parse.parse(buf if buf[-1] == '\n' else buf + '\n')

            if not stmt_list:
                continue
            if not options.no_resolve:
                G = resolve.resolve(stmt_list)
                graph_list = []
                for n in G.nodes():
                    temp = str.split(n, '_')
                    while len(temp) > 3:
                        temp[0] += '_' + temp.pop(1)
                    graph_list.append(temp + [G.node[n]["ident"].props])
                resolve_array_refs(stmt_list, graph_list)
            #print_list(stmt_list)
            if not options.no_backend:
                s = backend.backend(stmt_list).strip()
            if not options.output:
                f = splitext(basename(options.filename))[0] + ".py"
                with open(f, "w") as fp:
                    print_header(fp, s)
                    fp.write(s)
            else:
                print_header(fp, s)
                fp.write(s)
        except KeyboardInterrupt:
            break
        except:
            nerrors += 1
            traceback.print_exc(file=sys.stdout)
            if options.strict:
                break
        finally:
            pass
    if nerrors:
        print("Errors:", nerrors)
Esempio n. 21
0
#!/usr/bin/python3
from colorama import init,Fore,Back,Style
import os
import backend

while True:
    init()
    print("1. ip scan")
    print("2. puertos abiertos")
    print("salir")
    user_input = input(" :")
    if user_input == "salir":
        break
    elif user_input == "1":
        backend.backend()
    elif user_input == "2":

    else:
        print("\n")
        
    
Esempio n. 22
0
parser.add_argument("-L",
                    "--listen",
                    default='127.0.0.1',
                    help="Listen this address for HTTP")
parser.add_argument("-P",
                    "--port",
                    default=8000,
                    help="Listen this port for HTTP",
                    type=int)
parser.add_argument("-p",
                    "--pool",
                    default=10,
                    help="Amount of process in worker pool",
                    type=int)
parser.add_argument('--log-level',
                    help='Set logging level',
                    default='info',
                    choices=('critical', 'fatal', 'error', 'warning', 'warn',
                             'info', 'debug'))

options = parser.parse_args()

logging.basicConfig(
    level=getattr(logging, options.log_level.upper(), logging.INFO),
    format="[%(asctime)s] %(filename)s:%(lineno)d %(levelname)s %(message)s")

log.info("Starting service on http://%s:%d/", options.listen, options.port)

with Pool(options.pool) as p:
    backend(p, host=options.listen, port=options.port, debug=options.debug)
Esempio n. 23
0
                    print "!exec foo(3)"

                    continue
                if buf[0] == '!':
                    try:
                        exec buf[1:]
                    except:
                        print "eh?"
                    continue
                t = parse.parse(buf if buf[-1] == '\n' else buf + '\n')
                if not t:
                    continue
            except EOFError:
                return
            resolve.resolve(t, symtab)
            _ = backend.backend(t)
            print _

    if not output:
        output = "a.py"
    fp = open(output, "w") if output != "-" else sys.stdout
    print >> fp, "# Autogenerated with SMOP version " + __version__
    print >> fp, "# " + " ".join(sys.argv)
    print >> fp, "from __future__ import division"
    print >> fp, "from runtime import *"

    for pattern in args:
        for filename in glob.glob(os.path.expanduser(pattern)):
            if not filename.endswith(".m"):
                print "\tIngored file: '%s'" % filename
                continue
from tkinter import *
from backend import backend

backend = backend("books.db")


class Window(object):
    def __init__(self, window):

        self.window = window

        self.window.wm_title("BookStore")

        l1 = Label(window, text="Title")
        l1.grid(row=0, column=0)

        l2 = Label(window, text="Author")
        l2.grid(row=0, column=2)

        l3 = Label(window, text="Year")
        l3.grid(row=1, column=0)

        l4 = Label(window, text="ISBN")
        l4.grid(row=1, column=2)

        self.title_text = StringVar()
        self.e1 = Entry(window, textvariable=self.title_text)
        self.e1.grid(row=0, column=1)

        self.author_text = StringVar()
        self.e2 = Entry(window, textvariable=self.author_text)