示例#1
0
    def _get_features(self, state: tuple[Pokemon, Pokemon], move: Move):
        # TODO: Optimize feature extraction
        pokemon_a, pokemon_b = state
        type_mod = Type.dmg_modifier(move.info.type, pokemon_b.species.types[0]) * \
               (Type.dmg_modifier(move.info.type, pokemon_b.species.types[1]) if len(pokemon_b.species.types) > 1 else 1)
        type_mod /= 4  # Normalize the value between 0 and 1

        dmg_class_mod_stat_atk, dmg_class_mod_stat_def = (pokemon_a.stats.attack, pokemon_b.stats.defense) \
            if move.info.damage_class is DamageClass.PHYSICAL else (pokemon_a.stats.special, pokemon_b.stats.special)
        dmg_class_mod = (dmg_class_mod_stat_atk /
                         (dmg_class_mod_stat_atk + dmg_class_mod_stat_def))
        return [
            pokemon_a.hp / pokemon_a.stats.total_hp,
            pokemon_b.hp / pokemon_b.stats.total_hp,
            dmg_class_mod,
            type_mod,
            (move.info.power / 250),
            (move.info.accuracy if move.info.accuracy is not None else 1),
            # move.info.hit_info.min_hits,
            # move.info.hit_info.max_hits,
            int(move.info.high_crit_ratio),
            # move.info.priority,
            move.info.drain,
            # move.info.healing,
            # int(move.pp == 0)
            # TODO: Add more features
        ]
示例#2
0
    def _calc_modifier(self, attacking_pokemon: PokemonSpecies,
                       defending_pokemon: PokemonSpecies,
                       move_used: MoveInfo) -> float:
        rand_modifier = random.uniform(0.85, 1.0)
        if move_used.name == ATTACK_SELF:
            return rand_modifier

        stab = 1.5 if move_used.type in attacking_pokemon.types else 1
        type_modifier = Type.dmg_modifier(move_used.type,
                                          defending_pokemon.types[0])
        if len(defending_pokemon.types) > 1:
            type_modifier *= Type.dmg_modifier(move_used.type,
                                               defending_pokemon.types[1])
        return rand_modifier * stab * type_modifier
示例#3
0
def get_character_fittings(character_id, current_user=None):
    character = Character.get(character_id)
    character_application_access_check(current_user, character)
    fitting_data = character.get_op(
        'get_characters_character_id_fittings',
        character_id=character_id,
    )
    types = set()
    for entry in fitting_data:
        types.add(entry['ship_type_id'])
        for item in entry['items']:
            types.add(item['type_id'])
    type_dict = Type.get_multi(list(types))

    for entry in fitting_data:
        entry['redlisted'] = []
        entry['ship_type_name'] = type_dict[entry['ship_type_id']].name
        if type_dict[entry['ship_type_id']].is_redlisted:
            entry['redlisted'].append('ship_type_name')
        items_redlisted = False
        for item in entry['items']:
            item['type_name'] = type_dict[item['type_id']].name
            if type_dict[item['type_id']].is_redlisted:
                item['redlisted'] = ['type_name']
                items_redlisted = True
            else:
                item['redlisted'] = []
        if items_redlisted:
            entry['redlisted'].append('items')
    return {'info': fitting_data}
 def make_pokemon(self, name, type_name):
     trainer_id = users.get_current_user().user_id()
     pokemon = Pokemon(parent=trainer_key(trainer_id)) #Define a Trainer as the parent of the new pokemon. This trainer's key is the current user id. Thus every user has his own pokemon list
     pokemon.img_url = self.get_pokemon_image(name)
     pokemon.name = name
     pokemon.type = Type.query(Type.name == type_name).get()
     return pokemon
