コード例 #1
0
    def on_click_start(self):
        """Loads all the necessary parameters into the main backend function"""
        stock = self.stock_string.text()
        exp_date_list = [
            self.list_exp_select.item(i).text()
            for i in range(self.list_exp_select.count())
        ]
        legs = [[
            self.cb_leg1_put_call.currentText(),
            self.cb_leg1_sell_buy.currentText(),
            self.checkBox.checkState()
        ],
                [
                    self.cb_leg2_put_call.currentText(),
                    self.cb_leg2_sell_buy.currentText(),
                    self.checkBox_2.checkState()
                ],
                [
                    self.cb_leg3_put_call.currentText(),
                    self.cb_leg3_sell_buy.currentText(),
                    self.checkBox_3.checkState()
                ],
                [
                    self.cb_leg4_put_call.currentText(),
                    self.cb_leg4_sell_buy.currentText(),
                    self.checkBox_4.checkState()
                ]]
        leg1_2_strat = self.spin_leg1_2.value()
        leg2_3_strat = self.spin_leg2_3.value()
        leg3_4_strat = self.spin_leg3_4.value()
        strategy = [leg1_2_strat, leg2_3_strat, leg3_4_strat]
        variation = [
            self.spin_var_leg1_2.value(),
            max(self.spin_var_leg1_2.value(), self.spin_var_leg3_4.value()),
            self.spin_var_leg3_4.value()
        ]
        file_path = self.load_path_label.text()
        timer = self.spin_ever_min.value()
        commission_cost = self.dspin_commision_cost.value()

        setup()
        Form.hide()
        log1 = Settings(stock=stock,
                        strategy=strategy,
                        variation=variation,
                        exp_date=exp_date_list[0],
                        timer=timer * 60,
                        legs=legs,
                        volume_filter=500,
                        file_path=file_path)
        scan(log1)
        Form.show()
コード例 #2
0
def load_setting():
    settings.setup()
コード例 #3
0
    args = aparser.parse_args()
    inp = Path(args.inp)
    if args.benchmark_times:
        from analysis import Benchmark
        Benchmark(inp, args).start()

    elif inp.is_dir():
        from analysis import Analysis
        Analysis(inp, args).start()

    else:  # benchmark_times is None, input is a file: normal, single run
        assert args.benchmark_times is None and inp.is_file(), inp
        seed = round(time.time(), 2) if args.seed is None else float(args.seed)
        import settings
        mlog, se_mindepth = settings.setup(settings, args)
        mlog.info("{}: {}".format(datetime.datetime.now(), ' '.join(sys.argv)))

        if __debug__:
            mlog.warning("DEBUG MODE ON. Can be slow !")

        import alg
        if inp.suffix == ".java" or inp.suffix == ".class":
            if se_mindepth:
                settings.Java.SE_MIN_DEPTH = args.se_mindepth
            dig = alg.DigSymStatesJava(inp)
        elif inp.suffix == ".c":
            if se_mindepth:
                settings.C.SE_MIN_DEPTH = args.se_mindepth
            dig = alg.DigSymStatesC(inp)
        else:
コード例 #4
0
            auth.authorizor.check_permission(
                permission, self.username)
        except auth.NotLoggedInError:
            print('You are not logged in')
            return False
        except auth.NotPermittedError as e:
            print('This action is not permitted for {}'.format(
                e.username))
            return False
        else:
            return True

    def save(self):
        print('Saving...')
        keyring.keyring.save()

    def quit(self):
        if keyring.keyring.is_changed:
            choice = ''
            while choice not in self.quit_choices:
                choice = input('Save changes?[yes/no]: ')
            if choice == self.quit_choices[0]:
                self.save()
        print('Have a nice day :)')
        raise SystemExit


if __name__ == '__main__':
    settings.setup()
    Menu().run()
コード例 #5
0
from settings import setup
import resources.env as env
from lang.lang import lang
from pynput import keyboard

if __name__ == "__main__":
    ratio = [1, 1]
    ok = 0

    pyautogui.confirm(text="The program started at {}.".format(
        date.now().strftime("%H-%M")),
                      title='Started',
                      buttons=['OK'])
    print("Program started at", date.now().strftime("%H-%M"))

    Resolution, Language = setup()
    if Resolution is None:
        Resolution = [pyautogui.size().width, pyautogui.size().height]
        print("myResolution= {}".format(Resolution))

    env.init(Resolution, Language)
    env.update()
    print(date.now().strftime("%H-%M"))

    with keyboard.Listener(on_press=env._key_press) as listener:
        while True:  # main loop
            env.refreshing()
            start = time.perf_counter()
            for i in range(3):
                # check for bonus first
                bonus = env.bonus()
