Autoformat entire project, tidy up makefile

This commit is contained in:
Paul Hallett 2020-02-18 09:58:07 +13:00 committed by Paul Hallett
parent c7e10bd044
commit d5d55dad7f
17 changed files with 9667 additions and 4956 deletions

View file

@ -8,10 +8,10 @@ jobs:
- checkout
- run:
name: Install deps
command: sudo make install && sudo make dev-install
command: sudo make dev-install
- run:
name: Linting
command: make lint
command: make format-check
- run:
name: Run tests
command: make test

View file

@ -1,29 +1,38 @@
install:
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?# .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
install: # Install base requirements to run project
pip install -r requirements.txt
dev-install:
dev-install: # Install developer requirements + base requirements
pip install -r test-requirements.txt
lint:
pylint config data pokemon_v2 --load-plugins pylint_django
setup:
setup: # Set up the project database
python manage.py migrate --settings=config.local
wipe_db:
wipe_db: # Delete's the project database
rm -rf db.sqlite3
serve:
serve: # Run the project locally
python manage.py runserver --settings=config.local
test:
test: # Run tests
python manage.py test --settings=config.local
clean:
clean: # Remove any pyc files
find . -type f -name '*.pyc' -delete
migrate:
migrate: # run any outstanding migrations
python manage.py migrate --settings=config.local
shell:
shell: # Load a shell
python manage.py shell --settings=config.local
format: # Format the source code
black .
format-check: # Check the source code has been formatted
black . --check

View file

@ -2,13 +2,13 @@
from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pokeapi',
'USER': 'ash',
'PASSWORD': 'pokemon',
'HOST': 'db',
'PORT': 5432,
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "pokeapi",
"USER": "ash",
"PASSWORD": "pokemon",
"HOST": "db",
"PORT": 5432,
}
}
@ -17,9 +17,7 @@ CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://cache:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
}
}

View file

@ -2,13 +2,13 @@
from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pokeapi',
'USER': 'ash',
'PASSWORD': 'pokemon',
'HOST': 'localhost',
'PORT': '',
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "pokeapi",
"USER": "ash",
"PASSWORD": "pokemon",
"HOST": "localhost",
"PORT": "",
}
}
@ -17,9 +17,7 @@ CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
}
}

View file

@ -1,17 +1,13 @@
from .settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(PROJECT_ROOT, "db.sqlite3"),
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache",}}
DEBUG = True
TASTYPIE_FULL_DEBUG = True

View file

@ -8,23 +8,21 @@ DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Paul Hallett', 'paulandrewhallett@gmail.com'),
)
ADMINS = (("Paul Hallett", "paulandrewhallett@gmail.com"),)
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
MANAGERS = ADMINS
BASE_URL = 'http://pokeapi.co'
BASE_URL = "http://pokeapi.co"
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['.pokeapi.co', 'localhost', '127.0.0.1']
ALLOWED_HOSTS = [".pokeapi.co", "localhost", "127.0.0.1"]
TIME_ZONE = 'Europe/London'
TIME_ZONE = "Europe/London"
LANGUAGE_CODE = 'en-gb'
LANGUAGE_CODE = "en-gb"
SITE_ID = 1
@ -40,33 +38,33 @@ USE_L10N = True
USE_TZ = True
# Explicitly define test runner to avoid warning messages on test execution
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
TEST_RUNNER = "django.test.runner.DiscoverRunner"
SECRET_KEY = '4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#'
SECRET_KEY = "4nksdock439320df*(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#"
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"corsheaders.middleware.CorsMiddleware",
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = 'config.urls'
ROOT_URLCONF = "config.urls"
WSGI_APPLICATION = 'config.wsgi.application'
WSGI_APPLICATION = "config.wsgi.application"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pokeapi_co_db',
'USER': 'root',
'PASSWORD': 'pokeapi',
'HOST': 'localhost',
'PORT': '',
'CONN_MAX_AGE': 30
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "pokeapi_co_db",
"USER": "root",
"PASSWORD": "pokeapi",
"HOST": "localhost",
"PORT": "",
"CONN_MAX_AGE": 30,
}
}
@ -74,57 +72,46 @@ CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient",},
}
}
SECRET_KEY = os.environ.get(
'SECRET_KEY',
'ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#')
"SECRET_KEY", "ubx+22!jbo(^x2_scm-o$*py3e@-awu-n^hipkm%2l$sw$&2l#"
)
CUSTOM_APPS = (
'tastypie',
'pokemon_v2',
"tastypie",
"pokemon_v2",
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.humanize',
'corsheaders',
'rest_framework',
'cachalot'
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.admin",
"django.contrib.humanize",
"corsheaders",
"rest_framework",
"cachalot",
) + CUSTOM_APPS
API_LIMIT_PER_PAGE = 1
TASTYPIE_DEFAULT_FORMATS = ['json']
TASTYPIE_DEFAULT_FORMATS = ["json"]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_METHODS = (
'GET'
)
CORS_ALLOW_METHODS = "GET"
CORS_URLS_REGEX = r'^/api/.*$'
CORS_URLS_REGEX = r"^/api/.*$"
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': (
'drf_ujson.renderers.UJSONRenderer',
),
'DEFAULT_PARSER_CLASSES': (
'drf_ujson.renderers.UJSONRenderer',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20,
'PAGINATE_BY': 20
"DEFAULT_RENDERER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",),
"DEFAULT_PARSER_CLASSES": ("drf_ujson.renderers.UJSONRenderer",),
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
"PAGE_SIZE": 20,
"PAGINATE_BY": 20,
}