示例#5
0
    def _scrape_pokemon(self, poke_url: str) -> PokemonSpecies:
        with open("./data/poke_specials.json", "r") as f:
            data = json.load(f)
            special_stat_lookup = {entry["pokedex_id"]: entry["special"] for entry in data}

        poke_data = requests.get(poke_url).json()

        if poke_data["past_types"]:
            # Use past types (Gen 1) if present
            poke_data["types"] = poke_data["past_types"][0]["types"]

        gen1_sprites = poke_data["sprites"]["versions"]["generation-i"]["red-blue"]
        stat_lookup = {stat["stat"]["name"]: stat["base_stat"]
                       for stat in poke_data["stats"]
                       if stat["stat"]["name"] in ["hp", "attack", "defense", "speed"]}
        stat_lookup["total_hp"] = stat_lookup.pop("hp")

        base_stats = PokemonStats(**stat_lookup, special=special_stat_lookup[poke_data["id"]])

        raw_learn_set = {entry["move"]["name"] for entry in poke_data["moves"]
                         if entry["version_group_details"]
                         and entry["version_group_details"][0]["version_group"]["name"] == "red-blue"}

        return PokemonSpecies(
            api_id=poke_data["id"],
            name=poke_data["name"],
            sprite=Sprite(front=gen1_sprites["front_default"], back=gen1_sprites["back_default"]),
            types=[Type(t["type"]["name"].upper()) for t in sorted(poke_data["types"], key=lambda x: x["slot"])],
            base_stats=base_stats,
            learn_set={m for m in self.moves if m.name in raw_learn_set}
        )
示例#6
0
def process_industry(character, industry_job_data):
    type_ids = set()
    location_ids = set()
    for entry in industry_job_data:
        type_ids.add(entry['blueprint_type_id'])
        if 'station_id' in entry:
            location_ids.add(entry['station_id'])
        if 'location_id' in entry:
            location_ids.add(entry['location_id'])

    type_dict = Type.get_multi(list(type_ids))
    location_dict = get_location_multi(character, list(location_ids))

    for entry in industry_job_data:
        type = type_dict[entry['blueprint_type_id']]
        if 'location_id' in entry:
            location_id = entry['location_id']
        else:
            location_id = entry['station_id']
        location = location_dict[location_id]
        entry['blueprint_type_name'] = type.name
        entry['station_name'] = location.name
        entry['redlisted'] = []
        if type.is_redlisted:
            entry['redlisted'].append('blueprint_type_name')
        if location.is_redlisted:
            entry['redlisted'].append('station_name')
    return {'info': industry_job_data}
示例#7
0
def process_market_history(character, order_list):
    location_ids = set()
    type_ids = set()
    for order in order_list:
        location_ids.add(order['location_id'])
        type_ids.add(order['type_id'])
    location_dict = get_location_multi(character, list(location_ids))
    type_dict = Type.get_multi(list(type_ids))
    for order in order_list:
        order['redlisted'] = []
        if 'is_buy_order' not in order:  # always present if True
            order['is_buy_order'] = False
        if order['is_buy_order']:
            order['price'] *= -1
        order['value'] = order['price'] * order['volume_total']
        location = location_dict[order['location_id']]
        if location.system is None:
            order['location_name'] = location.name
            order['region_name'] = 'Unknown Region'
        else:
            order['location_name'] = location.name
            order['region_name'] = location.system.region.name
            if location.system.region.is_redlisted:
                order['redlisted'].append('region_name')
        type = type_dict[order['type_id']]
        order['type_name'] = type.name
        if type.is_redlisted:
            order['redlisted'].append('type_name')
        if location.is_redlisted:
            order['redlisted'].append('location_name')
    return {'info': order_list}
