mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	remove lots of unused code
This commit is contained in:
		| @@ -17,7 +17,6 @@ from whoosh.writing import AsyncWriter | ||||
| from documents.models import Document | ||||
| from ... import index | ||||
| from ...file_handling import create_source_path_directory | ||||
| from ...mixins import Renderable | ||||
| from ...parsers import get_parser_class_for_mime_type | ||||
|  | ||||
|  | ||||
| @@ -62,7 +61,7 @@ def handle_document(document_id): | ||||
|         parser.cleanup() | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         Using the current classification model, assigns correspondents, tags | ||||
| @@ -71,10 +70,6 @@ class Command(Renderable, BaseCommand): | ||||
|         modified) after their initial import. | ||||
|     """.replace("    ", "") | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         self.verbosity = 0 | ||||
|         BaseCommand.__init__(self, *args, **kwargs) | ||||
|  | ||||
|     def add_arguments(self, parser): | ||||
|         parser.add_argument( | ||||
|             "-f", "--overwrite", | ||||
|   | ||||
| @@ -1,10 +1,9 @@ | ||||
| from django.core.management.base import BaseCommand | ||||
|  | ||||
| from ...mixins import Renderable | ||||
| from ...tasks import train_classifier | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         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 | ||||
| from paperless.db import GnuPG | ||||
| from ...file_handling import generate_filename, delete_empty_directories | ||||
| from ...mixins import Renderable | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         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, \ | ||||
|     EXPORTER_ARCHIVE_NAME | ||||
| from ...file_handling import create_source_path_directory | ||||
| from ...mixins import Renderable | ||||
| 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) | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         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.db import transaction | ||||
|  | ||||
| from documents.mixins import Renderable | ||||
| from documents.tasks import index_reindex, index_optimize | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = "Manages the document index." | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         self.verbosity = 0 | ||||
|         BaseCommand.__init__(self, *args, **kwargs) | ||||
|  | ||||
|     def add_arguments(self, parser): | ||||
|         parser.add_argument("command", choices=['reindex', 'optimize']) | ||||
|  | ||||
|     def handle(self, *args, **options): | ||||
|  | ||||
|         self.verbosity = options["verbosity"] | ||||
|         with transaction.atomic(): | ||||
|             if options['command'] == '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 documents.models import Document | ||||
| from ...mixins import Renderable | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         This will rename all documents to match the latest filename format. | ||||
|     """.replace("    ", "") | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         self.verbosity = 0 | ||||
|         BaseCommand.__init__(self, *args, **kwargs) | ||||
|  | ||||
|     def handle(self, *args, **options): | ||||
|  | ||||
|         self.verbosity = options["verbosity"] | ||||
|  | ||||
|         logging.getLogger().handlers[0].level = logging.ERROR | ||||
|  | ||||
|         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.models import Document | ||||
| from ...mixins import Renderable | ||||
| from ...signals.handlers import set_correspondent, set_document_type, set_tags | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         Using the current classification model, assigns correspondents, tags | ||||
| @@ -17,10 +16,6 @@ class Command(Renderable, BaseCommand): | ||||
|         modified) after their initial import. | ||||
|     """.replace("    ", "") | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         self.verbosity = 0 | ||||
|         BaseCommand.__init__(self, *args, **kwargs) | ||||
|  | ||||
|     def add_arguments(self, parser): | ||||
|         parser.add_argument( | ||||
|             "-c", "--correspondent", | ||||
| @@ -61,8 +56,6 @@ class Command(Renderable, BaseCommand): | ||||
|  | ||||
|     def handle(self, *args, **options): | ||||
|  | ||||
|         self.verbosity = options["verbosity"] | ||||
|  | ||||
|         if options["inbox_only"]: | ||||
|             queryset = Document.objects.filter(tags__is_inbox_tag=True) | ||||
|         else: | ||||
|   | ||||
| @@ -7,7 +7,6 @@ from django import db | ||||
| from django.core.management.base import BaseCommand | ||||
|  | ||||
| from documents.models import Document | ||||
| from ...mixins import Renderable | ||||
| from ...parsers import get_parser_class_for_mime_type | ||||
|  | ||||
|  | ||||
| @@ -30,16 +29,12 @@ def _process_document(doc_in): | ||||
|         parser.cleanup() | ||||
|  | ||||
|  | ||||
| class Command(Renderable, BaseCommand): | ||||
| class Command(BaseCommand): | ||||
|  | ||||
|     help = """ | ||||
|         This will regenerate the thumbnails for all documents. | ||||
|     """.replace("    ", "") | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         self.verbosity = 0 | ||||
|         BaseCommand.__init__(self, *args, **kwargs) | ||||
|  | ||||
|     def add_arguments(self, parser): | ||||
|         parser.add_argument( | ||||
|             "-d", "--document", | ||||
| @@ -51,9 +46,6 @@ class Command(Renderable, BaseCommand): | ||||
|         ) | ||||
|  | ||||
|     def handle(self, *args, **options): | ||||
|  | ||||
|         self.verbosity = options["verbosity"] | ||||
|  | ||||
|         logging.getLogger().handlers[0].level = logging.ERROR | ||||
|  | ||||
|         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) | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler