def do_create_report(self, namespace): '''Creates a new expense report''' _pprint(self.client.post( 'expense/expensereport/v1.1/Report', Report=validate_report_elements(namespace.options), _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', ))
def do_get_Forms(self, namespace): '''Retrieves the list of configured form types or the configured forms for the specified form type''' options = validate_Forms(namespace.options) options.setdefault('FormCode', '') _pprint(self.client.get( 'expense/expensereport/v1.1/report/Forms/%(FormCode)s' % options, ))
def do_quickexpense(self, namespace): '''Creates a new quick expense''' _pprint(self.client.post( 'expense/expensereport/v1.0/quickexpense/', Report=validate_quickexpense_elements(namespace.options), _xmlns='http://www.concursolutions.com/api/expense/expensereport/2010/09', ))
def _print_op_results(results): for index, result in enumerate(results): prompt.info( "------------ Operation {0}: {1}----------------".format(index + 1, result.operation.__class__.__name__) ) _pprint(result.result, depth=3) print(result.message)
def do_post_workflowaction(self, namespace): '''Post workflowaction''' # TODO options = validate_workflowaction(namespace.options) _pprint(self.client.post( 'expense/expensereport/v1.1/report/{report id}/workflowaction' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_loyalty_1(self, namespace): '''Post loyalty_1''' # TODO options = validate_loyalty_1(namespace.options) _pprint(self.client.post( 'travelprofile/v1.0/loyalty' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_batch(self, namespace): '''Post batch''' # TODO options = validate_batch(namespace.options) _pprint(self.client.post( 'expense/expensereport/v1.1/api/expense/expensereport/v1.1/report/batch' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_Attendees_1(self, namespace): '''Post Attendees_1''' # TODO options = validate_Attendees_1(namespace.options) _pprint(self.client.post( 'expense/expensereport/v1.1/report/{report id}/entry/{entry id}/Attendees' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_invoice_by_id(self, namespace): '''Post invoice_by_id''' # TODO options = validate_invoice_by_id(namespace.options) _pprint(self.client.post( 'image/v1.1/invoice/{invoice id}' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_report_by_id_1(self, namespace): '''Post report_by_id_1''' # TODO options = validate_report_by_id_1(namespace.options) _pprint(self.client.post( 'image/v1.0/report/{report id}' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_quickexpense_1(self, namespace): '''Post quickexpense_1''' # TODO options = validate_quickexpense_1(namespace.options) _pprint(self.client.post( 'expense/expensereport/v1.0/quickexpense' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def do_post_job(self, namespace): '''Post job''' # TODO options = validate_job(namespace.options) _pprint(self.client.post( 'expense/extract/v1.0/{extract id}/job' % options, RootTag=options, # TODO _xmlns='http://www.concursolutions.com/api/expense/expensereport/2011/03', # TODO ))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_games") start_time = _default_timer() result = get_games('Austrian Bundesliga') _pprint(result) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_reports") start_time = _default_timer() result = get_reports() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def pprint(obj): """ Pretty-print an object into a string buffer. """ # Get dicts' items. if hasattr(obj, "items"): obj = sorted(obj.items()) buf = StringIO() _pprint(obj, buf) value = buf.getvalue() buf.close() return value
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_song_by_name") start_time = _default_timer() result = get_song_by_name("I Didn't Mean To") _pprint(result) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_songs_by_artist") start_time = _default_timer() result = get_songs_by_artist('Aerosmith', test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_songs_by_artist") start_time = _default_timer() result = get_songs_by_artist('Aerosmith') print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_songs") start_time = _default_timer() result = get_songs(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_songs") start_time = _default_timer() result = get_songs() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_report") start_time = _default_timer() result = get_report("Blacksburg, VA") _pprint(result) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_temperature") start_time = _default_timer() result = get_temperature("Blacksburg, VA") _pprint(result) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_finances_by_state") start_time = _default_timer() result = get_finances_by_state('Alaska') _pprint(result) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_finances") start_time = _default_timer() result = get_finances(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_finances") start_time = _default_timer() result = get_finances() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_scripts") start_time = _default_timer() result = get_scripts(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_scripts") start_time = _default_timer() result = get_scripts() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_script_by_title") start_time = _default_timer() result = get_script_by_title("the princess bride") _pprint(result) print("Time taken: {}".format(_default_timer() - start_time))
def test_Differ(): text1 = """ 1. Beautiful is better than ugly. 2. Explicit is better than implicit. 3. Simple is better than complex. 4. Complex is better than complicated. """.splitlines( 1 ) print text1 # print text1[0][-1] text2 = """ 1. Beautiful is better than ugly. 3. Simple is better than complex. 4. Complicated is better than complex. 5. Flat is better than nested. """.splitlines( 1 ) print text2 # print text2[0][-1] d = Differ() result = list(d.compare(text1, text2)) _pprint(result)
def exec_config_tests(device_id): """Execute the config tests using the device with the given device ID.""" device = _devices[device_id] for info, cfg_factory in _TEST_CONFIGS: desc = info['description'] config = cfg_factory() while True: s = raw_input('Test %s config ? [Y/n/p] ' % desc) if not s or s[0].lower() == 'y': config[u'X_test'] = True cfg_id = _configs.add(config) device.set({u'config': cfg_id}) configured = device.get()[u'configured'] print ' configured: %s' % configured break elif s[0].lower() == 'n': break elif s[0].lower() == 'p': _pprint(config) else: print 'Invalid input %s' % input print
def main(): p1 = Player(name="John") p2 = Player(name="Hulio") b = Board() b.add_player(p1) b.add_player(p2) b.start() _pprint(filled_cells(b.state)) raw_input() destruct_status = False prev_check = [] state = b.state promotions = 0 while state not in ("FIN", ): # for player in (p1, p2): # b.get_state(player) event = smart_event_factory(state, colors, destruct_status, prev_check) color = 'white' if 'w' == event["name"][0] else 'black' if check_the_turn(event, state) == False: continue else: print "VALID" if "promoted" in event.keys() and event["promoted"]: promotions +=1 print "PROMOTED CHECKS: ", promotions state = check_the_game_state(state, event, colors) if event['cutDown'] and destruction_is_possible(event['finalPos'], filled_cells(state, color=colors[1]), filled_cells(state, color=colors[0]), event.get('promoted')): destruct_status = True prev_check = event['finalPos'] print 'NEXT DESTRUCT' raw_input() else: colors.reverse() destruct_status = False prev_check = [] print 'COLORS REVERSED!' print 'FILLED CELLS: ' , len((filled_cells(state))) raw_input()
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_shows") start_time = _default_timer() result = get_shows(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_shows") start_time = _default_timer() result = get_shows() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_show_by_theatre") start_time = _default_timer() result = get_show_by_theatre("friedman", test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_show_by_theatre") start_time = _default_timer() result = get_show_by_theatre("friedman") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def do_get(self, *path, **params): '''Issues an HTTP GET request Syntax: \tget path... [key=value]... ''' _pprint(self.mc.get('/'.join(path), **params))
def pprint(): """Pretty print tweet's json object.""" while True: tweet = (yield) _pprint(tweet.parsed)
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_all_crimes") start_time = _default_timer() result = get_all_crimes() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_all_crimes") start_time = _default_timer() result = get_all_crimes(test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_crime_by_county") start_time = _default_timer() result = get_crime_by_county("Alabaster Police Dept") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_crime_by_county") start_time = _default_timer() result = get_crime_by_county("Alabaster Police Dept", test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_crime_by_year") start_time = _default_timer() result = get_crime_by_year(1984) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_crime_by_year") start_time = _default_timer() result = get_crime_by_year(1984, test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def do_tokeninfo(self, line): '''Displays information about the access token.''' _pprint(self.mc.tokeninfo())
elif not _os.access(_Constants._DATABASE_NAME, _os.R_OK): raise DatasetException( ("Error! Could not read the \"{0}\" file. " "Make sure that it readable by changing its " "permissions. You may need to get help from " "your instructor.").format(_Constants._DATABASE_NAME, __name__)) _Constants._DATASET = None def get_opioid_deaths(): """ Retrieves all of the Opioid Deaths. """ if _Constants._DATASET is None: with open(_Constants._DATABASE_NAME, 'rb') as _: _Constants._DATASET = _pickle.load(_) return _Constants._DATASET if __name__ == '__main__': from pprint import pprint as _pprint from timeit import default_timer as _default_timer print(">>> get_opioid_deaths()") start_time = _default_timer() result = get_opioid_deaths() print("Time taken: {}".format(_default_timer() - start_time)) _pprint(result[0])
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_games_by_home_team") start_time = _default_timer() result = get_games_by_home_team("St. Louis Cardinals") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_games_by_away_team") start_time = _default_timer() result = get_games_by_away_team("St. Louis Cardinals") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_games") start_time = _default_timer() result = get_games(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_games") start_time = _default_timer() result = get_games() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_players") start_time = _default_timer() result = get_players(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_players") start_time = _default_timer() result = get_players() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_player_by_name") start_time = _default_timer() result = get_player_by_name('Ameer Abdullah') _pprint(result) print("Time taken: {}".format(_default_timer() - start_time))
def pprint(data): _pprint(data)
def do_post(self, *path, **params): '''Issues an HTTP POST request Syntax: \tpost path... [key=value]... ''' _pprint(self.mc.post('/'.join(path), **params))
def pprint(data): print 'Content-type: text/html\n' _pprint(data)
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_player_by_name") start_time = _default_timer() result = get_player_by_name('Jon Edward Zuber') _pprint(result) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_players") start_time = _default_timer() result = get_players(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_players") start_time = _default_timer() result = get_players() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_team_by_name") start_time = _default_timer() result = get_team_by_name('Philadelphia Phillies') _pprint(result) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_teams") start_time = _default_timer() result = get_teams(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_teams") start_time = _default_timer() result = get_teams() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_reports") start_time = _default_timer() result = get_reports() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_reports") start_time = _default_timer() result = get_reports(test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_reports_by_year") start_time = _default_timer() result = get_reports_by_year(1990) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_reports_by_year") start_time = _default_timer() result = get_reports_by_year(1990, test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_reports_by_country") start_time = _default_timer() result = get_reports_by_country("Afghanistan") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_reports_by_country") start_time = _default_timer() result = get_reports_by_country("Afghanistan", test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def _print_op_results(results): for index, result in enumerate(results): prompt.info(u'------------ Operation {0}: {1}----------------'.format\ (index + 1, result.operation.__class__.__name__)) _pprint(result.result, depth=3) print result.message
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_cars") start_time = _default_timer() result = get_cars(test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_cars") start_time = _default_timer() result = get_cars() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_cars_by_year") start_time = _default_timer() result = get_cars_by_year("2001", test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_cars_by_year") start_time = _default_timer() result = get_cars_by_year("2001") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_cars_by_make") start_time = _default_timer() result = get_cars_by_make("'Pontiac'", test=False) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_cars_by_make") start_time = _default_timer() result = get_cars_by_make("'Pontiac'") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))
def _test_interfaces(): from pprint import pprint as _pprint from timeit import default_timer as _default_timer # Production test print("Production get_all_crimes") start_time = _default_timer() result = get_all_crimes() print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_all_crimes") start_time = _default_timer() result = get_all_crimes(test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_crime_by_state") start_time = _default_timer() result = get_crime_by_state("Alabama") print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_crime_by_state") start_time = _default_timer() result = get_crime_by_state("Alabama", test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Production test print("Production get_crime_by_year") start_time = _default_timer() result = get_crime_by_year(1984) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time)) # Test test print("Test get_crime_by_year") start_time = _default_timer() result = get_crime_by_year(1984, test=True) print("{} entries found.".format(len(result))) _pprint(_Auxiliary._guess_schema(result)) print("Time taken: {}".format(_default_timer() - start_time))