示例#8
0
def process_transactions(character, transaction_data):
    client_ids = list(set(entry['client_id'] for entry in transaction_data))
    type_ids = list(set(entry['type_id'] for entry in transaction_data))
    location_ids = list(set(entry['location_id']
                            for entry in transaction_data))
    clients = get_id_data(client_ids, sorted=False)
    types = Type.get_multi(type_ids)
    location_dict = get_location_multi(character, list(location_ids))
    for entry in transaction_data:
        entry['redlisted'] = []
        client = clients[entry['client_id']]
        type_id = entry['type_id']
        location = location_dict[entry['location_id']]
        entry['client_name'] = client.name
        if client.is_redlisted:
            entry['redlisted'].append('client_name')
        entry['type_name'] = types[type_id].name
        if types[type_id].is_redlisted:
            entry['redlisted'].append('type_name')
        entry['location_name'] = location.name
        if location.is_redlisted:
            entry['redlisted'].append('location_name')
        entry['total_value'] = entry['quantity'] * entry['unit_price']
        if abs(entry['total_value']) > 1e9:
            entry['redlisted'].append('total_value')
    if len(transaction_data) > 0:
        lowest_id = min(entry['transaction_id'] for entry in transaction_data)
    else:
        lowest_id = None
    return {'info': transaction_data, 'lowest_id': lowest_id}
示例#9
0
def process_assets(character, asset_list, corporation_id=None):
    """If corporation_id is passed, will resolve asset names using corporation
    asset names endpoint."""
    type_set = set()
    for entry in asset_list:
        type_set.add(entry['type_id'])
    type_dict = Type.get_multi(list(type_set))
    item_ids = set()
    for entry in asset_list:
        type = type_dict[entry['type_id']]
        entry['name'] = type.name
        entry['price'] = type.price
        entry['redlisted'] = []
        item_ids.add(entry['item_id'])
        if type.is_redlisted:
            entry['redlisted'].append('name')
    item_names = []
    item_ids = list(item_ids)
    if corporation_id is None:
        # Currently not resolving names for corp assets because we can only do
        # so for ships and containers, others give an error
        for i_start in range(0, len(item_ids), 1000):
            item_names.extend(
                character.get_op(
                    'post_characters_character_id_assets_names',
                    corporation_id=character.id,
                    item_ids=item_ids[i_start:i_start + 1000],
                ))
        item_names = {entry['item_id']: entry['name'] for entry in item_names}
        for entry in asset_list:
            item_id = entry['item_id']
            if item_names[item_id] != 'None' and entry['name'] != item_names[
                    item_id]:
                entry['name'] += ' ({})'.format(item_names[item_id])
    return organize_assets_by_location(character, asset_list)
示例#10
0
    def new_product(product_dict):
        publishing_house = PublishingHouse.query.filter_by(name=product_dict['publishing_house_name']).first()
        if publishing_house is None:
            publishing_house = PublishingHouse(product_dict['publishing_house_name'])
            publishing_house.save_data()
            publishing_house_id = PublishingHouse.query.filter_by(name=product_dict['publishing_house_name']).first().id
        else:
            publishing_house_id = publishing_house.id

        product_type = Type.query.filter_by(product_type=product_dict['type']).first()
        if product_type is None:
            product_type = Type(product_dict['type'])
            product_type.save_data()
            product_type_id = Type.query.filter_by(product_type=product_dict['type']).first().id
        else:
            product_type_id = product_type.id

        product = Product(product_dict['title'],
                          product_dict['publishing_year'],
                          product_dict['quantity_in_stock'],
                          publishing_house_id,
                          product_type_id)
        if product_type.product_type == "книга":
            for author_name in product_dict['authors']:
                author = Author.query.filter_by(name=author_name).first()
                if author is None:
                    author = Author(author_name)
                    db.session.add(author)
                    db.session.commit()
                    product.authors.append(author)
                else:
                    product.authors.append(author)
        db.session.add(product)
        db.session.commit()
示例#11
0
def get_character_skills(character_id, current_user=None):
    character = Character.get(character_id)
    character_application_access_check(current_user, character)
    skill_data = character.get_op(
        'get_characters_character_id_skills',
        character_id=character_id,
    )
    queue_data = character.get_op(
        'get_characters_character_id_skillqueue',
        character_id=character_id,
    )
    for skill_list in skill_data['skills'], queue_data:
        for entry in skill_list:
            skill = Type.get(entry['skill_id'])
            group = Group.get(skill.group_id)
            entry['skill_id'] = {
                'group_name': group.name,
                'skill_name': skill.name,
            }
    return {
        'info': {
            'skills': skill_data['skills'],
            'queue': queue_data,
            'total_sp': skill_data['total_sp']
        }
    }
