mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 11:23:13 +00:00
style: apply format using black
This commit is contained in:
parent
eb70b7012c
commit
176fdf3417
4 changed files with 41 additions and 37 deletions
|
@ -13,6 +13,7 @@ middleware here, or combine a Django application with an application of another
|
||||||
framework.
|
framework.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
|
|
@ -1242,9 +1242,11 @@ def _build_locations():
|
||||||
id=int(info[0]),
|
id=int(info[0]),
|
||||||
location_id=int(info[1]),
|
location_id=int(info[1]),
|
||||||
game_index=int(info[2]),
|
game_index=int(info[2]),
|
||||||
name="{}-{}".format(location.name, info[3])
|
name=(
|
||||||
|
"{}-{}".format(location.name, info[3])
|
||||||
if info[3]
|
if info[3]
|
||||||
else "{}-{}".format(location.name, "area"),
|
else "{}-{}".format(location.name, "area")
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
build_generic((LocationArea,), "location_areas.csv", csv_record_to_objects)
|
build_generic((LocationArea,), "location_areas.csv", csv_record_to_objects)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class NameOrIdRetrieval:
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = super().get_queryset()
|
queryset = super().get_queryset()
|
||||||
filter = self.request.GET.get('q', '')
|
filter = self.request.GET.get("q", "")
|
||||||
|
|
||||||
if filter:
|
if filter:
|
||||||
queryset = queryset.filter(Q(name__icontains=filter))
|
queryset = queryset.filter(Q(name__icontains=filter))
|
||||||
|
@ -397,8 +397,7 @@ class PokemonEncounterView(APIView):
|
||||||
for area_id in area_ids:
|
for area_id in area_ids:
|
||||||
location_area = location_area_objects.get(pk=area_id)
|
location_area = location_area_objects.get(pk=area_id)
|
||||||
|
|
||||||
area_encounters = encounter_objects.filter(
|
area_encounters = encounter_objects.filter(location_area_id=area_id)
|
||||||
location_area_id=area_id)
|
|
||||||
|
|
||||||
version_ids = (
|
version_ids = (
|
||||||
area_encounters.order_by("version_id")
|
area_encounters.order_by("version_id")
|
||||||
|
@ -423,10 +422,8 @@ class PokemonEncounterView(APIView):
|
||||||
encounter_details_list = []
|
encounter_details_list = []
|
||||||
|
|
||||||
for encounter in encounters_data:
|
for encounter in encounters_data:
|
||||||
slot = EncounterSlot.objects.get(
|
slot = EncounterSlot.objects.get(pk=encounter["encounter_slot"])
|
||||||
pk=encounter["encounter_slot"])
|
slot_data = EncounterSlotSerializer(slot, context=self.context).data
|
||||||
slot_data = EncounterSlotSerializer(
|
|
||||||
slot, context=self.context).data
|
|
||||||
|
|
||||||
del encounter["pokemon"]
|
del encounter["pokemon"]
|
||||||
del encounter["encounter_slot"]
|
del encounter["encounter_slot"]
|
||||||
|
|
|
@ -1679,42 +1679,46 @@ class APIData:
|
||||||
|
|
||||||
showdown = {
|
showdown = {
|
||||||
"front_default": showdown_path % pokemon.id if front_default else None,
|
"front_default": showdown_path % pokemon.id if front_default else None,
|
||||||
"front_female": showdown_path % f"female/{pokemon.id}"
|
"front_female": (
|
||||||
if front_female
|
showdown_path % f"female/{pokemon.id}" if front_female else None
|
||||||
else None,
|
),
|
||||||
"front_shiny": showdown_path % f"shiny/{pokemon.id}"
|
"front_shiny": (
|
||||||
if front_shiny
|
showdown_path % f"shiny/{pokemon.id}" if front_shiny else None
|
||||||
else None,
|
),
|
||||||
"front_shiny_female": showdown_path % f"shiny/female/{pokemon.id}"
|
"front_shiny_female": (
|
||||||
|
showdown_path % f"shiny/female/{pokemon.id}"
|
||||||
if front_shiny_female
|
if front_shiny_female
|
||||||
else None,
|
else None
|
||||||
"back_default": showdown_path % f"back/{pokemon.id}"
|
),
|
||||||
if back_default
|
"back_default": (
|
||||||
else None,
|
showdown_path % f"back/{pokemon.id}" if back_default else None
|
||||||
"back_female": showdown_path % f"back/female/{pokemon.id}"
|
),
|
||||||
if back_female
|
"back_female": (
|
||||||
else None,
|
showdown_path % f"back/female/{pokemon.id}" if back_female else None
|
||||||
"back_shiny": showdown_path % f"back/shiny/{pokemon.id}"
|
),
|
||||||
if back_shiny
|
"back_shiny": (
|
||||||
else None,
|
showdown_path % f"back/shiny/{pokemon.id}" if back_shiny else None
|
||||||
"back_shiny_female": showdown_path % f"back/shiny/female/{pokemon.id}"
|
),
|
||||||
|
"back_shiny_female": (
|
||||||
|
showdown_path % f"back/shiny/female/{pokemon.id}"
|
||||||
if back_shiny_female
|
if back_shiny_female
|
||||||
else None,
|
else None
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
sprites = {
|
sprites = {
|
||||||
"front_default": sprite_path % pokemon.id if front_default else None,
|
"front_default": sprite_path % pokemon.id if front_default else None,
|
||||||
"front_female": sprite_path % pokemon.id if front_female else None,
|
"front_female": sprite_path % pokemon.id if front_female else None,
|
||||||
"front_shiny": sprite_path % pokemon.id if front_shiny else None,
|
"front_shiny": sprite_path % pokemon.id if front_shiny else None,
|
||||||
"front_shiny_female": sprite_path % pokemon.id
|
"front_shiny_female": (
|
||||||
if front_shiny_female
|
sprite_path % pokemon.id if front_shiny_female else None
|
||||||
else None,
|
),
|
||||||
"back_default": sprite_path % pokemon.id if back_default else None,
|
"back_default": sprite_path % pokemon.id if back_default else None,
|
||||||
"back_female": sprite_path % pokemon.id if back_female else None,
|
"back_female": sprite_path % pokemon.id if back_female else None,
|
||||||
"back_shiny": sprite_path % pokemon.id if back_shiny else None,
|
"back_shiny": sprite_path % pokemon.id if back_shiny else None,
|
||||||
"back_shiny_female": sprite_path % pokemon.id
|
"back_shiny_female": (
|
||||||
if back_shiny_female
|
sprite_path % pokemon.id if back_shiny_female else None
|
||||||
else None,
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
pokemon_sprites = PokemonSprites.objects.create(
|
pokemon_sprites = PokemonSprites.objects.create(
|
||||||
|
|
Loading…
Reference in a new issue