codestyle

This commit is contained in:
Jonas Winkler 2020-11-18 22:41:14 +01:00
parent 93b81ef6e9
commit 727f86c369
9 changed files with 8 additions and 19 deletions

View File

@ -3,7 +3,6 @@ import hashlib
import logging
import os
import re
import uuid
from django.conf import settings
from django.db import transaction

View File

@ -86,7 +86,7 @@ def generate_filename(document):
added_day=document.added.day if document.added else "none",
tags=tags,
)
except (ValueError, KeyError, IndexError) as e:
except (ValueError, KeyError, IndexError):
logging.getLogger(__name__).warning("Invalid PAPERLESS_FILENAME_FORMAT: {}, falling back to default,".format(settings.PAPERLESS_FILENAME_FORMAT))
# Always append the primary key to guarantee uniqueness of filename

View File

@ -1,7 +1,4 @@
# Generated by Django 3.1.3 on 2020-11-07 12:35
import os
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion

View File

@ -2,11 +2,10 @@ import os
import shutil
import tempfile
from unittest import mock
from unittest.mock import MagicMock
from django.contrib.auth.models import User
from django.test import override_settings
from rest_framework.test import APITestCase, APIClient
from rest_framework.test import APITestCase
from documents.models import Document, Correspondent, DocumentType, Tag

View File

@ -80,6 +80,6 @@ class TestClassifier(TestCase):
self.classifier.save_classifier()
newClassifier = DocumentClassifier()
newClassifier.reload()
self.assertFalse(newClassifier.train())
new_classifier = DocumentClassifier()
new_classifier.reload()
self.assertFalse(new_classifier.train())

View File

@ -5,8 +5,6 @@ import tempfile
from unittest import mock
from unittest.mock import MagicMock
from django.conf import settings
from django.db import DatabaseError
from django.test import TestCase, override_settings
from ..consumer import Consumer, ConsumerError
@ -504,9 +502,9 @@ class TestConsumer(TestCase):
def testOverrideFilename(self):
filename = self.get_test_file()
overrideFilename = "My Bank - Statement for November.pdf"
override_filename = "My Bank - Statement for November.pdf"
document = self.consumer.try_consume_file(filename, override_filename=overrideFilename)
document = self.consumer.try_consume_file(filename, override_filename=override_filename)
self.assertEqual(document.correspondent.name, "My Bank")
self.assertEqual(document.title, "Statement for November")

View File

@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand
from paperless_mail import mail, tasks
from paperless_mail import tasks
class Command(BaseCommand):

View File

@ -1,6 +1,5 @@
import logging
from paperless_mail import mail
from paperless_mail.mail import MailAccountHandler
from paperless_mail.models import MailAccount

View File

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.