def setUp(self):
        from application import main

        app = main()
        from webtest import TestApp

        self.testapp = TestApp(app)
示例#2
0
    def setUp(self):
        from application import main

        app = main()
        from webtest import TestApp

        self.testapp = TestApp(app)
def main(mode: str = "application"):
    """
    Runs through the system's main procedures
    :param mode: the I/O mode for the application
    :return: None
    """
    # get gloval data
    global data
    global message_types
    global people_data

    # Import data from message.json
    try:
        data = unwrapper.load_file(str(os.getcwd()) + "\\" + DEFAULT_FILENAME)
    except FileNotFoundError:
        while True:
            try:
                # File could not be found under the default filename, try user input
                print(
                    "message.json not found, please enter file path or import file into\n"
                    + str(os.getcwd()))
                input("Press enter to continue...")
                try:
                    data = unwrapper.load_file(
                        str(os.getcwd()) + "\\" + DEFAULT_FILENAME)
                    break
                except FileNotFoundError:
                    data = unwrapper.load_file(input("Enter file path: "))
                    break
            except FileNotFoundError:
                continue

    # Distribute message types
    message_types = message_distribution()

    # Separate User Data
    people_data = operations.separate_users(data)

    # Run application in the I/O mode selected
    if mode == "legacy":
        # Run the application through the terminal
        menu()
        return
    elif mode == "application":
        application.main(data, message_types, people_data)
def click_main(divisor, logdir, loglevel):
    """Click template example

    The docstring entered here will be shown as part of the '--help' output.
    """
    # setup logger configuration
    script_name = pl.Path(sys.argv[0]).stem
    log_config = LOG_CONFIG.copy()
    log_config["root"]["level"] = loglevel
    log_config["handlers"]["file"]["filename"] = pl.Path(logdir).joinpath(f"{script_name}.log")
    logging.config.dictConfig(log_config)

    # initialize logging
    logger = logging.getLogger(__name__)
    logger.info("starting '%s' V%s", pl.Path(sys.argv[0]).name, __version__)
    if os.name == "nt":
        logger.info(
            "running on '%s' as user '%s\\%s'",
            os.environ["COMPUTERNAME"],
            os.environ["USERDOMAIN"],
            os.environ["USERNAME"],
        )

    # execute main
    return_code = 0
    try:
        return_code = application.main(divisor)
    except Exception:
        logger.critical("caught unhandled exception", exc_info=True)
        return_code = 1

    # exit with an informal or an error message
    msg = f"exit with returncode={return_code}"
    if return_code == 0:
        logger.info(msg)
    else:
        logger.error(msg)
    return return_code
示例#5
0
        self.cfg.mediaConfig.srtpUse = self.cfgMedSrtp.get()
        self.cfg.mediaConfig.srtpSecureSignaling = self.cfgMedSrtpSecure.get()
        self.cfg.mediaConfig.ipv6Use = pj.PJSUA_IPV6_ENABLED if self.cfgMedIpv6.get(
        ) else pj.PJSUA_IPV6_DISABLED

        # NAT
        self.cfg.natConfig.sipStunUse = self.cfgSipUseStun.get()
        self.cfg.natConfig.mediaStunUse = self.cfgMediaUseStun.get()
        self.cfg.natConfig.iceEnabled = self.cfgIceEnabled.get()
        self.cfg.natConfig.iceAggressiveNomination = self.cfgIceAggressive.get(
        )
        self.cfg.natConfig.iceAlwaysUpdate = self.cfgAlwaysUpdate.get()
        self.cfg.natConfig.iceMaxHostCands = 0 if self.cfgIceNoHostCands.get(
        ) else -1
        self.cfg.natConfig.turnEnabled = self.cfgTurnEnabled.get()
        self.cfg.natConfig.turnServer = self.cfgTurnServer.get()
        self.cfg.natConfig.turnConnType = self.cfgTurnConnType.get()
        self.cfg.natConfig.turnUserName = self.cfgTurnUser.get()
        self.cfg.natConfig.turnPasswordType = 0
        self.cfg.natConfig.turnPassword = self.cfgTurnPasswd.get()

        self.isOk = True
        self.destroy()

    def onCancel(self):
        self.destroy()


