예제 #1
0
파일: types.py 프로젝트: baadjis/pokedex
def get_type_by_name(query):

    if query is not None:
        query.lower()
        types = Type.select().where(query << Type.name)
        if len(types > 10):
            return (types[:10])
예제 #2
0
파일: types.py 프로젝트: baadjis/pokedex
def get_types(search=None, unused=False):
    if search is None:
        search = ""

    types = []
    for type in Type.select().limit(10):
        if search in type.name:
            types.append(type)

    if unused:
        types = [type for type in types if len(type.pokemons) == 0]
    return types
예제 #3
0
def get_number_of_types_by_generation(generation=None):
    type_of_generation = Type.select().where(Type.generation == generation)
    number_of_types_of_generation = type_of_generation.count()
    return number_of_types_of_generation
예제 #4
0
def number_of_Types(generation_id):
    counter = len(Type.select().where(Type.generation_id == generation_id))
    print(counter)
    return counter