From 5237c4ccc91f4255f85c285c6e49ea12ae280fca Mon Sep 17 00:00:00 2001 From: Naramsim Date: Wed, 8 Nov 2023 10:44:55 +0100 Subject: [PATCH 1/2] refactor: format with new black --- pokemon_v2/api.py | 51 ----- .../0001_squashed_0002_auto_20160301_1408.py | 1 - ...rites_pokemonformsprites_pokemonsprites.py | 1 - .../migrations/0003_auto_20160530_1132.py | 1 - .../migrations/0004_iso639length_20191217.py | 1 - .../migrations/0005_auto_20200709_1930.py | 1 - .../migrations/0006_auto_20200725_2205.py | 1 - .../migrations/0007_auto_20200815_0610.py | 1 - .../migrations/0008_auto_20201123_2045.py | 1 - pokemon_v2/migrations/0009_pokemontypepast.py | 1 - pokemon_v2/migrations/0010_pokemonformtype.py | 1 - .../migrations/0011_typeefficacypast.py | 1 - .../migrations/0012_auto_20220626_1402.py | 1 - .../migrations/0013_pokemonabilitypast.py | 1 - pokemon_v2/models.py | 110 --------- pokemon_v2/serializers.py | 216 ------------------ pokemon_v2/tests.py | 190 --------------- test-requirements.txt | 2 +- 18 files changed, 1 insertion(+), 581 deletions(-) diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index f06ab489..790f62b9 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -71,336 +71,288 @@ class PokeapiCommonViewset( class AbilityResource(PokeapiCommonViewset): - queryset = Ability.objects.all() serializer_class = AbilityDetailSerializer list_serializer_class = AbilitySummarySerializer class BerryResource(PokeapiCommonViewset): - queryset = Berry.objects.all() serializer_class = BerryDetailSerializer list_serializer_class = BerrySummarySerializer class BerryFirmnessResource(PokeapiCommonViewset): - queryset = BerryFirmness.objects.all() serializer_class = BerryFirmnessDetailSerializer list_serializer_class = BerryFirmnessSummarySerializer class BerryFlavorResource(PokeapiCommonViewset): - queryset = BerryFlavor.objects.all() serializer_class = BerryFlavorDetailSerializer list_serializer_class = BerryFlavorSummarySerializer class CharacteristicResource(PokeapiCommonViewset): - queryset = Characteristic.objects.all() serializer_class = CharacteristicDetailSerializer list_serializer_class = CharacteristicSummarySerializer class ContestEffectResource(PokeapiCommonViewset): - queryset = ContestEffect.objects.all() serializer_class = ContestEffectDetailSerializer list_serializer_class = ContestEffectSummarySerializer class ContestTypeResource(PokeapiCommonViewset): - queryset = ContestType.objects.all() serializer_class = ContestTypeDetailSerializer list_serializer_class = ContestTypeSummarySerializer class EggGroupResource(PokeapiCommonViewset): - queryset = EggGroup.objects.all() serializer_class = EggGroupDetailSerializer list_serializer_class = EggGroupSummarySerializer class EncounterConditionResource(PokeapiCommonViewset): - queryset = EncounterCondition.objects.all() serializer_class = EncounterConditionDetailSerializer list_serializer_class = EncounterConditionSummarySerializer class EncounterConditionValueResource(PokeapiCommonViewset): - queryset = EncounterConditionValue.objects.all() serializer_class = EncounterConditionValueDetailSerializer list_serializer_class = EncounterConditionValueSummarySerializer class EncounterMethodResource(PokeapiCommonViewset): - queryset = EncounterMethod.objects.all() serializer_class = EncounterMethodDetailSerializer list_serializer_class = EncounterMethodSummarySerializer class EvolutionChainResource(PokeapiCommonViewset): - queryset = EvolutionChain.objects.all() serializer_class = EvolutionChainDetailSerializer list_serializer_class = EvolutionChainSummarySerializer class EvolutionTriggerResource(PokeapiCommonViewset): - queryset = EvolutionTrigger.objects.all() serializer_class = EvolutionTriggerDetailSerializer list_serializer_class = EvolutionTriggerSummarySerializer class GenerationResource(PokeapiCommonViewset): - queryset = Generation.objects.all() serializer_class = GenerationDetailSerializer list_serializer_class = GenerationSummarySerializer class GenderResource(PokeapiCommonViewset): - queryset = Gender.objects.all() serializer_class = GenderDetailSerializer list_serializer_class = GenderSummarySerializer class GrowthRateResource(PokeapiCommonViewset): - queryset = GrowthRate.objects.all() serializer_class = GrowthRateDetailSerializer list_serializer_class = GrowthRateSummarySerializer class ItemResource(PokeapiCommonViewset): - queryset = Item.objects.all() serializer_class = ItemDetailSerializer list_serializer_class = ItemSummarySerializer class ItemCategoryResource(PokeapiCommonViewset): - queryset = ItemCategory.objects.all() serializer_class = ItemCategoryDetailSerializer list_serializer_class = ItemCategorySummarySerializer class ItemAttributeResource(PokeapiCommonViewset): - queryset = ItemAttribute.objects.all() serializer_class = ItemAttributeDetailSerializer list_serializer_class = ItemAttributeSummarySerializer class ItemFlingEffectResource(PokeapiCommonViewset): - queryset = ItemFlingEffect.objects.all() serializer_class = ItemFlingEffectDetailSerializer list_serializer_class = ItemFlingEffectSummarySerializer class ItemPocketResource(PokeapiCommonViewset): - queryset = ItemPocket.objects.all() serializer_class = ItemPocketDetailSerializer list_serializer_class = ItemPocketSummarySerializer class LanguageResource(PokeapiCommonViewset): - queryset = Language.objects.all() serializer_class = LanguageDetailSerializer list_serializer_class = LanguageSummarySerializer class LocationResource(PokeapiCommonViewset): - queryset = Location.objects.all() serializer_class = LocationDetailSerializer list_serializer_class = LocationSummarySerializer class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet): - queryset = LocationArea.objects.all() serializer_class = LocationAreaDetailSerializer list_serializer_class = LocationAreaSummarySerializer class MachineResource(PokeapiCommonViewset): - queryset = Machine.objects.all() serializer_class = MachineDetailSerializer list_serializer_class = MachineSummarySerializer class MoveResource(PokeapiCommonViewset): - queryset = Move.objects.all() serializer_class = MoveDetailSerializer list_serializer_class = MoveSummarySerializer class MoveDamageClassResource(PokeapiCommonViewset): - queryset = MoveDamageClass.objects.all() serializer_class = MoveDamageClassDetailSerializer list_serializer_class = MoveDamageClassSummarySerializer class MoveMetaAilmentResource(PokeapiCommonViewset): - queryset = MoveMetaAilment.objects.all() serializer_class = MoveMetaAilmentDetailSerializer list_serializer_class = MoveMetaAilmentSummarySerializer class MoveBattleStyleResource(PokeapiCommonViewset): - queryset = MoveBattleStyle.objects.all() serializer_class = MoveBattleStyleDetailSerializer list_serializer_class = MoveBattleStyleSummarySerializer class MoveMetaCategoryResource(PokeapiCommonViewset): - queryset = MoveMetaCategory.objects.all() serializer_class = MoveMetaCategoryDetailSerializer list_serializer_class = MoveMetaCategorySummarySerializer class MoveLearnMethodResource(PokeapiCommonViewset): - queryset = MoveLearnMethod.objects.all() serializer_class = MoveLearnMethodDetailSerializer list_serializer_class = MoveLearnMethodSummarySerializer class MoveTargetResource(PokeapiCommonViewset): - queryset = MoveTarget.objects.all() serializer_class = MoveTargetDetailSerializer list_serializer_class = MoveTargetSummarySerializer class NatureResource(PokeapiCommonViewset): - queryset = Nature.objects.all() serializer_class = NatureDetailSerializer list_serializer_class = NatureSummarySerializer class PalParkAreaResource(PokeapiCommonViewset): - queryset = PalParkArea.objects.all() serializer_class = PalParkAreaDetailSerializer list_serializer_class = PalParkAreaSummarySerializer class PokeathlonStatResource(PokeapiCommonViewset): - queryset = PokeathlonStat.objects.all() serializer_class = PokeathlonStatDetailSerializer list_serializer_class = PokeathlonStatSummarySerializer class PokedexResource(PokeapiCommonViewset): - queryset = Pokedex.objects.all() serializer_class = PokedexDetailSerializer list_serializer_class = PokedexSummarySerializer class PokemonColorResource(PokeapiCommonViewset): - queryset = PokemonColor.objects.all() serializer_class = PokemonColorDetailSerializer list_serializer_class = PokemonColorSummarySerializer class PokemonFormResource(PokeapiCommonViewset): - queryset = PokemonForm.objects.all() serializer_class = PokemonFormDetailSerializer list_serializer_class = PokemonFormSummarySerializer class PokemonHabitatResource(PokeapiCommonViewset): - queryset = PokemonHabitat.objects.all() serializer_class = PokemonHabitatDetailSerializer list_serializer_class = PokemonHabitatSummarySerializer class PokemonShapeResource(PokeapiCommonViewset): - queryset = PokemonShape.objects.all() serializer_class = PokemonShapeDetailSerializer list_serializer_class = PokemonShapeSummarySerializer class PokemonResource(PokeapiCommonViewset): - queryset = Pokemon.objects.all() serializer_class = PokemonDetailSerializer list_serializer_class = PokemonSummarySerializer class PokemonSpeciesResource(PokeapiCommonViewset): - queryset = PokemonSpecies.objects.all().order_by("id") serializer_class = PokemonSpeciesDetailSerializer list_serializer_class = PokemonSpeciesSummarySerializer class RegionResource(PokeapiCommonViewset): - queryset = Region.objects.all() serializer_class = RegionDetailSerializer list_serializer_class = RegionSummarySerializer class StatResource(PokeapiCommonViewset): - queryset = Stat.objects.all() serializer_class = StatDetailSerializer list_serializer_class = StatSummarySerializer class SuperContestEffectResource(PokeapiCommonViewset): - queryset = SuperContestEffect.objects.all() serializer_class = SuperContestEffectDetailSerializer list_serializer_class = SuperContestEffectSummarySerializer class TypeResource(PokeapiCommonViewset): - queryset = Type.objects.all() serializer_class = TypeDetailSerializer list_serializer_class = TypeSummarySerializer class VersionResource(PokeapiCommonViewset): - queryset = Version.objects.all() serializer_class = VersionDetailSerializer list_serializer_class = VersionSummarySerializer class VersionGroupResource(PokeapiCommonViewset): - queryset = VersionGroup.objects.all() serializer_class = VersionGroupDetailSerializer list_serializer_class = VersionGroupSummarySerializer @@ -412,7 +364,6 @@ class PokemonEncounterView(APIView): """ def get(self, request, pokemon_id): - self.context = dict(request=request) try: @@ -434,7 +385,6 @@ class PokemonEncounterView(APIView): encounters_list = [] 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) @@ -448,7 +398,6 @@ class PokemonEncounterView(APIView): version_details_list = [] for version_id in version_ids: - version = version_objects.get(pk=version_id) version_encounters = area_encounters.filter( diff --git a/pokemon_v2/migrations/0001_squashed_0002_auto_20160301_1408.py b/pokemon_v2/migrations/0001_squashed_0002_auto_20160301_1408.py index 109365ff..15c60c61 100644 --- a/pokemon_v2/migrations/0001_squashed_0002_auto_20160301_1408.py +++ b/pokemon_v2/migrations/0001_squashed_0002_auto_20160301_1408.py @@ -2,7 +2,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - # replaces = [(b'pokemon_v2', '0001_squashed_0006_pokemonformsprites'), (b'pokemon_v2', '0002_auto_20160301_1408')] # dependencies = [ diff --git a/pokemon_v2/migrations/0002_itemsprites_pokemonformsprites_pokemonsprites.py b/pokemon_v2/migrations/0002_itemsprites_pokemonformsprites_pokemonsprites.py index b845fd66..723c5a53 100644 --- a/pokemon_v2/migrations/0002_itemsprites_pokemonformsprites_pokemonsprites.py +++ b/pokemon_v2/migrations/0002_itemsprites_pokemonformsprites_pokemonsprites.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0001_squashed_0002_auto_20160301_1408"), ] diff --git a/pokemon_v2/migrations/0003_auto_20160530_1132.py b/pokemon_v2/migrations/0003_auto_20160530_1132.py index f5edc9a1..a5f27cf9 100644 --- a/pokemon_v2/migrations/0003_auto_20160530_1132.py +++ b/pokemon_v2/migrations/0003_auto_20160530_1132.py @@ -2,7 +2,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0002_itemsprites_pokemonformsprites_pokemonsprites"), ] diff --git a/pokemon_v2/migrations/0004_iso639length_20191217.py b/pokemon_v2/migrations/0004_iso639length_20191217.py index fa62bed3..bff709f2 100644 --- a/pokemon_v2/migrations/0004_iso639length_20191217.py +++ b/pokemon_v2/migrations/0004_iso639length_20191217.py @@ -2,7 +2,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0003_auto_20160530_1132"), ] diff --git a/pokemon_v2/migrations/0005_auto_20200709_1930.py b/pokemon_v2/migrations/0005_auto_20200709_1930.py index e4fa90c7..6cfb1209 100644 --- a/pokemon_v2/migrations/0005_auto_20200709_1930.py +++ b/pokemon_v2/migrations/0005_auto_20200709_1930.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0004_iso639length_20191217"), ] diff --git a/pokemon_v2/migrations/0006_auto_20200725_2205.py b/pokemon_v2/migrations/0006_auto_20200725_2205.py index eee9aa7d..238d8068 100644 --- a/pokemon_v2/migrations/0006_auto_20200725_2205.py +++ b/pokemon_v2/migrations/0006_auto_20200725_2205.py @@ -2,7 +2,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0005_auto_20200709_1930"), ] diff --git a/pokemon_v2/migrations/0007_auto_20200815_0610.py b/pokemon_v2/migrations/0007_auto_20200815_0610.py index d5f242f3..4966ca33 100644 --- a/pokemon_v2/migrations/0007_auto_20200815_0610.py +++ b/pokemon_v2/migrations/0007_auto_20200815_0610.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0006_auto_20200725_2205"), ] diff --git a/pokemon_v2/migrations/0008_auto_20201123_2045.py b/pokemon_v2/migrations/0008_auto_20201123_2045.py index 90e63d06..7b112546 100644 --- a/pokemon_v2/migrations/0008_auto_20201123_2045.py +++ b/pokemon_v2/migrations/0008_auto_20201123_2045.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0007_auto_20200815_0610"), ] diff --git a/pokemon_v2/migrations/0009_pokemontypepast.py b/pokemon_v2/migrations/0009_pokemontypepast.py index 2c8a4309..a9351a89 100644 --- a/pokemon_v2/migrations/0009_pokemontypepast.py +++ b/pokemon_v2/migrations/0009_pokemontypepast.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0008_auto_20201123_2045"), ] diff --git a/pokemon_v2/migrations/0010_pokemonformtype.py b/pokemon_v2/migrations/0010_pokemonformtype.py index 337cb55b..91046acb 100644 --- a/pokemon_v2/migrations/0010_pokemonformtype.py +++ b/pokemon_v2/migrations/0010_pokemonformtype.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0009_pokemontypepast"), ] diff --git a/pokemon_v2/migrations/0011_typeefficacypast.py b/pokemon_v2/migrations/0011_typeefficacypast.py index 0b100c59..7f96f04e 100644 --- a/pokemon_v2/migrations/0011_typeefficacypast.py +++ b/pokemon_v2/migrations/0011_typeefficacypast.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0010_pokemonformtype"), ] diff --git a/pokemon_v2/migrations/0012_auto_20220626_1402.py b/pokemon_v2/migrations/0012_auto_20220626_1402.py index 3279640e..b946fa8e 100644 --- a/pokemon_v2/migrations/0012_auto_20220626_1402.py +++ b/pokemon_v2/migrations/0012_auto_20220626_1402.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0011_typeefficacypast"), ] diff --git a/pokemon_v2/migrations/0013_pokemonabilitypast.py b/pokemon_v2/migrations/0013_pokemonabilitypast.py index e72d6fbd..421b1f97 100644 --- a/pokemon_v2/migrations/0013_pokemonabilitypast.py +++ b/pokemon_v2/migrations/0013_pokemonabilitypast.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("pokemon_v2", "0012_auto_20220626_1402"), ] diff --git a/pokemon_v2/models.py b/pokemon_v2/models.py index 01425bf0..4bd349c8 100644 --- a/pokemon_v2/models.py +++ b/pokemon_v2/models.py @@ -6,7 +6,6 @@ from django.db import models class HasAbility(models.Model): - ability = models.ForeignKey( "Ability", blank=True, @@ -20,7 +19,6 @@ class HasAbility(models.Model): class HasCharacteristic(models.Model): - characteristic = models.ForeignKey( "Characteristic", blank=True, @@ -34,7 +32,6 @@ class HasCharacteristic(models.Model): class HasContestType(models.Model): - contest_type = models.ForeignKey( "ContestType", blank=True, @@ -48,7 +45,6 @@ class HasContestType(models.Model): class HasContestEffect(models.Model): - contest_effect = models.ForeignKey( "ContestEffect", blank=True, @@ -62,7 +58,6 @@ class HasContestEffect(models.Model): class HasSuperContestEffect(models.Model): - super_contest_effect = models.ForeignKey( "SuperContestEffect", blank=True, @@ -76,7 +71,6 @@ class HasSuperContestEffect(models.Model): class HasDescription(models.Model): - description = models.CharField(max_length=1000, default="") class Meta: @@ -84,7 +78,6 @@ class HasDescription(models.Model): class HasGender(models.Model): - gender = models.ForeignKey( "Gender", blank=True, @@ -98,7 +91,6 @@ class HasGender(models.Model): class HasEffect(models.Model): - effect = models.CharField(max_length=6000) class Meta: @@ -106,7 +98,6 @@ class HasEffect(models.Model): class HasEggGroup(models.Model): - egg_group = models.ForeignKey( "EggGroup", blank=True, @@ -120,7 +111,6 @@ class HasEggGroup(models.Model): class HasEncounterMethod(models.Model): - encounter_method = models.ForeignKey( "EncounterMethod", blank=True, @@ -134,7 +124,6 @@ class HasEncounterMethod(models.Model): class HasEncounterCondition(models.Model): - encounter_condition = models.ForeignKey( "EncounterCondition", blank=True, @@ -148,7 +137,6 @@ class HasEncounterCondition(models.Model): class HasEvolutionTrigger(models.Model): - evolution_trigger = models.ForeignKey( "EvolutionTrigger", blank=True, @@ -162,7 +150,6 @@ class HasEvolutionTrigger(models.Model): class HasFlavorText(models.Model): - flavor_text = models.CharField(max_length=500) class Meta: @@ -170,7 +157,6 @@ class HasFlavorText(models.Model): class HasFlingEffect(models.Model): - item_fling_effect = models.ForeignKey( "ItemFlingEffect", blank=True, @@ -184,7 +170,6 @@ class HasFlingEffect(models.Model): class HasGameIndex(models.Model): - game_index = models.IntegerField() class Meta: @@ -192,7 +177,6 @@ class HasGameIndex(models.Model): class HasGeneration(models.Model): - generation = models.ForeignKey( "Generation", blank=True, @@ -206,7 +190,6 @@ class HasGeneration(models.Model): class HasGrowthRate(models.Model): - growth_rate = models.ForeignKey( "GrowthRate", blank=True, @@ -220,7 +203,6 @@ class HasGrowthRate(models.Model): class HasItem(models.Model): - item = models.ForeignKey( "Item", blank=True, @@ -234,7 +216,6 @@ class HasItem(models.Model): class HasItemAttribute(models.Model): - item_attribute = models.ForeignKey( "ItemAttribute", blank=True, @@ -248,7 +229,6 @@ class HasItemAttribute(models.Model): class HasItemCategory(models.Model): - item_category = models.ForeignKey( "ItemCategory", blank=True, @@ -262,7 +242,6 @@ class HasItemCategory(models.Model): class HasItemPocket(models.Model): - item_pocket = models.ForeignKey( "ItemPocket", blank=True, @@ -276,7 +255,6 @@ class HasItemPocket(models.Model): class HasLanguage(models.Model): - language = models.ForeignKey( "Language", blank=True, @@ -290,7 +268,6 @@ class HasLanguage(models.Model): class HasLocation(models.Model): - location = models.ForeignKey( "Location", blank=True, @@ -304,7 +281,6 @@ class HasLocation(models.Model): class HasLocationArea(models.Model): - location_area = models.ForeignKey( "LocationArea", blank=True, @@ -318,7 +294,6 @@ class HasLocationArea(models.Model): class HasMetaAilment(models.Model): - move_meta_ailment = models.ForeignKey( "MoveMetaAilment", blank=True, @@ -332,7 +307,6 @@ class HasMetaAilment(models.Model): class HasMetaCategory(models.Model): - move_meta_category = models.ForeignKey( "MoveMetaCategory", blank=True, @@ -346,7 +320,6 @@ class HasMetaCategory(models.Model): class HasMove(models.Model): - move = models.ForeignKey( "Move", blank=True, @@ -360,7 +333,6 @@ class HasMove(models.Model): class HasMoveDamageClass(models.Model): - move_damage_class = models.ForeignKey( "MoveDamageClass", blank=True, @@ -374,7 +346,6 @@ class HasMoveDamageClass(models.Model): class HasMoveEffect(models.Model): - move_effect = models.ForeignKey( "MoveEffect", blank=True, null=True, on_delete=models.CASCADE ) @@ -384,7 +355,6 @@ class HasMoveEffect(models.Model): class HasMoveAttribute(models.Model): - move_attribute = models.ForeignKey( "MoveAttribute", blank=True, null=True, on_delete=models.CASCADE ) @@ -394,7 +364,6 @@ class HasMoveAttribute(models.Model): class HasMoveTarget(models.Model): - move_target = models.ForeignKey( "MoveTarget", blank=True, @@ -408,7 +377,6 @@ class HasMoveTarget(models.Model): class HasName(models.Model): - name = models.CharField(max_length=100, db_index=True) class Meta: @@ -416,7 +384,6 @@ class HasName(models.Model): class HasNature(models.Model): - nature = models.ForeignKey( "Nature", blank=True, @@ -430,7 +397,6 @@ class HasNature(models.Model): class HasOrder(models.Model): - order = models.IntegerField(blank=True, null=True) class Meta: @@ -438,7 +404,6 @@ class HasOrder(models.Model): class HasPokeathlonStat(models.Model): - pokeathlon_stat = models.ForeignKey( "PokeathlonStat", blank=True, @@ -452,7 +417,6 @@ class HasPokeathlonStat(models.Model): class HasPokedex(models.Model): - pokedex = models.ForeignKey( "Pokedex", blank=True, @@ -466,7 +430,6 @@ class HasPokedex(models.Model): class HasPokemon(models.Model): - pokemon = models.ForeignKey( "Pokemon", blank=True, @@ -480,7 +443,6 @@ class HasPokemon(models.Model): class HasPokemonColor(models.Model): - pokemon_color = models.ForeignKey( "PokemonColor", blank=True, @@ -494,7 +456,6 @@ class HasPokemonColor(models.Model): class HasPokemonForm(models.Model): - pokemon_form = models.ForeignKey( "PokemonForm", blank=True, @@ -508,7 +469,6 @@ class HasPokemonForm(models.Model): class HasPokemonHabitat(models.Model): - pokemon_habitat = models.ForeignKey( "PokemonHabitat", blank=True, @@ -523,7 +483,6 @@ class HasPokemonHabitat(models.Model): # HasPokemonMoveMethod class HasMoveLearnMethod(models.Model): - move_learn_method = models.ForeignKey( "MoveLearnMethod", blank=True, @@ -537,7 +496,6 @@ class HasMoveLearnMethod(models.Model): class HasPokemonShape(models.Model): - pokemon_shape = models.ForeignKey( "PokemonShape", blank=True, @@ -551,7 +509,6 @@ class HasPokemonShape(models.Model): class HasPokemonSpecies(models.Model): - pokemon_species = models.ForeignKey( "PokemonSpecies", blank=True, @@ -565,7 +522,6 @@ class HasPokemonSpecies(models.Model): class HasRegion(models.Model): - region = models.ForeignKey( "Region", blank=True, @@ -579,7 +535,6 @@ class HasRegion(models.Model): class HasShortEffect(models.Model): - short_effect = models.CharField(max_length=300) class Meta: @@ -587,7 +542,6 @@ class HasShortEffect(models.Model): class HasStat(models.Model): - stat = models.ForeignKey( "Stat", blank=True, @@ -601,7 +555,6 @@ class HasStat(models.Model): class HasType(models.Model): - type = models.ForeignKey( "Type", blank=True, @@ -615,7 +568,6 @@ class HasType(models.Model): class HasTypeEfficacy(models.Model): - damage_type = models.ForeignKey( "Type", blank=True, @@ -639,7 +591,6 @@ class HasTypeEfficacy(models.Model): class HasVersion(models.Model): - version = models.ForeignKey( "Version", blank=True, @@ -653,7 +604,6 @@ class HasVersion(models.Model): class HasVersionGroup(models.Model): - version_group = models.ForeignKey( "VersionGroup", blank=True, @@ -713,7 +663,6 @@ class VersionGroupMoveLearnMethod(HasVersionGroup, HasMoveLearnMethod): class Language(HasName, HasOrder): - iso639 = models.CharField(max_length=10) iso3166 = models.CharField(max_length=2) @@ -722,7 +671,6 @@ class Language(HasName, HasOrder): class LanguageName(IsName): - local_language = models.ForeignKey( "Language", blank=True, @@ -738,7 +686,6 @@ class LanguageName(IsName): class Generation(HasName): - region = models.OneToOneField( "Region", blank=True, @@ -771,7 +718,6 @@ class RegionName(IsName, HasRegion): class Ability(HasName, HasGeneration): - is_main_series = models.BooleanField(default=False) @@ -792,7 +738,6 @@ class AbilityChange(HasAbility, HasVersionGroup): class AbilityChangeEffectText(HasLanguage, HasEffect): - ability_change = models.ForeignKey( AbilityChange, blank=True, @@ -834,7 +779,6 @@ class TypeEfficacyPast(HasTypeEfficacy, HasGeneration): class Stat(HasName, HasMoveDamageClass): - is_battle_only = models.BooleanField(default=False) game_index = models.IntegerField() @@ -850,7 +794,6 @@ class StatName(IsName, HasStat): class Characteristic(HasStat): - gene_mod_5 = models.IntegerField() @@ -901,7 +844,6 @@ class ItemFlingEffectEffectText(HasLanguage, HasEffect, HasFlingEffect): class Item(HasName, HasItemCategory, HasFlingEffect): - cost = models.IntegerField(blank=True, null=True) fling_power = models.IntegerField(blank=True, null=True) @@ -940,7 +882,6 @@ class ItemGameIndex(HasItem, HasGeneration, HasGameIndex): class ItemSprites(HasItem): - sprites = models.CharField(max_length=1000) @@ -954,14 +895,12 @@ class ContestType(HasName): class ContestTypeName(HasContestType, IsName): - flavor = models.CharField(max_length=10) color = models.CharField(max_length=10) class ContestEffect(models.Model): - appeal = models.IntegerField() jam = models.IntegerField() @@ -976,7 +915,6 @@ class ContestEffectFlavorText(HasLanguage, HasFlavorText, HasContestEffect): class ContestCombo(models.Model): - first_move = models.ForeignKey( "Move", blank=True, @@ -1004,7 +942,6 @@ class BerryFirmness(HasName): class BerryFirmnessName(IsName): - berry_firmness = models.ForeignKey( BerryFirmness, blank=True, @@ -1015,7 +952,6 @@ class BerryFirmnessName(IsName): class Berry(HasName, HasItem): - berry_firmness = models.ForeignKey( BerryFirmness, blank=True, @@ -1049,7 +985,6 @@ class Berry(HasName, HasItem): class BerryFlavor(HasName): - contest_type = models.OneToOneField( "ContestType", blank=True, @@ -1060,7 +995,6 @@ class BerryFlavor(HasName): class BerryFlavorName(IsName): - berry_flavor = models.ForeignKey( BerryFlavor, blank=True, @@ -1071,7 +1005,6 @@ class BerryFlavorName(IsName): class BerryFlavorMap(models.Model): - berry = models.ForeignKey( Berry, blank=True, null=True, related_name="%(class)s", on_delete=models.CASCADE ) @@ -1093,7 +1026,6 @@ class BerryFlavorMap(models.Model): class GrowthRate(HasName): - formula = models.CharField(max_length=500) @@ -1107,7 +1039,6 @@ class GrowthRateDescription(HasGrowthRate, IsDescription): class Nature(HasName): - decreased_stat = models.ForeignKey( Stat, blank=True, null=True, related_name="decreased", on_delete=models.CASCADE ) @@ -1140,12 +1071,10 @@ class NatureName(IsName, HasNature): class NaturePokeathlonStat(HasNature, HasPokeathlonStat): - max_change = models.IntegerField() class NatureBattleStylePreference(HasNature): - move_battle_style = models.ForeignKey( "MoveBattleStyle", blank=True, @@ -1185,7 +1114,6 @@ class LocationAreaName(IsName, HasLocationArea): class LocationAreaEncounterRate(HasEncounterMethod, HasLocationArea, HasVersion): - rate = models.IntegerField() @@ -1203,14 +1131,12 @@ class EncounterMethodName(HasEncounterMethod, IsName): class EncounterSlot(HasVersionGroup, HasEncounterMethod): - slot = models.IntegerField(blank=True, null=True) rarity = models.IntegerField() class Encounter(HasVersion, HasLocationArea, HasPokemon): - encounter_slot = models.ForeignKey( EncounterSlot, blank=True, null=True, on_delete=models.CASCADE ) @@ -1229,12 +1155,10 @@ class EncounterConditionName(HasEncounterCondition, IsName): class EncounterConditionValue(HasEncounterCondition, HasName): - is_default = models.BooleanField(default=False) class EncounterConditionValueName(IsName): - encounter_condition_value = models.ForeignKey( EncounterConditionValue, blank=True, @@ -1245,7 +1169,6 @@ class EncounterConditionValueName(IsName): class EncounterConditionValueMap(models.Model): - encounter = models.ForeignKey( Encounter, blank=True, null=True, on_delete=models.CASCADE ) @@ -1271,7 +1194,6 @@ class Move( HasContestEffect, HasSuperContestEffect, ): - power = models.IntegerField(blank=True, null=True) pp = models.IntegerField(blank=True, null=True) @@ -1292,7 +1214,6 @@ class MoveFlavorText(HasMove, HasVersionGroup, IsFlavorText): class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect): - power = models.IntegerField(blank=True, null=True) pp = models.IntegerField(blank=True, null=True) @@ -1329,7 +1250,6 @@ class MoveBattleStyle(HasName): class MoveBattleStyleName(IsName): - move_battle_style = models.ForeignKey( MoveBattleStyle, blank=True, @@ -1357,7 +1277,6 @@ class MoveEffectChange(HasMoveEffect, HasVersionGroup): class MoveEffectChangeEffectText(HasLanguage, HasEffect): - move_effect_change = models.ForeignKey( "MoveEffectChange", blank=True, @@ -1411,7 +1330,6 @@ class MoveTargetDescription(HasMoveTarget, IsDescription): class MoveMeta(HasMetaAilment, HasMetaCategory): - move = models.OneToOneField( Move, blank=False, @@ -1458,7 +1376,6 @@ class MoveMetaCategoryDescription(HasMetaCategory, IsDescription): class MoveMetaStatChange(HasMove, HasStat): - change = models.IntegerField() @@ -1468,7 +1385,6 @@ class MoveMetaStatChange(HasMove, HasStat): class Experience(HasGrowthRate): - level = models.IntegerField() experience = models.IntegerField() @@ -1489,7 +1405,6 @@ class Gender(HasName): class Machine(HasGrowthRate, HasItem): - machine_number = models.IntegerField() version_group = models.ForeignKey( @@ -1522,7 +1437,6 @@ class PalParkArea(HasName): class PalParkAreaName(IsName): - pal_park_area = models.ForeignKey( PalParkArea, blank=True, @@ -1533,7 +1447,6 @@ class PalParkAreaName(IsName): class PalPark(HasPokemonSpecies): - pal_park_area = models.ForeignKey( PalParkArea, blank=True, @@ -1553,7 +1466,6 @@ class PalPark(HasPokemonSpecies): class SuperContestEffect(models.Model): - appeal = models.IntegerField() @@ -1562,7 +1474,6 @@ class SuperContestEffectFlavorText(IsFlavorText, HasSuperContestEffect): class SuperContestCombo(models.Model): - first_move = models.ForeignKey( Move, blank=True, null=True, related_name="first", on_delete=models.CASCADE ) @@ -1578,7 +1489,6 @@ class SuperContestCombo(models.Model): class EvolutionChain(models.Model): - baby_trigger_item = models.ForeignKey( Item, blank=True, null=True, on_delete=models.CASCADE ) @@ -1598,7 +1508,6 @@ class EvolutionTriggerName(HasEvolutionTrigger, IsName): class Pokedex(HasName, HasRegion): - is_main_series = models.BooleanField(default=False) @@ -1622,7 +1531,6 @@ class PokedexVersionGroup(HasPokedex, HasVersionGroup): class PokemonSpecies( HasName, HasGeneration, HasPokemonColor, HasPokemonShape, HasGrowthRate, HasOrder ): - evolves_from_species = models.ForeignKey( "self", blank=True, null=True, on_delete=models.CASCADE ) @@ -1659,7 +1567,6 @@ class PokemonSpecies( class PokemonSpeciesName(IsName, HasPokemonSpecies): - genus = models.CharField(max_length=30) @@ -1672,7 +1579,6 @@ class PokemonSpeciesFlavorText(IsFlavorText, HasPokemonSpecies, HasVersion): class Pokemon(HasName, HasPokemonSpecies, HasOrder): - height = models.IntegerField(blank=True, null=True) weight = models.IntegerField(blank=True, null=True) @@ -1683,7 +1589,6 @@ class Pokemon(HasName, HasPokemonSpecies, HasOrder): class PokemonAbility(HasPokemon, HasAbility): - is_hidden = models.BooleanField(default=False) slot = models.IntegerField() @@ -1691,7 +1596,6 @@ class PokemonAbility(HasPokemon, HasAbility): # model for a Pokemon's abilities that were used until a given generation class PokemonAbilityPast(HasPokemon, HasAbility, HasGeneration): - is_hidden = models.BooleanField(default=False) slot = models.IntegerField() @@ -1706,7 +1610,6 @@ class PokemonColorName(HasPokemonColor, IsName): class PokemonDexNumber(HasPokemonSpecies, HasPokedex): - pokedex_number = models.IntegerField() @@ -1715,7 +1618,6 @@ class PokemonEggGroup(HasPokemonSpecies, HasEggGroup): class PokemonEvolution(HasEvolutionTrigger, HasGender): - evolution_item = models.ForeignKey( Item, blank=True, @@ -1790,7 +1692,6 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender): class PokemonForm(HasName, HasPokemon, HasOrder): - form_name = models.CharField(max_length=30) version_group = models.ForeignKey( @@ -1811,12 +1712,10 @@ class PokemonFormGeneration(HasPokemonForm, HasGeneration, HasGameIndex): class PokemonFormName(HasPokemonForm, IsName): - pokemon_name = models.CharField(max_length=60) class PokemonFormSprites(HasPokemonForm): - sprites = models.CharField(max_length=1000) @@ -1829,7 +1728,6 @@ class PokemonHabitat(HasName): class PokemonHabitatName(IsName): - pokemon_habitat = models.ForeignKey( PokemonHabitat, blank=True, @@ -1840,7 +1738,6 @@ class PokemonHabitatName(IsName): class PokemonItem(HasPokemon, HasVersion, HasItem): - rarity = models.IntegerField() @@ -1859,7 +1756,6 @@ class MoveLearnMethodDescription(IsDescription, HasMoveLearnMethod): class PokemonMove(HasPokemon, HasMoveLearnMethod, HasVersionGroup, HasMove, HasOrder): - level = models.IntegerField() @@ -1868,7 +1764,6 @@ class PokemonShape(HasName): class PokemonShapeName(IsName): - awesome_name = models.CharField(max_length=30) pokemon_shape = models.ForeignKey( @@ -1881,28 +1776,23 @@ class PokemonShapeName(IsName): class PokemonStat(HasPokemon, HasStat): - base_stat = models.IntegerField() effort = models.IntegerField() class PokemonType(HasPokemon, HasType): - slot = models.IntegerField() class PokemonFormType(HasPokemonForm, HasType): - slot = models.IntegerField() # model for a Pokemon's types that were used until a given generation class PokemonTypePast(HasPokemon, HasType, HasGeneration): - slot = models.IntegerField() class PokemonSprites(HasPokemon): - sprites = models.CharField(max_length=20000) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 046ca033..40821c32 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -314,7 +314,6 @@ class VersionGroupSummarySerializer(serializers.HyperlinkedModelSerializer): class BerryFlavorMapSerializer(serializers.ModelSerializer): - berry = BerrySummarySerializer() flavor = BerryFlavorSummarySerializer(source="berry_flavor") @@ -324,7 +323,6 @@ class BerryFlavorMapSerializer(serializers.ModelSerializer): class ItemAttributeMapSerializer(serializers.ModelSerializer): - item = ItemSummarySerializer() attribute = ItemAttributeSummarySerializer(source="item_attribute") @@ -337,7 +335,6 @@ class ItemAttributeMapSerializer(serializers.ModelSerializer): class MoveMetaStatChangeSerializer(serializers.ModelSerializer): - stat = StatSummarySerializer() move = MoveSummarySerializer() @@ -347,7 +344,6 @@ class MoveMetaStatChangeSerializer(serializers.ModelSerializer): class NaturePokeathlonStatSerializer(serializers.ModelSerializer): - pokeathlon_stat = PokeathlonStatSummarySerializer() nature = NatureSummarySerializer() @@ -357,7 +353,6 @@ class NaturePokeathlonStatSerializer(serializers.ModelSerializer): class PokemonAbilitySerializer(serializers.ModelSerializer): - pokemon = PokemonSummarySerializer() ability = AbilitySummarySerializer() @@ -367,7 +362,6 @@ class PokemonAbilitySerializer(serializers.ModelSerializer): class PokemonAbilityPastSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() ability = AbilitySummarySerializer() @@ -377,7 +371,6 @@ class PokemonAbilityPastSerializer(serializers.ModelSerializer): class PokemonDexEntrySerializer(serializers.ModelSerializer): - entry_number = serializers.IntegerField(source="pokedex_number") pokedex = PokedexSummarySerializer() @@ -387,7 +380,6 @@ class PokemonDexEntrySerializer(serializers.ModelSerializer): class PokemonTypeSerializer(serializers.ModelSerializer): - pokemon = PokemonSummarySerializer() type = TypeSummarySerializer() @@ -397,7 +389,6 @@ class PokemonTypeSerializer(serializers.ModelSerializer): class PokemonFormTypeSerializer(serializers.ModelSerializer): - pokemon_form = PokemonFormSummarySerializer() type = TypeSummarySerializer() @@ -407,7 +398,6 @@ class PokemonFormTypeSerializer(serializers.ModelSerializer): class PokemonTypePastSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() type = TypeSummarySerializer() @@ -417,7 +407,6 @@ class PokemonTypePastSerializer(serializers.ModelSerializer): class PokedexVersionGroupSerializer(serializers.ModelSerializer): - pokedex = PokedexSummarySerializer() version_group = VersionGroupSummarySerializer() @@ -427,7 +416,6 @@ class PokedexVersionGroupSerializer(serializers.ModelSerializer): class VersionGroupMoveLearnMethodSerializer(serializers.ModelSerializer): - version_group = VersionGroupSummarySerializer() move_learn_method = MoveLearnMethodSummarySerializer() @@ -437,7 +425,6 @@ class VersionGroupMoveLearnMethodSerializer(serializers.ModelSerializer): class VersionGroupRegionSerializer(serializers.ModelSerializer): - version_group = VersionGroupSummarySerializer() region = RegionSummarySerializer() @@ -450,7 +437,6 @@ class VersionGroupRegionSerializer(serializers.ModelSerializer): class EncounterConditionValueMapSerializer(serializers.ModelSerializer): - condition_value = EncounterConditionValueSummarySerializer( source="encounter_condition_value" ) @@ -466,7 +452,6 @@ class EncounterConditionValueMapSerializer(serializers.ModelSerializer): class CharacteristicDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -475,7 +460,6 @@ class CharacteristicDescriptionSerializer(serializers.ModelSerializer): class CharacteristicDetailSerializer(serializers.ModelSerializer): - descriptions = CharacteristicDescriptionSerializer( many=True, read_only=True, source="characteristicdescription" ) @@ -494,7 +478,6 @@ class CharacteristicDetailSerializer(serializers.ModelSerializer): ) def get_values(self, obj): - mod = obj.gene_mod_5 values = [] while mod <= 31: @@ -510,7 +493,6 @@ class CharacteristicDetailSerializer(serializers.ModelSerializer): class SuperContestEffectFlavorTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -519,7 +501,6 @@ class SuperContestEffectFlavorTextSerializer(serializers.ModelSerializer): class SuperContestEffectDetailSerializer(serializers.ModelSerializer): - flavor_text_entries = SuperContestEffectFlavorTextSerializer( many=True, read_only=True, source="supercontesteffectflavortext" ) @@ -531,7 +512,6 @@ class SuperContestEffectDetailSerializer(serializers.ModelSerializer): class ContestEffectEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -540,7 +520,6 @@ class ContestEffectEffectTextSerializer(serializers.ModelSerializer): class ContestEffectFlavorTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -549,7 +528,6 @@ class ContestEffectFlavorTextSerializer(serializers.ModelSerializer): class ContestEffectDetailSerializer(serializers.ModelSerializer): - effect_entries = ContestEffectEffectTextSerializer( many=True, read_only=True, source="contesteffecteffecttext" ) @@ -563,7 +541,6 @@ class ContestEffectDetailSerializer(serializers.ModelSerializer): class ContestTypeNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -572,7 +549,6 @@ class ContestTypeNameSerializer(serializers.ModelSerializer): class ContestTypeDetailSerializer(serializers.ModelSerializer): - names = ContestTypeNameSerializer( many=True, read_only=True, source="contesttypename" ) @@ -584,7 +560,6 @@ class ContestTypeDetailSerializer(serializers.ModelSerializer): class SuperContestComboSerializer(serializers.ModelSerializer): - first_move = MoveSummarySerializer() second_move = MoveSummarySerializer() @@ -594,7 +569,6 @@ class SuperContestComboSerializer(serializers.ModelSerializer): class ContestComboSerializer(serializers.ModelSerializer): - first_move = MoveSummarySerializer() second_move = MoveSummarySerializer() @@ -609,7 +583,6 @@ class ContestComboSerializer(serializers.ModelSerializer): class RegionNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -618,7 +591,6 @@ class RegionNameSerializer(serializers.ModelSerializer): class RegionDetailSerializer(serializers.ModelSerializer): - names = RegionNameSerializer(many=True, read_only=True, source="regionname") locations = LocationSummarySerializer(many=True, read_only=True, source="location") version_groups = serializers.SerializerMethodField("get_region_version_groups") @@ -638,7 +610,6 @@ class RegionDetailSerializer(serializers.ModelSerializer): ) def get_region_version_groups(self, obj): - vg_regions = VersionGroupRegion.objects.filter(region=obj) data = VersionGroupRegionSerializer( vg_regions, many=True, context=self.context @@ -657,7 +628,6 @@ class RegionDetailSerializer(serializers.ModelSerializer): class GenerationNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -666,7 +636,6 @@ class GenerationNameSerializer(serializers.ModelSerializer): class GenerationDetailSerializer(serializers.ModelSerializer): - main_region = RegionSummarySerializer(source="region") names = GenerationNameSerializer(many=True, read_only=True, source="generationname") abilities = AbilitySummarySerializer(many=True, read_only=True, source="ability") @@ -700,7 +669,6 @@ class GenerationDetailSerializer(serializers.ModelSerializer): class GenderDetailSerializer(serializers.ModelSerializer): - pokemon_species_details = serializers.SerializerMethodField("get_species") required_for_evolution = serializers.SerializerMethodField("get_required") @@ -709,7 +677,6 @@ class GenderDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "pokemon_species_details", "required_for_evolution") def get_species(self, obj): - species_objects = [] if obj.name == "female": @@ -732,7 +699,6 @@ class GenderDetailSerializer(serializers.ModelSerializer): return details def get_required(self, obj): - evo_objects = PokemonEvolution.objects.filter(gender=obj) species_list = [] @@ -757,7 +723,6 @@ class ExperienceSerializer(serializers.ModelSerializer): class GrowthRateDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -766,7 +731,6 @@ class GrowthRateDescriptionSerializer(serializers.ModelSerializer): class GrowthRateDetailSerializer(serializers.ModelSerializer): - descriptions = GrowthRateDescriptionSerializer( many=True, read_only=True, source="growthratedescription" ) @@ -786,7 +750,6 @@ class GrowthRateDetailSerializer(serializers.ModelSerializer): class LanguageNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer(source="local_language") class Meta: @@ -795,7 +758,6 @@ class LanguageNameSerializer(serializers.ModelSerializer): class LanguageDetailSerializer(serializers.ModelSerializer): - names = LanguageNameSerializer( many=True, read_only=True, source="languagename_language" ) @@ -811,7 +773,6 @@ class LanguageDetailSerializer(serializers.ModelSerializer): class EncounterConditionNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -820,7 +781,6 @@ class EncounterConditionNameSerializer(serializers.ModelSerializer): class EncounterConditionDetailSerializer(serializers.ModelSerializer): - names = EncounterConditionNameSerializer( many=True, read_only=True, source="encounterconditionname" ) @@ -834,7 +794,6 @@ class EncounterConditionDetailSerializer(serializers.ModelSerializer): class EncounterConditionValueNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -843,7 +802,6 @@ class EncounterConditionValueNameSerializer(serializers.ModelSerializer): class EncounterConditionValueDetailSerializer(serializers.ModelSerializer): - condition = EncounterConditionSummarySerializer(source="encounter_condition") names = EncounterConditionValueNameSerializer( many=True, read_only=True, source="encounterconditionvaluename" @@ -855,7 +813,6 @@ class EncounterConditionValueDetailSerializer(serializers.ModelSerializer): class EncounterMethodNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -864,7 +821,6 @@ class EncounterMethodNameSerializer(serializers.ModelSerializer): class EncounterMethodDetailSerializer(serializers.ModelSerializer): - names = EncounterMethodNameSerializer( many=True, read_only=True, source="encountermethodname" ) @@ -875,7 +831,6 @@ class EncounterMethodDetailSerializer(serializers.ModelSerializer): class EncounterSlotSerializer(serializers.ModelSerializer): - encounter_method = EncounterMethodSummarySerializer() chance = serializers.IntegerField(source="rarity") @@ -885,7 +840,6 @@ class EncounterSlotSerializer(serializers.ModelSerializer): class EncounterDetailSerializer(serializers.ModelSerializer): - version = VersionSummarySerializer() location_area = LocationAreaSummarySerializer() pokemon = PokemonSummarySerializer() @@ -904,7 +858,6 @@ class EncounterDetailSerializer(serializers.ModelSerializer): ) def get_encounter_conditions(self, obj): - condition_values = EncounterConditionValueMap.objects.filter(encounter=obj) data = EncounterConditionValueMapSerializer( condition_values, many=True, context=self.context @@ -918,7 +871,6 @@ class EncounterDetailSerializer(serializers.ModelSerializer): class LocationAreaEncounterRateSerializer(serializers.ModelSerializer): - encounter_method = EncounterMethodSummarySerializer() version = VersionSummarySerializer() @@ -928,7 +880,6 @@ class LocationAreaEncounterRateSerializer(serializers.ModelSerializer): class LocationAreaNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -937,7 +888,6 @@ class LocationAreaNameSerializer(serializers.ModelSerializer): class LocationAreaDetailSerializer(serializers.ModelSerializer): - location = LocationSummarySerializer() encounter_method_rates = serializers.SerializerMethodField("get_method_rates") pokemon_encounters = serializers.SerializerMethodField("get_encounters") @@ -958,7 +908,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): ) def get_method_rates(self, obj): - # Get encounters related to this area and pull out unique encounter methods encounter_rates = LocationAreaEncounterRate.objects.filter( location_area=obj @@ -967,7 +916,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): encounter_rate_list = [] for id in method_ids: - encounter_rate_details = OrderedDict() # Get each Unique Item by ID @@ -989,7 +937,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): encounter_rate_details["version_details"] = [] for area_encounter in serializer.data: - version_detail = OrderedDict() version_detail["rate"] = area_encounter["rate"] @@ -1002,7 +949,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): return encounter_rate_list def get_encounters(self, obj): - # get versions for later use version_objects = Version.objects.all() version_data = VersionSummarySerializer( @@ -1015,7 +961,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): # break encounters into pokemon groupings for poke in all_encounters.values("pokemon").distinct(): - pokemon_object = Pokemon.objects.get(pk=poke["pokemon"]) pokemon_detail = OrderedDict() @@ -1043,7 +988,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): # each version has multiple ways a pokemon can be encountered for encounter in poke_data: - slot = EncounterSlot.objects.get(pk=encounter["encounter_slot"]) slot_data = EncounterSlotSerializer(slot, context=self.context).data del encounter["pokemon"] @@ -1064,7 +1008,6 @@ class LocationAreaDetailSerializer(serializers.ModelSerializer): class LocationGameIndexSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() class Meta: @@ -1073,7 +1016,6 @@ class LocationGameIndexSerializer(serializers.ModelSerializer): class LocationNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1082,7 +1024,6 @@ class LocationNameSerializer(serializers.ModelSerializer): class LocationDetailSerializer(serializers.ModelSerializer): - region = RegionSummarySerializer() names = LocationNameSerializer(many=True, read_only=True, source="locationname") game_indices = LocationGameIndexSerializer( @@ -1103,7 +1044,6 @@ class LocationDetailSerializer(serializers.ModelSerializer): class AbilityEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1112,7 +1052,6 @@ class AbilityEffectTextSerializer(serializers.ModelSerializer): class AbilityFlavorTextSerializer(serializers.ModelSerializer): - flavor_text = serializers.CharField() language = LanguageSummarySerializer() version_group = VersionGroupSummarySerializer() @@ -1123,7 +1062,6 @@ class AbilityFlavorTextSerializer(serializers.ModelSerializer): class AbilityChangeEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1135,7 +1073,6 @@ class AbilityChangeEffectTextSerializer(serializers.ModelSerializer): class AbilityChangeSerializer(serializers.ModelSerializer): - version_group = VersionGroupSummarySerializer() effect_entries = AbilityChangeEffectTextSerializer( many=True, read_only=True, source="abilitychangeeffecttext" @@ -1147,7 +1084,6 @@ class AbilityChangeSerializer(serializers.ModelSerializer): class AbilityNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1156,7 +1092,6 @@ class AbilityNameSerializer(serializers.ModelSerializer): class AbilityDetailSerializer(serializers.ModelSerializer): - effect_entries = AbilityEffectTextSerializer( many=True, read_only=True, source="abilityeffecttext" ) @@ -1185,7 +1120,6 @@ class AbilityDetailSerializer(serializers.ModelSerializer): ) def get_ability_pokemon(self, obj): - pokemon_ability_objects = PokemonAbility.objects.filter(ability=obj) data = PokemonAbilitySerializer( pokemon_ability_objects, many=True, context=self.context @@ -1205,7 +1139,6 @@ class AbilityDetailSerializer(serializers.ModelSerializer): class StatNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1214,7 +1147,6 @@ class StatNameSerializer(serializers.ModelSerializer): class StatDetailSerializer(serializers.ModelSerializer): - names = StatNameSerializer(many=True, read_only=True, source="statname") move_damage_class = MoveDamageClassSummarySerializer() characteristics = CharacteristicSummarySerializer( @@ -1238,7 +1170,6 @@ class StatDetailSerializer(serializers.ModelSerializer): ) def get_moves_that_affect(self, obj): - stat_change_objects = MoveMetaStatChange.objects.filter(stat=obj) stat_changes = MoveMetaStatChangeSerializer( stat_change_objects, many=True, context=self.context @@ -1255,7 +1186,6 @@ class StatDetailSerializer(serializers.ModelSerializer): return changes def get_natures_that_affect(self, obj): - increase_objects = Nature.objects.filter(increased_stat=obj) increases = NatureSummarySerializer( increase_objects, many=True, context=self.context @@ -1274,7 +1204,6 @@ class StatDetailSerializer(serializers.ModelSerializer): class ItemPocketNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1283,7 +1212,6 @@ class ItemPocketNameSerializer(serializers.ModelSerializer): class ItemPocketDetailSerializer(serializers.ModelSerializer): - names = ItemPocketNameSerializer(many=True, read_only=True, source="itempocketname") categories = ItemCategorySummarySerializer( many=True, read_only=True, source="itemcategory" @@ -1298,7 +1226,6 @@ class ItemPocketDetailSerializer(serializers.ModelSerializer): # ITEM CATEGORY SERIALIZERS # ############################### class ItemCategoryNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1307,7 +1234,6 @@ class ItemCategoryNameSerializer(serializers.ModelSerializer): class ItemCategoryDetailSerializer(serializers.ModelSerializer): - names = ItemCategoryNameSerializer( many=True, read_only=True, source="itemcategoryname" ) @@ -1325,7 +1251,6 @@ class ItemCategoryDetailSerializer(serializers.ModelSerializer): class ItemAttributeNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1334,7 +1259,6 @@ class ItemAttributeNameSerializer(serializers.ModelSerializer): class ItemAttributeDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1343,7 +1267,6 @@ class ItemAttributeDescriptionSerializer(serializers.ModelSerializer): class ItemAttributeDetailSerializer(serializers.ModelSerializer): - names = ItemAttributeNameSerializer( many=True, read_only=True, source="itemattributename" ) @@ -1357,7 +1280,6 @@ class ItemAttributeDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "descriptions", "items", "names") def get_attribute_items(self, obj): - item_map_objects = ItemAttributeMap.objects.filter(item_attribute=obj) items = [] @@ -1373,7 +1295,6 @@ class ItemAttributeDetailSerializer(serializers.ModelSerializer): # ITEM FLING EFFECT SERIALIZERS # ################################### class ItemFlingEffectEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1382,7 +1303,6 @@ class ItemFlingEffectEffectTextSerializer(serializers.ModelSerializer): class ItemFlingEffectDetailSerializer(serializers.ModelSerializer): - effect_entries = ItemFlingEffectEffectTextSerializer( many=True, read_only=True, source="itemflingeffecteffecttext" ) @@ -1397,7 +1317,6 @@ class ItemFlingEffectDetailSerializer(serializers.ModelSerializer): # ITEM SERIALIZERS # ####################### class ItemFlavorTextSerializer(serializers.ModelSerializer): - text = serializers.CharField(source="flavor_text") language = LanguageSummarySerializer() version_group = VersionGroupSummarySerializer() @@ -1408,7 +1327,6 @@ class ItemFlavorTextSerializer(serializers.ModelSerializer): class ItemEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1417,7 +1335,6 @@ class ItemEffectTextSerializer(serializers.ModelSerializer): class ItemGameIndexSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() class Meta: @@ -1426,7 +1343,6 @@ class ItemGameIndexSerializer(serializers.ModelSerializer): class ItemNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1441,7 +1357,6 @@ class ItemSpritesSerializer(serializers.ModelSerializer): class ItemDetailSerializer(serializers.ModelSerializer): - names = ItemNameSerializer(many=True, read_only=True, source="itemname") game_indices = ItemGameIndexSerializer( many=True, read_only=True, source="itemgameindex" @@ -1481,13 +1396,11 @@ class ItemDetailSerializer(serializers.ModelSerializer): ) def get_item_machines(self, obj): - machine_objects = Machine.objects.filter(item=obj) machines = [] for machine_object in machine_objects: - machine_data = MachineSummarySerializer( machine_object, context=self.context ).data @@ -1503,7 +1416,6 @@ class ItemDetailSerializer(serializers.ModelSerializer): return machines def get_item_sprites(self, obj): - sprites_object = ItemSprites.objects.get(item_id=obj) sprites_data = ItemSpritesSerializer(sprites_object, context=self.context).data sprites_data = json.loads(sprites_data["sprites"]) @@ -1511,7 +1423,6 @@ class ItemDetailSerializer(serializers.ModelSerializer): return sprites_data def get_item_attributes(self, obj): - item_attribute_maps = ItemAttributeMap.objects.filter(item=obj) serializer = ItemAttributeMapSerializer( item_attribute_maps, many=True, context=self.context @@ -1529,13 +1440,11 @@ class ItemDetailSerializer(serializers.ModelSerializer): return attributes def get_held_by_pokemon(self, obj): - pokemon_items = PokemonItem.objects.filter(item=obj).order_by("pokemon_id") pokemon_ids = pokemon_items.values("pokemon_id").distinct() pokemon_list = [] for id in pokemon_ids: - item_pokemon_details = OrderedDict() # Get each Unique Item by ID @@ -1563,7 +1472,6 @@ class ItemDetailSerializer(serializers.ModelSerializer): return pokemon_list def get_baby_trigger_for(self, obj): - try: chain_object = EvolutionChain.objects.get(baby_trigger_item=obj) data = EvolutionChainSummarySerializer( @@ -1581,7 +1489,6 @@ class ItemDetailSerializer(serializers.ModelSerializer): class NatureBattleStylePreferenceSerializer(serializers.ModelSerializer): - move_battle_style = MoveBattleStyleSummarySerializer() class Meta: @@ -1594,7 +1501,6 @@ class NatureBattleStylePreferenceSerializer(serializers.ModelSerializer): class NatureNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1603,7 +1509,6 @@ class NatureNameSerializer(serializers.ModelSerializer): class NatureDetailSerializer(serializers.ModelSerializer): - names = NatureNameSerializer(many=True, read_only=True, source="naturename") decreased_stat = StatSummarySerializer() increased_stat = StatSummarySerializer() @@ -1631,7 +1536,6 @@ class NatureDetailSerializer(serializers.ModelSerializer): ) def get_pokeathlon_stats(self, obj): - pokeathlon_stat_objects = NaturePokeathlonStat.objects.filter(nature=obj) pokeathlon_stats = NaturePokeathlonStatSerializer( pokeathlon_stat_objects, many=True, context=self.context @@ -1649,7 +1553,6 @@ class NatureDetailSerializer(serializers.ModelSerializer): class BerryFirmnessNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1658,7 +1561,6 @@ class BerryFirmnessNameSerializer(serializers.ModelSerializer): class BerryFirmnessDetailSerializer(serializers.ModelSerializer): - names = BerryFirmnessNameSerializer( many=True, read_only=True, source="berryfirmnessname" ) @@ -1670,7 +1572,6 @@ class BerryFirmnessDetailSerializer(serializers.ModelSerializer): class BerryFlavorNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1679,7 +1580,6 @@ class BerryFlavorNameSerializer(serializers.ModelSerializer): class BerryFlavorDetailSerializer(serializers.ModelSerializer): - names = BerryFlavorNameSerializer( many=True, read_only=True, source="berryflavorname" ) @@ -1691,7 +1591,6 @@ class BerryFlavorDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "berries", "contest_type", "names") def get_berries_with_flavor(self, obj): - flavor_map_objects = BerryFlavorMap.objects.filter( berry_flavor=obj, potency__gt=0 ).order_by("potency") @@ -1706,7 +1605,6 @@ class BerryFlavorDetailSerializer(serializers.ModelSerializer): class BerryDetailSerializer(serializers.ModelSerializer): - item = ItemSummarySerializer() natural_gift_type = TypeSummarySerializer() firmness = BerryFirmnessSummarySerializer(source="berry_firmness") @@ -1730,7 +1628,6 @@ class BerryDetailSerializer(serializers.ModelSerializer): ) def get_berry_flavors(self, obj): - flavor_map_objects = BerryFlavorMap.objects.filter(berry=obj) flavor_maps = BerryFlavorMapSerializer( flavor_map_objects, many=True, context=self.context @@ -1748,7 +1645,6 @@ class BerryDetailSerializer(serializers.ModelSerializer): # EGG GROUP SERIALIZERS # ########################### class PokemonEggGroupSerializer(serializers.ModelSerializer): - species = PokemonSpeciesSummarySerializer(source="pokemon_species") egg_group = EggGroupSummarySerializer() @@ -1758,7 +1654,6 @@ class PokemonEggGroupSerializer(serializers.ModelSerializer): class EggGroupNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1767,7 +1662,6 @@ class EggGroupNameSerializer(serializers.ModelSerializer): class EggGroupDetailSerializer(serializers.ModelSerializer): - names = EggGroupNameSerializer(many=True, read_only=True, source="egggroupname") pokemon_species = serializers.SerializerMethodField("get_species") @@ -1776,7 +1670,6 @@ class EggGroupDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "names", "pokemon_species") def get_species(self, obj): - results = PokemonEggGroup.objects.filter(egg_group=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data associated_species = [] @@ -1797,7 +1690,6 @@ class TypeEfficacySerializer(serializers.ModelSerializer): class TypeEfficacyPastSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() class Meta: @@ -1806,7 +1698,6 @@ class TypeEfficacyPastSerializer(serializers.ModelSerializer): class TypeGameIndexSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() class Meta: @@ -1815,7 +1706,6 @@ class TypeGameIndexSerializer(serializers.ModelSerializer): class TypeNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -1873,7 +1763,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): ) def get_type_relationships(self, obj): - relations = OrderedDict() relations["no_damage_to"] = [] relations["half_damage_to"] = [] @@ -1914,7 +1803,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): current_generation = "" generation_data = [] for relation in serializer_data: - gen_name = relation["generation"]["name"] if gen_name != current_generation: # first item for this generation so create its list @@ -1939,7 +1827,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): # returns past type relationships for the given type object def get_type_past_relationships(self, obj): - # collect data from DB damage_type_results = list(TypeEfficacyPast.objects.filter(damage_type=obj)) target_type_results = list(TypeEfficacyPast.objects.filter(target_type=obj)) @@ -1991,7 +1878,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): # populate offensive relations results = list(filter(lambda x: x["damage_type"] == obj.id, gen_data)) for relation in results: - type = Type.objects.get(pk=relation["target_type"]) # remove conflicting entry if it exists @@ -2008,7 +1894,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): # populate defensive relations results = list(filter(lambda x: x["target_type"] == obj.id, gen_data)) for relation in results: - type = Type.objects.get(pk=relation["damage_type"]) # remove conflicting entry if it exists @@ -2036,7 +1921,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): return gen_introduced.id <= current_gen.id def get_type_pokemon(self, obj): - poke_type_objects = PokemonType.objects.filter(type=obj) poke_types = PokemonTypeSerializer( poke_type_objects, many=True, context=self.context @@ -2052,7 +1936,6 @@ class TypeDetailSerializer(serializers.ModelSerializer): # MACHINE SERIALIZERS # ######################### class MachineDetailSerializer(serializers.ModelSerializer): - item = ItemSummarySerializer() version_group = VersionGroupSummarySerializer() move = MoveSummarySerializer() @@ -2066,7 +1949,6 @@ class MachineDetailSerializer(serializers.ModelSerializer): # MOVE BATTLE STYLE SERIALIZERS # ################################### class MoveBattleStyleNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2075,7 +1957,6 @@ class MoveBattleStyleNameSerializer(serializers.ModelSerializer): class MoveBattleStyleDetailSerializer(serializers.ModelSerializer): - names = MoveBattleStyleNameSerializer( many=True, read_only=True, source="movebattlestylename" ) @@ -2089,7 +1970,6 @@ class MoveBattleStyleDetailSerializer(serializers.ModelSerializer): # MOVE DAMAGE CLASS SERIALIZERS # ################################### class MoveDamageClassNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2098,7 +1978,6 @@ class MoveDamageClassNameSerializer(serializers.ModelSerializer): class MoveDamageClassDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2107,7 +1986,6 @@ class MoveDamageClassDescriptionSerializer(serializers.ModelSerializer): class MoveDamageClassDetailSerializer(serializers.ModelSerializer): - names = MoveDamageClassNameSerializer( many=True, read_only=True, source="movedamageclassname" ) @@ -2131,7 +2009,6 @@ class MoveDamageClassDetailSerializer(serializers.ModelSerializer): # MOVE META SERIALIZERS # ########################### class MoveMetaAilmentNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2140,7 +2017,6 @@ class MoveMetaAilmentNameSerializer(serializers.ModelSerializer): class MoveMetaAilmentDetailSerializer(serializers.ModelSerializer): - names = MoveMetaAilmentNameSerializer( many=True, read_only=True, source="movemetaailmentname" ) @@ -2151,7 +2027,6 @@ class MoveMetaAilmentDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "moves", "names") def get_ailment_moves(self, obj): - move_meta_objects = MoveMeta.objects.filter(move_meta_ailment=obj) moves = [] @@ -2164,7 +2039,6 @@ class MoveMetaAilmentDetailSerializer(serializers.ModelSerializer): class MoveMetaCategoryDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2173,7 +2047,6 @@ class MoveMetaCategoryDescriptionSerializer(serializers.ModelSerializer): class MoveMetaCategoryDetailSerializer(serializers.ModelSerializer): - descriptions = MoveMetaCategoryDescriptionSerializer( many=True, read_only=True, source="movemetacategorydescription" ) @@ -2184,7 +2057,6 @@ class MoveMetaCategoryDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "descriptions", "moves") def get_category_moves(self, obj): - move_meta_objects = MoveMeta.objects.filter(move_meta_category=obj) moves = [] @@ -2197,7 +2069,6 @@ class MoveMetaCategoryDetailSerializer(serializers.ModelSerializer): class MoveMetaSerializer(serializers.ModelSerializer): - ailment = MoveMetaAilmentSummarySerializer(source="move_meta_ailment") category = MoveMetaCategorySummarySerializer(source="move_meta_category") @@ -2223,7 +2094,6 @@ class MoveMetaSerializer(serializers.ModelSerializer): # MOVE TARGET SERIALIZERS # ############################# class MoveTargetNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2232,7 +2102,6 @@ class MoveTargetNameSerializer(serializers.ModelSerializer): class MoveTargetDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2241,7 +2110,6 @@ class MoveTargetDescriptionSerializer(serializers.ModelSerializer): class MoveTargetDetailSerializer(serializers.ModelSerializer): - names = MoveTargetNameSerializer(many=True, read_only=True, source="movetargetname") descriptions = MoveTargetDescriptionSerializer( many=True, read_only=True, source="movetargetdescription" @@ -2257,7 +2125,6 @@ class MoveTargetDetailSerializer(serializers.ModelSerializer): # MOVE SERIALIZERS # ###################### class MoveNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2266,7 +2133,6 @@ class MoveNameSerializer(serializers.ModelSerializer): class MoveChangeSerializer(serializers.ModelSerializer): - version_group = VersionGroupSummarySerializer() type = TypeSummarySerializer() effect_entries = serializers.SerializerMethodField("get_effects") @@ -2285,7 +2151,6 @@ class MoveChangeSerializer(serializers.ModelSerializer): ) def get_effects(self, obj): - effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context @@ -2295,7 +2160,6 @@ class MoveChangeSerializer(serializers.ModelSerializer): class MoveEffectEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2304,7 +2168,6 @@ class MoveEffectEffectTextSerializer(serializers.ModelSerializer): class MoveEffectChangeEffectTextSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2313,7 +2176,6 @@ class MoveEffectChangeEffectTextSerializer(serializers.ModelSerializer): class MoveEffectChangeSerializer(serializers.ModelSerializer): - version_group = VersionGroupSummarySerializer() effect_entries = MoveEffectChangeEffectTextSerializer( many=True, read_only=True, source="moveeffectchangeeffecttext" @@ -2325,7 +2187,6 @@ class MoveEffectChangeSerializer(serializers.ModelSerializer): class MoveFlavorTextSerializer(serializers.ModelSerializer): - flavor_text = serializers.CharField() language = LanguageSummarySerializer() version_group = VersionGroupSummarySerializer() @@ -2336,7 +2197,6 @@ class MoveFlavorTextSerializer(serializers.ModelSerializer): class MoveDetailSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() type = TypeSummarySerializer() target = MoveTargetSummarySerializer(source="move_target") @@ -2388,7 +2248,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): ) def get_learned_by_pokemon(self, obj): - pokemon_moves = PokemonMove.objects.filter(move_id=obj).order_by("pokemon_id") pokemon_list = [] @@ -2396,7 +2255,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): pokemon_ids = pokemon_moves.values("pokemon_id").distinct() for id in pokemon_ids: - pokemon_object = Pokemon.objects.get(pk=id["pokemon_id"]) pokemon_data = PokemonSummarySerializer( pokemon_object, context=self.context @@ -2407,7 +2265,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): return pokemon_list def get_move_machines(self, obj): - machine_objects = Machine.objects.filter(move=obj) machines = [] @@ -2428,7 +2285,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): return machines def get_combos(self, obj): - normal_before_objects = ContestCombo.objects.filter(first_move=obj) normal_before_data = ContestComboSerializer( normal_before_objects, many=True, context=self.context @@ -2455,7 +2311,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): or super_before_data or super_after_data ): - details = OrderedDict() details["normal"] = OrderedDict() details["normal"]["use_before"] = None @@ -2487,7 +2342,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): return details def get_effect_text(self, obj): - effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context @@ -2496,7 +2350,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): return data def get_effect_change_text(self, obj): - effect_changes = MoveEffectChange.objects.filter(move_effect=obj.move_effect) data = MoveEffectChangeSerializer( effect_changes, many=True, context=self.context @@ -2505,7 +2358,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): return data def get_move_stat_change(self, obj): - stat_change_objects = MoveMetaStatChange.objects.filter(move=obj) stat_changes = MoveMetaStatChangeSerializer( stat_change_objects, many=True, context=self.context @@ -2523,7 +2375,6 @@ class MoveDetailSerializer(serializers.ModelSerializer): class PalParkSerializer(serializers.ModelSerializer): - area = PalParkAreaSummarySerializer(read_only=True, source="pal_park_area") pokemon_species = PokemonSpeciesSummarySerializer() @@ -2533,7 +2384,6 @@ class PalParkSerializer(serializers.ModelSerializer): class PalParkAreaNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2542,7 +2392,6 @@ class PalParkAreaNameSerializer(serializers.HyperlinkedModelSerializer): class PalParkAreaDetailSerializer(serializers.ModelSerializer): - names = PalParkAreaNameSerializer( many=True, read_only=True, source="palparkareaname" ) @@ -2553,7 +2402,6 @@ class PalParkAreaDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "names", "pokemon_encounters") def get_encounters(self, obj): - pal_park_objects = PalPark.objects.filter(pal_park_area=obj) parks = PalParkSerializer( pal_park_objects, many=True, context=self.context @@ -2573,7 +2421,6 @@ class PalParkAreaDetailSerializer(serializers.ModelSerializer): class PokemonColorNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2582,7 +2429,6 @@ class PokemonColorNameSerializer(serializers.HyperlinkedModelSerializer): class PokemonColorDetailSerializer(serializers.ModelSerializer): - names = PokemonColorNameSerializer( many=True, read_only=True, source="pokemoncolorname" ) @@ -2605,7 +2451,6 @@ class PokemonFormSpritesSerializer(serializers.ModelSerializer): class PokemonFormNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2614,7 +2459,6 @@ class PokemonFormNameSerializer(serializers.ModelSerializer): class PokemonFormDetailSerializer(serializers.ModelSerializer): - pokemon = PokemonSummarySerializer() version_group = VersionGroupSummarySerializer() sprites = serializers.SerializerMethodField("get_pokemon_form_sprites") @@ -2642,7 +2486,6 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer): ) def get_pokemon_form_names(self, obj): - form_results = PokemonFormName.objects.filter( pokemon_form=obj, name__regex=".+" ) @@ -2658,7 +2501,6 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer): return data def get_pokemon_form_pokemon_names(self, obj): - form_results = PokemonFormName.objects.filter( pokemon_form=obj, pokemon_name__regex=".+" ) @@ -2675,7 +2517,6 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer): return data def get_pokemon_form_sprites(self, obj): - sprites_object = PokemonFormSprites.objects.get(pokemon_form_id=obj) sprites_data = PokemonFormSpritesSerializer( sprites_object, context=self.context @@ -2685,7 +2526,6 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer): return sprites_data def get_pokemon_form_types(self, obj): - form_type_objects = PokemonFormType.objects.filter(pokemon_form=obj) form_types = PokemonFormTypeSerializer( form_type_objects, many=True, context=self.context @@ -2714,7 +2554,6 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer): class PokemonHabitatNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2723,7 +2562,6 @@ class PokemonHabitatNameSerializer(serializers.HyperlinkedModelSerializer): class PokemonHabitatDetailSerializer(serializers.ModelSerializer): - names = PokemonHabitatNameSerializer( many=True, read_only=True, source="pokemonhabitatname" ) @@ -2742,7 +2580,6 @@ class PokemonHabitatDetailSerializer(serializers.ModelSerializer): class MoveLearnMethodNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2751,7 +2588,6 @@ class MoveLearnMethodNameSerializer(serializers.HyperlinkedModelSerializer): class MoveLearnMethodDescriptionSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2760,7 +2596,6 @@ class MoveLearnMethodDescriptionSerializer(serializers.HyperlinkedModelSerialize class MoveLearnMethodDetailSerializer(serializers.ModelSerializer): - names = MoveLearnMethodNameSerializer( many=True, read_only=True, source="movelearnmethodname" ) @@ -2774,7 +2609,6 @@ class MoveLearnMethodDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "names", "descriptions", "version_groups") def get_method_version_groups(self, obj): - version_group_objects = VersionGroupMoveLearnMethod.objects.filter( move_learn_method=obj ) @@ -2800,7 +2634,6 @@ class PokemonMoveSerializer(serializers.ModelSerializer): # POKEMON SHAPE SERIALIZERS # ############################### class PokemonShapeNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -2809,7 +2642,6 @@ class PokemonShapeNameSerializer(serializers.HyperlinkedModelSerializer): class PokemonShapeDetailSerializer(serializers.ModelSerializer): - names = serializers.SerializerMethodField("get_shape_names") awesome_names = serializers.SerializerMethodField("get_shape_awesome_names") pokemon_species = PokemonSpeciesSummarySerializer( @@ -2821,7 +2653,6 @@ class PokemonShapeDetailSerializer(serializers.ModelSerializer): fields = ("id", "name", "awesome_names", "names", "pokemon_species") def get_shape_names(self, obj): - results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( results, many=True, context=self.context @@ -2834,7 +2665,6 @@ class PokemonShapeDetailSerializer(serializers.ModelSerializer): return data def get_shape_awesome_names(self, obj): - results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( results, many=True, context=self.context @@ -2851,7 +2681,6 @@ class PokemonShapeDetailSerializer(serializers.ModelSerializer): # POKEMON ITEM SERIALIZERS # ############################## class PokemonItemSerializer(serializers.ModelSerializer): - version = VersionSummarySerializer() item = ItemSummarySerializer() @@ -2864,7 +2693,6 @@ class PokemonItemSerializer(serializers.ModelSerializer): # POKEMON STAT SERIALIZERS # ############################## class PokemonStatSerializer(serializers.ModelSerializer): - stat = StatSummarySerializer() class Meta: @@ -2878,7 +2706,6 @@ class PokemonStatSerializer(serializers.ModelSerializer): class PokemonGameIndexSerializer(serializers.ModelSerializer): - version = VersionSummarySerializer() class Meta: @@ -2893,7 +2720,6 @@ class PokemonSpritesSerializer(serializers.ModelSerializer): class PokemonDetailSerializer(serializers.ModelSerializer): - abilities = serializers.SerializerMethodField("get_pokemon_abilities") past_abilities = serializers.SerializerMethodField("get_past_pokemon_abilities") game_indices = PokemonGameIndexSerializer( @@ -2936,7 +2762,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): ) def get_pokemon_sprites(self, obj): - sprites_object = PokemonSprites.objects.get(pokemon_id=obj) sprites_data = PokemonSpritesSerializer( sprites_object, context=self.context @@ -2945,7 +2770,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return json.loads(sprites_data["sprites"]) def get_pokemon_moves(self, obj): - version_objects = VersionGroup.objects.all() version_data = VersionGroupSummarySerializer( version_objects, many=True, context=self.context @@ -2965,7 +2789,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): move_list = [] for id in move_ids: - pokemon_move_details = OrderedDict() # Get each Unique Move by ID @@ -2981,7 +2804,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): pokemon_move_details["version_group_details"] = [] for move in serializer.data: - version_detail = OrderedDict() version_detail["level_learned_at"] = move["level"] @@ -2999,14 +2821,12 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return move_list def get_pokemon_held_items(self, obj): - # Get items related to this pokemon and pull out unique Item IDs pokemon_items = PokemonItem.objects.filter(pokemon_id=obj).order_by("item_id") item_ids = pokemon_items.values("item_id").distinct() item_list = [] for id in item_ids: - pokemon_item_details = OrderedDict() # Get each Unique Item by ID @@ -3022,7 +2842,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): pokemon_item_details["version_details"] = [] for item in serializer.data: - version_detail = OrderedDict() version_detail["rarity"] = item["rarity"] @@ -3035,7 +2854,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return item_list def get_pokemon_abilities(self, obj): - pokemon_ability_objects = PokemonAbility.objects.filter(pokemon=obj) data = PokemonAbilitySerializer( pokemon_ability_objects, many=True, context=self.context @@ -3049,7 +2867,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return abilities def get_past_pokemon_abilities(self, obj): - pokemon_past_ability_objects = PokemonAbilityPast.objects.filter(pokemon=obj) pokemon_past_abilities = PokemonAbilityPastSerializer( pokemon_past_ability_objects, many=True, context=self.context @@ -3085,7 +2902,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return final_data def get_pokemon_types(self, obj): - poke_type_objects = PokemonType.objects.filter(pokemon=obj) poke_types = PokemonTypeSerializer( poke_type_objects, many=True, context=self.context @@ -3097,7 +2913,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return poke_types def get_past_pokemon_types(self, obj): - poke_past_type_objects = PokemonTypePast.objects.filter(pokemon=obj) poke_past_types = PokemonTypePastSerializer( poke_past_type_objects, many=True, context=self.context @@ -3133,7 +2948,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): return final_data def get_encounters(self, obj): - return reverse("pokemon_encounters", kwargs={"pokemon_id": obj.pk}) @@ -3141,7 +2955,6 @@ class PokemonDetailSerializer(serializers.ModelSerializer): # POKEMON SPECIES SERIALIZERS # ################################# class EvolutionTriggerNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3150,7 +2963,6 @@ class EvolutionTriggerNameSerializer(serializers.HyperlinkedModelSerializer): class EvolutionTriggerDetailSerializer(serializers.HyperlinkedModelSerializer): - names = EvolutionTriggerNameSerializer( many=True, read_only=True, source="evolutiontriggername" ) @@ -3161,7 +2973,6 @@ class EvolutionTriggerDetailSerializer(serializers.HyperlinkedModelSerializer): fields = ("id", "name", "names", "pokemon_species") def get_species(self, obj): - evo_objects = PokemonEvolution.objects.filter(evolution_trigger=obj) species_list = [] species_names = set() @@ -3178,7 +2989,6 @@ class EvolutionTriggerDetailSerializer(serializers.HyperlinkedModelSerializer): class PokemonSpeciesDescriptionSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3187,7 +2997,6 @@ class PokemonSpeciesDescriptionSerializer(serializers.ModelSerializer): class PokemonSpeciesFlavorTextSerializer(serializers.ModelSerializer): - flavor_text = serializers.CharField() language = LanguageSummarySerializer() version = VersionSummarySerializer() @@ -3198,7 +3007,6 @@ class PokemonSpeciesFlavorTextSerializer(serializers.ModelSerializer): class PokemonSpeciesNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3217,7 +3025,6 @@ class PokemonSpeciesEvolutionSerializer(serializers.ModelSerializer): class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): - names = serializers.SerializerMethodField("get_pokemon_names") form_descriptions = PokemonSpeciesDescriptionSerializer( many=True, read_only=True, source="pokemonspeciesdescription" @@ -3273,7 +3080,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): ) def get_pokemon_names(self, obj): - species_results = PokemonSpeciesName.objects.filter(pokemon_species=obj) species_serializer = PokemonSpeciesNameSerializer( species_results, many=True, context=self.context @@ -3287,7 +3093,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): return data def get_pokemon_genera(self, obj): - results = PokemonSpeciesName.objects.filter(pokemon_species=obj) serializer = PokemonSpeciesNameSerializer( results, many=True, context=self.context @@ -3303,7 +3108,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): return genera def get_pokemon_egg_groups(self, obj): - results = PokemonEggGroup.objects.filter(pokemon_species=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data groups = [] @@ -3313,7 +3117,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): return groups def get_pokemon_varieties(self, obj): - results = Pokemon.objects.filter(pokemon_species=obj) summary_data = PokemonSummarySerializer( results, many=True, context=self.context @@ -3333,7 +3136,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): return varieties def get_encounters(self, obj): - pal_park_objects = PalPark.objects.filter(pokemon_species=obj) parks = PalParkSerializer( pal_park_objects, many=True, context=self.context @@ -3348,7 +3150,6 @@ class PokemonSpeciesDetailSerializer(serializers.ModelSerializer): class PokemonEvolutionSerializer(serializers.ModelSerializer): - item = ItemSummarySerializer(source="evolution_item") held_item = ItemSummarySerializer() known_move = MoveSummarySerializer() @@ -3384,7 +3185,6 @@ class PokemonEvolutionSerializer(serializers.ModelSerializer): class EvolutionChainDetailSerializer(serializers.ModelSerializer): - baby_trigger_item = ItemSummarySerializer() chain = serializers.SerializerMethodField("build_chain") @@ -3393,7 +3193,6 @@ class EvolutionChainDetailSerializer(serializers.ModelSerializer): fields = ("id", "baby_trigger_item", "chain") def build_chain(self, obj): - chain_id = obj.id pokemon_objects = PokemonSpecies.objects.filter( @@ -3452,7 +3251,6 @@ class EvolutionChainDetailSerializer(serializers.ModelSerializer): species = chain_link["species"] if species["evolves_from_species"]: - evolution_object = PokemonEvolution.objects.filter( evolved_species=species["id"] ) @@ -3477,7 +3275,6 @@ class EvolutionChainDetailSerializer(serializers.ModelSerializer): class PokemonDexNumberSerializer(serializers.ModelSerializer): - entry_number = serializers.IntegerField(source="pokedex_number") pokemon_species = PokemonSpeciesSummarySerializer() @@ -3490,7 +3287,6 @@ class PokemonDexNumberSerializer(serializers.ModelSerializer): # POKEATHLON SERIALIZERS # ############################ class PokeathlonStatNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3499,7 +3295,6 @@ class PokeathlonStatNameSerializer(serializers.HyperlinkedModelSerializer): class PokeathlonStatDetailSerializer(serializers.HyperlinkedModelSerializer): - names = PokeathlonStatNameSerializer( many=True, read_only=True, source="pokeathlonstatname" ) @@ -3510,7 +3305,6 @@ class PokeathlonStatDetailSerializer(serializers.HyperlinkedModelSerializer): fields = ("id", "name", "affecting_natures", "names") def get_natures_that_affect(self, obj): - stat_change_objects = NaturePokeathlonStat.objects.filter(pokeathlon_stat=obj) stat_changes = NaturePokeathlonStatSerializer( stat_change_objects, many=True, context=self.context @@ -3531,7 +3325,6 @@ class PokeathlonStatDetailSerializer(serializers.HyperlinkedModelSerializer): # POKEDEX SERIALIZERS # ######################### class PokedexNameSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3540,7 +3333,6 @@ class PokedexNameSerializer(serializers.HyperlinkedModelSerializer): class PokedexDescriptionSerializer(serializers.HyperlinkedModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3549,7 +3341,6 @@ class PokedexDescriptionSerializer(serializers.HyperlinkedModelSerializer): class PokedexDetailSerializer(serializers.ModelSerializer): - region = RegionSummarySerializer() names = PokedexNameSerializer(many=True, read_only=True, source="pokedexname") descriptions = PokedexDescriptionSerializer( @@ -3572,7 +3363,6 @@ class PokedexDetailSerializer(serializers.ModelSerializer): ) def get_pokedex_entries(self, obj): - results = PokemonDexNumber.objects.filter(pokedex=obj).order_by( "pokedex_number" ) @@ -3587,7 +3377,6 @@ class PokedexDetailSerializer(serializers.ModelSerializer): return data def get_pokedex_version_groups(self, obj): - dex_group_objects = PokedexVersionGroup.objects.filter(pokedex=obj) dex_groups = PokedexVersionGroupSerializer( dex_group_objects, many=True, context=self.context @@ -3604,7 +3393,6 @@ class PokedexDetailSerializer(serializers.ModelSerializer): # VERSION SERIALIZERS # ######################### class VersionNameSerializer(serializers.ModelSerializer): - language = LanguageSummarySerializer() class Meta: @@ -3628,7 +3416,6 @@ class VersionDetailSerializer(serializers.ModelSerializer): class VersionGroupDetailSerializer(serializers.ModelSerializer): - generation = GenerationSummarySerializer() versions = VersionSummarySerializer(many=True, read_only=True, source="version") regions = serializers.SerializerMethodField("get_version_group_regions") @@ -3649,7 +3436,6 @@ class VersionGroupDetailSerializer(serializers.ModelSerializer): ) def get_version_group_regions(self, obj): - vg_regions = VersionGroupRegion.objects.filter(version_group=obj) data = VersionGroupRegionSerializer( vg_regions, many=True, context=self.context @@ -3662,7 +3448,6 @@ class VersionGroupDetailSerializer(serializers.ModelSerializer): return regions def get_learn_methods(self, obj): - learn_method_objects = VersionGroupMoveLearnMethod.objects.filter( version_group=obj ) @@ -3677,7 +3462,6 @@ class VersionGroupDetailSerializer(serializers.ModelSerializer): return methods def get_version_groups_pokedexes(self, obj): - dex_group_objects = PokedexVersionGroup.objects.filter(version_group=obj) dex_groups = PokedexVersionGroupSerializer( dex_group_objects, many=True, context=self.context diff --git a/pokemon_v2/tests.py b/pokemon_v2/tests.py index 344f8ca2..456d5501 100644 --- a/pokemon_v2/tests.py +++ b/pokemon_v2/tests.py @@ -16,7 +16,6 @@ class APIData: # Gender Data @classmethod def setup_gender_data(cls, name="gndr"): - gender = Gender.objects.create( name=name, ) @@ -27,7 +26,6 @@ class APIData: # Language Data @classmethod def setup_language_data(cls, name="lang"): - language = Language.objects.create( iso639="ts", iso3166="tt", @@ -41,7 +39,6 @@ class APIData: @classmethod def setup_language_name_data(cls, language, name="lang nm"): - local_language = cls.setup_language_data(name="lang for " + name) language_name = LanguageName.objects.create( @@ -54,7 +51,6 @@ class APIData: # Region Data @classmethod def setup_region_data(cls, name="reg"): - region = Region.objects.create(name=name) region.save() @@ -62,7 +58,6 @@ class APIData: @classmethod def setup_region_name_data(cls, region, name="reg nm"): - language = cls.setup_language_data(name="lang for " + name) region_name = RegionName.objects.create( @@ -75,7 +70,6 @@ class APIData: # Generation Data @classmethod def setup_generation_data(cls, region=None, name="gen"): - region = region or cls.setup_region_data(name="reg for " + name) generation = Generation.objects.create(region=region, name=name) @@ -85,7 +79,6 @@ class APIData: @classmethod def setup_generation_name_data(cls, generation, name="gen nm"): - language = cls.setup_language_data(name="lang for " + name) generation_name = GenerationName.objects.create( @@ -98,7 +91,6 @@ class APIData: # Version Data @classmethod def setup_version_group_data(cls, name="ver grp", generation=None): - generation = generation or cls.setup_generation_data(name="gen for " + name) version_group = VersionGroup.objects.create( @@ -110,7 +102,6 @@ class APIData: @classmethod def setup_version_group_region_data(cls, version_group=None, region=None): - version_group_region = VersionGroupRegion.objects.create( version_group=version_group, region=region ) @@ -120,7 +111,6 @@ class APIData: @classmethod def setup_version_data(cls, version_group=None, name="ver"): - version = Version.objects.create( name=name, version_group=version_group, @@ -131,7 +121,6 @@ class APIData: @classmethod def setup_version_name_data(cls, version, name="ver nm"): - language = cls.setup_language_data(name="lang for " + name) version_name = VersionName.objects.create( @@ -144,7 +133,6 @@ class APIData: # Ability Data @classmethod def setup_ability_data(cls, name="ablty", generation=None): - generation = generation or cls.setup_generation_data(name="gen for " + name) ability = Ability.objects.create( @@ -156,7 +144,6 @@ class APIData: @classmethod def setup_ability_name_data(cls, ability, name="ablty nm"): - language = cls.setup_language_data(name="lang for " + name) ability_name = AbilityName.objects.create( @@ -170,7 +157,6 @@ class APIData: def setup_ability_effect_text_data( cls, ability, short_effect="ablty shrt efct", effect="ablty efct" ): - language = cls.setup_language_data(name="lang for " + effect) ability_effect_text = AbilityEffectText.objects.create( @@ -182,7 +168,6 @@ class APIData: @classmethod def setup_ability_change_data(cls, ability): - version_group = cls.setup_version_group_data(name="ver grp for ablty chng") ability_change = AbilityChange.objects.create( @@ -196,7 +181,6 @@ class APIData: def setup_ability_change_effect_text_data( cls, ability_change, effect="ablty change efct" ): - language = cls.setup_language_data(name="lang for " + effect) ability_change_effect_text = AbilityChangeEffectText.objects.create( @@ -208,7 +192,6 @@ class APIData: @classmethod def setup_ability_flavor_text_data(cls, ability, flavor_text="ablty flvr txt"): - version_group = cls.setup_version_group_data(name="ver grp for " + flavor_text) language = cls.setup_language_data(name="lang for " + flavor_text) @@ -226,7 +209,6 @@ class APIData: # Item Data @classmethod def setup_item_attribute_data(cls, name="itm attr"): - item_attribute = ItemAttribute.objects.create( name=name, ) @@ -236,7 +218,6 @@ class APIData: @classmethod def setup_item_attribute_name_data(cls, item_attribute, name="itm attr nm"): - language = cls.setup_language_data(name="lang for " + name) item_attribute_name = ItemAttributeName.objects.create( @@ -250,7 +231,6 @@ class APIData: def setup_item_attribute_description_data( cls, item_attribute, description="itm attr desc" ): - language = cls.setup_language_data(name="lang for " + description) item_attribute_description = ItemAttributeDescription.objects.create( @@ -262,7 +242,6 @@ class APIData: @classmethod def setup_item_attribute_map_data(cls, item, item_attribute): - item_attribute_map = ItemAttributeMap(item=item, item_attribute=item_attribute) item_attribute_map.save() @@ -270,7 +249,6 @@ class APIData: @classmethod def setup_item_fling_effect_data(cls, name="itm flng efct"): - item_fling_effect = ItemFlingEffect.objects.create( name=name, ) @@ -282,7 +260,6 @@ class APIData: def setup_item_fling_effect_effect_text_data( cls, item_fling_effect, effect="itm flng efct efct txt" ): - language = cls.setup_language_data(name="lang for " + effect) item_fling_effect_effect_text = ItemFlingEffectEffectText.objects.create( @@ -294,7 +271,6 @@ class APIData: @classmethod def setup_item_pocket_data(cls, name="itm pkt"): - item_pocket = ItemPocket.objects.create( name=name, ) @@ -304,7 +280,6 @@ class APIData: @classmethod def setup_item_pocket_name_data(cls, item_pocket, name="itm pkt nm"): - language = cls.setup_language_data(name="lang for " + name) item_pocket_name = ItemPocketName.objects.create( @@ -316,7 +291,6 @@ class APIData: @classmethod def setup_item_category_data(cls, name="itm ctgry", item_pocket=None): - item_pocket = item_pocket or cls.setup_item_pocket_data( name="itm pkt for " + name ) @@ -328,7 +302,6 @@ class APIData: @classmethod def setup_item_category_name_data(cls, item_category, name="itm ctgry nm"): - language = cls.setup_language_data(name="lang for " + name) item_category_name = ItemCategoryName.objects.create( @@ -340,7 +313,6 @@ class APIData: @classmethod def setup_item_sprites_data(cls, item, default=True): - sprite_path = "/media/sprites/items/%s.png" sprites = { @@ -363,7 +335,6 @@ class APIData: cost=100, fling_power=100, ): - item = Item.objects.create( name=name, item_category=item_category, @@ -377,7 +348,6 @@ class APIData: @classmethod def setup_item_name_data(cls, item, name="itm nm"): - language = cls.setup_language_data(name="lang for " + name) item_name = ItemName.objects.create(item=item, name=name, language=language) @@ -389,7 +359,6 @@ class APIData: def setup_item_effect_text_data( cls, item, short_effect="ablty shrt efct", effect="ablty efct" ): - language = cls.setup_language_data(name="lang for " + effect) item_effect_text = ItemEffectText.objects.create( @@ -401,7 +370,6 @@ class APIData: @classmethod def setup_item_flavor_text_data(cls, item, flavor_text="itm flvr txt"): - version_group = cls.setup_version_group_data(name="ver grp for " + flavor_text) language = cls.setup_language_data(name="lang for " + flavor_text) @@ -418,7 +386,6 @@ class APIData: @classmethod def setup_item_game_index_data(cls, item, game_index=0): - generation = cls.setup_generation_data(name="gen for itm gm indx") item_game_index = ItemGameIndex.objects.create( @@ -431,7 +398,6 @@ class APIData: # Contest Data @classmethod def setup_contest_type_data(cls, name="cntst tp"): - contest_type = ContestType.objects.create( name=name, ) @@ -441,7 +407,6 @@ class APIData: @classmethod def setup_contest_type_name_data(cls, contest_type, name="cntst tp nm"): - language = cls.setup_language_data(name="lang for " + name) contest_type_name = ContestTypeName.objects.create( @@ -453,7 +418,6 @@ class APIData: @classmethod def setup_contest_effect_data(cls, appeal=2, jam=0): - contest_effect = ContestEffect.objects.create(appeal=appeal, jam=jam) contest_effect.save() @@ -463,7 +427,6 @@ class APIData: def setup_contest_effect_flavor_text_data( cls, contest_effect, flavor_text="cntst efct flvr txt" ): - language = cls.setup_language_data(name="lang for " + flavor_text) contest_effect_flavor_text = ContestEffectFlavorText.objects.create( @@ -477,7 +440,6 @@ class APIData: def setup_contest_effect_effect_text_data( cls, contest_effect, effect="cntst efct efct txt" ): - language = cls.setup_language_data(name="lang for " + effect) contest_effect_effect_text = ContestEffectEffectText.objects.create( @@ -489,7 +451,6 @@ class APIData: @classmethod def setup_super_contest_effect_data(cls, appeal=2): - super_contest_effect = SuperContestEffect.objects.create( appeal=appeal, ) @@ -501,7 +462,6 @@ class APIData: def setup_super_contest_effect_flavor_text_data( cls, super_contest_effect, flavor_text="spr cntst efct flvr txt" ): - language = cls.setup_language_data(name="lang for " + flavor_text) super_contest_effect_flavor_text = SuperContestEffectFlavorText.objects.create( @@ -516,7 +476,6 @@ class APIData: # Berry Data @classmethod def setup_berry_flavor_data(cls, contest_type=None, name="bry flvr"): - contest_type = contest_type or cls.setup_contest_type_data( name="cntst tp for bry flvr" ) @@ -528,7 +487,6 @@ class APIData: @classmethod def setup_berry_flavor_name_data(cls, berry_flavor, name="bry flvr nm"): - language = cls.setup_language_data(name="lang for " + name) berry_flavor_name = BerryFlavorName.objects.create( @@ -540,7 +498,6 @@ class APIData: @classmethod def setup_berry_firmness_data(cls, name="bry frmns"): - berry_firmness = BerryFirmness.objects.create( name=name, ) @@ -550,7 +507,6 @@ class APIData: @classmethod def setup_berry_firmness_name_data(cls, berry_firmness, name="bry frmns nm"): - language = cls.setup_language_data(name="lang for " + name) berry_firmness_name = BerryFirmnessName.objects.create( @@ -562,7 +518,6 @@ class APIData: @classmethod def setup_berry_flavor_map_data(cls, berry, berry_flavor, potency=20): - berry_flavor_map = BerryFlavorMap( berry=berry, berry_flavor=berry_flavor, potency=potency ) @@ -584,7 +539,6 @@ class APIData: soil_dryness=15, smoothness=25, ): - item = item or cls.setup_item_data(name="itm for " + name) berry_firmness = berry_firmness or cls.setup_berry_firmness_data( @@ -610,7 +564,6 @@ class APIData: # Egg Group Data @classmethod def setup_egg_group_data(cls, name="egg grp"): - egg_group = EggGroup.objects.create( name=name, ) @@ -620,7 +573,6 @@ class APIData: @classmethod def setup_egg_group_name_data(cls, egg_group, name="ntr nm"): - language = cls.setup_language_data(name="lang for " + name) egg_group_name = EggGroupName.objects.create( @@ -633,7 +585,6 @@ class APIData: # Growth Rate Data @classmethod def setup_growth_rate_data(cls, name="grth rt", formula="pie*1000"): - growth_rate = GrowthRate(name=name, formula=formula) growth_rate.save() @@ -643,7 +594,6 @@ class APIData: def setup_growth_rate_description_data( cls, growth_rate, description="grth rt desc" ): - language = cls.setup_language_data(name="lang for " + description) growth_rate_description = GrowthRateDescription.objects.create( @@ -656,7 +606,6 @@ class APIData: # Location Data @classmethod def setup_location_data(cls, region=None, name="lctn"): - region = region or cls.setup_region_data(name="rgn for " + name) location = Location(name=name, region=region) @@ -666,7 +615,6 @@ class APIData: @classmethod def setup_location_game_index_data(cls, location, game_index=0): - generation = cls.setup_generation_data(name="gen for itm gm indx") location_game_index = LocationGameIndex.objects.create( @@ -678,7 +626,6 @@ class APIData: @classmethod def setup_location_name_data(cls, location, name="lctn nm"): - language = cls.setup_language_data(name="lang for " + name) location_name = LocationName.objects.create( @@ -690,7 +637,6 @@ class APIData: @classmethod def setup_location_area_data(cls, location=None, name="lctn area", game_index=0): - location = location or cls.setup_location_data(name="lctn for " + name) location_area = LocationArea( @@ -702,7 +648,6 @@ class APIData: @classmethod def setup_location_area_name_data(cls, location_area, name="lctn area nm"): - language = cls.setup_language_data(name="lang for " + name) location_area_name = LocationAreaName.objects.create( @@ -715,7 +660,6 @@ class APIData: # Type Data @classmethod def setup_type_data(cls, name="tp", move_damage_class=None, generation=None): - move_damage_class = move_damage_class or cls.setup_move_damage_class_data( name="mv dmg cls for " + name ) @@ -731,7 +675,6 @@ class APIData: @classmethod def setup_type_name_data(cls, type, name="tp nm"): - language = cls.setup_language_data(name="lang for " + name) type_name = TypeName.objects.create(language=language, name=name, type=type) @@ -741,7 +684,6 @@ class APIData: @classmethod def setup_type_game_index_data(cls, type, game_index=0): - generation = cls.setup_generation_data(name="gen for tp gm indx") type_game_index = TypeGameIndex.objects.create( @@ -754,7 +696,6 @@ class APIData: # Move Data @classmethod def setup_move_ailment_data(cls, name="mv almnt"): - move_ailment = MoveMetaAilment.objects.create(name=name) move_ailment.save() @@ -762,7 +703,6 @@ class APIData: @classmethod def setup_move_ailment_name_data(cls, move_ailment, name="mv almnt nm"): - language = cls.setup_language_data(name="lang for " + name) move_ailment_name = MoveMetaAilmentName.objects.create( @@ -774,7 +714,6 @@ class APIData: @classmethod def setup_move_battle_style_data(cls, name="mv btl stl"): - move_battle_style = MoveBattleStyle.objects.create(name=name) move_battle_style.save() @@ -782,7 +721,6 @@ class APIData: @classmethod def setup_move_battle_style_name_data(cls, move_battle_style, name="mv almnt nm"): - language = cls.setup_language_data(name="lang for " + name) move_battle_style_name = MoveBattleStyleName.objects.create( @@ -794,7 +732,6 @@ class APIData: @classmethod def setup_move_category_data(cls, name="mv ctgry"): - move_category = MoveMetaCategory.objects.create(name=name) move_category.save() @@ -804,7 +741,6 @@ class APIData: def setup_move_category_description_data( cls, move_category, description="mv ctgry desc" ): - language = cls.setup_language_data(name="lang for " + description) move_category_description = MoveMetaCategoryDescription.objects.create( @@ -816,7 +752,6 @@ class APIData: @classmethod def setup_move_effect_data(cls): - move_effect = MoveEffect.objects.create() move_effect.save() @@ -829,7 +764,6 @@ class APIData: effect="mv efct efct txt", short_effect="mv efct shrt efct txt", ): - language = cls.setup_language_data(name="lang for " + effect) effect_effect_text = MoveEffectEffectText.objects.create( @@ -844,7 +778,6 @@ class APIData: @classmethod def setup_move_damage_class_data(cls, name="mv dmg cls"): - move_damage_class = MoveDamageClass.objects.create(name=name) move_damage_class.save() @@ -852,7 +785,6 @@ class APIData: @classmethod def setup_move_damage_class_name_data(cls, move_damage_class, name="mv dmg cls nm"): - language = cls.setup_language_data(name="lang for " + name) move_damage_class_name = MoveDamageClassName.objects.create( @@ -866,7 +798,6 @@ class APIData: def setup_move_damage_class_description_data( cls, move_damage_class, description="mv dmg cls desc" ): - language = cls.setup_language_data(name="lang for " + description) move_damage_class_description = MoveDamageClassDescription.objects.create( @@ -880,7 +811,6 @@ class APIData: @classmethod def setup_move_learn_method_data(cls, name="mv lrn mthd"): - move_learn_method = MoveLearnMethod.objects.create(name=name) move_learn_method.save() @@ -890,7 +820,6 @@ class APIData: def setup_move_learn_method_name_data( cls, move_learn_method, name="mv lrn mthd nm" ): - language = cls.setup_language_data(name="lang for " + name) move_learn_method_name = MoveLearnMethodName.objects.create( @@ -904,7 +833,6 @@ class APIData: def setup_move_learn_method_description_data( cls, move_learn_method, description="mv lrn mthd desc" ): - language = cls.setup_language_data(name="lang for " + description) move_learn_method_description = MoveLearnMethodDescription.objects.create( @@ -918,7 +846,6 @@ class APIData: @classmethod def setup_move_target_data(cls, name="mv trgt"): - move_target = MoveTarget.objects.create(name=name) move_target.save() @@ -926,7 +853,6 @@ class APIData: @classmethod def setup_move_target_name_data(cls, move_target, name="mv trgt nm"): - language = cls.setup_language_data(name="lang for " + name) move_target_name = MoveTargetName.objects.create( @@ -940,7 +866,6 @@ class APIData: def setup_move_target_description_data( cls, move_target, description="mv trgt desc" ): - language = cls.setup_language_data(name="lang for " + description) move_target_description = MoveTargetDescription.objects.create( @@ -952,7 +877,6 @@ class APIData: @classmethod def setup_contest_combo_data(cls, first_move, second_move): - contest_combo = ContestCombo.objects.create( first_move=first_move, second_move=second_move ) @@ -964,7 +888,6 @@ class APIData: def setup_version_group_move_learn_method_data( cls, version_group=None, move_learn_method=None ): - version_group_move_learn_method = VersionGroupMoveLearnMethod.objects.create( version_group=version_group, move_learn_method=move_learn_method ) @@ -974,7 +897,6 @@ class APIData: @classmethod def setup_super_contest_combo_data(cls, first_move, second_move): - super_contest_combo = SuperContestCombo.objects.create( first_move=first_move, second_move=second_move ) @@ -1016,7 +938,6 @@ class APIData: priority=0, effect_chance=50, ): - contest_type = contest_type or cls.setup_contest_type_data( name="cntst tp for " + name ) @@ -1061,7 +982,6 @@ class APIData: @classmethod def setup_move_name_data(cls, move, name="mv nm"): - language = cls.setup_language_data(name="lang for " + name) move_name = MoveName.objects.create(move=move, language=language, name=name) @@ -1086,7 +1006,6 @@ class APIData: flinch_chance=0, stat_chance=0, ): - move_ailment = move_ailment or cls.setup_move_ailment_data() move_category = move_category or cls.setup_move_category_data() @@ -1122,7 +1041,6 @@ class APIData: accuracy=80, effect_chance=50, ): - version_group = version_group or cls.setup_version_group_data( name="ver grp for mv chng" ) @@ -1143,7 +1061,6 @@ class APIData: @classmethod def setup_move_effect_change_data(cls, move_effect=None): - version_group = cls.setup_version_group_data(name="ver grp for mv chng") move_effect_change = MoveEffectChange.objects.create( @@ -1157,7 +1074,6 @@ class APIData: def setup_move_effect_change_effect_text_data( cls, move_effect_change=None, effect="mv efct chng efct txt" ): - language = cls.setup_language_data(name="lang for " + effect) move_effect_change_effect_text = MoveEffectChangeEffectText.objects.create( @@ -1170,7 +1086,6 @@ class APIData: # Stat Data @classmethod def setup_stat_data(cls, name="stt", is_battle_only=True, game_index=1): - move_damage_class = cls.setup_move_damage_class_data( name="mv dmg cls for " + name ) @@ -1187,7 +1102,6 @@ class APIData: @classmethod def setup_stat_name_data(cls, stat, name="stt nm"): - language = cls.setup_language_data(name="lang for " + name) stat_name = StatName.objects.create(stat=stat, language=language, name=name) @@ -1197,7 +1111,6 @@ class APIData: @classmethod def setup_move_stat_change_data(cls, move, stat=None, change=1): - stat = stat or cls.setup_stat_data(name="stt for mv") move_stat_change = MoveMetaStatChange.objects.create( @@ -1209,7 +1122,6 @@ class APIData: @classmethod def setup_pokeathlon_stat_data(cls, name="pkathln stt"): - pokeathlon_stat = PokeathlonStat.objects.create(name=name) pokeathlon_stat.save() @@ -1217,7 +1129,6 @@ class APIData: @classmethod def setup_pokeathlon_stat_name_data(cls, pokeathlon_stat, name="pkathln stt nm"): - language = cls.setup_language_data(name="lang for " + name) pokeathlon_stat_name = PokeathlonStatName.objects.create( @@ -1230,7 +1141,6 @@ class APIData: # Characteristic Data @classmethod def setup_characteristic_data(cls, gene_mod_5=0, stat=None): - stat = stat or cls.setup_stat_data(name="stt for char") characteristic = Characteristic.objects.create(stat=stat, gene_mod_5=gene_mod_5) @@ -1242,7 +1152,6 @@ class APIData: def setup_characteristic_description_data( cls, characteristic, description="char desc" ): - language = cls.setup_language_data(name="lang for " + description) characteristic_description = CharacteristicDescription.objects.create( @@ -1263,7 +1172,6 @@ class APIData: name="ntr", game_index=1, ): - nature = Nature.objects.create( name=name, decreased_stat=decreased_stat, @@ -1278,7 +1186,6 @@ class APIData: @classmethod def setup_nature_name_data(cls, nature, name="ntr nm"): - language = cls.setup_language_data(name="lang for " + name) nature_name = NatureName.objects.create( @@ -1292,7 +1199,6 @@ class APIData: def setup_nature_pokeathlon_stat_data( cls, nature=None, pokeathlon_stat=None, max_change=1 ): - nature_pokeathlon_stat = NaturePokeathlonStat.objects.create( nature=nature, pokeathlon_stat=pokeathlon_stat, @@ -1310,7 +1216,6 @@ class APIData: low_hp_preference=10, high_hp_preference=20, ): - nature_battle_style_preference = NatureBattleStylePreference.objects.create( nature=nature, move_battle_style=move_battle_style, @@ -1324,7 +1229,6 @@ class APIData: # Pokedex Data @classmethod def setup_pokedex_data(cls, region=None, name="pkdx"): - region = region or cls.setup_region_data(name="rgn for " + name) pokedex = Pokedex.objects.create( @@ -1337,7 +1241,6 @@ class APIData: @classmethod def setup_pokedex_name_data(cls, pokedex, name="pkdx nm"): - language = cls.setup_language_data(name="lang for " + name) pokedex_name = PokedexName.objects.create( @@ -1349,7 +1252,6 @@ class APIData: @classmethod def setup_pokedex_description_data(cls, pokedex, description="pkdx desc"): - language = cls.setup_language_data(name="lang for " + description) pokedex_description = PokedexDescription.objects.create( @@ -1361,7 +1263,6 @@ class APIData: @classmethod def setup_pokedex_version_group_data(cls, pokedex, version_group=None): - version_group = version_group or cls.setup_language_data( name="ver grp for pkdx" ) @@ -1376,7 +1277,6 @@ class APIData: # Pokemon Data @classmethod def setup_pokemon_habitat_data(cls, name="pkm hbtt"): - pokemon_habitat = PokemonHabitat.objects.create( name=name, ) @@ -1386,7 +1286,6 @@ class APIData: @classmethod def setup_pokemon_habitat_name_data(cls, pokemon_habitat, name="pkm hbtt nm"): - language = cls.setup_language_data(name="lang for " + name) pokemon_habitat_name = PokemonHabitatName.objects.create( @@ -1398,7 +1297,6 @@ class APIData: @classmethod def setup_pokemon_color_data(cls, name="pkm clr"): - pokemon_color = PokemonColor.objects.create( name=name, ) @@ -1408,7 +1306,6 @@ class APIData: @classmethod def setup_pokemon_color_name_data(cls, pokemon_color, name="pkm clr nm"): - language = cls.setup_language_data(name="lang for " + name) pokemon_color_name = PokemonColorName.objects.create( @@ -1420,7 +1317,6 @@ class APIData: @classmethod def setup_pokemon_shape_data(cls, name="pkm shp"): - pokemon_shape = PokemonShape.objects.create( name=name, ) @@ -1432,7 +1328,6 @@ class APIData: def setup_pokemon_shape_name_data( cls, pokemon_shape, name="pkm shp nm", awesome_name="pkm shp awsm nm" ): - language = cls.setup_language_data(name="lang for " + name) pokemon_shape_name = PokemonShapeName.objects.create( @@ -1449,7 +1344,6 @@ class APIData: def setup_pokemon_species_form_description_data( cls, pokemon_species=None, description="pkm spcs frm dscr" ): - language = cls.setup_language_data(name="lang for " + description) pokemon_species_form_description = PokemonSpeciesDescription.objects.create( @@ -1463,7 +1357,6 @@ class APIData: def setup_pokemon_species_flavor_text_data( cls, pokemon_species, flavor_text="pkmn spcs flvr txt" ): - version = cls.setup_version_data(name="ver for " + flavor_text) language = cls.setup_language_data(name="lang for " + flavor_text) @@ -1500,7 +1393,6 @@ class APIData: is_mythical=False, order=1, ): - generation = generation or cls.setup_generation_data(name="gen for " + name) growth_rate = growth_rate or cls.setup_growth_rate_data( @@ -1547,7 +1439,6 @@ class APIData: def setup_pokemon_species_name_data( cls, pokemon_species, name="pkmn spcs nm", genus="pkmn spcs gns" ): - language = cls.setup_language_data(name="lang for " + name) pokemon_species_name = PokemonSpeciesName.objects.create( @@ -1559,7 +1450,6 @@ class APIData: @classmethod def setup_pokemon_dex_entry_data(cls, pokemon_species, pokedex, entry_number=100): - dex_number = PokemonDexNumber( pokemon_species=pokemon_species, pokedex=pokedex, @@ -1571,7 +1461,6 @@ class APIData: @classmethod def setup_pokemon_egg_group_data(cls, pokemon_species, egg_group): - pokemon_egg_group = PokemonEggGroup( pokemon_species=pokemon_species, egg_group=egg_group ) @@ -1590,7 +1479,6 @@ class APIData: order=1, is_default=False, ): - pokemon_species = pokemon_species or cls.setup_pokemon_species_data( name="pkmn spcs for " + name ) @@ -1610,7 +1498,6 @@ class APIData: @classmethod def setup_pokemon_game_index_data(cls, pokemon, game_index=0): - version = cls.setup_version_data(name="ver for pkmn gm indx") pokemon_game_index = PokemonGameIndex.objects.create( @@ -1629,7 +1516,6 @@ class APIData: back_default=False, back_shiny=False, ): - sprite_path = "/media/sprites/pokemon/%s.png" sprites = { @@ -1648,7 +1534,6 @@ class APIData: @classmethod def setup_pokemon_form_type_data(cls, pokemon_form, type=None, slot=1): - type = type or cls.setup_type_data(name="tp for pkmn frm") form_type = PokemonFormType(pokemon_form=pokemon_form, type=type, slot=slot) @@ -1668,7 +1553,6 @@ class APIData: form_order=1, is_mega=False, ): - version_group = cls.setup_version_group_data(name="ver grp for " + name) pokemon_form = PokemonForm( @@ -1688,7 +1572,6 @@ class APIData: @classmethod def setup_pokemon_ability_data(cls, pokemon, ability=None, is_hidden=False, slot=1): - ability = ability or cls.setup_ability_data(name="ablty for pkmn") pokemon_ability = PokemonAbility( @@ -1702,7 +1585,6 @@ class APIData: def setup_pokemon_past_ability_data( cls, pokemon, generation, ability=None, is_hidden=False, slot=1 ): - ability = ability or cls.setup_ability_data(name="ablty for pkmn") pokemon_ability_past = PokemonAbilityPast( @@ -1718,7 +1600,6 @@ class APIData: @classmethod def setup_pokemon_stat_data(cls, pokemon, base_stat=10, effort=10): - stat = cls.setup_stat_data(name="stt for pkmn") pokemon_stat = PokemonStat( @@ -1730,7 +1611,6 @@ class APIData: @classmethod def setup_pokemon_type_data(cls, pokemon, type=None, slot=1): - type = type or cls.setup_type_data(name="tp for pkmn") pokemon_type = PokemonType(pokemon=pokemon, type=type, slot=slot) @@ -1740,7 +1620,6 @@ class APIData: @classmethod def setup_pokemon_past_type_data(cls, pokemon, generation, type=None, slot=1): - type = type or cls.setup_type_data(name="tp for pkmn") pokemon_type_past = PokemonTypePast( @@ -1752,7 +1631,6 @@ class APIData: @classmethod def setup_pokemon_item_data(cls, pokemon=None, item=None, version=None, rarity=50): - item = item or cls.setup_item_data(name="itm for pkmn") pokemon = pokemon or cls.setup_pokemon_data(name="pkmn for pkmn") @@ -1768,7 +1646,6 @@ class APIData: @classmethod def setup_pokemon_move_data(cls, pokemon, move, version_group, level=0, order=1): - move_learn_method = cls.setup_move_learn_method_data( name="mv lrn mthd for pkmn" ) @@ -1798,7 +1675,6 @@ class APIData: back_shiny=False, back_shiny_female=False, ): - sprite_path = "/media/sprites/pokemon/%s.png" sprites = { @@ -1826,7 +1702,6 @@ class APIData: # Evolution Data @classmethod def setup_evolution_trigger_data(cls, name="evltn trgr"): - evolution_trigger = EvolutionTrigger.objects.create( name=name, ) @@ -1836,7 +1711,6 @@ class APIData: @classmethod def setup_evolution_trigger_name_data(cls, evolution_trigger, name="evltn trgr nm"): - language = cls.setup_language_data(name="lang for " + name) evolution_trigger_name = EvolutionTriggerName.objects.create( @@ -1848,7 +1722,6 @@ class APIData: @classmethod def setup_evolution_chain_data(cls, baby_trigger_item=None): - evolution_chain = EvolutionChain.objects.create( baby_trigger_item=baby_trigger_item, ) @@ -1879,7 +1752,6 @@ class APIData: needs_overworld_rain=False, turn_upside_down=False, ): - evolved_species = evolved_species or cls.setup_pokemon_species_data( name="pkmn spcs for pkmn evltn" ) @@ -1916,7 +1788,6 @@ class APIData: # Encounter Data @classmethod def setup_encounter_method_data(cls, name="encntr mthd", order=0): - encounter_method = EncounterMethod.objects.create(name=name, order=order) encounter_method.save() @@ -1924,7 +1795,6 @@ class APIData: @classmethod def setup_encounter_method_name_data(cls, encounter_method, name="encntr mthd nm"): - language = cls.setup_language_data(name="lang for " + name) encounter_method_name = EncounterMethodName.objects.create( @@ -1936,7 +1806,6 @@ class APIData: @classmethod def setup_encounter_condition_data(cls, name="encntr cndtn"): - encounter_condition = EncounterCondition.objects.create(name=name) encounter_condition.save() @@ -1946,7 +1815,6 @@ class APIData: def setup_encounter_condition_name_data( cls, encounter_condition, name="encntr cndtn nm" ): - language = cls.setup_language_data(name="lang for " + name) encounter_condition_name = EncounterConditionName.objects.create( @@ -1960,7 +1828,6 @@ class APIData: def setup_encounter_condition_value_data( cls, encounter_condition, name="encntr cndtn vlu", is_default=False ): - encounter_condition_value = EncounterConditionValue.objects.create( encounter_condition=encounter_condition, name=name, is_default=is_default ) @@ -1972,7 +1839,6 @@ class APIData: def setup_encounter_condition_value_name_data( cls, encounter_condition_value, name="encntr cndtn vlu nm" ): - language = cls.setup_language_data(name="lang for " + name) encounter_condition_value_name = EncounterConditionValueName.objects.create( @@ -1988,7 +1854,6 @@ class APIData: def setup_encounter_condition_value_map_data( cls, encounter, encounter_condition_value ): - encounter_condition_value_map = EncounterConditionValue.objects.create( encounter=encounter, encounter_condition_value=encounter_condition_value ) @@ -1998,7 +1863,6 @@ class APIData: @classmethod def setup_encounter_slot_data(cls, encounter_method=None, slot=0, rarity=0): - encounter_method = encounter_method or cls.setup_encounter_method_data( name="encntr mthd for encntr slt" ) @@ -2019,7 +1883,6 @@ class APIData: def setup_location_area_encounter_rate_data( cls, location_area, encounter_method, rate=0 ): - version = cls.setup_version_data(name="ver for lctn area") location_area_encounter_rate = LocationAreaEncounterRate.objects.create( @@ -2042,7 +1905,6 @@ class APIData: min_level=10, max_level=15, ): - location_area = location_area or cls.setup_location_area_data( name="ver for encntr" ) @@ -2068,7 +1930,6 @@ class APIData: # Pal Park Data @classmethod def setup_pal_park_area_data(cls, name="pl prk area"): - pal_park_area = PalParkArea.objects.create(name=name) pal_park_area.save() @@ -2076,7 +1937,6 @@ class APIData: @classmethod def setup_pal_park_area_name_data(cls, pal_park_area, name="pl prk area nm"): - language = cls.setup_language_data(name="lang for " + name) pal_park_area_name = PalParkAreaName.objects.create( @@ -2090,7 +1950,6 @@ class APIData: def setup_pal_park_data( cls, pokemon_species=None, pal_park_area=None, base_score=10, rate=10 ): - pal_park_area = pal_park_area or cls.setup_pal_park_area_data( name="pl prk area" ) @@ -2110,7 +1969,6 @@ class APIData: class APITests(APIData, APITestCase): # Gender Tests def test_gender_api(self): - gender = self.setup_gender_data(name="female") pokemon_species = self.setup_pokemon_species_data( name="pkmn spcs for gndr", gender_rate=8 @@ -2152,7 +2010,6 @@ class APITests(APIData, APITestCase): # Language Tests def test_language_api(self): - language = self.setup_language_data(name="base lang") language_name = self.setup_language_name_data(language, name="base lang name") @@ -2181,7 +2038,6 @@ class APITests(APIData, APITestCase): # Region Tests def test_region_api(self): - region = self.setup_region_data(name="base reg") region_name = self.setup_region_name_data(region, name="base reg name") location = self.setup_location_data(region=region, name="lctn for base rgn") @@ -2235,7 +2091,6 @@ class APITests(APIData, APITestCase): # Generation Tests def test_generation_api(self): - generation = self.setup_generation_data(name="base gen") generation_name = self.setup_generation_name_data( generation, name="base reg name" @@ -2307,7 +2162,6 @@ class APITests(APIData, APITestCase): # Version Tests def test_version_api(self): - version_group = self.setup_version_group_data(name="ver grp for ver") version = self.setup_version_data(name="base ver", version_group=version_group) version_name = self.setup_version_name_data(version, name="base ver name") @@ -2338,7 +2192,6 @@ class APITests(APIData, APITestCase): ) def test_version_group_api(self): - version_group = self.setup_version_group_data(name="base ver grp") move_learn_method = self.setup_move_learn_method_data(name="mv lrn mthd for ") self.setup_version_group_move_learn_method_data( @@ -2403,7 +2256,6 @@ class APITests(APIData, APITestCase): # Egg Group Tests def test_egg_group_api(self): - egg_group = self.setup_egg_group_data(name="base egg grp") egg_group_name = self.setup_egg_group_name_data( egg_group, name="base egg grp name" @@ -2440,7 +2292,6 @@ class APITests(APIData, APITestCase): # Ability Tests def test_ability_api(self): - ability = self.setup_ability_data(name="base ablty") ability_name = self.setup_ability_name_data(ability, name="base ablty name") ability_effect_text = self.setup_ability_effect_text_data( @@ -2554,7 +2405,6 @@ class APITests(APIData, APITestCase): # Item Tests def test_item_attribute_api(self): - # item attribute data item_attribute = self.setup_item_attribute_data(name="base itm attr") item_attribute_name = self.setup_item_attribute_name_data( @@ -2608,7 +2458,6 @@ class APITests(APIData, APITestCase): ) def test_item_category_api(self): - # item category data item_category = self.setup_item_category_data(name="base itm ctgry") item_category_name = self.setup_item_category_name_data( @@ -2655,7 +2504,6 @@ class APITests(APIData, APITestCase): ) def test_item_fling_effect_api(self): - # item category data item_fling_effect = self.setup_item_fling_effect_data(name="base itm flng efct") item_fling_effect_effect_text = self.setup_item_fling_effect_effect_text_data( @@ -2695,7 +2543,6 @@ class APITests(APIData, APITestCase): ) def test_item_pocket_api(self): - # item pocket data item_pocket = self.setup_item_pocket_data(name="base itm pkt") item_pocket_name = self.setup_item_pocket_name_data( @@ -2719,7 +2566,6 @@ class APITests(APIData, APITestCase): ) def test_item_api(self): - item_category = self.setup_item_category_data(name="itm ctgry for base itm") item_fling_effect = self.setup_item_fling_effect_data( name="itm flng efct for base itm" @@ -2871,7 +2717,6 @@ class APITests(APIData, APITestCase): # Berry Tests def test_berry_firmness_api(self): - berry_firmness = self.setup_berry_firmness_data(name="base bry frmns") berry_firmness_name = self.setup_berry_firmness_name_data( berry_firmness, name="base bry frmns nm" @@ -2907,7 +2752,6 @@ class APITests(APIData, APITestCase): ) def test_berry_flavor_api(self): - berry_flavor = self.setup_berry_flavor_data(name="base bry flvr") berry_flavor_name = self.setup_berry_flavor_name_data( berry_flavor, name="base bry flvr nm" @@ -2957,7 +2801,6 @@ class APITests(APIData, APITestCase): ) def test_berry_api(self): - type = self.setup_type_data(name="tp fr base bry") berry = self.setup_berry_data(name="base bry", natural_gift_type=type) berry_flavor = self.setup_berry_flavor_data(name="bry flvr for base bry") @@ -3010,7 +2853,6 @@ class APITests(APIData, APITestCase): # Growth Rate Tests def test_growth_rate_api(self): - # item pocket data growth_rate = self.setup_growth_rate_data(name="base grth rt") growth_rate_description = self.setup_growth_rate_description_data( @@ -3061,7 +2903,6 @@ class APITests(APIData, APITestCase): # Location Tests def test_location_api(self): - location = self.setup_location_data(name="base lctn") location_name = self.setup_location_name_data(location, name="base lctn name") location_game_index = self.setup_location_game_index_data( @@ -3107,7 +2948,6 @@ class APITests(APIData, APITestCase): ) def test_location_area_api(self): - location = self.setup_location_data(name="lctn for base lctn area") location_area = self.setup_location_area_data(location, name="base lctn area") location_area_name = self.setup_location_area_name_data( @@ -3297,7 +3137,6 @@ class APITests(APIData, APITestCase): # Contest Tests def test_contest_type_api(self): - contest_type = self.setup_contest_type_data(name="base cntst tp") contest_type_name = self.setup_contest_type_name_data( contest_type, name="base cntst tp name" @@ -3335,7 +3174,6 @@ class APITests(APIData, APITestCase): ) def test_contest_effect_api(self): - contest_effect = self.setup_contest_effect_data(appeal=10, jam=20) contest_effect_flavor_text = self.setup_contest_effect_flavor_text_data( contest_effect, flavor_text="base cntst efct flvr txt" @@ -3386,7 +3224,6 @@ class APITests(APIData, APITestCase): ) def test_super_contest_effect_api(self): - super_contest_effect = self.setup_super_contest_effect_data(appeal=10) super_contest_effect_flavor_text = ( self.setup_super_contest_effect_flavor_text_data( @@ -3430,7 +3267,6 @@ class APITests(APIData, APITestCase): # Type Tests def test_type_api(self): - type = self.setup_type_data(name="base tp") type_name = self.setup_type_name_data(type, name="base tp nm") type_game_index = self.setup_type_game_index_data(type, game_index=10) @@ -3690,7 +3526,6 @@ class APITests(APIData, APITestCase): # Pokedex Tests def test_pokedex_api(self): - pokedex = self.setup_pokedex_data(name="base pkdx") pokedex_name = self.setup_pokedex_name_data(pokedex, name="base pkdx name") pokedex_description = self.setup_pokedex_description_data( @@ -3757,7 +3592,6 @@ class APITests(APIData, APITestCase): # Move Tests def test_move_ailment_api(self): - move_ailment = self.setup_move_ailment_data(name="base mv almnt") move_ailment_name = self.setup_move_ailment_name_data( move_ailment, name="base mv almnt name" @@ -3794,7 +3628,6 @@ class APITests(APIData, APITestCase): ) def test_move_battle_style_api(self): - move_battle_style = self.setup_move_battle_style_data(name="base mv btl stl") move_battle_style_name = self.setup_move_battle_style_name_data( move_battle_style, name="base mv btl stl name" @@ -3823,7 +3656,6 @@ class APITests(APIData, APITestCase): ) def test_move_category_api(self): - move_category = self.setup_move_category_data(name="base mv ctgry") move_category_description = self.setup_move_category_description_data( move_category, description="base mv ctgry description" @@ -3863,7 +3695,6 @@ class APITests(APIData, APITestCase): ) def test_move_damage_class_api(self): - move_damage_class = self.setup_move_damage_class_data(name="base mv dmg cls") move_damage_class_name = self.setup_move_damage_class_name_data( move_damage_class, name="base mv dmg cls nm" @@ -3919,7 +3750,6 @@ class APITests(APIData, APITestCase): ) def test_move_learn_method_api(self): - move_learn_method = self.setup_move_learn_method_data(name="base mv lrn mthd") move_learn_method_name = self.setup_move_learn_method_name_data( move_learn_method, name="base mv lrn mthd nm" @@ -3978,7 +3808,6 @@ class APITests(APIData, APITestCase): ) def test_move_target_api(self): - move_target = self.setup_move_target_data(name="base mv trgt") move_target_name = self.setup_move_target_name_data( move_target, name="base mv trgt nm" @@ -4028,7 +3857,6 @@ class APITests(APIData, APITestCase): ) def test_move_api(self): - move_effect = self.setup_move_effect_data() move_effect_effect_text = self.setup_move_effect_effect_text_data(move_effect) move = self.setup_move_data(name="base mv", move_effect=move_effect) @@ -4293,7 +4121,6 @@ class APITests(APIData, APITestCase): # Stat Tests def test_stat_api(self): - stat = self.setup_stat_data(name="base stt") stat_name = self.setup_stat_name_data(stat, name="base stt name") increase_move = self.setup_move_data(name="incrs mv for base stt") @@ -4389,7 +4216,6 @@ class APITests(APIData, APITestCase): ) def test_pokeathlon_stat_api(self): - pokeathlon_stat = self.setup_pokeathlon_stat_data(name="base pkathln stt") pokeathlon_stat_name = self.setup_pokeathlon_stat_name_data( pokeathlon_stat, name="base pkathln stt name" @@ -4419,7 +4245,6 @@ class APITests(APIData, APITestCase): # Characteristic Tests def test_characteristic_api(self): - characteristic = self.setup_characteristic_data(gene_mod_5=5) characteristic_description = self.setup_characteristic_description_data( characteristic, description="base char desc" @@ -4474,7 +4299,6 @@ class APITests(APIData, APITestCase): # Nature Tests def test_nature_api(self): - hates_flavor = self.setup_berry_flavor_data(name="hts flvr for base ntr") likes_flavor = self.setup_berry_flavor_data(name="lks flvr for base ntr") decreased_stat = self.setup_stat_data(name="dcrs stt for base ntr") @@ -4579,7 +4403,6 @@ class APITests(APIData, APITestCase): # Pokemon Tests def test_pokemon_habitat_api(self): - pokemon_habitat = self.setup_pokemon_habitat_data(name="base pkmn hbtt trgr") pokemon_habitat_name = self.setup_pokemon_habitat_name_data( pokemon_habitat, name="base pkmn hbtt name" @@ -4619,7 +4442,6 @@ class APITests(APIData, APITestCase): ) def test_pokemon_color_api(self): - pokemon_color = self.setup_pokemon_color_data(name="base pkmn clr trgr") pokemon_color_name = self.setup_pokemon_color_name_data( pokemon_color, name="base pkmn clr name" @@ -4659,7 +4481,6 @@ class APITests(APIData, APITestCase): ) def test_pokemon_shape_api(self): - pokemon_shape = self.setup_pokemon_shape_data(name="base pkmn shp trgr") pokemon_shape_name = self.setup_pokemon_shape_name_data( pokemon_shape, name="base pkmn shp name" @@ -4714,7 +4535,6 @@ class APITests(APIData, APITestCase): ) def test_pokemon_species_api(self): - evolves_from_species = self.setup_pokemon_species_data( name="evolves from pkmn spcs" ) @@ -4948,7 +4768,6 @@ class APITests(APIData, APITestCase): ) def test_pokemon_api(self): - pokemon_species = self.setup_pokemon_species_data( name="pkmn spcs for base pkmn" ) @@ -5216,7 +5035,6 @@ class APITests(APIData, APITestCase): self.assertEqual(response.data["sprites"]["back_default"], None) def test_pokemon_form_api(self): - pokemon_species = self.setup_pokemon_species_data() pokemon = self.setup_pokemon_data(pokemon_species=pokemon_species) pokemon_form = self.setup_pokemon_form_data( @@ -5279,7 +5097,6 @@ class APITests(APIData, APITestCase): # Evolution test def test_evolution_trigger_api(self): - evolution_trigger = self.setup_evolution_trigger_data(name="base evltn trgr") evolution_trigger_name = self.setup_evolution_trigger_name_data( evolution_trigger, name="base evltn trgr name" @@ -5322,7 +5139,6 @@ class APITests(APIData, APITestCase): ) def test_evolution_chain_api(self): - baby_trigger_item = self.setup_item_data(name="bby itm for evo chn") evolution_chain = self.setup_evolution_chain_data( baby_trigger_item=baby_trigger_item @@ -5484,7 +5300,6 @@ class APITests(APIData, APITestCase): # verifies that the wurmple evolution chain is serialized correctly def test_evolution_chain_api_wurmple_bugfix(self): - # set up wurmple-like evolution chain evolution_chain = self.setup_evolution_chain_data() @@ -5550,7 +5365,6 @@ class APITests(APIData, APITestCase): # Encounter Tests def test_encounter_method_api(self): - encounter_method = self.setup_encounter_method_data(name="base encntr mthd") encounter_method_name = self.setup_encounter_method_name_data( encounter_method, name="base encntr mthd name" @@ -5580,7 +5394,6 @@ class APITests(APIData, APITestCase): ) def test_encounter_condition_value_api(self): - encounter_condition = self.setup_encounter_condition_data( name="encntr cndtn for base encntr cndtn vlu" ) @@ -5626,7 +5439,6 @@ class APITests(APIData, APITestCase): ) def test_encounter_condition_api(self): - encounter_condition = self.setup_encounter_condition_data( name="base encntr cndtn" ) @@ -5675,7 +5487,6 @@ class APITests(APIData, APITestCase): # Pal Park Tests def test_pal_park_area_api(self): - pal_park_area = self.setup_pal_park_area_data(name="base pl prk area") pal_park_area_name = self.setup_pal_park_area_name_data( pal_park_area, name="base pl prk area nm" @@ -5725,7 +5536,6 @@ class APITests(APIData, APITestCase): # ID Range Tests def test_id_range_api(self): - response = self.client.get("{}/pokemon/{}/".format(API_V2, 2147483648)) self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) diff --git a/test-requirements.txt b/test-requirements.txt index 1bbc1f77..6ebf43ee 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,4 +2,4 @@ pylint===2.8.2 pylint-django===2.4.4 astroid==2.5.6 -black==22.3.0 +black==23.11.0 From 8ba6f94c0cef7436a766f22943885c9f3e68f1a3 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Wed, 8 Nov 2023 11:11:56 +0100 Subject: [PATCH 2/2] refactor/fix: format/sprite test --- pokemon_v2/tests.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pokemon_v2/tests.py b/pokemon_v2/tests.py index 456d5501..994a51f4 100644 --- a/pokemon_v2/tests.py +++ b/pokemon_v2/tests.py @@ -6,7 +6,6 @@ from pokemon_v2.models import * # pylint: disable=redefined-builtin TEST_HOST = "http://testserver" -MEDIA_HOST = "https://raw.githubusercontent.com/PokeAPI/sprites/master/" API_V2 = "/api/v2" @@ -313,7 +312,7 @@ class APIData: @classmethod def setup_item_sprites_data(cls, item, default=True): - sprite_path = "/media/sprites/items/%s.png" + sprite_path = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/%s.png" sprites = { "default": sprite_path % item.id if default else None, @@ -1516,7 +1515,7 @@ class APIData: back_default=False, back_shiny=False, ): - sprite_path = "/media/sprites/pokemon/%s.png" + sprite_path = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/%s.png" sprites = { "front_default": sprite_path % pokemon_form.id if front_default else None, @@ -1675,7 +1674,7 @@ class APIData: back_shiny=False, back_shiny_female=False, ): - sprite_path = "/media/sprites/pokemon/%s.png" + sprite_path = "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/%s.png" sprites = { "front_default": sprite_path % pokemon.id if front_default else None, @@ -2712,7 +2711,7 @@ class APITests(APIData, APITestCase): # sprites self.assertEqual( response.data["sprites"]["default"], - "{}{}".format(MEDIA_HOST, sprites_data["default"].replace("/media/", "")), + "{}".format(sprites_data["default"]), ) # Berry Tests @@ -5028,9 +5027,7 @@ class APITests(APIData, APITestCase): # sprite params self.assertEqual( response.data["sprites"]["front_default"], - "{}{}".format( - MEDIA_HOST, sprites_data["front_default"].replace("/media/", "") - ), + "{}".format(sprites_data["front_default"]), ) self.assertEqual(response.data["sprites"]["back_default"], None) @@ -5080,9 +5077,7 @@ class APITests(APIData, APITestCase): # sprite params self.assertEqual( response.data["sprites"]["front_default"], - "{}{}".format( - MEDIA_HOST, sprites_data["front_default"].replace("/media/", "") - ), + "{}".format(sprites_data["front_default"]), ) self.assertEqual(response.data["sprites"]["back_default"], None) # type params