mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix pycodestyle complaints
Apparently, pycodestyle updated itself to now check for invalid escape sequences, which only complain if the regex in use isn't a raw string (r"").
This commit is contained in:
		| @@ -135,7 +135,7 @@ class MatchingModel(models.Model): | ||||
|         Example: | ||||
|           '  some random  words "with   quotes  " and   spaces' | ||||
|             ==> | ||||
|           ["some", "random", "words", "with\s+quotes", "and", "spaces"] | ||||
|           ["some", "random", "words", "with+quotes", "and", "spaces"] | ||||
|         """ | ||||
|         findterms = re.compile(r'"([^"]+)"|(\S+)').findall | ||||
|         normspace = re.compile(r"\s+").sub | ||||
|   | ||||
| @@ -166,7 +166,7 @@ class TestMatching(TestCase): | ||||
|     def test_match_regex(self): | ||||
|  | ||||
|         self._test_matching( | ||||
|             "alpha\w+gamma", | ||||
|             r"alpha\w+gamma", | ||||
|             "MATCH_REGEX", | ||||
|             ( | ||||
|                 "I have alpha_and_gamma in me", | ||||
|   | ||||
| @@ -272,8 +272,9 @@ def run_unpaper(args): | ||||
| def strip_excess_whitespace(text): | ||||
|     collapsed_spaces = re.sub(r"([^\S\r\n]+)", " ", text) | ||||
|     no_leading_whitespace = re.sub( | ||||
|         "([\n\r]+)([^\S\n\r]+)", '\\1', collapsed_spaces) | ||||
|     no_trailing_whitespace = re.sub("([^\S\n\r]+)$", '', no_leading_whitespace) | ||||
|         r"([\n\r]+)([^\S\n\r]+)", '\\1', collapsed_spaces) | ||||
|     no_trailing_whitespace = re.sub( | ||||
|         r"([^\S\n\r]+)$", '', no_leading_whitespace) | ||||
|     return no_trailing_whitespace | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ from .parsers import RasterisedDocumentParser | ||||
|  | ||||
| class ConsumerDeclaration: | ||||
|  | ||||
|     MATCHING_FILES = re.compile("^.*\.(pdf|jpe?g|gif|png|tiff?|pnm|bmp)$") | ||||
|     MATCHING_FILES = re.compile(r"^.*\.(pdf|jpe?g|gif|png|tiff?|pnm|bmp)$") | ||||
|  | ||||
|     @classmethod | ||||
|     def handle(cls, sender, **kwargs): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn