示例#1
0
def task_set_output(self,s):
    api('v1').job_tasks().update(uuid=self['uuid'],
                                 body={
            'output':s,
            'success':True,
            'progress':1.0
            }).execute()
示例#2
0
def task_set_output(self,s):
    api('v1').job_tasks().update(uuid=self['uuid'],
                                 body={
            'output':s,
            'success':True,
            'progress':1.0
            }).execute()
示例#3
0
 def one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=False):
     if if_sequence != current_task()['sequence']:
         return
     job_input = current_job()['script_parameters']['input']
     cr = CollectionReader(job_input)
     for s in cr.all_streams():
         for f in s.all_files():
             if input_as_path:
                 task_input = os.path.join(job_input, s.name(), f.name())
             else:
                 task_input = f.as_manifest()
             new_task_attrs = {
                 'job_uuid': current_job()['uuid'],
                 'created_by_job_task_uuid': current_task()['uuid'],
                 'sequence': if_sequence + 1,
                 'parameters': {
                     'input':task_input
                     }
                 }
             api('v1').job_tasks().create(body=new_task_attrs).execute()
     if and_end_task:
         api('v1').job_tasks().update(uuid=current_task()['uuid'],
                                    body={'success':True}
                                    ).execute()
         exit(0)
示例#4
0
 def one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=False):
     if if_sequence != current_task()['sequence']:
         return
     job_input = current_job()['script_parameters']['input']
     cr = CollectionReader(job_input)
     for s in cr.all_streams():
         for f in s.all_files():
             if input_as_path:
                 task_input = os.path.join(job_input, s.name(), f.name())
             else:
                 task_input = f.as_manifest()
             new_task_attrs = {
                 'job_uuid': current_job()['uuid'],
                 'created_by_job_task_uuid': current_task()['uuid'],
                 'sequence': if_sequence + 1,
                 'parameters': {
                     'input':task_input
                     }
                 }
             api('v1').job_tasks().create(body=new_task_attrs).execute()
     if and_end_task:
         api('v1').job_tasks().update(uuid=current_task()['uuid'],
                                    body={'success':True}
                                    ).execute()
         exit(0)
示例#5
0
def current_job():
    global _current_job
    if _current_job:
        return _current_job
    t = api('v1').jobs().get(uuid=os.environ['JOB_UUID']).execute()
    t = UserDict.UserDict(t)
    t.tmpdir = os.environ['JOB_WORK']
    _current_job = t
    return t
示例#6
0
def current_job():
    global _current_job
    if _current_job:
        return _current_job
    t = api('v1').jobs().get(uuid=os.environ['JOB_UUID']).execute()
    t = UserDict.UserDict(t)
    t.tmpdir = os.environ['JOB_WORK']
    _current_job = t
    return t
示例#7
0
def main(request):
    """
        main view, for the webinterface, as for the api,
            as the api uses only one url with GET-Parameters.
    """
    if "api" in request.GET:
        return api(request)
    else:
        return home(request)
示例#8
0
def current_task():
    global _current_task
    if _current_task:
        return _current_task
    t = api('v1').job_tasks().get(uuid=os.environ['TASK_UUID']).execute()
    t = UserDict.UserDict(t)
    t.set_output = types.MethodType(task_set_output, t)
    t.tmpdir = os.environ['TASK_WORK']
    _current_task = t
    return t
示例#9
0
def current_task():
    global _current_task
    if _current_task:
        return _current_task
    t = api('v1').job_tasks().get(uuid=os.environ['TASK_UUID']).execute()
    t = UserDict.UserDict(t)
    t.set_output = types.MethodType(task_set_output, t)
    t.tmpdir = os.environ['TASK_WORK']
    _current_task = t
    return t
示例#10
0
 def one_task_per_input_stream(if_sequence=0, and_end_task=True):
     if if_sequence != current_task()['sequence']:
         return
     job_input = current_job()['script_parameters']['input']
     cr = CollectionReader(job_input)
     for s in cr.all_streams():
         task_input = s.tokens()
         new_task_attrs = {
             'job_uuid': current_job()['uuid'],
             'created_by_job_task_uuid': current_task()['uuid'],
             'sequence': if_sequence + 1,
             'parameters': {
                 'input':task_input
                 }
             }
         api('v1').job_tasks().create(body=new_task_attrs).execute()
     if and_end_task:
         api('v1').job_tasks().update(uuid=current_task()['uuid'],
                                    body={'success':True}
                                    ).execute()
         exit(0)