コード例 #6
0
ファイル: viola.py プロジェクト: mseyne/viola
def rungame(gamedata):
    global height, width, title, terpnum, foreground, background
    settings.setup(gamedata)
    defset = settings.getsettings(settings.getdefaults())
    gameset = settings.getsettings(settings.findgame())

    for a in range(len(gameset)):
        if gameset[a] == None:
            gameset[a] = defset[a]

    if height == None:
        height = gameset[2]
    if width == None:
        width = gameset[1]

    try:
        foreground = zcode.screen.basic_colours[gameset[5]]
    except:
        foreground = 2

    try:
        background = zcode.screen.basic_colours[gameset[6]]
    except:
        background = 9

    if gameset[3] != None:
        blorbs.append(io.findfile(gameset[3]))

    for a in range(len(blorbs)):
        if blorbs[a] == False:
            blorbs.pop(a)

    terpnum = gameset[4]

    if title == None:
        title = gameset[0]

    if title == None:
        for a in blorbs:
            iFiction = a.getmetadata()
            if iFiction:
                title = babel.gettitle(iFiction)
                headline = babel.getheadline(iFiction)
                author = babel.getauthor(iFiction)
                if title == None:
                    title = ''
                if headline != None:
                    title = title + ' (' + headline + ')'
                if author != None:
                    title += ' by ' + author

    if title == '' or title == None:
        title = 'Viola'
    else:
        title = 'Viola - ' + title

    if setupmodules(gamedata) == False:
        zcode.error.fatal('Couldn\'t open gamefile ' + sys.argv[1])

    zcode.routines.execstart(debug)
    return 1
コード例 #7
0
ファイル: index.py プロジェクト: brooksbecton/RemindMeBot
import asyncio
import discord
import os

from settings import setup

setup()
client = discord.Client()


@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')


@client.event
async def on_message(message):
    if message.content.startswith('!test'):
        counter = 0
        tmp = await client.send_message(message.channel,
                                        'Calculating messages...')
        async for log in client.logs_from(message.channel, limit=100):
            if log.author == message.author:
                counter += 1

        await client.edit_message(tmp, 'You have {} messages.'.format(counter))
    elif message.content.startswith('!sleep'):
        await asyncio.sleep(5)
コード例 #8
0
ファイル: main.py プロジェクト: Procrat/eva
def setup():
    settings.setup()
コード例 #9
0
ファイル: conftest.py プロジェクト: guoyangnice/QdPyTest
def pytest_sessionstart(session):
    settings.setup()
コード例 #10
0
ファイル: setup.py プロジェクト: gopinathdanda/pennapps-2014
from distutils.core import setup, Extension

import os

if not os.path.exists('settings.json'):
    import settings
    settings.setup()

# define the extension module
pennapprobot = Extension('pennapprobot', sources=['pennapprobot.c'], libraries=['bcm2835'], library_dirs=['/usr/local/lib'])
pennappcam = Extension('pennappcam', sources=['pennappcam.c'], libraries=['bcm2835'], library_dirs=['/usr/local/lib'])



# run the setup
setup(ext_modules=[pennapprobot])
setup(ext_modules=[pennappcam])

コード例 #11
0
ファイル: main.py プロジェクト: ArtemDav/PythonGame
black = pygame.Color("black")
white = pygame.Color("white")
slateblue = pygame.Color("#191970")
blue = pygame.Color("#1E90FF")
#################################

pygame.init()
background_image = pygame.image.load("assets/Image/background.png")
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
w, h = pygame.display.get_surface().get_size()
pygame.mixer.pre_init(44100, 16, 2, 4096)
pygame.mixer.music.load("assets/Sounds/Main_Music.wav")
pygame.mixer.music.play()
#################################
#       SETTINGS FROM BASE
base = setup()
#       CHECKBOX
boolean = str(base.load_settings("Sounds")).replace("True",
                                                    "1").replace("False", "0")
sounds = checkbox.Checkbox(w // 4 + 20, h // 3 + 20, "Sounds",
                           bool(int(boolean)))
#################################


