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.
"""
import os
from django.core.wsgi import get_wsgi_application

View file

@ -1242,9 +1242,11 @@ def _build_locations():
id=int(info[0]),
location_id=int(info[1]),
game_index=int(info[2]),
name="{}-{}".format(location.name, info[3])
name=(
"{}-{}".format(location.name, 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)

View file

@ -41,7 +41,7 @@ class NameOrIdRetrieval:
def get_queryset(self):
queryset = super().get_queryset()
filter = self.request.GET.get('q', '')
filter = self.request.GET.get("q", "")
if filter:
queryset = queryset.filter(Q(name__icontains=filter))
@ -397,8 +397,7 @@ class PokemonEncounterView(APIView):
for area_id in area_ids:
location_area = location_area_objects.get(pk=area_id)
area_encounters = encounter_objects.filter(
location_area_id=area_id)
area_encounters = encounter_objects.filter(location_area_id=area_id)
version_ids = (
area_encounters.order_by("version_id")
@ -423,10 +422,8 @@ class PokemonEncounterView(APIView):
encounter_details_list = []
for encounter in encounters_data:
slot = EncounterSlot.objects.get(
pk=encounter["encounter_slot"])
slot_data = EncounterSlotSerializer(
slot, context=self.context).data
slot = EncounterSlot.objects.get(pk=encounter["encounter_slot"])
slot_data = EncounterSlotSerializer(slot, context=self.context).data
del encounter["pokemon"]
del encounter["encounter_slot"]

View file

@ -1679,42 +1679,46 @@ class APIData:
showdown = {
"front_default": showdown_path % pokemon.id if front_default else None,
"front_female": showdown_path % f"female/{pokemon.id}"
if front_female
else None,
"front_shiny": showdown_path % f"shiny/{pokemon.id}"
if front_shiny
else None,
"front_shiny_female": showdown_path % f"shiny/female/{pokemon.id}"
"front_female": (
showdown_path % f"female/{pokemon.id}" if front_female else None
),
"front_shiny": (
showdown_path % f"shiny/{pokemon.id}" if front_shiny else None
),
"front_shiny_female": (
showdown_path % f"shiny/female/{pokemon.id}"
if front_shiny_female
else None,
"back_default": showdown_path % f"back/{pokemon.id}"
if back_default
else None,
"back_female": showdown_path % f"back/female/{pokemon.id}"
if back_female
else None,
"back_shiny": showdown_path % f"back/shiny/{pokemon.id}"
if back_shiny
else None,
"back_shiny_female": showdown_path % f"back/shiny/female/{pokemon.id}"
else None
),
"back_default": (
showdown_path % f"back/{pokemon.id}" if back_default else None
),
"back_female": (
showdown_path % f"back/female/{pokemon.id}" if back_female else None
),
"back_shiny": (
showdown_path % f"back/shiny/{pokemon.id}" if back_shiny else None
),
"back_shiny_female": (
showdown_path % f"back/shiny/female/{pokemon.id}"
if back_shiny_female
else None,
else None
),
}
sprites = {
"front_default": sprite_path % pokemon.id if front_default 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_female": sprite_path % pokemon.id
if front_shiny_female
else None,
"front_shiny_female": (
sprite_path % pokemon.id if front_shiny_female 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_shiny": sprite_path % pokemon.id if back_shiny else None,
"back_shiny_female": sprite_path % pokemon.id
if back_shiny_female
else None,
"back_shiny_female": (
sprite_path % pokemon.id if back_shiny_female else None
),
}
pokemon_sprites = PokemonSprites.objects.create(