mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-16 00:36:22 +00:00
Changes out the settings and a decent amount of test code to be pathlib compatible
This commit is contained in:
@@ -2,7 +2,6 @@ import logging
|
||||
import os
|
||||
import pickle
|
||||
import re
|
||||
import shutil
|
||||
import warnings
|
||||
from datetime import datetime
|
||||
from hashlib import sha256
|
||||
@@ -122,7 +121,7 @@ class DocumentClassifier:
|
||||
|
||||
def save(self):
|
||||
target_file = settings.MODEL_FILE
|
||||
target_file_temp = settings.MODEL_FILE + ".part"
|
||||
target_file_temp = settings.MODEL_FILE.with_suffix(".pickle.part")
|
||||
|
||||
with open(target_file_temp, "wb") as f:
|
||||
pickle.dump(self.FORMAT_VERSION, f)
|
||||
@@ -138,9 +137,7 @@ class DocumentClassifier:
|
||||
pickle.dump(self.document_type_classifier, f)
|
||||
pickle.dump(self.storage_path_classifier, f)
|
||||
|
||||
if os.path.isfile(target_file):
|
||||
os.unlink(target_file)
|
||||
shutil.move(target_file_temp, target_file)
|
||||
target_file_temp.rename(target_file)
|
||||
|
||||
def train(self):
|
||||
|
||||
|
Reference in New Issue
Block a user