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()
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])
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))])
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])
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"
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 )
def setup(args): config = gen_config(args) core.setup(config)
def postprocess(args): print("Running postprocess") _check_modeling_inputs(args) config = gen_config(args) config = core.setup(config) core.run_postprocessing(config)
def cluster(args): print("Running cluster") config = gen_config(args) config = core.setup(config) core.run_cluster_function(config)
def score(args): print("Running score") config = gen_config(args) config = core.setup(config) core.run_score_function(config)
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)
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)
def run_all(args): print("Running all") _check_modeling_inputs(args) config = gen_config(args) config = core.setup(config) core.run_all(config)
def main(): core.setup() core.run()
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]'),
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'), ]