示例#1
0
def main():
    """Initializes "demon" mode and controls game flow."""

    words, length = choose_length(
        interface.import_words('/usr/share/dict/words'))

    interface.word_length(words[0])

    demon_guess(words, length)

    if interface.play_again():
        return interface.main()
    else:
        os.system('clear')
        return
示例#2
0
async def gen(ctx,
              arg1="nothing was entered0",
              arg2="nothing was entered0",
              arg3="nothing was entered0",
              arg4="nothing was entered0"):

    openoutput, secretoutput = interface.main(ctx, arg1, arg2, arg3, arg4)

    if openoutput == secretoutput:
        await ctx.send(openoutput)
    else:
        if isinstance(ctx.message.channel, discord.abc.GuildChannel):
            await ctx.send(openoutput)
            await ctx.message.author.send(secretoutput)
        else:
            await ctx.send(secretoutput)
示例#3
0
def login_user():                        # ask users to input the login username and password in order to login
    email=input("Enter your E-mail address: ")
    password = getpass.getpass("Enter your password: "******"select u.email, u.pass from users u where u.email = '{0}' and u.pass = '******'".format(email, password))
    users=curs.fetchall()

    curs.execute("select u.email, u.last_login from users u where u.email = '{0}' and u.pass = '******'".format(email, password))
    getLog = curs.fetchall()
    print("your last login is " + getLog[0][1].strftime('%d/%m/%y'))
    print("\n")
    if len(users) == 1:
	    isAgent = False
	    curs.execute("select * from airline_agents a where a.email = '{}'".format(email))
	    agents=curs.fetchall()
	    if len(agents) == 1:
		    isAgent = True
	    user_input = interface.main(conString,connection,curs,email, isAgent)
	    return user_input
    else:
	    input("Invalid login")
示例#4
0
async def g(ctx, item = "nothing was entered0", *args):
	
	for races in racesbyID:
		if races['ID'] == ctx.message.author.id:
			userraces = races['list']
			break
	
	else:
		dum, tempraces = psqlf.readraces(serverinfo, ctx.message.author.id, 'all')
		output = []
		for temprace in tempraces:
			output.append(dict(genre= temprace[1], racename= temprace[2], gender= temprace[3],\
				weight= temprace[4], names= temprace[5], surnames= temprace[6], maxsettlement = temprace[7]\
				, occupations = [temprace[8], temprace[9], temprace[10], temprace[11], temprace[12], temprace[13], temprace[14], temprace[15], temprace[16], temprace[17], temprace[18]]))
				
		
		racesbyID.append(dict(ID= ctx.message.author.id, list= output))
		userraces = output



	await delete_command(ctx)


	
	openoutput, secretoutput = interface.main(ctx, userraces, item.lower(), *args)
	
	if max(len(openoutput), len(secretoutput)) > 1999:
		await ctx.send("The generated message is too long, one of us was too ambitious, try again.")
	else:
		if openoutput == secretoutput:
			await ctx.send(openoutput)
		else:
			if isinstance(ctx.message.channel, discord.abc.GuildChannel):
				await ctx.send(openoutput)
				await ctx.message.author.send(secretoutput)
			else:
				await ctx.send(secretoutput)
示例#5
0
    # parse commandline arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--config",
                        help="path to config file [bitcoin.conf]",
                        default="bitcoin.conf")
    args = parser.parse_args()

    # parse config file
    try:
        cfg = config.read_file(args.config)
    except IOError:
        cfg = {}
        s = {'stop': "configuration file [" + args.config + "] does not exist or could not be read"}
        interface_queue.put(s)

    # initialise interrupt signal handler (^C)
    signal.signal(signal.SIGINT, interrupt_signal)

    # start RPC thread
    rpc_process = multiprocessing.Process(target=rpc.loop, args = (interface_queue, rpc_queue, cfg))
    rpc_process.daemon = True
    rpc_process.start()

    #debug(rpc_queue)

    # main loop
    interface.main(interface_queue, rpc_queue)

    # ensure RPC thread exits cleanly
    rpc_process.join()
示例#6
0
 def Connect(self, event):
     self.buttonGameTime.Enable()
     interface.main()
示例#7
0
def main():
    interface.main()
# main file
from interface import main

if __name__ == '__main__':
    main()
示例#9
0
文件: main.py 项目: pedropaulovc/UFSC
"""
Created on 02/10/2010

@author: PedroPaulo
"""
from interface import main

if __name__ == "__main__":
    main()
示例#10
0
if __name__ == "__main__":
    try:
        import errors
        import interface

        print("\n")
        check_result = version_check(vi)
        if check_result > -1:
            if check_result == 0:
                print(
                    "\nWARNING: CV_Analyser has only been tested on Python 3.6.5!"
                )
            print("\n")
            print("Current Working Directory: ")
            interface.main()
        else:
            raise errors.IncompatibleVersionError
    except ImportError:
        print("\nUnable to import the required components.")
        print(
            "Verify all dependencies are accessible from the current interpreter."
        )
        print(
            "Verify all CV_Analyser files are present in the current working directory.\n"
        )
    except errors.IncompatibleVersionError as e:
        print("\nERROR: " + e.message)
        print("CV_Analyser requires Python 3.0 or greater.\n")
    except KeyboardInterrupt:
        print("\nForce exit acknowledged.\n")
