mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
remove lots of unused code
This commit is contained in:
parent
138f38d1f3
commit
0d3ab3aaf7
@ -17,7 +17,6 @@ from whoosh.writing import AsyncWriter
|
|||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from ... import index
|
from ... import index
|
||||||
from ...file_handling import create_source_path_directory
|
from ...file_handling import create_source_path_directory
|
||||||
from ...mixins import Renderable
|
|
||||||
from ...parsers import get_parser_class_for_mime_type
|
from ...parsers import get_parser_class_for_mime_type
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ def handle_document(document_id):
|
|||||||
parser.cleanup()
|
parser.cleanup()
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Using the current classification model, assigns correspondents, tags
|
Using the current classification model, assigns correspondents, tags
|
||||||
@ -71,10 +70,6 @@ class Command(Renderable, BaseCommand):
|
|||||||
modified) after their initial import.
|
modified) after their initial import.
|
||||||
""".replace(" ", "")
|
""".replace(" ", "")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.verbosity = 0
|
|
||||||
BaseCommand.__init__(self, *args, **kwargs)
|
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-f", "--overwrite",
|
"-f", "--overwrite",
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from ...mixins import Renderable
|
|
||||||
from ...tasks import train_classifier
|
from ...tasks import train_classifier
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Trains the classifier on your data and saves the resulting models to a
|
Trains the classifier on your data and saves the resulting models to a
|
||||||
|
@ -16,10 +16,9 @@ from documents.settings import EXPORTER_FILE_NAME, EXPORTER_THUMBNAIL_NAME, \
|
|||||||
EXPORTER_ARCHIVE_NAME
|
EXPORTER_ARCHIVE_NAME
|
||||||
from paperless.db import GnuPG
|
from paperless.db import GnuPG
|
||||||
from ...file_handling import generate_filename, delete_empty_directories
|
from ...file_handling import generate_filename, delete_empty_directories
|
||||||
from ...mixins import Renderable
|
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Decrypt and rename all files in our collection into a given target
|
Decrypt and rename all files in our collection into a given target
|
||||||
|
@ -15,7 +15,6 @@ from documents.models import Document
|
|||||||
from documents.settings import EXPORTER_FILE_NAME, EXPORTER_THUMBNAIL_NAME, \
|
from documents.settings import EXPORTER_FILE_NAME, EXPORTER_THUMBNAIL_NAME, \
|
||||||
EXPORTER_ARCHIVE_NAME
|
EXPORTER_ARCHIVE_NAME
|
||||||
from ...file_handling import create_source_path_directory
|
from ...file_handling import create_source_path_directory
|
||||||
from ...mixins import Renderable
|
|
||||||
from ...signals.handlers import update_filename_and_move_files
|
from ...signals.handlers import update_filename_and_move_files
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ def disable_signal(sig, receiver, sender):
|
|||||||
sig.connect(receiver=receiver, sender=sender)
|
sig.connect(receiver=receiver, sender=sender)
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Using a manifest.json file, load the data from there, and import the
|
Using a manifest.json file, load the data from there, and import the
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
from documents.mixins import Renderable
|
|
||||||
from documents.tasks import index_reindex, index_optimize
|
from documents.tasks import index_reindex, index_optimize
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = "Manages the document index."
|
help = "Manages the document index."
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.verbosity = 0
|
|
||||||
BaseCommand.__init__(self, *args, **kwargs)
|
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument("command", choices=['reindex', 'optimize'])
|
parser.add_argument("command", choices=['reindex', 'optimize'])
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.verbosity = options["verbosity"]
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
if options['command'] == 'reindex':
|
if options['command'] == 'reindex':
|
||||||
index_reindex()
|
index_reindex()
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
from django.core.management.base import BaseCommand
|
|
||||||
|
|
||||||
from documents.models import Log
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
|
|
||||||
help = "A quick & dirty way to see what's in the logs"
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
|
||||||
for log in Log.objects.order_by("pk"):
|
|
||||||
print(log)
|
|
@ -5,23 +5,16 @@ from django.core.management.base import BaseCommand
|
|||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
|
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from ...mixins import Renderable
|
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
This will rename all documents to match the latest filename format.
|
This will rename all documents to match the latest filename format.
|
||||||
""".replace(" ", "")
|
""".replace(" ", "")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.verbosity = 0
|
|
||||||
BaseCommand.__init__(self, *args, **kwargs)
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.verbosity = options["verbosity"]
|
|
||||||
|
|
||||||
logging.getLogger().handlers[0].level = logging.ERROR
|
logging.getLogger().handlers[0].level = logging.ERROR
|
||||||
|
|
||||||
for document in tqdm.tqdm(Document.objects.all()):
|
for document in tqdm.tqdm(Document.objects.all()):
|
||||||
|
@ -4,11 +4,10 @@ from django.core.management.base import BaseCommand
|
|||||||
|
|
||||||
from documents.classifier import load_classifier
|
from documents.classifier import load_classifier
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from ...mixins import Renderable
|
|
||||||
from ...signals.handlers import set_correspondent, set_document_type, set_tags
|
from ...signals.handlers import set_correspondent, set_document_type, set_tags
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
Using the current classification model, assigns correspondents, tags
|
Using the current classification model, assigns correspondents, tags
|
||||||
@ -17,10 +16,6 @@ class Command(Renderable, BaseCommand):
|
|||||||
modified) after their initial import.
|
modified) after their initial import.
|
||||||
""".replace(" ", "")
|
""".replace(" ", "")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.verbosity = 0
|
|
||||||
BaseCommand.__init__(self, *args, **kwargs)
|
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c", "--correspondent",
|
"-c", "--correspondent",
|
||||||
@ -61,8 +56,6 @@ class Command(Renderable, BaseCommand):
|
|||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.verbosity = options["verbosity"]
|
|
||||||
|
|
||||||
if options["inbox_only"]:
|
if options["inbox_only"]:
|
||||||
queryset = Document.objects.filter(tags__is_inbox_tag=True)
|
queryset = Document.objects.filter(tags__is_inbox_tag=True)
|
||||||
else:
|
else:
|
||||||
|
@ -7,7 +7,6 @@ from django import db
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
from ...mixins import Renderable
|
|
||||||
from ...parsers import get_parser_class_for_mime_type
|
from ...parsers import get_parser_class_for_mime_type
|
||||||
|
|
||||||
|
|
||||||
@ -30,16 +29,12 @@ def _process_document(doc_in):
|
|||||||
parser.cleanup()
|
parser.cleanup()
|
||||||
|
|
||||||
|
|
||||||
class Command(Renderable, BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
||||||
help = """
|
help = """
|
||||||
This will regenerate the thumbnails for all documents.
|
This will regenerate the thumbnails for all documents.
|
||||||
""".replace(" ", "")
|
""".replace(" ", "")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
self.verbosity = 0
|
|
||||||
BaseCommand.__init__(self, *args, **kwargs)
|
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-d", "--document",
|
"-d", "--document",
|
||||||
@ -51,9 +46,6 @@ class Command(Renderable, BaseCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.verbosity = options["verbosity"]
|
|
||||||
|
|
||||||
logging.getLogger().handlers[0].level = logging.ERROR
|
logging.getLogger().handlers[0].level = logging.ERROR
|
||||||
|
|
||||||
if options['document']:
|
if options['document']:
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
class Renderable:
|
|
||||||
"""
|
|
||||||
A handy mixin to make it easier/cleaner to print output based on a
|
|
||||||
verbosity value.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def _render(self, text, verbosity):
|
|
||||||
if self.verbosity >= verbosity:
|
|
||||||
print(text)
|
|
Loading…
x
Reference in New Issue
Block a user