示例#11
0
def modify_record(email, password, domain_id, sub_domain, record_type,
                  record_line, value, ttl, record_id):
    api = RecordModify(email=email,
                       password=password,
                       domain_id=domain_id,
                       sub_domain=sub_domain,
                       record_type=record_type,
                       record_line=record_line,
                       value=value,
                       ttl=ttl,
                       record_id=record_id)
    return api().get('status')
示例#12
0
 def one_task_per_input_stream(if_sequence=0, and_end_task=True):
     if if_sequence != current_task()['sequence']:
         return
     job_input = current_job()['script_parameters']['input']
     cr = CollectionReader(job_input)
     for s in cr.all_streams():
         task_input = s.tokens()
         new_task_attrs = {
             'job_uuid': current_job()['uuid'],
             'created_by_job_task_uuid': current_task()['uuid'],
             'sequence': if_sequence + 1,
             'parameters': {
                 'input':task_input
                 }
             }
         api('v1').job_tasks().create(body=new_task_attrs).execute()
     if and_end_task:
         api('v1').job_tasks().update(uuid=current_task()['uuid'],
                                    body={'success':True}
                                    ).execute()
         exit(0)
示例#13
0
def get_domains_json(email, password):
    api = DomainList(email=email, password=password)
    return api().get("domains")
示例#14
0
 def setUp(self):
     self.api=api()
     self.carleton = {
     "INSTNM" : "Carleton College",
     "CITY" : "Northfield",
     "STABBR" : "MN",
     "OPEID" : 234000,
     "ADM_RATE" : 0.2262,
     "SAT_AVG" : 1413,
     "UGDS_WHITE" : 0.6161,
     "COSTT4_A" : 64420,
     "MD_EARN_WNE_P9" : 75000
     }
     self.carleton_full={
     "INSTNM" :"Carleton College" ,
     "CITY" :"Northfield" ,
     "STABBR" :"MN" ,
     "ZIP" :"55057-4001" ,
     "INSTURL" :"www.carleton.edu" ,
     "NPCURL" :"https://apps.carleton.edu/admissions/afford/estimator/ ",
     "OPEID" :234000 ,
     "OPEID6" :2340 ,
     "REGION" :4 ,
     "LOCALE" :32 ,
     "LATITUDE" :44.462318 ,
     "LONGITUDE" :-93.154666 ,
     "ADM_RATE" :0.2262 ,
     "SATVR25" :660 ,
     "SATVR75" :770 ,
     "SATMT25" :660 ,
     "SATMT75" :770 ,
     "SATWR25" :660 ,
     "SATWR75" :750 ,
     "SATVRMID" :715 ,
     "SATMTMID" :715 ,
     "SATWRMID" :705 ,
     "ACTCM25" :30 ,
     "ACTCM75" :33 ,
     "ACTEN25" : None ,
     "ACTEN75" : None ,
     "ACTMT25" : None ,
     "ACTMT75" : None ,
     "ACTWR25" : None ,
     "ACTWR75" : None ,
     "ACTCMMID" :32 ,
     "ACTENMID" : None ,
     "ACTMTMID" : None ,
     "ACTWRMID" : None ,
     "SAT_AVG" :1413 ,
     "SAT_AVG_ALL" :1413 ,
     "PCIP01" :0 ,
     "PCIP03" :0.0201 ,
     "PCIP04" :0 ,
     "PCIP05" :0.0241 ,
     "PCIP09" :0 ,
     "PCIP10" :0 ,
     "PCIP11" :0.1006 ,
     "PCIP12" :0 ,
     "PCIP13" :0 ,
     "PCIP14" :0 ,
     "PCIP15" :0 ,
     "PCIP16" :0.0302 ,
     "PCIP19" :0 ,
     "PCIP22" :0 ,
     "PCIP23" :0.0644 ,
     "PCIP24" :0 ,
     "PCIP25" :0 ,
     "PCIP26" :0.1127 ,
     "PCIP27" :0.0644 ,
     "PCIP29" :0 ,
     "PCIP30" :0.006 ,
     "PCIP31" :0 ,
     "PCIP38" :0.0282 ,
     "PCIP39" :0 ,
     "PCIP40" :0.1268 ,
     "PCIP41" :0 ,
     "PCIP42" :0.0604 ,
     "PCIP43" :0 ,
     "PCIP44" :0 ,
     "PCIP45" :0.1992 ,
     "PCIP46" :0 ,
     "PCIP47" :0 ,
     "PCIP48" :0 ,
     "PCIP49" :0 ,
     "PCIP50" :0.0986 ,
     "PCIP51" :0 ,
     "PCIP52" :0 ,
     "PCIP54" :0.0644 ,
     "UGDS" :2045 ,
     "UG" :1936 ,
     "UGDS_WHITE" :0.6161 ,
     "UGDS_BLACK" :0.045 ,
     "UGDS_HISP" :0.0748 ,
     "UGDS_ASIAN" :0.0856 ,
     "UGDS_AIAN" :0.0015 ,
     "UGDS_NHPI" :0.001 ,
     "UGDS_2MOR" :0.0567 ,
     "UGDS_NRA" :0.1017 ,
     "UGDS_UNKN" :0.0176 ,
     "UGDS_WHITENH" :0.6913 ,
     "UGDS_BLACKNH" :0.0463 ,
     "UGDS_API" :0.0967 ,
     "UGDS_AIANOLD" :0.0065 ,
     "UGDS_HISPOLD" :0.0554 ,
     "UG_NRA" :0.0181 ,
     "UG_UNKN" :0 ,
     "UG_WHITENH" :0.8316 ,
     "UG_BLACKNH" :0.0294 ,
     "UG_API" :0.0821 ,
     "UG_AIANOLD" :0.0026 ,
     "UG_HISPOLD" :0.0362 ,
     "NPT4_PRIV" :26745 ,
     "NPT41_PUB" : None ,
     "NPT42_PUB" : None ,
     "NPT43_PUB" : None ,
     "NPT44_PUB" : None ,
     "NPT45_PUB" : None ,
     "NPT41_PRIV" :12207 ,
     "NPT42_PRIV" :13473 ,
     "NPT43_PRIV" :14682 ,
     "NPT44_PRIV" :22396 ,
     "NPT45_PRIV" :38398 ,
     "NUM4_PRIV" :228 ,
     "COSTT4_A" :64420 ,
     "TUITIONFEE_IN" :50874 ,
     "TUITIONFEE_OUT" :50874 ,
     "FEMALE_ENRL_ORIG_YR2_RT" :0.803571429 ,
     "MALE_ENRL_ORIG_YR2_RT" :0.819047619 ,
     "GRAD_DEBT_MDN" :19500 ,
     "FIRSTGEN_DEBT_MDN" :18409 ,
     "NOTFIRSTGEN_DEBT_MDN" :18798 ,
     "FIRST_GEN" :0.162393162 ,
     "COUNT_WNE_INDEP0_INC1_P10" :21
     }
