コード例 #1
0
ファイル: server.py プロジェクト: kioster/materialWebSite
def main():
    tornado.options.parse_command_line()
    app = application()
    app.listen(options.port)
    print('Development server is running at http://127.0.0.1:%s/' % options.port)
    print('Quit the server with Control-C')
    tornado.ioloop.IOLoop.instance().start()
コード例 #2
0
ファイル: analysis.py プロジェクト: Krocodial/ceevee
def parse(name):
    list = []
    counter = 1
    #output = open('../error.txt', 'a')
    try:
        input = csv.reader(open(name))
        for line in input:
            break
        row_count = sum(1 for i in csv.reader(open(name)))
        itera = int(row_count / 100)
        for line in input:
            if not counter % itera:
                print('\rProcessed: ' + str(counter // itera) + '%', end='')

            counter = counter + 1
            flag = 1

            if len(line) < 3:
                print('\rProcessed: 100%', end='')
                break

            server = line[0]
            name = line[1]
            version = line[2]

            if addriver.match(name):  #useless drivers
                continue

            for obj in list:
                if obj.getName() == name and version in obj.getVersions(
                ):  #set(version).issubset(obj.getVersions()):# not in obj.getVersions():
                    obj.addServer(server)
                    flag = 0
                    break
            if flag == 1:
                tmp = application(name, version, server)
                list.append(tmp)
        return list

    except Exception as e:
        #print(os.getcwd())
        output = open('../errors.txt', 'a')
        output.write('[' + str(datetime.datetime.now()) + '] ' + str(e) + '\n')
        output.close()
        print('View errors in ~/errors.txt, exiting....')
        sys.exit()
コード例 #3
0
%(tb_txt)s

------here----
Content-Type: text/html; name="bug.html"
Content-Disposition: attachment; filename="bug.html"

""" % locals()) + str(djangoerror())
        sendmail(
          "your buggy site <%s>" % from_address,
          "the bugfixer <%s>" % to_address,
          "bug: %(error_name)s: %(error_value)s (%(path)s)" % locals(),
          text, 
          headers={'Content-Type': 'multipart/mixed; boundary="----here----"'})
        return error
    
    return emailerrors_internal

if __name__ == "__main__":
    urls = (
        '/', 'index'
    )
    from application import application
    app = application(urls, globals())
    app.internalerror = debugerror
    
    class index:
        def GET(self):
            thisdoesnotexist

    app.run()
コード例 #4
0
def main():

    # Enable automatic garbage collector
    gc.enable()

    if machine.reset_cause() == machine.DEEPSLEEP_RESET:
        print('wake from deep sleep')
        hard_reset = False
    else:
        hard_reset = True
        print('wake from hard reset')

    # Read from file the whole configuration
    config.read_config()

    # Get WiFi defaults and connect
    ssid = config.get_config('ssid')
    pwd = config.get_config('pwd')
    interface = do_connect(ssid, pwd, network.STA_IF, hard_reset)

    if not interface:
        # Turn on Access Point only with passw
        apssid = 'YoT-%s' % bytes.decode(chipid)
        appwd = config.get_config('appwd')
        interface = do_connect(apssid, appwd, network.AP_IF)
        if not interface:
            print('Restart 10"')
            time.sleep(10.0)
            machine.reset()

    # Set Parameters
    (address, mask, gateway, dns) = interface.ifconfig()
    chipid = hexlify(machine.unique_id())

    config.set_config('address', address)
    config.set_config('mask', mask)
    config.set_config('gateway', gateway)
    config.set_config('dns', dns)
    config.set_config('mac', hexlify(interface.config('mac'), ':'))
    config.set_config('chipid', chipid)

    # We can set the time now
    # Set Time RTC
    from ntptime import settime
    try:
        settime()
        (y, m, d, h, mm, s, c, u) = time.localtime()
        starttime = '%d-%d-%d %d:%d:%d UTC' % (y, m, d, h, mm, s)
    except:
        starttime = '2061-01-01 00:00:00'
        print('Cannot set time')

    if hard_reset:
        config.set_config('starttime', starttime)

    # Set hostname
    interface.config(dhcp_hostname=chipid)
    config.set_config('hostname', interface.config('dhcp_hostname'))

    # We will save new configuration only at powerup
    if hard_reset:
        config.save_config()

    # Free some memory
    ssid = pwd = None
    apssid = appwd = None
    address = mask = gateway = dns = None
    gc.collect()

    # The application hook
    from application import application
    application()

    # Restart
    print('Restarting')
    time.sleep(5.0)

    # If everything was ok we go to sleep for a while
    sleep = config.get_config('sleep')
    if sleep:
        from gotosleep import gotosleep
        gotosleep(int(sleep))

    machine.reset()
コード例 #5
0
from application import application

application = application('dev')

if __name__ == '__main__':
    application.run()
コード例 #6
0
ファイル: app.py プロジェクト: 3apt/covid-project
import streamlit as st
st.set_page_config(page_title='Détecteur de COVID v1')

# Local Imports
import intro
import biais
import preprocessing
import application
import conclusion

# Sidebar Options & File Uplaod
las_file = None
st.sidebar.write('# Détecteur de COVID')

# Sidebar Navigation
st.sidebar.title('Menu')
options = st.sidebar.radio('Selectionnez une page :', [
    'Introduction', 'Biais du dataset', 'Preprocessing', 'Application',
    'Conclusion'
])

if options == 'Introduction':
    intro.intro()
elif options == 'Biais du dataset':
    biais.biais()
elif options == 'Preprocessing':
    preprocessing.preprocessing()
elif options == 'Application':
    application.application()
elif options == 'Conclusion':
    conclusion.conclusion()
コード例 #7
0
import sys

from application import application

global app
app = application()
app.get_config()

app.clear()
app.convert_excel()
app.get_resources()
app.get_sows()
app.get_engine_timesheet_data()
# app.get_hmrc_data()
# app.compare_timesheets()
app.write_timesheet_data()
app.terminate()
コード例 #8
0
'''
    主函数,先初始化一个application,用于接收路由,创建一个服务器并绑定端口,开启io循环
'''

import tornado.ioloop
import tornado.httpserver

import config                      # 导入配置文件
import application                 # 导入application


if __name__ == "__main__":
    app = application.application()                     # 创建一个app用例,路由到IndexHandler
    httpServer = tornado.httpserver.HTTPServer(app)     # 用app初始化一个httpserver用例
    httpServer.bind(config.options["port"])             # 绑定端口号
    httpServer.start(1)                                 # 开启一个进程
    tornado.ioloop.IOLoop.current().start()             # 开启io循环,监听绑定的端口号
コード例 #9
0
# -*- encoding: utf-8 -*-
'''
@File : main.py
@Time : 2019/01/24 14:24:53
@Author : zhangyachen
@Version : 1.0
@Contact : [email protected]
@License : (C)Copyright 2017-2018, Liugroup-NLPR-CASIA
@Desc : None
'''

# here put the import lib
import train
import test
import application
from tool.config import Config

# 主程序

if __name__ == "__main__":
    if Config.run_flag == "0":
        train.train(Config)
    elif Config.run_flag == "1":
        test.test(Config)
    else:
        application.application(Config)