mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	pep8 corrections
This commit is contained in:
		| @@ -362,7 +362,8 @@ class Consumer(object): | |||||||
|  |  | ||||||
| def strip_excess_whitespace(text): | def strip_excess_whitespace(text): | ||||||
|     collapsed_spaces = re.sub(r"([^\S\r\n]+)", " ", text) |     collapsed_spaces = re.sub(r"([^\S\r\n]+)", " ", text) | ||||||
|     no_leading_whitespace = re.sub("([\n\r]+)([^\S\n\r]+)", '\\1', collapsed_spaces) |     no_leading_whitespace = re.sub( | ||||||
|  |         "([\n\r]+)([^\S\n\r]+)", '\\1', collapsed_spaces) | ||||||
|     no_trailing_whitespace = re.sub("([^\S\n\r]+)$", '', no_leading_whitespace) |     no_trailing_whitespace = re.sub("([^\S\n\r]+)$", '', no_leading_whitespace) | ||||||
|     return no_trailing_whitespace |     return no_trailing_whitespace | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ from dateutil import parser | |||||||
| from django.conf import settings | from django.conf import settings | ||||||
|  |  | ||||||
| from .consumer import Consumer | from .consumer import Consumer | ||||||
| from .models import Correspondent, Log | from .models import Correspondent | ||||||
|  |  | ||||||
|  |  | ||||||
| class MailFetcherError(Exception): | class MailFetcherError(Exception): | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ import time | |||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.core.management.base import BaseCommand, CommandError | from django.core.management.base import BaseCommand, CommandError | ||||||
|  |  | ||||||
| from ...models import Log |  | ||||||
| from ...consumer import Consumer, ConsumerError | from ...consumer import Consumer, ConsumerError | ||||||
| from ...mail import MailFetcher, MailFetcherError | from ...mail import MailFetcher, MailFetcherError | ||||||
|  |  | ||||||
|   | |||||||
| @@ -134,7 +134,7 @@ class TestAttributes(TestCase): | |||||||
|         ) |         ) | ||||||
|  |  | ||||||
|  |  | ||||||
| class Permutations(TestCase): | class TestFieldPermutations(TestCase): | ||||||
|  |  | ||||||
|     valid_dates = ( |     valid_dates = ( | ||||||
|         "20150102030405Z", |         "20150102030405Z", | ||||||
| @@ -305,13 +305,28 @@ class Permutations(TestCase): | |||||||
|  |  | ||||||
|  |  | ||||||
| class TestOCR(TestCase): | class TestOCR(TestCase): | ||||||
|  |  | ||||||
|     text_cases = [ |     text_cases = [ | ||||||
|         ("simple     string", "simple string"), |         ("simple     string", "simple string"), | ||||||
|         ("simple    newline\n   testing string", "simple newline\ntesting string"), |         ( | ||||||
|         ("utf-8   строка с пробелами в конце  ", "utf-8 строка с пробелами в конце") |             "simple    newline\n   testing string", | ||||||
|  |             "simple newline\ntesting string" | ||||||
|  |         ), | ||||||
|  |         ( | ||||||
|  |             "utf-8   строка с пробелами в конце  ", | ||||||
|  |             "utf-8 строка с пробелами в конце" | ||||||
|  |         ) | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|     def test_strip_excess_whitespace(self): |     def test_strip_excess_whitespace(self): | ||||||
|         for source, result in self.text_cases: |         for source, result in self.text_cases: | ||||||
|             actual_result = strip_excess_whitespace(source) |             actual_result = strip_excess_whitespace(source) | ||||||
|             assert result == actual_result, "strip_exceess_whitespace(%s) != '%s', but '%s'" % (source, result, actual_result) |             self.assertEqual( | ||||||
|  |                 result, | ||||||
|  |                 actual_result, | ||||||
|  |                 "strip_exceess_whitespace({}) != '{}', but '{}'".format( | ||||||
|  |                     source, | ||||||
|  |                     result, | ||||||
|  |                     actual_result | ||||||
|  |                 ) | ||||||
|  |             ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn