style: apply format using black

This commit is contained in:
JVMartyns 2024-04-08 11:05:29 -03:00
parent eb70b7012c
commit 176fdf3417
4 changed files with 41 additions and 37 deletions

View file

@ -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

View file

@ -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=(
if info[3] "{}-{}".format(location.name, info[3])
else "{}-{}".format(location.name, "area"), if info[3]
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)

View file

@ -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"]

View file

@ -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": (
if front_shiny_female showdown_path % f"shiny/female/{pokemon.id}"
else None, if front_shiny_female
"back_default": showdown_path % f"back/{pokemon.id}" else None
if back_default ),
else None, "back_default": (
"back_female": showdown_path % f"back/female/{pokemon.id}" showdown_path % f"back/{pokemon.id}" if back_default else None
if back_female ),
else None, "back_female": (
"back_shiny": showdown_path % f"back/shiny/{pokemon.id}" showdown_path % f"back/female/{pokemon.id}" if back_female else None
if back_shiny ),
else None, "back_shiny": (
"back_shiny_female": showdown_path % f"back/shiny/female/{pokemon.id}" showdown_path % f"back/shiny/{pokemon.id}" if back_shiny else None
if back_shiny_female ),
else None, "back_shiny_female": (
showdown_path % f"back/shiny/female/{pokemon.id}"
if back_shiny_female
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(