示例#15
0
 def _get_url(self):
     api = FlickrFavoritesRemoveAPI if self.fav else FlickrFavoritesAddAPI
     url = api().get_url(self.arg['id'])
     return url
示例#16
0
文件: main.py 项目: ovyas24/quoter
def index():
    quote = api()
    return render_template("index.html", quote=quote)
示例#17
0
PACKAGE_PARENT = '../..'
SCRIPT_DIR = os.path.dirname(
    os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
from api import *

import time
import random
from threading import Thread
from sys import argv
import sys
from sys import exit
import pathlib

main = api()

if (len(sys.argv) > 1):
    main.load_config(pathlib.Path().absolute(), sys.argv[1])
else:
    main.load_config(pathlib.Path().absolute(), "main")

wiz_count = main.config["config"]["wizards"]
main.register_windows(count=wiz_count)

# Thread Init - Used for movement sequences
threads = []

while True:
    main.start_time = time.time()
    main.round_count += 1
示例#18
0
 def _get_url(self):
     api = FlickrFavoritesRemoveAPI if self.fav else FlickrFavoritesAddAPI
     url = api().get_url(self.arg['id'])
     return url
示例#19
0
def get_domains_json(email, password):
    api = DomainList(email=email, password=password)
    return api().get("domains")
示例#20
0
token='CAACEdEose0cBACER45cmArLFqGPf2ALQ1F3S8v04By1qulqmPNqOZAr5j8uTeHScgsTMmzC8sQUXu1DkKIjfjh203p3ynK7Hv18sKKZCr61GI8kjvaRHacu1x8fW8hEbSWMDk2uXgvlqSZB5RNb0xwFVOMzokZAuhh2ZBEZBKZCpgZDZD'
from wiring import *
from api import *
from request import *
f=api(token)


示例#21
0
def get_records_json(email, password, domain_id):
    api = RecordList(email=email, password=password, domain_id=domain_id)
    return api().get('records')
示例#22
0
    butV = Button(f,
                  text='Voltar',
                  command=qualifyReturn,
                  width=12,
                  font='verdana 10 bold')
    butV.pack()
    f.pack()


#Instancias da classe tk que é a biblioteca usada para desenvolver a interface,
#da classe cliente e da classe api
s = Tk()
s.title('Autorama')
s.geometry('680x570')
c = client()
a = api()

#As linhas de código abaixo em sua maioria dizem respeito a instâncias de componentes de tela,
#como botões, labels, inputs e etc, despensa explicações

#Componentes da tela de configuração do RFID e servidor

screen1 = Frame(s)
framer1 = Frame(screen1)
framer2 = Frame(screen1)
framer3 = Frame(screen1)
framer4 = Frame(screen1)
framer5 = Frame(screen1)
framer6 = Frame(screen1)

lr1 = Label(framer1, text='RFID', font='verdana 16 bold', anchor='e')
示例#23
0
def set_get_started(gs_obj):
    request_endpoint = '{0}/me/messenger_profile'.format(bot.graph_url)
    response = requests.post(
        request_endpoint,
        params=bot.auth_args,
        json=gs_obj,
    )
    result = response.json()
    return result


def send_quick_replies(recipient_id, text, quick_replies):
    return bot.send_message(recipient_id, {
        "text": text,
        "quick_replies": quick_replies
    })


def verify_fb_token(token_sent):
    # take token sent by facebook and verify it matches the verify token you sent
    # if they match, allow the request, else return an error
    if token_sent == VERIFY_TOKEN:
        return request.args.get("hub.challenge")
    return 'Invalid verification token'


if __name__ == "__main__":
    set_get_started({"get_started": {"payload": "started"}})
    api(app, db)
    app.run(host='0.0.0.0', debug=True)
示例#24
0
import api
api = api.config('abdul_f9cfcade4264cba870585a')

val, res = api('temp-deprecated').run('sayHello', {
    'name': 'hi'
})

if res.error:
    print 'oh no'
else:
    print val
示例#25
0
def get_records_json(email, password, domain_id):
    api = RecordList(email=email, password=password, domain_id=domain_id)
    return api().get('records')
示例#26
0
import dwollav2
import firebase_admin
from firebase_admin import auth
from firebase_admin import credentials
from utils import *
from api import *
import boto3
import time

#Setup firebase, and API
cred = credentials.Certificate(
    "./dracker-9443c-firebase-adminsdk-gmc2g-7d48bbd323.json")
firebase_admin.initialize_app(cred)
api_instance = api("keys.json")
keys = api_instance.get_keys()


def register_user(user):
    # Test new User
    res = api_instance.new_user(user)
    data = res.json()
    #Need to do this because, the data is not sanatized
    if data['message'] != 'SUCCESS':
        print("Register new user: Test Failed! initial create")
        return (None, None)
    uid = data['uid']
    #After successful creation of a user, check for duplicate registration possibility
    org_phone = user['phone']
    org_email = user['email']
    #Test duplicate email
    user['phone'] = random_phone()
示例#27
0
def modify_record(email, password, domain_id, sub_domain, record_type, record_line, value, ttl, record_id):
    api = RecordModify(
        email=email, password=password, domain_id=domain_id, sub_domain=sub_domain, record_type=record_type,
        record_line=record_line, value=value, ttl=ttl, record_id=record_id)
    return api().get('status')
示例#28
0
# getconfig() -- Return a configuration variable
# getpubkeys() -- Return the public keys for a wallet address
# getrawtransaction() -- Retrieve a transaction
# getmpk() -- Return your wallet\'s master public key
# help() -- Prints this help
# history() -- Returns the transaction history of your wallet
# listaddresses() -- Returns your list of addresses.
# listunspent() -- Returns the list of unspent inputs in your wallet.
# getaddressunspent() -- Returns the list of unspent inputs for an address.
# restore() -- Restore a wallet
# setconfig() -- Set a configuration variable
# setlabel() -- Assign a label to an item
# sendrawtransaction() -- Broadcasts a transaction to the network.
# unfreeze() -- Unfreeze the funds at one of your wallet\'s address
# validateaddress() -- Check that the address is valid
# verifymessage() -- Verifies a signature', verifymessage_syntax
# encrypt() -- encrypt a message with pubkey
# daemon("<stop/status>") -- <stop|status>
# getproof() -- get merkle proof
# getutxoaddress() -- get the address of an unspent transaction output


#Exsample
import api              # imports the api
from api import *       # imports all funtions

api = api()   			    # bind class
print api.daemon("status")  # Prints daemon status
print api.getbalance()      # Prints balance
print api.getservers()      # Prints all servers in electrum network