mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 03:13:06 +00:00
Linting for the entire project
This commit is contained in:
parent
3867a3bb8d
commit
341b635332
8 changed files with 482 additions and 448 deletions
6
Makefile
6
Makefile
|
@ -1,6 +1,12 @@
|
|||
install:
|
||||
pip install -r requirements.txt
|
||||
|
||||
dev-install:
|
||||
pip install -r test-requirements.txt
|
||||
|
||||
lint:
|
||||
flake8 .
|
||||
|
||||
setup:
|
||||
python manage.py migrate --settings=config.local
|
||||
python manage.py loaddata dev-data.json --settings=config.local
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
dependencies:
|
||||
override:
|
||||
- pip install -r requirements.txt
|
||||
- pip install -r test-requirements.txt
|
||||
|
||||
test:
|
||||
override:
|
||||
- make lint
|
||||
- make test
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
from .models import * # NOQA
|
||||
|
||||
admin.site.register(Ability)
|
||||
admin.site.register(AbilityName)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from __future__ import unicode_literals
|
||||
from rest_framework import viewsets
|
||||
from django.shortcuts import get_object_or_404
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
from .models import * # NOQA
|
||||
from .serializers import * # NOQA
|
||||
import re
|
||||
from hits.models import ResourceView
|
||||
|
||||
|
@ -21,7 +21,7 @@ class ListOrDetailSerialRelation():
|
|||
list_serializer_class = None
|
||||
|
||||
def get_serializer_class(self):
|
||||
if (self.action == 'list' and self.list_serializer_class != None):
|
||||
if (self.action == 'list' and self.list_serializer_class is not None):
|
||||
return self.list_serializer_class
|
||||
return self.serializer_class
|
||||
|
||||
|
@ -51,14 +51,17 @@ class NameOrIdRetrieval():
|
|||
|
||||
return resp
|
||||
|
||||
|
||||
class IncrementingReadOnlyModelViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
|
||||
def retrieve(self, request, *args, **kwargs):
|
||||
ResourceView.objects.increment_view_count(version=2)
|
||||
return super(IncrementingReadOnlyModelViewSet, self).retrieve(self, request, *args, **kwargs)
|
||||
return super(
|
||||
IncrementingReadOnlyModelViewSet, self).retrieve(self, request, *args, **kwargs)
|
||||
|
||||
|
||||
class PokeapiCommonViewset(ListOrDetailSerialRelation, NameOrIdRetrieval, IncrementingReadOnlyModelViewSet):
|
||||
class PokeapiCommonViewset(ListOrDetailSerialRelation,
|
||||
NameOrIdRetrieval, IncrementingReadOnlyModelViewSet):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -86,6 +89,7 @@ class BerryFirmnessResource(PokeapiCommonViewset):
|
|||
serializer_class = BerryFirmnessDetailSerializer
|
||||
list_serializer_class = BerryFirmnessSummarySerializer
|
||||
|
||||
|
||||
class BerryFlavorResource(PokeapiCommonViewset):
|
||||
|
||||
queryset = BerryFlavor.objects.all()
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.db import models
|
|||
# ABSTRACT MODELS #
|
||||
#####################
|
||||
|
||||
|
||||
class HasAbility(models.Model):
|
||||
|
||||
ability = models.ForeignKey('Ability', blank=True, null=True, related_name="%(class)s")
|
||||
|
@ -15,7 +16,8 @@ class HasAbility(models.Model):
|
|||
|
||||
class HasCharacteristic(models.Model):
|
||||
|
||||
characteristic = models.ForeignKey('Characteristic', blank=True, null=True, related_name="%(class)s")
|
||||
characteristic = models.ForeignKey(
|
||||
'Characteristic', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -23,7 +25,8 @@ class HasCharacteristic(models.Model):
|
|||
|
||||
class HasContestType(models.Model):
|
||||
|
||||
contest_type = models.ForeignKey('ContestType', blank=True, null=True, related_name="%(class)s")
|
||||
contest_type = models.ForeignKey(
|
||||
'ContestType', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -31,7 +34,8 @@ class HasContestType(models.Model):
|
|||
|
||||
class HasContestEffect(models.Model):
|
||||
|
||||
contest_effect = models.ForeignKey('ContestEffect', blank=True, null=True, related_name="%(class)s")
|
||||
contest_effect = models.ForeignKey(
|
||||
'ContestEffect', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -39,7 +43,8 @@ class HasContestEffect(models.Model):
|
|||
|
||||
class HasSuperContestEffect(models.Model):
|
||||
|
||||
super_contest_effect = models.ForeignKey('SuperContestEffect', blank = True, null = True, related_name="%(class)s")
|
||||
super_contest_effect = models.ForeignKey(
|
||||
'SuperContestEffect', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -55,7 +60,8 @@ class HasDescription(models.Model):
|
|||
|
||||
class HasGender(models.Model):
|
||||
|
||||
gender = models.ForeignKey('Gender', blank=True, null=True, related_name="%(class)s")
|
||||
gender = models.ForeignKey(
|
||||
'Gender', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -71,7 +77,8 @@ class HasEffect(models.Model):
|
|||
|
||||
class HasEggGroup(models.Model):
|
||||
|
||||
egg_group = models.ForeignKey('EggGroup', blank=True, null=True, related_name="%(class)s")
|
||||
egg_group = models.ForeignKey(
|
||||
'EggGroup', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -79,7 +86,8 @@ class HasEggGroup(models.Model):
|
|||
|
||||
class HasEncounterMethod(models.Model):
|
||||
|
||||
encounter_method = models.ForeignKey('EncounterMethod', blank=True, null=True, related_name="%(class)s")
|
||||
encounter_method = models.ForeignKey(
|
||||
'EncounterMethod', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -87,7 +95,8 @@ class HasEncounterMethod(models.Model):
|
|||
|
||||
class HasEncounterCondition(models.Model):
|
||||
|
||||
encounter_condition = models.ForeignKey('EncounterCondition', blank=True, null=True, related_name="%(class)s")
|
||||
encounter_condition = models.ForeignKey(
|
||||
'EncounterCondition', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -95,7 +104,8 @@ class HasEncounterCondition(models.Model):
|
|||
|
||||
class HasEvolutionTrigger(models.Model):
|
||||
|
||||
evolution_trigger = models.ForeignKey('EvolutionTrigger', blank=True, null=True, related_name="%(class)s")
|
||||
evolution_trigger = models.ForeignKey(
|
||||
'EvolutionTrigger', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -111,7 +121,8 @@ class HasFlavorText(models.Model):
|
|||
|
||||
class HasFlingEffect(models.Model):
|
||||
|
||||
item_fling_effect = models.ForeignKey('ItemFlingEffect', blank=True, null=True, related_name="%(class)s")
|
||||
item_fling_effect = models.ForeignKey(
|
||||
'ItemFlingEffect', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -151,7 +162,8 @@ class HasItem(models.Model):
|
|||
|
||||
class HasItemAttribute(models.Model):
|
||||
|
||||
item_attribute = models.ForeignKey('ItemAttribute', blank=True, null=True, related_name="%(class)s")
|
||||
item_attribute = models.ForeignKey(
|
||||
'ItemAttribute', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -159,7 +171,8 @@ class HasItemAttribute(models.Model):
|
|||
|
||||
class HasItemCategory(models.Model):
|
||||
|
||||
item_category = models.ForeignKey('ItemCategory', blank=True, null=True, related_name="%(class)s")
|
||||
item_category = models.ForeignKey(
|
||||
'ItemCategory', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -167,7 +180,8 @@ class HasItemCategory(models.Model):
|
|||
|
||||
class HasItemPocket(models.Model):
|
||||
|
||||
item_pocket = models.ForeignKey('ItemPocket', blank=True, null=True, related_name="%(class)s")
|
||||
item_pocket = models.ForeignKey(
|
||||
'ItemPocket', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -175,7 +189,8 @@ class HasItemPocket(models.Model):
|
|||
|
||||
class HasLanguage(models.Model):
|
||||
|
||||
language = models.ForeignKey('Language', blank = True, null = True, related_name="%(class)s_language")
|
||||
language = models.ForeignKey(
|
||||
'Language', blank=True, null=True, related_name="%(class)s_language")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -191,7 +206,8 @@ class HasLocation(models.Model):
|
|||
|
||||
class HasLocationArea(models.Model):
|
||||
|
||||
location_area = models.ForeignKey('LocationArea', blank = True, null = True, related_name="%(class)s")
|
||||
location_area = models.ForeignKey(
|
||||
'LocationArea', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -199,7 +215,8 @@ class HasLocationArea(models.Model):
|
|||
|
||||
class HasMetaAilment(models.Model):
|
||||
|
||||
move_meta_ailment = models.ForeignKey('MoveMetaAilment', blank = True, null = True, related_name="%(class)s")
|
||||
move_meta_ailment = models.ForeignKey(
|
||||
'MoveMetaAilment', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -207,7 +224,8 @@ class HasMetaAilment(models.Model):
|
|||
|
||||
class HasMetaCategory(models.Model):
|
||||
|
||||
move_meta_category = models.ForeignKey('MoveMetaCategory', blank = True, null = True, related_name="%(class)s")
|
||||
move_meta_category = models.ForeignKey(
|
||||
'MoveMetaCategory', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -223,7 +241,8 @@ class HasMove(models.Model):
|
|||
|
||||
class HasMoveDamageClass(models.Model):
|
||||
|
||||
move_damage_class = models.ForeignKey('MoveDamageClass', blank = True, null = True, related_name="%(class)s")
|
||||
move_damage_class = models.ForeignKey(
|
||||
'MoveDamageClass', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -247,7 +266,8 @@ class HasMoveAttribute(models.Model):
|
|||
|
||||
class HasMoveTarget(models.Model):
|
||||
|
||||
move_target = models.ForeignKey('MoveTarget', blank = True, null = True, related_name="%(class)s")
|
||||
move_target = models.ForeignKey(
|
||||
'MoveTarget', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -279,7 +299,8 @@ class HasOrder(models.Model):
|
|||
|
||||
class HasPokeathlonStat(models.Model):
|
||||
|
||||
pokeathlon_stat = models.ForeignKey('PokeathlonStat', blank=True, null=True, related_name="%(class)s")
|
||||
pokeathlon_stat = models.ForeignKey(
|
||||
'PokeathlonStat', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -303,7 +324,8 @@ class HasPokemon(models.Model):
|
|||
|
||||
class HasPokemonColor(models.Model):
|
||||
|
||||
pokemon_color = models.ForeignKey('PokemonColor', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_color = models.ForeignKey(
|
||||
'PokemonColor', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -311,7 +333,8 @@ class HasPokemonColor(models.Model):
|
|||
|
||||
class HasPokemonForm(models.Model):
|
||||
|
||||
pokemon_form = models.ForeignKey('PokemonForm', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_form = models.ForeignKey(
|
||||
'PokemonForm', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -319,7 +342,8 @@ class HasPokemonForm(models.Model):
|
|||
|
||||
class HasPokemonHabitat(models.Model):
|
||||
|
||||
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_habitat = models.ForeignKey(
|
||||
'PokemonHabitat', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -328,7 +352,8 @@ class HasPokemonHabitat(models.Model):
|
|||
# HasPokemonMoveMethod
|
||||
class HasMoveLearnMethod(models.Model):
|
||||
|
||||
move_learn_method = models.ForeignKey('MoveLearnMethod', blank=True, null=True, related_name="%(class)s")
|
||||
move_learn_method = models.ForeignKey(
|
||||
'MoveLearnMethod', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -336,7 +361,8 @@ class HasMoveLearnMethod(models.Model):
|
|||
|
||||
class HasPokemonShape(models.Model):
|
||||
|
||||
pokemon_shape = models.ForeignKey('PokemonShape', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_shape = models.ForeignKey(
|
||||
'PokemonShape', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -344,7 +370,8 @@ class HasPokemonShape(models.Model):
|
|||
|
||||
class HasPokemonSpecies(models.Model):
|
||||
|
||||
pokemon_species = models.ForeignKey('PokemonSpecies', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_species = models.ForeignKey(
|
||||
'PokemonSpecies', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -392,7 +419,8 @@ class HasVersion(models.Model):
|
|||
|
||||
class HasVersionGroup(models.Model):
|
||||
|
||||
version_group = models.ForeignKey('VersionGroup', blank=True, null=True, related_name="%(class)s")
|
||||
version_group = models.ForeignKey(
|
||||
'VersionGroup', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -435,12 +463,12 @@ class VersionGroup(HasName, HasGeneration, HasOrder):
|
|||
class VersionGroupRegion(HasVersionGroup, HasRegion):
|
||||
pass
|
||||
|
||||
|
||||
# VersionGroupPokemonMoveMethod
|
||||
class VersionGroupMoveLearnMethod(HasVersionGroup, HasMoveLearnMethod):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
#####################
|
||||
# LANGUAGE MODELS #
|
||||
#####################
|
||||
|
@ -456,8 +484,8 @@ class Language(HasName, HasOrder):
|
|||
|
||||
class LanguageName(IsName):
|
||||
|
||||
local_language = models.ForeignKey('Language', blank = True, null = True, related_name="locallanguage")
|
||||
|
||||
local_language = models.ForeignKey(
|
||||
'Language', blank=True, null=True, related_name="locallanguage")
|
||||
|
||||
|
||||
#######################
|
||||
|
@ -473,7 +501,6 @@ class GenerationName(IsName, HasGeneration):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# REGION MODELS #
|
||||
###################
|
||||
|
@ -486,7 +513,6 @@ class RegionName(IsName, HasRegion):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
####################
|
||||
# ABILITY MODELS #
|
||||
####################
|
||||
|
@ -514,8 +540,8 @@ class AbilityChange(HasAbility, HasVersionGroup):
|
|||
|
||||
class AbilityChangeEffectText(HasLanguage, HasEffect):
|
||||
|
||||
ability_change = models.ForeignKey(AbilityChange, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
ability_change = models.ForeignKey(
|
||||
AbilityChange, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
#################
|
||||
|
@ -543,7 +569,6 @@ class TypeEfficacy(models.Model):
|
|||
damage_factor = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# STAT MODELS #
|
||||
#################
|
||||
|
@ -559,7 +584,6 @@ class StatName(IsName, HasStat):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# CHARACTERISTIC MODELS #
|
||||
###########################
|
||||
|
@ -573,7 +597,6 @@ class CharacteristicDescription(HasCharacteristic, IsDescription):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# EGG GROUP MODELS #
|
||||
######################
|
||||
|
@ -586,7 +609,6 @@ class EggGroupName(IsName, HasEggGroup):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# ITEM MODELS #
|
||||
#################
|
||||
|
@ -659,7 +681,6 @@ class ItemSprites(HasItem):
|
|||
sprites = models.CharField(max_length=500)
|
||||
|
||||
|
||||
|
||||
####################
|
||||
# CONTEST MODELS #
|
||||
####################
|
||||
|
@ -697,7 +718,6 @@ class ContestCombo(models.Model):
|
|||
second_move = models.ForeignKey('Move', blank=True, null=True, related_name='second_move')
|
||||
|
||||
|
||||
|
||||
##################
|
||||
# BERRY MODELS #
|
||||
##################
|
||||
|
@ -708,12 +728,14 @@ class BerryFirmness(HasName):
|
|||
|
||||
class BerryFirmnessName(IsName):
|
||||
|
||||
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True, related_name="%(class)s")
|
||||
berry_firmness = models.ForeignKey(
|
||||
BerryFirmness, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
class Berry(HasName, HasItem):
|
||||
|
||||
berry_firmness = models.ForeignKey(BerryFirmness, blank=True, null=True, related_name="%(class)s")
|
||||
berry_firmness = models.ForeignKey(
|
||||
BerryFirmness, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
natural_gift_power = models.IntegerField()
|
||||
|
||||
|
@ -737,9 +759,12 @@ way it was handled in the veekun data set. Berry Flavor here
|
|||
does not match the csv table. Berry Flavor Map
|
||||
is a table fabricated just to suit this project.
|
||||
"""
|
||||
|
||||
|
||||
class BerryFlavor(HasName):
|
||||
|
||||
contest_type = models.OneToOneField('ContestType', blank=True, null=True, related_name="%(class)s")
|
||||
contest_type = models.OneToOneField(
|
||||
'ContestType', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
class BerryFlavorName(IsName):
|
||||
|
@ -756,7 +781,6 @@ class BerryFlavorMap(models.Model):
|
|||
potency = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
########################
|
||||
# GROWTH RATE MODELS #
|
||||
########################
|
||||
|
@ -770,7 +794,6 @@ class GrowthRateDescription(HasGrowthRate, IsDescription):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# NATURE MODELS #
|
||||
###################
|
||||
|
@ -781,9 +804,11 @@ class Nature(HasName):
|
|||
|
||||
increased_stat = models.ForeignKey(Stat, blank=True, null=True, related_name='increased')
|
||||
|
||||
hates_flavor = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'hates_flavor')
|
||||
hates_flavor = models.ForeignKey(
|
||||
BerryFlavor, blank=True, null=True, related_name='hates_flavor')
|
||||
|
||||
likes_flavor = models.ForeignKey(BerryFlavor, blank = True, null = True, related_name = 'likes_flavor')
|
||||
likes_flavor = models.ForeignKey(
|
||||
BerryFlavor, blank=True, null=True, related_name='likes_flavor')
|
||||
|
||||
game_index = models.IntegerField()
|
||||
|
||||
|
@ -799,14 +824,14 @@ class NaturePokeathlonStat(HasNature, HasPokeathlonStat):
|
|||
|
||||
class NatureBattleStylePreference(HasNature):
|
||||
|
||||
move_battle_style = models.ForeignKey('MoveBattleStyle', blank = True, null = True, related_name="%(class)s")
|
||||
move_battle_style = models.ForeignKey(
|
||||
'MoveBattleStyle', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
low_hp_preference = models.IntegerField()
|
||||
|
||||
high_hp_preference = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
#####################
|
||||
# LOCATION MODELS #
|
||||
#####################
|
||||
|
@ -836,7 +861,6 @@ class LocationAreaEncounterRate(HasEncounterMethod, HasLocationArea, HasVersion)
|
|||
rate = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ENCOUNTER MODELS #
|
||||
######################
|
||||
|
@ -880,7 +904,8 @@ class EncounterConditionValue(HasEncounterCondition, HasName):
|
|||
|
||||
class EncounterConditionValueName(IsName):
|
||||
|
||||
encounter_condition_value = models.ForeignKey(EncounterConditionValue, blank = True, null = True, related_name="%(class)s")
|
||||
encounter_condition_value = models.ForeignKey(
|
||||
EncounterConditionValue, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
class EncounterConditionValueMap(models.Model):
|
||||
|
@ -890,12 +915,13 @@ class EncounterConditionValueMap(models.Model):
|
|||
encounter_condition_value = models.ForeignKey(EncounterConditionValue, blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# MOVE MODELS #
|
||||
#################
|
||||
|
||||
class Move(HasName, HasGeneration, HasType, HasMoveDamageClass, HasMoveEffect, HasMoveTarget, HasContestType, HasContestEffect, HasSuperContestEffect):
|
||||
class Move(
|
||||
HasName, HasGeneration, HasType, HasMoveDamageClass, HasMoveEffect,
|
||||
HasMoveTarget, HasContestType, HasContestEffect, HasSuperContestEffect):
|
||||
|
||||
power = models.IntegerField(blank=True, null=True)
|
||||
|
||||
|
@ -908,7 +934,6 @@ class Move(HasName, HasGeneration, HasType, HasMoveDamageClass, HasMoveEffect, H
|
|||
move_effect_chance = models.IntegerField(blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
class MoveName(HasMove, IsName):
|
||||
pass
|
||||
|
||||
|
@ -928,7 +953,6 @@ class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
|
|||
move_effect_chance = models.IntegerField(blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# MOVE DAMAGE CLASS MODELS #
|
||||
##############################
|
||||
|
@ -936,14 +960,15 @@ class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
|
|||
class MoveDamageClass(HasName):
|
||||
pass
|
||||
|
||||
|
||||
class MoveDamageClassName(HasMoveDamageClass, IsName):
|
||||
pass
|
||||
|
||||
|
||||
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
##############################
|
||||
# MOVE BATTLE STYLE MODELS #
|
||||
##############################
|
||||
|
@ -954,8 +979,8 @@ class MoveBattleStyle(HasName):
|
|||
|
||||
class MoveBattleStyleName(IsName):
|
||||
|
||||
move_battle_style = models.ForeignKey(MoveBattleStyle, blank = True, null = True, related_name="%(class)s")
|
||||
|
||||
move_battle_style = models.ForeignKey(
|
||||
MoveBattleStyle, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
########################
|
||||
|
@ -976,8 +1001,8 @@ class MoveEffectChange(HasMoveEffect, HasVersionGroup):
|
|||
|
||||
class MoveEffectChangeEffectText(HasLanguage, HasEffect):
|
||||
|
||||
move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True, related_name="%(class)s")
|
||||
|
||||
move_effect_change = models.ForeignKey(
|
||||
'MoveEffectChange', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
################################
|
||||
|
@ -1000,7 +1025,6 @@ class MoveAttributeMap(HasMove, HasMoveAttribute):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
########################
|
||||
# MOVE TARGET MODELS #
|
||||
########################
|
||||
|
@ -1017,7 +1041,6 @@ class MoveTargetDescription(HasMoveTarget, IsDescription):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# MOVE META MODELS #
|
||||
######################
|
||||
|
@ -1068,7 +1091,6 @@ class MoveMetaStatChange(HasMove, HasStat):
|
|||
change = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
# EXPERIENCE MODELS #
|
||||
#######################
|
||||
|
@ -1080,7 +1102,6 @@ class Experience(HasGrowthRate):
|
|||
experience = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# GENDER MODELS #
|
||||
###################
|
||||
|
@ -1089,7 +1110,6 @@ class Gender(HasName):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
####################
|
||||
# MACHINE MODELS #
|
||||
####################
|
||||
|
@ -1103,7 +1123,6 @@ class Machine(HasGrowthRate, HasItem):
|
|||
move = models.ForeignKey(Move, blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
# POKEATHLON MODELS #
|
||||
#######################
|
||||
|
@ -1116,7 +1135,6 @@ class PokeathlonStatName(IsName, HasPokeathlonStat):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
#####################
|
||||
# PAL PARK MODELS #
|
||||
#####################
|
||||
|
@ -1127,19 +1145,20 @@ class PalParkArea(HasName):
|
|||
|
||||
class PalParkAreaName(IsName):
|
||||
|
||||
pal_park_area = models.ForeignKey(PalParkArea, blank = True, null = True, related_name="%(class)s")
|
||||
pal_park_area = models.ForeignKey(
|
||||
PalParkArea, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
class PalPark(HasPokemonSpecies):
|
||||
|
||||
pal_park_area = models.ForeignKey(PalParkArea, blank = True, null = True, related_name="%(class)s")
|
||||
pal_park_area = models.ForeignKey(
|
||||
PalParkArea, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
base_score = models.IntegerField(blank=True, null=True)
|
||||
|
||||
rate = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
##########################
|
||||
# SUPER CONTEST MODELS #
|
||||
##########################
|
||||
|
@ -1160,7 +1179,6 @@ class SuperContestCombo(models.Model):
|
|||
second_move = models.ForeignKey(Move, blank=True, null=True, related_name='second')
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# EVOLUTION MODELS #
|
||||
######################
|
||||
|
@ -1178,7 +1196,6 @@ class EvolutionTriggerName(HasEvolutionTrigger, IsName):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
####################
|
||||
# POKEDEX MODELS #
|
||||
####################
|
||||
|
@ -1200,7 +1217,6 @@ class PokedexVersionGroup(HasPokedex, HasVersionGroup):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
####################
|
||||
# POKEMON MODELS #
|
||||
####################
|
||||
|
@ -1212,7 +1228,8 @@ class PokemonSpecies(HasName, HasGeneration, HasPokemonColor,
|
|||
|
||||
evolution_chain = models.ForeignKey(EvolutionChain, blank=True, null=True)
|
||||
|
||||
pokemon_habitat = models.ForeignKey('PokemonHabitat', blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_habitat = models.ForeignKey(
|
||||
'PokemonHabitat', blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
gender_rate = models.IntegerField()
|
||||
|
||||
|
@ -1281,7 +1298,8 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender):
|
|||
|
||||
evolution_item = models.ForeignKey(Item, blank=True, null=True, related_name='evolution_item')
|
||||
|
||||
evolved_species = models.ForeignKey(PokemonSpecies, related_name="evolved_species", blank=True, null=True)
|
||||
evolved_species = models.ForeignKey(
|
||||
PokemonSpecies, related_name="evolved_species", blank=True, null=True)
|
||||
|
||||
min_level = models.IntegerField(blank=True, null=True)
|
||||
|
||||
|
@ -1303,11 +1321,13 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender):
|
|||
|
||||
relative_physical_stats = models.IntegerField(blank=True, null=True)
|
||||
|
||||
party_species = models.ForeignKey(PokemonSpecies, related_name="party_species", blank=True, null=True)
|
||||
party_species = models.ForeignKey(
|
||||
PokemonSpecies, related_name="party_species", blank=True, null=True)
|
||||
|
||||
party_type = models.ForeignKey(Type, related_name="party_type", blank=True, null=True)
|
||||
|
||||
trade_species = models.ForeignKey(PokemonSpecies, related_name="trade_species", blank=True, null=True)
|
||||
trade_species = models.ForeignKey(
|
||||
PokemonSpecies, related_name="trade_species", blank=True, null=True)
|
||||
|
||||
needs_overworld_rain = models.BooleanField(default=False)
|
||||
|
||||
|
@ -1353,7 +1373,8 @@ class PokemonHabitat(HasName):
|
|||
|
||||
class PokemonHabitatName(IsName):
|
||||
|
||||
pokemon_habitat = models.ForeignKey(PokemonHabitat, blank=True, null=True, related_name="%(class)s")
|
||||
pokemon_habitat = models.ForeignKey(
|
||||
PokemonHabitat, blank=True, null=True, related_name="%(class)s")
|
||||
|
||||
|
||||
class PokemonItem(HasPokemon, HasVersion, HasItem):
|
||||
|
@ -1365,6 +1386,7 @@ class PokemonItem(HasPokemon, HasVersion, HasItem):
|
|||
class MoveLearnMethod(HasName):
|
||||
pass
|
||||
|
||||
|
||||
# PokemonMoveMethodName
|
||||
class MoveLearnMethodName(IsName, HasMoveLearnMethod):
|
||||
pass
|
||||
|
@ -1387,7 +1409,8 @@ class PokemonShapeName(IsName):
|
|||
|
||||
awesome_name = models.CharField(max_length=30)
|
||||
|
||||
pokemon_shape = models.ForeignKey(PokemonShape, blank=True, null=True, related_name="pokemonshapename")
|
||||
pokemon_shape = models.ForeignKey(
|
||||
PokemonShape, blank=True, null=True, related_name="pokemonshapename")
|
||||
|
||||
|
||||
class PokemonStat(HasPokemon, HasStat):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import patterns, include, url
|
||||
from django.views.generic import TemplateView
|
||||
from django.conf.urls import include, url
|
||||
|
||||
#####################################
|
||||
#
|
||||
|
@ -11,7 +10,7 @@ from django.views.generic import TemplateView
|
|||
#####################################
|
||||
|
||||
from rest_framework import routers
|
||||
from pokemon_v2.api import *
|
||||
from pokemon_v2.api import * # NOQA
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
|
||||
|
@ -71,11 +70,5 @@ router.register(r"version-group", VersionGroupResource)
|
|||
###########################
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
url(r'^api/v2/', include(router.urls)),
|
||||
|
||||
# url(r'^.*$',
|
||||
# TemplateView.as_view(template_name='home.html'),
|
||||
# name="home"
|
||||
# )
|
||||
]
|
||||
|
|
4
setup.cfg
Normal file
4
setup.cfg
Normal file
|
@ -0,0 +1,4 @@
|
|||
[flake8]
|
||||
|
||||
exclude=*migrations*
|
||||
max-line-length = 100
|
2
test-requirements.txt
Normal file
2
test-requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
flake8==2.5.4
|
||||
pyflakes==1.0.0
|
Loading…
Reference in a new issue