chore: Configure PyLint and correct code formatting

This commit is contained in:
Charles Marttinen 2018-10-19 20:05:10 -04:00 committed by Charles Marttinen
parent 6bb6611a89
commit 63b4f9040b
14 changed files with 1499 additions and 1489 deletions

View file

@ -7,7 +7,7 @@ extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
ignore=CVS, migrations, docker-compose.py, docker.py
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
@ -67,7 +67,14 @@ disable=missing-docstring,
wildcard-import,
function-redefined,
too-many-ancestors,
too-many-statements
too-many-statements,
unsubscriptable-object,
too-many-locals,
too-many-arguments,
too-many-public-methods,
too-few-public-methods,
duplicate-code,
no-self-use,
# Disabled by default:
@ -204,7 +211,7 @@ argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style.
#argument-rgx=
argument-rgx=[a-z0-9_]{1,30}$
# Naming style matching correct attribute names.
attr-naming-style=snake_case
@ -303,7 +310,7 @@ variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style.
#variable-rgx=
variable-rgx=[a-z0-9_]{1,75}$
[FORMAT]

View file

@ -1,5 +1,5 @@
# Docker settings
from .settings import * # NOQA
from .settings import *
DATABASES = {
'default': {

View file

@ -1,5 +1,5 @@
# Docker settings
from .settings import * # NOQA
from .settings import *
DATABASES = {
'default': {

View file

@ -1,4 +1,4 @@
from .settings import * # NOQA
from .settings import *
DATABASES = {
'default': {

View file

@ -1,6 +1,6 @@
# Production settings
from unipath import Path
import os
from unipath import Path
PROJECT_ROOT = Path(__file__).ancestor(2)

View file

@ -1,7 +1,8 @@
from django.conf.urls import include, url
from pokemon_v2 import urls as pokemon_v2_urls
# pylint: disable=invalid-name
urlpatterns = [
url(r'^', include(pokemon_v2_urls)),
]

View file

@ -1 +1 @@
from .build import * # NOQA
from .build import *

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,14 @@
import re
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.views import APIView
from django.shortcuts import get_object_or_404
from django.http import Http404
import re
from .models import * # NOQA
from .serializers import * # NOQA
from .models import *
from .serializers import *
# pylint: disable=no-member, attribute-defined-outside-init
###########################
# BEHAVIOR ABSTRACTIONS #
@ -33,8 +34,8 @@ class NameOrIdRetrieval():
pk (in this case ID) or by name
"""
idPattern = re.compile("^-?[0-9]+$")
namePattern = re.compile("^[0-9A-Za-z\-\+]+$")
idPattern = re.compile(r"^-?[0-9]+$")
namePattern = re.compile(r"^[0-9A-Za-z\-\+]+$")
def get_object(self):
queryset = self.get_queryset()

View file

@ -782,13 +782,12 @@ class Berry(HasName, HasItem):
smoothness = models.IntegerField()
"""
Berry Flavors are a bit of a hack because their relationship
in terms of flavors to contest types is really awkward the
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.
"""
# Berry Flavors are a bit of a hack because their relationship
# in terms of flavors to contest types is really awkward the
# 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):

View file

@ -1,13 +1,13 @@
from django.urls import reverse
from rest_framework import serializers
from collections import OrderedDict
import json
from django.urls import reverse
from rest_framework import serializers
"""
PokeAPI v2 serializers in order of dependency
"""
# pylint: disable=redefined-builtin
from .models import * # NOQA
# PokeAPI v2 serializers in order of dependency
from .models import *
#########################
@ -497,7 +497,7 @@ class CharacteristicDetailSerializer(serializers.ModelSerializer):
mod = obj.gene_mod_5
values = []
while (mod <= 30):
while mod <= 30:
values.append(mod)
mod += 5
@ -1402,7 +1402,7 @@ class ItemDetailSerializer(serializers.ModelSerializer):
sprites_data = json.loads(sprites_data['sprites'])
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
for key, val in sprites_data.items():
for key in sprites_data:
if sprites_data[key]:
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
@ -2305,7 +2305,7 @@ class PokemonFormDetailSerializer(serializers.ModelSerializer):
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
for key, val in sprites_data.items():
for key in sprites_data:
if sprites_data[key]:
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
@ -2523,7 +2523,7 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
sprites_data = json.loads(sprites_data['sprites'])
host = 'raw.githubusercontent.com/PokeAPI/sprites/master/'
for key, val in sprites_data.items():
for key in sprites_data:
if sprites_data[key]:
sprites_data[key] = 'https://' + host + sprites_data[key].replace('/media/', '')
@ -2538,12 +2538,11 @@ class PokemonDetailSerializer(serializers.ModelSerializer):
method_data = MoveLearnMethodSummarySerializer(
method_objects, many=True, context=self.context).data
'''
Get moves related to this pokemon and pull out unique Move IDs.
Note that it's important to order by the same column we're using to
determine if the entries are unique. Otherwise distinct() will
return apparent duplicates.
'''
# Get moves related to this pokemon and pull out unique Move IDs.
# Note that it's important to order by the same column we're using to
# determine if the entries are unique. Otherwise distinct() will
# return apparent duplicates.
pokemon_moves = PokemonMove.objects.filter(pokemon_id=obj).order_by('move_id')
move_ids = pokemon_moves.values('move_id').distinct()
move_list = []

View file

@ -1,5 +1,5 @@
from django.test import TestCase
from pokemon_v2.models import * # NOQA
from pokemon_v2.models import *
class AbilityTestCase(TestCase):

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,9 @@ from django.conf.urls import include, url
#####################################
from rest_framework import routers
from pokemon_v2.api import * # NOQA
from pokemon_v2.api import *
# pylint: disable=invalid-name
router = routers.DefaultRouter()