mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-05 11:39:29 -05:00

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"").
24 lines
473 B
Python
24 lines
473 B
Python
import re
|
|
|
|
from .parsers import RasterisedDocumentParser
|
|
|
|
|
|
class ConsumerDeclaration:
|
|
|
|
MATCHING_FILES = re.compile(r"^.*\.(pdf|jpe?g|gif|png|tiff?|pnm|bmp)$")
|
|
|
|
@classmethod
|
|
def handle(cls, sender, **kwargs):
|
|
return cls.test
|
|
|
|
@classmethod
|
|
def test(cls, doc):
|
|
|
|
if cls.MATCHING_FILES.match(doc.lower()):
|
|
return {
|
|
"parser": RasterisedDocumentParser,
|
|
"weight": 0
|
|
}
|
|
|
|
return None
|