if __name__ == '__main__':
    application.main()
示例#6
0
		row += 1
		ttk.Checkbutton(frm, text='Subscribe presence', variable=self.cfgSubscribe).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2)

		self.wTab.add(frm, text='Basic Settings')
		
	
	def onOk(self):
		# Check basic settings
		errors = "";
		if self.cfgUri.get():
			if not endpoint.validateSipUri(self.cfgUri.get()):
				errors += "Invalid Buddy URI: '%s'\n" % (self.cfgUri.get())
				
		if errors:
			msgbox.showerror("Error detected:", errors)
			return
		
		# Basic settings
		self.cfg.uri = self.cfgUri.get()
		self.cfg.subscribe = self.cfgSubscribe.get()
		
		self.isOk = True
		self.destroy()
		
	def onCancel(self):
		self.destroy()


if __name__ == '__main__':
	application.main()
示例#7
0
def call():
    return main(request)
示例#8
0
def main():
    application = Log2DbDaemon()
    application.main()
示例#9
0
from application import main

if __name__ == "__main__":
    main()
示例#10
0
from application import main
from keras import models

import winsound

model = models.load_model('model.h5')
student_results = []

for i in range(0, 10):
    video_src = 'Video/video-' + str(i) + '.avi'
    result = main(model, video_src)
    student_results.append(float(result))
    print('video-' + str(i) + '.avi ', str(result))

res = []
n = 0
with open('Video/res.txt') as file:
    data = file.read()
    lines = data.split('\n')
    for id, line in enumerate(lines):
        if (id > 0):
            cols = line.split('\t')
            if (cols[0] == ''):
                continue
            cols[1] = cols[1].replace('\r', '')
            res.append(float(cols[1]))
            n += 1

diff = 0
for index, res_col in enumerate(res):
    diff += abs(res_col - student_results[index])
示例#11
0
    "Thank you very much",
    "Is there any job for me here?",
    "I need some weapons, where i can found those?",
    "Hello",
    "I have searched the caves, there are some cult activities there",
    "Where can I go now?",
    "Appreciate it",
]
first_conversation_expected_outputs: List[List[str]] = [
    ["UNKNOWN"], ["GREETINGS"], ["ASK_FOR_NAME"], ["TOWN"],
    ["RESPONSE_TO_GRATITUDE"], ["QUEST_1_INTRO",
                                "QUEST_2_INTRO"], ["SHOPPING"], ["GREETINGS"],
    ["QUEST_1_FINISH"], ["NEAREST_TOWN"], ["RESPONSE_TO_GRATITUDE"]
]
second_conversation: List[str] = [
    "Hello", "I encountered some bandit camp nearby",
    "I forgot asking. What is your name?", "What you actualy do here?",
    "Thanks",
    "I have cleared bandit camp, I heard about some Black Spider there.",
    "Triboar should be nearby. How to get there?", "Fine, I will go there"
]

second_conversation_expected_outputs: List[List[str]] = [
    ["GREETINGS"], ["QUEST_2_INTRO"], ["ASK_FOR_NAME"], ["PROFFESION"],
    ["RESPONSE_TO_GRATITUDE"], ["QUEST_2_TRIBOAR"], ["WHERE_IS_TRIBOAR"],
    ["APPROVAL"]
]

application.main([5, 8], 0.7, first_conversation,
                 first_conversation_expected_outputs)
示例#12
0
from application import main
import sys

# ractf{d3velopersM4keM1stake5}

if __name__ == "__main__":
    main(*sys.argv)
示例#13
0
文件: main.py 项目: copton/lethe
#!/usr/bin/python

import sys
import application

if __name__ == '__main__':
    application = application.Application()
    status = application.main(sys.argv)
    sys.exit(status)

示例#14
0
def main():
    application = Log2DbDaemon()
    application.main()