def get(self): # extract URL-Parameters article = self.get_argument("article") last = self.get_argument("last", None) if article in self.threads: thread = self.threads[article] if thread.completed == 1 and thread.startdate > int( time.time()) - 5: logging.debug( "process finished few seconds ago, recovering existing results" ) self.worker_done(thread.datasources) elif thread.completed == 1: logging.debug("process already finished, starting new process") thread = Base(self.config, article, last, self.worker_done) thread.start() self.threads[article] = thread else: tstartdate = datetime.datetime.fromtimestamp( thread.startdate).strftime("%d.%m.%Y %H:%M:%S") logging.debug("process with article %s running since %s" % (article, tstartdate)) self.worker_done(thread.datasources) else: logging.debug( "Article: %s first time fetched, starting new process" % article) thread = Base(self.config, article, last, self.worker_done) thread.start() self.threads[article] = thread
def mainLoop(clock, window, sprites, audio): run = True status = Status.inMenu tick = 0 drawer = Drawer(window) hitBoxe = HitBoxe(audio.hitSound, audio.dieSound, audio.pointSound) base = Base(sprites.base) bird = Bird(sprites.bird, audio.wingSound, hitBoxe) pipes = Pipes(sprites.pipe, hitBoxe) score = Score(sprites.numbers) while run: clock.tick(FPS) for event in pygame.event.get(): if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE): run = False if status == Status.inMenu and event.type == pygame.KEYUP and ( event.key == pygame.K_SPACE or event.key == pygame.K_UP): status = Status.inGame if status == Status.inGame and event.type == pygame.KEYDOWN and ( event.key == pygame.K_SPACE or event.key == pygame.K_UP): bird.jump() if status == Status.inGameOver and event.type == pygame.KEYUP and ( event.key == pygame.K_SPACE or event.key == pygame.K_UP): status = Status.inMenu tick = 0 base = Base(sprites.base) bird = Bird(sprites.bird, audio.wingSound, hitBoxe) pipes = Pipes(sprites.pipe, hitBoxe) score = Score(sprites.numbers) if status == Status.inGame: hitBase = hitBoxe.birdHitBase(bird, base) hitPipe = hitBoxe.birdHitPipes(bird, pipes) hitBoxe.birdPassPipe(bird, pipes.pipes, score) if hitBase or hitPipe: status = Status.inGameOver bird.die() if status == Status.inMenu: drawer.drawInMenu(sprites.background, sprites.message, base, bird, tick) elif status == Status.inGame: drawer.drawInGame(sprites.background, base, bird, pipes, score, tick) else: drawer.drawInGameOver(sprites.background, sprites.gameOver, base, bird, pipes, score, tick) if tick < FPS: tick += 1 else: tick = 0
def __init__(self): ''' 基本数据来源支持 ''' self.yamlelements = Base().readYamlcaseElement() self.jsonpath = ReaderJson().getJsonPath(Base().toJson( Base().jsonDatafile())) self.cycleCase = cycle(self.yamlelements) self.jsons = Base().toJson(Base().jsonDatafile())
def create_bases(self): bases = [ Base("left", LIVES, self.textures['red'], self.textures['green'], self.window.height, self.window.width), Base("right", LIVES, self.textures['red'], self.textures['green'], self.window.height, self.window.width) ] for base in bases: self.collision_manager.add(base) return bases
def parse(dir_name): print("#####PARSING#####") arn_list = [] for filename in os.listdir(dir_name): file = open(dir_name + filename, 'r') print("file: " + dir_name + filename) # On construit l'objet ARN arn = ARN(filename.split("_")[0]) file.readline() file.readline() chain = file.readline().split(" ")[1].rsplit('\t') chain_id = chain[0] chain = chain[1].rsplit('\n')[0] arn.chain = chain arn.chain_id = chain_id file.readline() # On ajoute les interactions et bases a l'ARN arn._set_bases() for line in file: line = line.rsplit('\t') base1 = Base(line[2], int(line[5])) base2 = Base(line[6], int(line[9].rsplit('\n')[0])) interaction = Interaction(base1, line[1], base2) arn._add_interaction(interaction) # On ajoute les boucles a l'ARN expr = "Catalog_results/loop." + arn.name + "*" for loop_file_name in glob.glob(expr): print("|\tloop file: " + loop_file_name) loop_file = open(loop_file_name) loop = Loop(arn.name, arn.chain_id, loop_file.readline().split(":")[1].rsplit('\n')[0]) loop_bases = loop_file.readline().split(": ")[1].split(", ") loop_bases[-1] = loop_bases[-1].rsplit('\n')[0] loop.bases = [Base(b[:1], b[1:]) for b in loop_bases] loop_file.readline() for line in loop_file: line = line.rsplit('\t') base1 = Base(line[0][:1], int(line[0][1:])) base2 = Base(line[2][:1], int(line[2][1:].rsplit('\n')[0])) interaction = Interaction(base1, line[1], base2) print("|\t|\tadding interaction " + str(interaction)) loop.add_interaction(interaction) arn._add_loop(loop) loop_file.close() file.close() arn_list.append(arn) print("#####FINISHED PARSING#####") return arn_list
def run(): try: file = open('./board.mc', 'r') text = file.read() except FileNotFoundError: file = open('../board.mc', 'r') text = file.read() file.close() lex = Lexer(text) token, error = lex.tokenize() if (token is None): return error else: passer = Passer(token) rule, error = passer.grammar() if rule is None: return error else: if (token[0].value == 'solve'): sol = Solve(rule[2:]) return sol.useCaseTest() elif (token[0].value == 'base'): bases = Base(rule[2:]) return bases.results() elif (token[0].value == 'evaluate'): eva = Evaluate(rule[2:-1]) return eva.useCaseTest() elif (token[0].value == 'standardform'): sdform = Standardform(rule[2:-1]) return sdform.results()
def run(self): found_record = [] while True: tmp = Base() (func, args, kargs) = self.tasks.get() try: found_record = func(*args, **kargs) if found_record: Worker.lck.acquire() # brtdata.append(found_record) # self.write_csv(found_record) # print found_record for r in found_record: # data=[] # data.append(r['Type']) # data.append(r['Name']) # data.append(r['Address']) # data.append(r['Target']) # data.append(r['Port']) # data.append(r['String']) self.result.put(r) # msg=' '.join(data) # tmp.print_good(msg) # # if type(r).__name__ == "dict": # # for k, v in r.iteritems(): # tmp.print_good("\t{0}:{1}".format(k, v)) # print_status() # else: # print_status("\t {0}".format(" ".join(r))) Worker.lck.release() except Exception as e: tmp.print_debug(e) self.tasks.task_done()
def __init__(self, simulation=True): """Initializes various aspects of the Fetch.""" rospy.init_node("fetch") rospy.loginfo("initializing the Fetch...") self.arm = Arm() self.arm_joints = ArmJoints() self.base = Base() self.camera = RGBD() self.head = Head() self.gripper = Gripper(self.camera) self.torso = Torso() self.joint_reader = JointStateReader() # Tucked arm starting joint angle configuration self.names = ArmJoints().names() self.tucked = [1.3200, 1.3999, -0.1998, 1.7199, 0.0, 1.6600, 0.0] self.tucked_list = [(x,y) for (x,y) in zip(self.names, self.tucked)] # Initial (x,y,yaw) position of the robot wrt map origin. We keep this # fixed so that we can reset to this position as needed. The HSR's # `omni_base.pose` (i.e., the start pose) returns (x,y,yaw) where yaw is # the rotation about that axis (intuitively, the z axis). For the base, # `base.odom` supplies both `position` and `orientation` attributes. start = copy.deepcopy(self.base.odom.position) yaw = Base._yaw_from_quaternion(self.base.odom.orientation) self.start_pose = np.array([start.x, start.y, yaw]) rospy.loginfo("...finished initialization!")
def __init__(self): self.Base = Base() self.ArpScan = ArpScan() self.ICMPv6Scan = ICMPv6Scan() if not self.Base.check_installed_software("nmap"): exit(2)
def __init__(self, width=288, height=512): """ Initialize the game. Argument: width (int): width of game screen in pixels height (int): height of game screen in pixels """ pygame.init() # Frame rate of the game self.fps = 30 # Game clock which ticks according to the game framerate self.clock = pygame.time.Clock() # Set up display self.width, self.height = width, height self.screen = pygame.display.set_mode((self.width, self.height)) pygame.display.set_caption('Flappy Bird') # Set up game objects self.bg = pygame.image.load('assets/background.png').convert_alpha() self.game_text = GameText() self.player = Bird(0.2 * width, 0.45 * height) self.base = Base() self.pipes = [] # List of flags indicating whether or not the pass through of the pipe # pairs has been counted yet self.pipe_counted = [False, False] # Set game difficulty as [0,1,2] = [easy, medium, or hard] self.level = 2
def main(argv): parser = argparse.ArgumentParser() parser.add_argument("apikey", type=str, help="Mashery V2 API Key") parser.add_argument("secret", type=str, help="Mashery V2 API Secret") parser.add_argument("siteId", type=str, help="Mashery Area/Site ID") parser.add_argument("outputFile", type=str, help="Output Filename") args = parser.parse_args() apikey = args.apikey secret = args.secret siteId = args.siteId outputFile = args.outputFile masheryV2 = Base('https', 'api.mashery.com', siteId, apikey, secret) allDevelopers = masheryV2.fetch('members', 'username, email, applications, keys, package_keys', '') f = open(outputFile,'w') headers = 'username, email, num_applications, num_keys, num_package_keys\n' f.write(headers) for developer in allDevelopers: fieldValues = '' fieldValues = fieldValues + '"' + developer['username'] + '",' fieldValues = fieldValues + '"' + developer['email'] + '",' fieldValues = fieldValues + str(len(developer['applications'])) + ',' fieldValues = fieldValues + str(len(developer['keys'])) + ',' fieldValues = fieldValues + str(len(developer['package_keys'])) f.write(fieldValues + '\n')
def _do_login(self, continue_function, user='******', force_dashboard=True): self._set_login_fields(user) # TODO: Remove once bug is fixed time.sleep(1.25) continue_function() try: self._wait_for_results_refresh() except: self._wait_for_results_refresh() from pages.dashboard import DashboardPage page = DashboardPage(self.testsetup) try: page.is_the_current_page except AssertionError: if force_dashboard: from fixtures.navigation import intel_dashboard_pg page = intel_dashboard_pg() else: # Not the dashboard page and not forcing dashboard page # return a generic Base page page = Base(self.testsetup) return page
def on_init(self, genomes, config): """ Initialize before the main loop """ pygame.init() self.win = pygame.display.set_mode(self.size) pygame.display.set_caption("Flappy bird") self.clock = pygame.time.Clock() self.score = 0 self.gen += 1 self.nets = [] self.ge = [] self.birds = [] for _, genome in genomes: genome.fitness = 0 net = neat.nn.FeedForwardNetwork.create(genome, config) self.nets.append(net) self.birds.append(Bird(230, 350)) self.ge.append(genome) self.base = Base(self.win_height) self.pipes = [Pipe(self.win_width + 200)] self.run = True
def test_fake(retrain, render): data_path = '/data/money/fake_sin_data.json' punished = retrain if not retrain: init_logger() times = 1 if retrain else 1 for i in range(times): trainer = Base() info = trainer.train(data_path, DQN, MlpPolicy, retrain=punished, render=render, train_steps=200000, save_path='fake', env_params={ 'punished': False, 'nav': 50000, 'data_kwargs': { 'use_ta': True, 'start_random': False }, }, rl_model_params={ 'verbose': 1, 'learning_rate': 5e-5 }) profit = info[0]['profit']['total'] if profit > 10000: break
def __init__(self): self.conf = Base.Base() self.deviceId = self.conf.deviceId self.baseurl = self.conf.baseurl self.gameid = self.conf.gameid self.randomkey = self.conf.randomkey self.eventid = self.conf.eventid self.refererurl = self.conf.refererurl self.HOST = self.conf.HOST self.headers = { "Content-Type": "application/json", "Host": self.HOST, "gameDeviceld": self.deviceId, "Accept": "*/*", "Origin": self.refererurl, "Connection": "keep-alive", "gameAppVersion": "31000004", "Accept-Language": "en", "Accept-Encoding": "gzip, deflate", "Content-Length": '266', "User-Agent": "GLWebSDKSample/24357 CFNetwork/1107.1 Darwin/19.0.0", "gameLang": "en", "Cache-Control": "no-cache" }
def __init__(self, time): self.xPos = 1195 self.yPos = -50 self.width = 300 self.height = 400 self.direction = 'e' self.previousDirection = 'e' self.speed = 0.05 self.health = 20 self.hurt = False self.hurtTime = 0 self.changeInHp = 0 self.attacking = 0 # 0 = not, 1 = up, 2 = right, 3 = down, 4 = down self.attackingTime = 0 self.floorTile = 3 self.base = Base(self.xPos, self.yPos, self.width, self.height, 50, 200) self.pathTime = time self.pathTimeUpdateRate = 1000 self.directions = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'] self.currentFrame = -1 self.currentTime = -1 self.projectiles = [Projectile(0, 0, 0, 0, 'none', 0, 0, 0, 0, 0)] self.dying = False self.dead = False self.endOfOrange = False
def test_fake(retrain, render, is_test): if is_test: data_path = '/data/money/source_minute_test.json' else: data_path = '/data/money/source_minute.json' punished = retrain if not retrain: init_logger() times = 1 if retrain else 1 for i in range(times): trainer = Base() info = trainer.train(data_path, DQN, MlpPolicy, retrain=punished, render=render, train_steps=1500000, save_path='fake', env_params={ 'punished': False, 'nav': 30000, 'data_kwargs': { 'use_ta': True, 'start_random': False, 'ta_timeperiods': [5, 10, 15, 30], }, 'add_extra': True }, rl_model_params={ 'verbose': 1, 'learning_rate': 1e-5, }) profit = info[0]['profit']['total'] if profit > 10000: break
def setUpClass(cls) -> None: print(cls.docs) driver_path = os.path.join(os.getcwd(), "webdriver", "chromedriver.exe") cls.driver = webdriver.Chrome(executable_path=driver_path) cls.base = Base(cls.driver) cls.base.open_page("http://www.baidu.com")
def runCommand(command, chatId): base = Base(chatId) if command == '0' or command == '/repeat': words = base.findNewData() if len(words) == 0: bot.send_message(chatId, "Новых слов на сегодня нет!") bot.send_message(chatId, "На сегодня {} слов: ".format(len(words))) result = 0 # for i in words: # prompt = "{} - ".format(i.rus) # answer = input(prompt) # if i.test(answer): # result += 1 # base.update(i) # print("\n Итого {}/{} правильных ответов".format(result, len(words))) # wait() # cls() elif command == '1' or command == '/list': words = base.findAllData() mass = "" bot.send_message(chatId, "Сейчас в безе {} записей: ".format(len(words))) for i in words: mass += ("{} \r\n".format(i)) if len(mass) > 0: bot.send_message(chatId, mass) elif command == '/CLEAR_ALL_DATA': del base os.remove("{}.db".format(chatId))
def __init__(self, simulation=True): """Initializes various aspects of the Fetch. TODOs: get things working, also use `simulation` flag to change ROS topic names if necessary (especially for the cameras!). UPDATE: actually I don't think this is necessary now, they have the same topic names. """ rospy.init_node("fetch") self.arm = Arm() self.arm_joints = ArmJoints() self.base = Base() self.camera = RGBD() self.head = Head() self.gripper = Gripper(self.camera) self.torso = Torso() self.joint_reader = JointStateReader() # Tucked arm starting joint angle configuration self.names = ArmJoints().names() self.tucked = [1.3200, 1.3999, -0.1998, 1.7199, 0.0, 1.6600, 0.0] self.tucked_list = [(x, y) for (x, y) in zip(self.names, self.tucked)] # Initial (x,y,yaw) position of the robot wrt map origin. We keep this # fixed so that we can reset to this position as needed. The HSR's # `omni_base.pose` (i.e., the start pose) returns (x,y,yaw) where yaw is # the rotation about that axis (intuitively, the z axis). For the base, # `base.odom` supplies both `position` and `orientation` attributes. start = copy.deepcopy(self.base.odom.position) yaw = Base._yaw_from_quaternion(self.base.odom.orientation) self.start_pose = np.array([start.x, start.y, yaw]) self.TURN_SPEED = 0.3 self.num_restarts = 0
def __init__(self): from base import Base from network import Ethernet_raw, IPv6_raw, ICMPv6_raw self.base = Base() self.eth = Ethernet_raw() self.ipv6 = IPv6_raw() self.icmpv6 = ICMPv6_raw() self.rawSocket = socket(AF_PACKET, SOCK_RAW, htons(0x0003)) self.results = [] self.unique_results = [] self.mac_addresses = [] self.retry_number = 3 self.timeout = 0 self.router_info = {} # region Create vendor list self.mac_prefixes_file = utils_path + "mac-prefixes.txt" self.vendor_list = [] with open(self.mac_prefixes_file, 'r') as mac_prefixes_descriptor: for string in mac_prefixes_descriptor.readlines(): string_list = string.split(" ", 1) self.vendor_list.append({ "prefix": string_list[0], "vendor": string_list[1][:-1] })
def __init__(self, num_threads, filename=None): if filename is None: tmp = Base() filename = tmp.get_random_str(10) + '.csv' self.tasks = Queue(num_threads) self.result = Queue() for _ in range(num_threads): Worker(self.tasks, self.result, filename)
def main(argv): parser = argparse.ArgumentParser() parser.add_argument("apikey", type=str, help="Mashery V2 API Key") parser.add_argument("secret", type=str, help="Mashery V2 API Secret") parser.add_argument("siteId", type=str, help="Mashery Area/Site ID") parser.add_argument("outputFile", type=str, help="Output Filename") parser.add_argument( '--fields', nargs='+', help= 'List of key fields to retrieve, space separated, e.g username email') args = parser.parse_args() apikey = args.apikey secret = args.secret siteId = args.siteId outputFile = args.outputFile fields = args.fields masheryV2 = Base('https', 'api.mashery.com', siteId, apikey, secret, logging.getLogger('exportKeys')) allKeys = masheryV2.fetch('keys', ','.join(fields), '') f = open(outputFile, 'w') headers = ','.join(fields) + '\n' f.write(headers) for key in allKeys: fieldValues = '' unknown_field = '<UNKNOWN>' for field in fields: splitFields = field.split('.') try: if field == 'limits': t_fieldValues = '' t_fieldValues = t_fieldValues + str( key[field][0]['ceiling'] ) + ' calls per ' + key[field][0]['period'] + ' and ' t_fieldValues = t_fieldValues + str( key[field][1] ['ceiling']) + ' calls per ' + key[field][1]['period'] fieldValues = fieldValues + '"' + t_fieldValues + '",' else: if len(splitFields) == 2: value = key[splitFields[0]][splitFields[1]] fieldValues = fieldValues + '"' + unicode(value) + '",' else: fieldValues = fieldValues + '"' + unicode( key[splitFields[0]]) + '",' except TypeError: fieldValues = fieldValues + '"' + unknown_field + '",' pass fieldValues = fieldValues + '\n' f.write(fieldValues.encode('utf8'))
def main_play(): global Win, generation win = Win generation += 1 bird = Bird(200, 320) BGround = Back_ground() base = Base(FLOOR) pipes = [Pipe(650)] run = True clock = pygame.time.Clock() scores = 0 while run: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False pygame.quit() # bird.move() if event.type == pygame.KEYDOWN and (event.key == pygame.K_SPACE or event.key == pygame.K_UP): bird.jump() bird.y -= 15 bird.move() BGround.move() base.move() disappear = [] addPipe = False for pipe in pipes: pipe.move() if pipe.attack(bird): run = False if pipe.x + pipe.pipe_top.get_width() < 0: disappear.append(pipe) if not pipe.passed and pipe.x < bird.x: pipe.passed = True addPipe = True if addPipe: scores += 1 pipes.append(Pipe(500)) for pipe_remove in disappear: pipes.remove(pipe_remove) if bird.y + bird.image.get_height() - 10 >= FLOOR or bird.y < 0: run = False draw_win(Win, bird, pipes, base, BGround, scores, generation)
def main(): call = Base() try: tests_file_path = sys.argv[1] except IndexError: raise Exception("Path to a tests file should be provided!") if os.path.exists(tests_file_path): logger.info("Reading tests file '%s'..." % tests_file_path) with open(tests_file_path) as f: test_cases = [test for test in f.read().split("\n") if test] logger.info("Tests file '%s' has been successfully read." % tests_file_path) else: raise Exception("Tests file '%s' doesn't exist!" % tests_file_path) logger.info("Initializing TestRail client...") logger.info("TestRail client has been successfully initialized.") logger.info("Getting milestone '%s'..." % config.MILESTONE) milestone = call.get_milestone_by_name(config.MILESTONE) logger.info(milestone) logger.info("Getting tests suite '%s'..." % config.SUITE) suite = call.get_suite_by_name(config.SUITE) if not suite: logger.info("Tests suite '%s' not found. " "Creating tests suite..." % config.SUITE) suite = call.add_suite(config.SUITE) logger.info("Tests suite has benn successfully created.") logger.info(suite) logger.info("Creating test cases for TestRail...") tr_test_cases = create_tr_test_cases( test_cases, milestone["id"], type_id=config.TEST_CASE_TYPE_ID, priority_id=config.TEST_CASE_PRIORITY_ID, qa_team=config.QA_TEAM) logger.info("Test cases have been successfully created.") sections_map = {} for section in sorted(config.SECTIONS_MAP.keys()): logger.info("Creating section '%s'..." % section) s = call.add_section(suite["id"], section) logger.info("Section '%s' has been successfully created." % section) sections_map[section] = s["id"] logger.info("Uploading created test cases to TestRail...") all_added_test_cases = [] for t in tr_test_cases: test_cases = add_tr_test_case(call, sections_map[t["section"]], t) all_added_test_cases.append(test_cases) logger.info("Test cases have been successfully uploaded.")
def test_la_base_peut_perdre_des_pv(self): b = Base() self.assertEqual(b.pv, 20) before = b.pv b.attaquer() after = b.pv self.assertEqual(before - 1, after) b.attaquer(25) self.assertEqual(b.pv, 0)
def main(): b = Base() b.message() p = Persona() p.message() a = Animal() a.message()
def run(self): base = Base(750) while True: self.handle_events() self.update() self.redraw() base.draw(self.screen) base.move() pygame.display.flip() self.clock.tick_busy_loop(self.fps)
def test_execute(self, mock_wf, mock_sys): base = Base('mock_arg') mock_wf_instance = mock_wf.return_value base.execute() self.assertEqual(base.wf, mock_wf_instance) self.assertEqual(base.log, mock_wf_instance.logger) mock_wf_instance.run.assert_called_once_with(base.main) mock_sys.exit.has_called()
def main(argv): parser = argparse.ArgumentParser() parser.add_argument("apikey", type=str, help="Mashery V2 API Key") parser.add_argument("secret", type=str, help="Mashery V2 API Secret") parser.add_argument("siteId", type=str, help="Mashery Area/Site ID") parser.add_argument("startDate", type=str, help="Start Date of reporting data") parser.add_argument("endDate", type=str, help="End Date of reporting data") parser.add_argument("keyCreateDate", type=str, help="Key Create Date, i.e. keys created before this date will be considered for disablement/deletion") parser.add_argument('--delete', action='store_true', default=False, help='specify to delete, leave off command to disable') parser.add_argument('--nodryrun', action='store_true', default=False, help='specify to perform work, leave off command for dry run') parser.add_argument('--archive', type=str, help="Name of file to use for archiving deleted fileds") args = parser.parse_args() apikey = args.apikey secret = args.secret siteId = args.siteId startDate = args.startDate endDate = args.endDate keyCreateDate = args.keyCreateDate delete = args.delete dryrun = args.nodryrun archive = args.archive if masheryDate.dayGap(startDate, endDate) < 1: print 'ERROR: endDate must be at least 1 day past startDate' return masheryV2 = Base('https', 'api.mashery.com', siteId, apikey, secret) allKeys = fetchAllKeys(siteId, apikey, secret) writeToFile('keys.csv', allKeys) allActiveKeys = fetchAllActiveKeys(siteId, apikey, secret, startDate, endDate) writeToFile('active_keys.csv', allActiveKeys) for key in allKeys: if (masheryDate.dayGap(key['created'], keyCreateDate) > 0): if hasActivity(key['apikey'], allActiveKeys) == False and key['apikey'] != 'noapikey': actionType = 'disable' if delete == True: actionType = 'delete' if dryrun == False: print 'Need to {actionType} {apikey}, created on {created} for user: {username} ({email})'.format(actionType= actionType, apikey= key['apikey'], created= key['created'], username= key['username'], email= key['member']['email'] if key['member'] != None else '' ) else: if key['application'] == None or key['application']['is_packaged'] == False: print '{actionType}: {apikey}, created on {created} for user: {username} ({email})'.format(actionType= actionType, apikey= key['apikey'], created= key['created'], username= key['username'], email= key['member']['email'] if key['member'] != None else '' ) print processKey(siteId, apikey, secret, key, delete, archive)