Exemplo n.º 1
0
def main():
    core.setup()
    updater = Updater(TELEGRAM_TOKEN)
    dp = updater.dispatcher

    dp.add_handler(CommandHandler('start', start))
    dp.add_handler(CommandHandler('help', help))
    dp.add_handler(CommandHandler('work', start_work, pass_args=True))
    dp.add_handler(CommandHandler('end', end_work, pass_args=True))
    dp.add_handler(CommandHandler('entries', get_entries, pass_args=True))
    dp.add_handler(CommandHandler('undo', delete_last_action))
    dp.add_handler(CommandHandler('clear', clear_wrapper))
    dp.add_handler(CommandHandler('feedback', feedback, pass_args=True))
    dp.add_handler(CallbackQueryHandler(clear, pattern="clear_true"))
    dp.add_handler(
        CallbackQueryHandler(handle_clear_false, pattern="clear_false"))
    dp.add_error_handler(error)

    updater.start_polling()
    logger.info('----- Bot running -----')
    updater.idle()
Exemplo n.º 2
0
def startMixes():
    for i in range(3):
        port = int(sys.argv[1 + (i*4)])
        host = sys.argv[2 + (i*4)]
        name = sys.argv[3 + (i*4)]
        group = int(sys.argv[4 + (i*4)])
        setup = core.setup()
        G, o, g, o_bytes = setup
        secret = o.random()
        file("../example/secretMixnode%d.prv"%(i+1), "wb").write(petlib.pack.encode(secret))
        pub = secret * g
        file("../example/publicMixnode%d.bin"%(i+1), "wb").write(petlib.pack.encode(["mixnode", name, port, host, group, pub]))
        dbManager.insert_row_into_table('Mixnodes',
                [None, name, port, host,
                sqlite3.Binary(petlib.pack.encode(pub)), group])
Exemplo n.º 3
0
def startProviders():
    for i in range(2):
        port = int(sys.argv[1 + (i*3)])
        host = sys.argv[2 + (i*3)]
        name = sys.argv[3 + (i*3)]

        setup = core.setup()
        G, o, g, o_bytes = setup

        secret = o.random()
        file("../example/secretProvider%d.prv"%(i+1), "wb").write(petlib.pack.encode(secret))

        pub = secret * g
        file("../example/publicProvider%d.bin"%(i+1), "wb").write(petlib.pack.encode(["provider", name, port, host, pub]))
        dbManager.insert_row_into_table('Providers',
            [None, name, port, host,
            sqlite3.Binary(petlib.pack.encode(pub))])
Exemplo n.º 4
0
def startClients():
    for i in range(2):
        port = int(sys.argv[1 + (i*4)])
        host = sys.argv[2 + (i*4)]
        name = sys.argv[3 + (i*4)]
        prvinfo = str(sys.argv[4 + (i*4)])

        setup = core.setup()
        G, o, g, o_bytes = setup

        secret = o.random()
        file("../example/secretClient%d.prv"%(i+1), "wb").write(petlib.pack.encode(secret))

        pub = secret * g
        file("../example/publicClient%d.bin"%(i+1), "wb").write(petlib.pack.encode(["client", name, port, host, pub, prvinfo]))
        dbManager.insert_row_into_table('Users',
            [None, name, port, host,
            sqlite3.Binary(petlib.pack.encode(pub)),
            prvinfo])
Exemplo n.º 5
0
import core
import sys
import petlib.pack
import os.path

if __name__ == "__main__":

    if not (os.path.exists("secretProvider.prv")
            or os.path.exists("publicProvider.bin")):

        port = int(sys.argv[1])
        host = sys.argv[2]
        name = sys.argv[3]

        setup = core.setup()
        G, o, g, o_bytes = setup

        secret = o.random()
        file("secretProvider.prv", "wb").write(petlib.pack.encode(secret))

        pub = secret * g
        file("publicProvider.bin", "wb").write(
            petlib.pack.encode(["provider", name, port, host, pub]))

    else:
        print "Files Exist"