示例#12
0
def fetch_types():
    type_query = Type.query()
    types = type_query.fetch()

    if not types:
        return init_types()
    else:
        return types
示例#13
0
    def test_source_insert_8(self):
        s = Type(name ='steel', half_to ='steel,fire,water,electric', half_from = 'normal,flying,rock,bug,steel,grass,psychic,ice,dragon,fairy', double_to ='rock,ice,fairy', double_from ='fighting,ground,fire')
        session.add(s)
        session.commit()


        r = session.query(Type).filter_by(name = 'steel').one()
        self.assertEqual(str(r.name), 'steel')

        session.query(Type).filter_by(name = 'steel').delete()
        session.commit()
示例#14
0
    def test_source_insert_9(self):
        s = Type(name='ice', half_to = 'steel,fire,water,ice', half_from='ice',double_to='flying,ground,grass,dragon',double_from='fighting,rock,steel,fire')
        session.add(s)
        session.commit()


        r = session.query(Type).filter_by(name = 'ice').one()
        self.assertEqual(str(r.name), 'ice')

        session.query(Type).filter_by(name = 'ice').delete()
        session.commit()
示例#15
0
    def test_source_insert_7(self):
        s = Type(name='ghost', half_to = 'dark', half_from = 'poison,bug', double_to = 'ghost,psychic', double_from = 'ghost,dark')
        session.add(s)
        session.commit()


        r = session.query(Type).filter_by(name = 'ghost').one()
        self.assertEqual(str(r.name), 'ghost')

        session.query(Type).filter_by(name = 'ghost').delete()
        session.commit()
示例#16
0
def init_type():
    type_list = ['knife', 'pistol', 'SMG', 'shotgun', 'rifle', 
                  'sniper rifle', 'machinegun', 'sticker', 'pin',
                  'agent','case','capsule', 'cotainer', 'grafitti',
                  'gloves', 'music kit', 'collectible', 'patch',
                  'key', 'pass', 'gift', 'tag','tool']
    
    for type_ in type_list:
        row = Type(type_desc=type_)
        session.add(row)
        session.commit()
示例#17
0
 def _types_advantage(self, pokemon_a: PokemonSpecies,
                      pokemon_b: PokemonSpecies) -> Matchup:
     weight = math.prod(
         Type.dmg_modifier(at, dt)
         for at, dt in itertools.product(pokemon_a.types, pokemon_b.types))
     if weight > 1:
         return Matchup.ADVANTAGEOUS
     elif weight < 1:
         return Matchup.DISADVANTAGEOUS
     else:
         return Matchup.NEUTRAL
示例#18
0
def addType():
    if request.method == 'POST':
        title = request.form.get('title')
        description = request.form.get('description')
        author = g.user
        type = Type(title=title, description=description, author=author)

        db.session.add(type)
        db.session.commit()
        return redirect(url_for('index'))

    return render_template('addType.html')
示例#19
0
 def __on_var_updated(self, data):
     if hasattr(data,'changelist'):
         names = [item['name'] for item in data.changelist]
         for item in data.changelist:
             if 'value' in item:
                 self.vars.vars[item['name']].data = item['value']
             if 'new_type' in item:
                 self.vars.vars[item['name']].type = Type.parse(item['new_type'])
             if 'new_num_children' in item:
                 self.vars.vars[item['name']].children = int(item['new_num_children'])                    
         if names:
             self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=names))
