mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-16 00:19:32 -06:00
typing stuff
This commit is contained in:
@@ -173,7 +173,6 @@ src/documents/filters.py:0: error: Function is missing a type annotation [no-un
|
|||||||
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation [no-untyped-def]
|
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
||||||
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
src/documents/filters.py:0: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ class ConsumerPlugin(
|
|||||||
original_document.checksum = hashlib.md5(
|
original_document.checksum = hashlib.md5(
|
||||||
file_for_checksum.read_bytes(),
|
file_for_checksum.read_bytes(),
|
||||||
).hexdigest()
|
).hexdigest()
|
||||||
original_document.content = text
|
original_document.content = text or ""
|
||||||
original_document.page_count = page_count
|
original_document.page_count = page_count
|
||||||
original_document.mime_type = mime_type
|
original_document.mime_type = mime_type
|
||||||
original_document.original_filename = self.filename
|
original_document.original_filename = self.filename
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import json
|
|||||||
import operator
|
import operator
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
@@ -161,7 +162,7 @@ class InboxFilter(Filter):
|
|||||||
|
|
||||||
@extend_schema_field(serializers.CharField)
|
@extend_schema_field(serializers.CharField)
|
||||||
class TitleContentFilter(Filter):
|
class TitleContentFilter(Filter):
|
||||||
def filter(self, qs, value):
|
def filter(self, qs: Any, value: Any) -> Any:
|
||||||
value = value.strip() if isinstance(value, str) else value
|
value = value.strip() if isinstance(value, str) else value
|
||||||
if value:
|
if value:
|
||||||
try:
|
try:
|
||||||
@@ -178,7 +179,7 @@ class TitleContentFilter(Filter):
|
|||||||
|
|
||||||
@extend_schema_field(serializers.CharField)
|
@extend_schema_field(serializers.CharField)
|
||||||
class EffectiveContentFilter(Filter):
|
class EffectiveContentFilter(Filter):
|
||||||
def filter(self, qs, value):
|
def filter(self, qs: Any, value: Any) -> Any:
|
||||||
value = value.strip() if isinstance(value, str) else value
|
value = value.strip() if isinstance(value, str) else value
|
||||||
if not value:
|
if not value:
|
||||||
return qs
|
return qs
|
||||||
|
|||||||
@@ -884,7 +884,9 @@ class DocumentViewSet(
|
|||||||
self.perform_update(serializer)
|
self.perform_update(serializer)
|
||||||
|
|
||||||
if content_updated and content_doc.id != root_doc.id:
|
if content_updated and content_doc.id != root_doc.id:
|
||||||
content_doc.content = updated_content
|
content_doc.content = (
|
||||||
|
str(updated_content) if updated_content is not None else ""
|
||||||
|
)
|
||||||
content_doc.save(update_fields=["content", "modified"])
|
content_doc.save(update_fields=["content", "modified"])
|
||||||
|
|
||||||
if getattr(root_doc, "_prefetched_objects_cache", None):
|
if getattr(root_doc, "_prefetched_objects_cache", None):
|
||||||
|
|||||||
Reference in New Issue
Block a user