View file

@ -4,5 +4,5 @@ from pokemon_v2 import urls as pokemon_v2_urls
# pylint: disable=invalid-name
urlpatterns = [
url(r'^', include(pokemon_v2_urls)),
url(r"^", include(pokemon_v2_urls)),
]

View file

@ -14,7 +14,8 @@ from .serializers import *
# BEHAVIOR ABSTRACTIONS #
###########################
class ListOrDetailSerialRelation():
class ListOrDetailSerialRelation:
"""
Mixin to allow association with separate serializers
for list or detail view.
@ -23,12 +24,12 @@ class ListOrDetailSerialRelation():
list_serializer_class = None
def get_serializer_class(self):
if (self.action == 'list' and self.list_serializer_class is not None):
if self.action == "list" and self.list_serializer_class is not None:
return self.list_serializer_class
return self.serializer_class
class NameOrIdRetrieval():
class NameOrIdRetrieval:
"""
Mixin to allow retrieval of resources by
pk (in this case ID) or by name
@ -40,7 +41,7 @@ class NameOrIdRetrieval():
def get_object(self):
queryset = self.get_queryset()
queryset = self.filter_queryset(queryset)
lookup = self.kwargs['pk']
lookup = self.kwargs["pk"]
if self.idPattern.match(lookup):
resp = get_object_or_404(queryset, pk=lookup)
@ -54,8 +55,9 @@ class NameOrIdRetrieval():
return resp
class PokeapiCommonViewset(ListOrDetailSerialRelation,
NameOrIdRetrieval, viewsets.ReadOnlyModelViewSet):
class PokeapiCommonViewset(
ListOrDetailSerialRelation, NameOrIdRetrieval, viewsets.ReadOnlyModelViewSet
):
pass
@ -63,6 +65,7 @@ class PokeapiCommonViewset(ListOrDetailSerialRelation,
# APIS #
##########
class AbilityResource(PokeapiCommonViewset):
queryset = Ability.objects.all()
@ -352,7 +355,7 @@ class PokemonResource(PokeapiCommonViewset):
class PokemonSpeciesResource(PokeapiCommonViewset):
queryset = PokemonSpecies.objects.all().order_by('id')
queryset = PokemonSpecies.objects.all().order_by("id")
serializer_class = PokemonSpeciesDetailSerializer
list_serializer_class = PokemonSpeciesSummarySerializer
@ -415,10 +418,11 @@ class PokemonEncounterView(APIView):
encounter_objects = Encounter.objects.filter(pokemon=pokemon)
area_ids = (encounter_objects
.order_by('location_area')
.distinct('location_area')
.values_list('location_area', flat=True))
area_ids = (
encounter_objects.order_by("location_area")
.distinct("location_area")
.values_list("location_area", flat=True)
)
location_area_objects = LocationArea.objects.filter(pk__in=area_ids)
version_objects = Version.objects
@ -431,10 +435,11 @@ class PokemonEncounterView(APIView):
area_encounters = encounter_objects.filter(location_area_id=area_id)
version_ids = (area_encounters
.order_by('version_id')
.distinct('version_id')
.values_list('version_id', flat=True))
version_ids = (
area_encounters.order_by("version_id")
.distinct("version_id")
.values_list("version_id", flat=True)
)
version_details_list = []
@ -442,40 +447,48 @@ class PokemonEncounterView(APIView):
version = version_objects.get(pk=version_id)
version_encounters = (area_encounters
.filter(version_id=version_id)
.order_by('encounter_slot_id'))
version_encounters = area_encounters.filter(
version_id=version_id
).order_by("encounter_slot_id")
encounters_data = EncounterDetailSerializer(
version_encounters, many=True, context=self.context).data
version_encounters, many=True, context=self.context
).data
max_chance = 0
encounter_details_list = []
for encounter in encounters_data:
slot = EncounterSlot.objects.get(pk=encounter['encounter_slot'])
slot = EncounterSlot.objects.get(pk=encounter["encounter_slot"])
slot_data = EncounterSlotSerializer(slot, context=self.context).data
del encounter['pokemon']
del encounter['encounter_slot']
del encounter['location_area']
del encounter['version']
encounter['chance'] = slot_data['chance']
max_chance += slot_data['chance']
encounter['method'] = slot_data['encounter_method']
del encounter["pokemon"]
del encounter["encounter_slot"]
del encounter["location_area"]
del encounter["version"]
encounter["chance"] = slot_data["chance"]
max_chance += slot_data["chance"]
encounter["method"] = slot_data["encounter_method"]
encounter_details_list.append(encounter)
version_details_list.append({
'version': VersionSummarySerializer(version, context=self.context).data,
'max_chance': max_chance,
'encounter_details': encounter_details_list
})
version_details_list.append(
{
"version": VersionSummarySerializer(
version, context=self.context
).data,
"max_chance": max_chance,
"encounter_details": encounter_details_list,
}
)
encounters_list.append({
'location_area': LocationAreaSummarySerializer(
location_area, context=self.context).data,
'version_details': version_details_list
})
encounters_list.append(
{
"location_area": LocationAreaSummarySerializer(
location_area, context=self.context
).data,
"version_details": version_details_list,
}
)
return Response(encounters_list)