示例#11
0
def mainfn(window):
    # initialise queues
    response_queue = gevent.queue.Queue()
    rpc_queue = gevent.queue.Queue()

    # parse commandline arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("-c",
                        "--config",
                        help="path to config file [bitcoin.conf]",
                        default=os.path.expanduser("~/.bitcoin/bitcoin.conf"))
    parser.add_argument("-m", "--mode", help="initial mode", default=None)
    args = parser.parse_args()

    # parse config file
    try:
        cfg = config.read_file(args.config)
    except IOError:
        cfg = {}
        return "configuration file [{}] does not exist or could not be read".format(
            args.config)

    # initialise interrupt signal handler (^C)
    signal.signal(signal.SIGINT, interrupt_signal)

    bstore = block_store.BlockStore()
    bviewer = block_viewer.BlockViewer(bstore, window)

    bstore._on_block = bviewer.on_block

    # start RPC thread
    rpcc = rpc2.BitcoinRPCClient(
        response_queue=response_queue,  # TODO: refactor this
        block_store=bstore,
        rpcuser=cfg["rpcuser"],
        rpcpassword=cfg["rpcpassword"],
        rpcip=(cfg["rpcip"] if "rpcip" in cfg else "localhost"),
        rpcport=(cfg["rpcport"]
                 if "rpcport" in cfg else 18332 if "testnet" in cfg else 8332),
        protocol=(cfg["protocol"] if "protocol" in cfg else "http"),
    )

    bstore._rpcc = rpcc

    connected = rpcc.connect()
    if not connected:
        return "RPCC failed to connect"

    rpc2_process = gevent.spawn(rpcc.run)

    poller = rpc2.Poller(rpcc)
    poller_process = gevent.spawn(poller.run)

    if args.mode is not None:
        initial_mode = args.mode
    elif "mode" in cfg:
        initial_mode = cfg["mode"]
    else:
        initial_mode = None

    # main loop
    try:
        interface.main(bviewer, window, response_queue, rpcc, poller,
                       initial_mode)
    finally:
        rpcc.stop()
        rpc2_process.join()
示例#12
0
#!/usr/bin/python3

import sys
import interface

if __name__ == '__main__':
    interface.main(sys.argv[1:])
    sys.exit(0)
示例#13
0
def mainfn(window):
    # initialise queues
    response_queue = gevent.queue.Queue()
    rpc_queue = gevent.queue.Queue()

    # parse commandline arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--config",
                        help="path to config file [bitcoin.conf]",
                        default="bitcoin.conf")
    parser.add_argument("-m", "--mode",
                        help="initial mode",
                        default=None)
    args = parser.parse_args()

    # parse config file
    try:
        cfg = config.read_file(args.config)
    except IOError:
        cfg = {}
        s = {'stop': "configuration file [" + args.config + "] does not exist or could not be read"}
        response_queue.put(s)

    # initialise interrupt signal handler (^C)
    signal.signal(signal.SIGINT, interrupt_signal)

    bstore = block_store.BlockStore()
    bviewer = block_viewer.BlockViewer(bstore, window)

    bstore._on_block = bviewer.on_block

    # start RPC thread
    rpcc = rpc2.BitcoinRPCClient(
        response_queue=response_queue, # TODO: refactor this
        block_store=bstore,
        rpcuser=cfg["rpcuser"],
        rpcpassword=cfg["rpcpassword"],
        rpcip=(cfg["rpcip"] if "rpcip" in cfg else "localhost"),
        rpcport=(cfg["rpcport"] if "rpcport" in cfg else 18332 if "testnet" in cfg else 8332),
        protocol=(cfg["protocol"] if "protocol" in cfg else "http"),
    )
    connected = rpcc.connect()
    if not connected:
        print "RPCC failed to connect"
        sys.exit(1)

    rpc2_process = gevent.spawn(rpcc.run)

    poller = rpc2.Poller(rpcc)
    poller_process = gevent.spawn(poller.run)

    if args.mode is not None:
        initial_mode = args.mode
    elif "mode" in cfg:
        initial_mode = cfg["mode"]
    else:
        initial_mode = None

    # main loop
    try:
        interface.main(bviewer, window, response_queue, rpcc, poller, initial_mode)
    finally:
        rpcc.stop()
        rpc2_process.join()
示例#14
0
import numpy as np
import pandas as pd
import pygame as pg

from world import World
from human import Human
import interface

nb_cells_visible = 80
nb_stats = 4
nb_ressources = 6
proba_mutation = 0.02
shape_dna = (4, nb_cells_visible * nb_ressources + nb_stats)

idx = 0

debug = True

sizeX = 80
sizeY = 80
world = World(sizeX, sizeY)

if __name__ == '__main__':
    print "hello gilles!"
    interface.main(world)
示例#15
0
"""Access point for the Script."""

import sys
from interface import main

main(sys.argv[1:])
示例#16
0
文件: __init__.py 项目: sashi88/optim
import interface
from pulp import *

# import main
if __name__ == "__main__":
    interface.main()