Skip to content

Commit

Permalink
fix some linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
astynax committed Feb 11, 2021
1 parent 4d6e02f commit 2640f00
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 27 deletions.
4 changes: 2 additions & 2 deletions djaif/book/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ def save_to(self, save_id):
state.items.set(self.items.all())
else:
state = ProgressSave.objects.get(id=save_id)
state.book_page=self.book_page
state.book_page = self.book_page
state.save()
state.items.set(self.items.all())

def load_from(self, save_id):
state = ProgressSave.objects.get(id=save_id)
self.book_page=state.book_page
self.book_page = state.book_page # noqa: WPS601
self.save()
self.items.set(state.items.all())

Expand Down
3 changes: 0 additions & 3 deletions djaif/book/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from django.test import TestCase

# Create your tests here.
9 changes: 5 additions & 4 deletions djaif/book/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from functools import wraps

from graphviz import Digraph

from django.http import FileResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.http import FileResponse
from graphviz import Digraph

from djaif.book import models

Expand Down Expand Up @@ -36,9 +35,11 @@ def view_books(request):
context={'books': models.Book.objects.all()},
)


def view_book(request, book_id):
book = get_object_or_404(models.Book, id=book_id)
assert book.first_page
if not book.first_page:
raise ValueError("Book {0.id} hasn't a first page!")
try:
progress = models.BookProgress.objects.get(
book=book, user=request.user,
Expand Down
15 changes: 0 additions & 15 deletions djaif/urls.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
"""djaif URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
Expand Down
10 changes: 7 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ exclude =
.eggs
*.egg
**/migrations/**
manage.py

ignore =
# documentation isn't so important for now
D100, D101, D102, D103, D105, D106,
D100, D101, D102, D103, D104, D105, D106,
# yes, we have bad names here and there
WPS110, WPS111,
# annoying stuff
WPS326, WPS306, WPS317,
WPS326, WPS306, WPS317, WPS202, WPS226, WPS411, WPS323,
# I like multiline conditions!
WPS337, W503, W504,

per-file-ignores =
settings.py: WPS407, E501, C812, WPS221, WPS226
settings.py: WPS407, E501, C812, WPS221, WPS226, S105
models.py: WPS226

0 comments on commit 2640f00

Please sign in to comment.