def post_mark(): """ Save a mark in the database. :return: Return HTTP status code and the mark as is saved in the data store. """ return process_response(MarksManager.post_mark(request.get_json()))
def post_disciplinary_note(): """ Save a Disciplinary Note in the database. :return: A dict with the key of item saved, some as {'disciplinaryNoteId': <int>} """ return process_response( DisciplinaryNotesManager.post_dn(request.get_json()))
def delete_mark(mark_id): """ Do a logic deletion of a mark in the data store. :param mark_id: mark id in data store :return: Nothing, normal status code """ return process_response(MarksManager.delete_mark(mark_id))
def delete_ac(ac_id): """ Delete an AC ite from data store. :param ac_id: Id of the ac that will be deleted. :return: Nothing """ return process_response(AttendanceControlsManager.delete_ac(ac_id))
def post_ac(): """ Save an AC in the data store. :return: A dict with the key of item saved, some as {'acId': <int>} """ return process_response( AttendanceControlsManager.post_ac(request.get_json()))
def get_ac_base(ac_id): """ Get the Attendance Control Base to the association with id passed in url. :param association_id: id of the association saved in TDBmS. :return: A json data block with the base to do an ac in the UI. """ return process_response(AttendanceControlsManager.get_ac_base(ac_id))
def get_ac(ac_id=None): """ Return all attendance controls realized with minimal info or a specific with all. :param ac_id: Id of the ac that will be returned. :return: A json data block with ac data or a list of them. """ return process_response(AttendanceControlsManager.get_ac(ac_id))
def get_disciplinary_note(disciplinary_note_id=None): """ Get a list of disciplinary_notes or a specific disciplinary note from data store. :param disciplinary_note_id: Id of dn block. :return: A json data block with ac data or a list of them. """ return process_response( DisciplinaryNotesManager.get_dn(disciplinary_note_id))
def update_mark(mark_id): """ Update a Mark item in the data store. :param mark_id: Mark id which will be updated. :return: Nothing """ return process_response( MarksManager.update_mark(mark_id, request.get_json()))
def update_ac(ac_id): """ Update a AC item in the data store. :param ac_id: Id of the ac that will be updated. :return: Nothing """ return process_response( AttendanceControlsManager.update_ac(ac_id, request.get_json()))
def delete_disciplinary_note(disciplinary_note_id): """ Do a logic deletion of a disciplinary note in the data store. :param disciplinary_note_id: Id of the disciplinary note that will be deleted :return: Nothing. """ return process_response( DisciplinaryNotesManager.delete_dn(disciplinary_note_id))
def get_mark(mark_id=None): """ Get a list of marks or a specific mark from data store. :param mark_id: The id of the mark item to searh in data store. :return: A mark object """ print request.args return process_response(MarksManager.get_mark(mark_id, request.args))
def update_disciplinary_note(disciplinary_note_id): """ Update a DN item in the data store. :param disciplinary_note_id: Id of the dn that will be updated. :return: Nothing. """ return process_response( DisciplinaryNotesManager.update_dn(disciplinary_note_id, request.get_json()))
def arxiv_request_and_save(args): ''' arXiv search API request is executed, parsed, and then stored as a csv. ''' # Convert readable CLI arguments to arXiv search v0.5.6 params args = args_stringify(args) arxiv_params = { CLI_TO_ARXIV_PARAMS[key]: value for key, value in args.items() } arxiv_response = utils.arxiv_request(arxiv_params) clean_documents = utils.process_response(arxiv_response) file_name = "{}.csv".format(args_to_name(args)) utils.store_as_csv(clean_documents, fname=file_name)
def search_fulfill(): ''' Services API requests for arXiv searches. Is actually technically capable of servicing all arXiv search v0.5.6 requests. ''' # Note: we don't need to unpack the arguments since superflous # arguments will be naturally ignored by the API. args = request.args.to_dict(flat=True) arxiv_response = utils.arxiv_request(args) clean_documents = utils.process_response(arxiv_response) fname = utils.store_as_csv(clean_documents) ret = {'entries': clean_documents} # Pythonic dictionary update is in-place ret.update({'csv_name': fname}) return jsonify(ret)
#model.load_models() #model.copy_weights() print('[*] State Dimensions : ', STATE_DIM) print('[*] Action Dimensions : ', ACTION_DIM) print('[*] Start training...') losses = [] model.noise.reset() succeed_time = 0 for i_episode in range(MAX_EPISODES): # for every episode, reset environment first. Make sure getting the right position pytorch_io_service(0.0, 0.0, True) time.sleep(0.5) resp_ = pytorch_io_service(0.0, 0.0, False) _, _, cx, cy, cow, cox, coy, coz, tx, ty, tow, tox, toy, toz = utils.process_response( resp_) step_count = 0 episode_experience = [] print('Target x: %f, Target y: %f' % (tx, ty)) # for experience generating for i_step in range(MAX_STEPS): a_x, a_z = model.sample_action(cx, cy, cow, cox, coy, coz, tx, ty, tow, tox, toy, toz) # implement action and get response for t in range(TIME_DELAY): resp_ = pytorch_io_service(a_x, a_z, False) r, terminal, nx, ny, now, nox, noy, noz, tx, ty, tow, tox, toy, toz = utils.process_response( resp_) if terminal == 1:
def get_disciplinary_note_schema(): return process_response( DisciplinaryNotesManager.cru_dn_schema(schema=request.get_json(), action=request.method))