示例#20
0
    def _scrape_move(self, move_url: str) -> Optional[MoveInfo]:
        move_data = requests.get(move_url).json()
        if move_data["name"] in self.blacklist:
            return None

        # TODO: Support status moves?
        if move_data["damage_class"]["name"].upper() not in [x.value for x in DamageClass]:
            logger.info(f"IGNORED STATUS MOVE: {move_data['name']} | {move_data['id']}")
            return None

        if move_data["past_values"]:
            if len(move_data["past_values"]) == 0:
                logger.warning(f"MULTIPLE PAST VALUES DETECTED: {move_data['name']} | {move_data['id']}")

            # Use past values instead
            move_data.update({k: v for k, v in move_data["past_values"][0].items()
                              if k in ["accuracy", "power", "type", "pp"] and v is not None})

        if move_data["power"] is None:
            logger.info(f"IGNORED NON-STANDARD DAMAGING MOVE: {move_data['name']} | {move_data['id']}")
            return None

        try:
            min_hits = move_data["meta"]["min_hits"] or 1
            max_hits = move_data["meta"]["max_hits"] or 1
            hit_count_info = HitInfo(min_hits=min_hits, max_hits=max_hits,
                                     has_invulnerable_phase=(move_data["name"] in self.moves_with_invulnerable_phase),
                                     requires_charge=(move_data["name"] in self.moves_that_charge),
                                     has_recharge=(move_data["name"] in self.moves_with_recharge),
                                     self_destructing=(move_data["name"] in self.self_destructing_moves))
            ailment = move_data["meta"]["ailment"]["name"]
            ailment_chance = move_data["meta"]["ailment_chance"] / 100
            if ailment not in self.ailment_blacklist and ailment_chance == 0:
                ailment_chance = 1

            return MoveInfo(
                api_id=move_data["id"],
                name=move_data["name"],
                type=Type(move_data["type"]["name"].upper()),
                power=move_data["power"],
                total_pp=move_data["pp"],
                damage_class=DamageClass(move_data["damage_class"]["name"].upper()),
                priority=move_data["priority"],
                high_crit_ratio=(move_data["name"] in self.high_crit_ratio_moves),
                healing=(move_data["meta"]["healing"] / 100),
                drain=(move_data["meta"]["drain"] / 100),
                hit_info=hit_count_info,
                accuracy=(move_data["accuracy"] / 100 if move_data["accuracy"] else None),
                ailment=Ailment(ailment.upper()) if ailment not in self.ailment_blacklist else None,
                ailment_chance=ailment_chance,
            )
        except ValueError as e:
            raise e
示例#21
0
def new_type():
    """
    Add a new instrument type
    """
    form = TypeForm(request.form)
    if request.method == 'POST' and form.validate():
        # save the type
        save_changes('type', Type(), form, new=True)
        flash('Instrument type created successfully!')
        return redirect('/')

    return render_template('new_type.html', form=form)
示例#22
0
 def __on_var_created(self, expression, frame, data):
     # Created variable info
     try:
         type = Type.parse(data.type)
         numchild = int(data.numchild)
         name = data.name
         value = [] if numchild else data.value
         # Update the model and notify
         self.vars.add(name, Variable(name, expression, type, children=numchild, data=value, frame=frame))
         self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=[name]))
     except Exception, e:
         print "Exception creating variable: %s" % e
         print data
示例#23
0
文件: db.py 项目: hasanakgoz/NfQuery
def insert_type(store):

    #import logger
    from models import Type
    type_list = ['0', '1', '0,2,1,3', '0,3', '0,2,3', '0,2,3', '0,1,3']

    for name in type_list:
        type = Type()
        type.type = unicode(name)
        store.add(type)
        store.flush()
    store.commit()
    #logger.info('Type list is inserted into database.')
    print('Type list is inserted into database.')
示例#24
0
    def post(self):
        if 'description' not in request.form or 'duration' not in request.form:
            return build_response(
                status_code=400,
                error="Missing fields",
                description="Missing description or duration argument")

        new_type = Type(request.form['description'], request.form['duration'])
        db.session.add(new_type)
        db.session.commit()

        return build_response(status_code=200,
                              description="Type successfully created",
                              data=new_type.serialize)