Exemplo n.º 6
0
    config['packages'].append(sub_package)
    config['package_dir'][sub_package] = os.path.join(local_path, 'command')

    #for name in glob(os.path.join(local_path,'tests','*_ext')):
    #    p = dot_join(parent_package,package,'tests',os.path.basename(name))
    #    config['packages'].append(p)
    #    config['package_dir'][p] = name

    config['data_files'].append(
        (package, [os.path.join(local_path, 'sample_site.cfg')]))
    return config


if __name__ == '__main__':
    from scipy_distutils_version import scipy_distutils_version
    print 'scipy_distutils Version', scipy_distutils_version
    from core import setup
    config = configuration(parent_path='')
    for k, v in config.items():
        if not v:
            del config[k]
    setup(version = scipy_distutils_version,
          description = "Changes to distutils needed for SciPy "\
          "-- mostly Fortran support",
          author = "Travis Oliphant, Eric Jones, and Pearu Peterson",
          author_email = "*****@*****.**",
          license = "SciPy License (BSD Style)",
          url = 'http://www.scipy.org',
          **config
          )
Exemplo n.º 7
0
def setup(args):
    config = gen_config(args)
    core.setup(config)
Exemplo n.º 8
0
def postprocess(args):
    print("Running postprocess")
    _check_modeling_inputs(args)
    config = gen_config(args)
    config = core.setup(config)
    core.run_postprocessing(config)
Exemplo n.º 9
0
def cluster(args):
    print("Running cluster")
    config = gen_config(args)
    config = core.setup(config)
    core.run_cluster_function(config)
Exemplo n.º 10
0
def score(args):
    print("Running score")
    config = gen_config(args)
    config = core.setup(config)
    core.run_score_function(config)
Exemplo n.º 11
0
def abinitio_relax(args):
    print("Running abinitio relax")
    _check_modeling_inputs(args)
    config = gen_config(args)
    config = core.setup(config)
    core.run_abinitio_relax(config)
Exemplo n.º 12
0
def fragment_picker(args):
    print("Running fragment picker")
    _check_modeling_inputs(args)
    config = gen_config(args)
    config = core.setup(config)
    core.run_fragment_picker(config)
Exemplo n.º 13
0
def run_all(args):
    print("Running all")
    _check_modeling_inputs(args)
    config = gen_config(args)
    config = core.setup(config)
    core.run_all(config)
Exemplo n.º 14
0
def main():
    core.setup()
    core.run()
Exemplo n.º 15
0
import fileio
import logging
import core
import fileio
import hist
import analysers

import file_config_v00_03 as samples

## logging
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)

## setup core tools
core.setup(batch_mode=True, )

## selection
base_selection = [
    core.Cut('tau_pt[0]>50.e3'),
    core.Cut('tau_pt[1]>50.e3'),
    core.Cut('tau_numTrack[0]==1||tau_numTrack[0]==3'),
    core.Cut('tau_numTrack[1]==1||tau_numTrack[1]==3'),
    core.Cut('TMath::Abs(tau_charge[0])==1'),
    core.Cut('TMath::Abs(tau_charge[1])==1'),
    core.Cut('TMath::ACos(TMath::Cos(tau_phi[0]-tau_phi[1]))>2.7'),
    core.Cut('EF_2tau38T_medium1'),
]

sel_sig = [
    core.Cut('tau_JetBDTSigMedium[0]'),
Exemplo n.º 16
0
import core
import fileio
import hist 
import analysers

import file_config_v00_03 as samples

## logging
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)


## setup core tools
core.setup( 
        batch_mode = True,
        )


## selection
base_selection = [
    core.Cut('tau_pt[0]>50.e3'),
    core.Cut('tau_pt[1]>50.e3'),
    core.Cut('tau_numTrack[0]==1||tau_numTrack[0]==3'),
    core.Cut('tau_numTrack[1]==1||tau_numTrack[1]==3'),
    core.Cut('TMath::Abs(tau_charge[0])==1'),
    core.Cut('TMath::Abs(tau_charge[1])==1'),
    core.Cut('TMath::ACos(TMath::Cos(tau_phi[0]-tau_phi[1]))>2.7'),
    core.Cut('EF_2tau38T_medium1'),
    ]