File diff suppressed because it is too large Load diff

View file

@ -4,41 +4,86 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0001_squashed_0002_auto_20160301_1408'),
("pokemon_v2", "0001_squashed_0002_auto_20160301_1408"),
]
operations = [
migrations.CreateModel(
name='ItemSprites',
name="ItemSprites",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('sprites', models.CharField(max_length=500)),
('item', models.ForeignKey(on_delete=models.CASCADE, related_name='itemsprites', blank=True, to='pokemon_v2.Item', null=True)),
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"item",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="itemsprites",
blank=True,
to="pokemon_v2.Item",
null=True,
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
migrations.CreateModel(
name='PokemonFormSprites',
name="PokemonFormSprites",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('sprites', models.CharField(max_length=500)),
('pokemon_form', models.ForeignKey(on_delete=models.CASCADE, related_name='pokemonformsprites', blank=True, to='pokemon_v2.PokemonForm', null=True)),
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"pokemon_form",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="pokemonformsprites",
blank=True,
to="pokemon_v2.PokemonForm",
null=True,
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
migrations.CreateModel(
name='PokemonSprites',
name="PokemonSprites",
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('sprites', models.CharField(max_length=500)),
('pokemon', models.ForeignKey(on_delete=models.CASCADE, related_name='pokemonsprites', blank=True, to='pokemon_v2.Pokemon', null=True)),
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("sprites", models.CharField(max_length=500)),
(
"pokemon",
models.ForeignKey(
on_delete=models.CASCADE,
related_name="pokemonsprites",
blank=True,
to="pokemon_v2.Pokemon",
null=True,
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
]

View file

@ -4,493 +4,493 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pokemon_v2', '0002_itemsprites_pokemonformsprites_pokemonsprites'),
("pokemon_v2", "0002_itemsprites_pokemonformsprites_pokemonsprites"),
]
operations = [
migrations.AlterField(
model_name='ability',
name='name',
model_name="ability",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='abilityname',
name='name',
model_name="abilityname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berry',
name='name',
model_name="berry",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berryfirmness',
name='name',
model_name="berryfirmness",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berryfirmnessname',
name='name',
model_name="berryfirmnessname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berryflavor',
name='name',
model_name="berryflavor",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='berryflavorname',
name='name',
model_name="berryflavorname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='contesttype',
name='name',
model_name="contesttype",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='contesttypename',
name='name',
model_name="contesttypename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='egggroup',
name='name',
model_name="egggroup",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='egggroupname',
name='name',
model_name="egggroupname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encountercondition',
name='name',
model_name="encountercondition",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionname',
name='name',
model_name="encounterconditionname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionvalue',
name='name',
model_name="encounterconditionvalue",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encounterconditionvaluename',
name='name',
model_name="encounterconditionvaluename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encountermethod',
name='name',
model_name="encountermethod",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='encountermethodname',
name='name',
model_name="encountermethodname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='evolutiontrigger',
name='name',
model_name="evolutiontrigger",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='evolutiontriggername',
name='name',
model_name="evolutiontriggername",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='gender',
name='name',
model_name="gender",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='generation',
name='name',
model_name="generation",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='generationname',
name='name',
model_name="generationname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='growthrate',
name='name',
model_name="growthrate",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='item',
name='name',
model_name="item",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemattribute',
name='name',
model_name="itemattribute",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemattributename',
name='name',
model_name="itemattributename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemcategory',
name='name',
model_name="itemcategory",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemcategoryname',
name='name',
model_name="itemcategoryname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemflingeffect',
name='name',
model_name="itemflingeffect",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itemname',
name='name',
model_name="itemname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itempocket',
name='name',
model_name="itempocket",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='itempocketname',
name='name',
model_name="itempocketname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='language',
name='name',
model_name="language",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='languagename',
name='name',
model_name="languagename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='location',
name='name',
model_name="location",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationarea',
name='name',
model_name="locationarea",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationareaname',
name='name',
model_name="locationareaname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='locationname',
name='name',
model_name="locationname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='move',
name='name',
model_name="move",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveattribute',
name='name',
model_name="moveattribute",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='moveattributename',
name='name',
model_name="moveattributename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movebattlestyle',
name='name',
model_name="movebattlestyle",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movebattlestylename',
name='name',
model_name="movebattlestylename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movedamageclass',
name='name',
model_name="movedamageclass",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movedamageclassname',
name='name',
model_name="movedamageclassname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movelearnmethod',
name='name',
model_name="movelearnmethod",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movelearnmethodname',
name='name',
model_name="movelearnmethodname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetaailment',
name='name',
model_name="movemetaailment",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetaailmentname',
name='name',
model_name="movemetaailmentname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movemetacategory',
name='name',
model_name="movemetacategory",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movename',
name='name',
model_name="movename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movetarget',
name='name',
model_name="movetarget",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='movetargetname',
name='name',
model_name="movetargetname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='nature',
name='name',
model_name="nature",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='naturename',
name='name',
model_name="naturename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='palparkarea',
name='name',
model_name="palparkarea",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='palparkareaname',
name='name',
model_name="palparkareaname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokeathlonstat',
name='name',
model_name="pokeathlonstat",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokeathlonstatname',
name='name',
model_name="pokeathlonstatname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedex',
name='name',
model_name="pokedex",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokedexname',
name='name',
model_name="pokedexname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemon',
name='name',
model_name="pokemon",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemoncolor',
name='name',
model_name="pokemoncolor",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemoncolorname',
name='name',
model_name="pokemoncolorname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonform',
name='name',
model_name="pokemonform",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonformname',
name='name',
model_name="pokemonformname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonhabitat',
name='name',
model_name="pokemonhabitat",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonhabitatname',
name='name',
model_name="pokemonhabitatname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonshape',
name='name',
model_name="pokemonshape",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonshapename',
name='name',
model_name="pokemonshapename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspecies',
name='name',
model_name="pokemonspecies",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='pokemonspeciesname',
name='name',
model_name="pokemonspeciesname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='region',
name='name',
model_name="region",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='regionname',
name='name',
model_name="regionname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='stat',
name='name',
model_name="stat",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='statname',
name='name',
model_name="statname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='type',
name='name',
model_name="type",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='typename',
name='name',
model_name="typename",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='version',
name='name',
model_name="version",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versiongroup',
name='name',
model_name="versiongroup",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),
migrations.AlterField(
model_name='versionname',
name='name',
model_name="versionname",
name="name",
field=models.CharField(max_length=100, db_index=True),
preserve_default=True,
),

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,13 +3,8 @@ from pokemon_v2.models import *
class AbilityTestCase(TestCase):
def setUp(self):
Ability.objects.create(
name="Smell",
generation_id=3,
is_main_series=True
)
Ability.objects.create(name="Smell", generation_id=3, is_main_series=True)
def fields_are_valid(self):
smell = Ability.objects.get(name="Smell")

File diff suppressed because it is too large Load diff

View file

@ -70,7 +70,10 @@ router.register(r"version-group", VersionGroupResource)
###########################
urlpatterns = [
url(r'^api/v2/', include(router.urls)),
url(r'^api/v2/pokemon/(?P<pokemon_id>\d+)/encounters',
PokemonEncounterView.as_view(), name='pokemon_encounters')
url(r"^api/v2/", include(router.urls)),
url(
r"^api/v2/pokemon/(?P<pokemon_id>\d+)/encounters",
PokemonEncounterView.as_view(),
name="pokemon_encounters",
),
]

View file

@ -1,3 +1,5 @@
-r requirements.txt
pylint===2.1.1
pylint-django===2.0.2
astroid==2.0.4
black==19.10b0