示例#25
0
文件: app.py 项目: dai175/foster
    def create_type_submission(jwt):
        try:
            categories = Category.query.order_by(Category.id).all()
        except exc.SQLAlchemyError:
            abort(422)

        form = TypeForm()

        #  Add category list to form
        form.category.choices = [(category.id, category.name)
                                 for category in categories]

        if not form.validate_on_submit():
            return jsonify({'success': False})

        type = Type(category_id=int(request.form['category']),
                    name=request.form['name'],
                    description=request.form['description'])

        error = False

        try:
            db.session.add(type)
            db.session.commit()

            # Save images as
            file = request.files['image']
            if file:
                filename = upload_image(file, consts.LEAD_TYPE, type.id)
                type.image = filename
                db.session.commit()
        except exc.SQLAlchemyError:
            error = True
            db.session.rollback()
        finally:
            db.session.close()

        if not error:
            flash('Type {} was successfully listed!'.format(
                request.form['name']))
        else:
            flash('An error occurred. Type {} could not be listed.'.format(
                request.form['name']))

        return jsonify({'success': not error})
示例#26
0
def process_mining(mining_data):
    return_list = []
    for entry in mining_data:
        redlisted = []
        type = Type.get(entry['type_id'])
        system = System.get(entry['solar_system_id'])
        if system.is_redlisted:
            redlisted.append('system_name')
        return_list.append({
            'date': entry['date'],
            'quantity': entry['quantity'],
            'system_id': entry['solar_system_id'],
            'system_name': system.name,
            'type_id': entry['type_id'],
            'type_name': type.name,
            'value': entry['quantity'] * type.price,
            'redlisted': redlisted,
        })
    return {'info': return_list}
示例#27
0
    def __on_var_list_children(self, data):
        kids = []
        updated_kids =[]
        for item in data.children:
            child = item['child']
            numchild = int(child['numchild'])
            value = [] if numchild else child['value']
            type = Type.parse(child['type'])
            expression = child['exp']
            name = child['name']
            parent = GDBVarModel.parent_name(name)
            if name not in self.vars:
                self.vars.add(name, Variable(name, expression, type, children=numchild, data=value))
                updated_kids.append(name)
            kids.append(name)
        if parent:
            self.vars[parent].data = kids

        if updated_kids:
            self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=kids))
示例#28
0
def create_type():
    type = load_json('pokemon_types.json')

    for next_type in type:
        print(next_type)
        name = next_type
        half_to = type[next_type]['half_to']
        half_from = type[next_type]['half_from']
        double_to = type[next_type]['double_to']
        double_from = type[next_type]['double_from']

        newType = Type(name=name,
                       half_to=half_to,
                       half_from=half_from,
                       double_to=double_to,
                       double_from=double_from)
        # After I create the book, I can then add it to my session.
        session.add(newType)
        # commit the session to my DB.
        session.commit()
示例#29
0
def process_blueprints(assets, blueprints_list):
    asset_system_dict, system_name_dict, redlisted_systems = get_asset_systems(
        assets)
    type_ids = set()
    for entry in blueprints_list:
        type_ids.add(entry['type_id'])
    type_dict = Type.get_multi(list(type_ids))
    for entry in blueprints_list:
        entry['redlisted'] = []
        entry['is_blueprint_copy'] = entry['quantity'] == -2
        type = type_dict[entry['type_id']]
        entry['type_name'] = type.name
        if entry['item_id'] in asset_system_dict:
            system_id = asset_system_dict[entry['item_id']]
            entry['system_id'] = system_id
            entry['system_name'] = system_name_dict[system_id]
            if system_id in redlisted_systems:
                entry['redlisted'].append('system_name')
        else:
            entry['system_id'] = -1
            entry['system_name'] = 'None'
        if type.is_redlisted:
            entry['redlisted'].append('type_name')
    return {'info': blueprints_list}
示例#30
0
文件: forms.py 项目: yunin7/akar
 def __init__(self, *args, **kwargs):
     super(SearchForm, self).__init__(*args, **kwargs)
     self.fields['type'].choices = Type.choices()
     self.fields['town'].choices = Town.choices()