class Button:
    def __init__(self,
                 text,
                 size_text,
                 center=False,
                 center_pos=0,
                 color=white):
コード例 #12
0
ファイル: viola.py プロジェクト: DFillmore/viola
def rungame(gamedata):
    global height, width, title, terpnum
    settings.setup(gamedata)
    defset = settings.getsettings(settings.getdefaults())
    gameset = settings.getsettings(settings.findgame())
        
    for a in range(len(gameset)):
        if gameset[a] == None:
            gameset[a] = defset[a]
    
    if height == None:
        height = gameset[2]
    if width == None:
        width = gameset[1]
    
    if gameset[3] != None:
        blorbs.append(io.findfile(gameset[3]))

    for a in range(len(blorbs)):
        if blorbs[a] == False:
            blorbs.pop(a)

        
    terpnum = gameset[4]

    if title == None:
        title = gameset[0]
    icon = None
    if title == None:
        for a in blorbs:
            iFiction = a.getmetadata()
            if iFiction:
                title = babel.gettitle(iFiction)
                headline = babel.getheadline(iFiction)
                author = babel.getauthor(iFiction)
                if headline != None:
                    title = title + ': ' + headline
                if author != None:
                    title += ' by ' + author
                if title == None:
                    title = ''
                else:
                    title = ' - ' + title

    if title == None:
        title = 'Viola'
    else:
        title = 'Viola - ' + title

    if setupmodules(gamedata) == False:
        zcode.error.fatal('Couldn\'t open gamefile ' + sys.argv[1])  
       


    for a in blorbs:
        icon = a.gettitlepic()
    if icon:
        io.setIcon(icon)
    


    zcode.routines.execstart(debug)
    return 1
コード例 #13
0
ファイル: analysis.py プロジェクト: ruricolist/dig
    def start(self):
        inp = self.inp
        args = self.args

        bfiles = []
        if self.valid_file(inp):
            # benchmark single file
            bfiles = [inp]
            bstr = inp.stem  # CohenDiv
        elif inp.is_dir():
            # benchmark all files in dir
            bfiles = sorted(f for f in inp.iterdir() if self.valid_file(f))
            bstr = str(inp.resolve()).replace('/', '_')  # /benchmark/nla
        else:
            mlog.error('something wrong with {}'.format(inp))

        ntimes = args.benchmark_times

        toruns = []
        if args.benchmark_dir:
            benchmark_dir = Path(args.benchmark_dir).resolve()
            assert benchmark_dir.is_dir(), benchmark_dir
        else:
            import tempfile
            prefix = "dig_bm{}{}_".format(ntimes, bstr)
            benchmark_dir = Path(
                tempfile.mkdtemp(dir=settings.tmpdir, prefix=prefix))

        self.benchmark_dir = benchmark_dir

        # compute which runs we have to do (in case there are some existing runs)
        myruns = set(range(ntimes))
        for i, f in enumerate(bfiles):
            bmdir = benchmark_dir / f.stem
            if bmdir.is_dir():  # if there's some previous runs
                succruns = self.get_success_runs(bmdir)
                remainruns = list(myruns - succruns)
                if not remainruns:
                    mlog.info("{} ran, results in {}".format(f, bmdir))
                else:
                    mlog.info("{} in {} needs {} more runs".format(
                        f, bmdir, len(remainruns)))
            else:
                remainruns = list(myruns)

            if remainruns:
                toruns.append((f, bmdir, remainruns))

            self.toruns = toruns

        opts = settings.setup(None, args)
        self.CMD = "timeout {timeout} sage -python -O dig.py {opts} ".format(
            timeout=self.TIMEOUT, opts=opts) \
            + "{filename} -seed {seed} -tmpdir {tmpdir}"

        import os
        for i, (f, bdir, remainruns) in enumerate(self.toruns):
            if not bdir.is_dir():
                bdir.mkdir()

            for j, seed in enumerate(sorted(remainruns)):
                mlog.info("## file {}/{}, run {}/{}, seed {}, {}: {}".format(
                    i + 1, len(self.toruns), j + 1, len(remainruns), seed,
                    time.strftime("%c"), f))
                try:
                    CMD = self.CMD.format(filename=f, seed=seed, tmpdir=bdir)
                    os.system(CMD)
                except Exception as ex:
                    mlog.error("Something wrong. Exiting!\n{}".format(ex))

        mlog.info("benchmark result dir: {}".format(self.benchmark_dir))