示例#31
0
def process_contracts(character, contract_list):
    entry_items = character.get_op(
        'get_characters_character_id_contracts_contract_id_items',
        character_id=character.id,
        contract_id=[entry['contract_id'] for entry in contract_list],
    )

    type_ids = set()
    for item_list in entry_items.values():
        type_ids.update([item['type_id'] for item in item_list])
    type_dict = Type.get_multi(list(type_ids))

    location_ids = set()
    character_ids = set()
    corporation_ids = set()
    for entry in contract_list:
        if 'start_location_id' in entry:
            location_ids.add(entry['start_location_id'])
        if 'end_location_id' in entry:
            location_ids.add(entry['end_location_id'])
        character_ids.add(entry['issuer_id'])
        if entry['acceptor_id'] != 0:
            character_ids.add(entry['acceptor_id'])
        corporation_ids.add(entry['issuer_corporation_id'])
    location_dict = get_location_multi(character, list(location_ids))
    character_dict = Character.get_multi(list(character_ids))
    character_dict[0] = DummyAcceptor()
    corporation_dict = Corporation.get_multi(list(corporation_ids))
    corporation_dict[None] = DummyCorporation()

    # issuer_corporation, acceptor, issuer, end_location, start_location
    for entry in contract_list:
        entry['redlisted'] = []
        entry['items'] = entry_items[entry['contract_id']]
        items_redlisted = False
        for item in entry['items']:
            type = type_dict[item['type_id']]
            item['type_name'] = type.name
            item['redlisted'] = []
            if type.is_redlisted:
                item['redlisted'].append('type_name')
                items_redlisted = True
        if items_redlisted:
            entry['redlisted'].append('items')
        issuer_corporation = corporation_dict[entry['issuer_corporation_id']]
        entry['issuer_corporation_name'] = issuer_corporation.name
        entry['issuer_corporation_ticker'] = issuer_corporation.ticker
        entry['issuer_alliance_id'] = issuer_corporation.alliance_id
        if issuer_corporation.alliance is None:
            entry['issuer_alliance_name'] = None
        else:
            entry['issuer_alliance_name'] = issuer_corporation.alliance.name
            if issuer_corporation.alliance.is_redlisted:
                entry['redlisted'].append('issuer_alliance_name')
        if corporation_dict[entry['issuer_corporation_id']].is_redlisted:
            entry['redlisted'].append('issuer_corporation_name')
            entry['redlisted'].append('issuer_corporation_ticker')
        issuer = character_dict[entry['issuer_id']]
        entry['issuer_name'] = issuer.name
        acceptor = character_dict[entry['acceptor_id']]
        entry['acceptor_name'] = acceptor.name
        acceptor_corporation = acceptor.corporation
        entry['acceptor_corporation_id'] = acceptor_corporation.id
        entry['acceptor_corporation_name'] = acceptor_corporation.name
        entry['acceptor_corporation_ticker'] = acceptor_corporation.ticker
        entry['acceptor_alliance_id'] = acceptor_corporation.alliance_id
        if acceptor_corporation.alliance is None:
            entry['acceptor_alliance_name'] = 'None'
        else:
            entry[
                'acceptor_alliance_name'] = acceptor_corporation.alliance.name
            if acceptor_corporation.alliance.is_redlisted:
                entry['redlisted'].append('acceptor_alliance_name')
        if acceptor_corporation.is_redlisted:
            entry['redlisted'].append('acceptor_corporation_name')
            entry['redlisted'].append('acceptor_corporation_ticker')
        if issuer.is_redlisted:
            entry['redlisted'].append('issuer_name')
        if acceptor.is_redlisted:
            entry['redlisted'].append('acceptor_name')
        if 'start_location_id' in entry:
            start_location = location_dict[entry['start_location_id']]
            entry['start_location_name'] = start_location.name
            if start_location.is_redlisted:
                entry['redlisted'].append('start_location_name')
        if 'end_location_id' in entry:
            end_location = location_dict[entry['end_location_id']]
            entry['end_location_name'] = end_location.name
            if end_location.is_redlisted:
                entry['redlisted'].append('end_location_name')

    return {'info': contract_list}