Skip to content

Commit 5af54b3

Browse files
better handling of global_temp_dir
1 parent 80e6d1b commit 5af54b3

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

DocToolsLLM/utils/loaders.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
from .misc import (doc_loaders_cache, html_to_text, hasher,
4747
file_hasher, get_splitter, check_docs_tkn_length,
48-
average_word_length, wpm)
48+
average_word_length, wpm, global_temp_dir)
4949
from .typechecker import optional_typecheck
5050
from .logger import whi, yel, red, log
5151
from .flags import is_verbose, is_linux
@@ -173,8 +173,6 @@ def load(self):
173173
["norm"],
174174
]
175175

176-
global_temp_dir = [None] # will be replaced when load_one_doc is called
177-
178176

179177
@optional_typecheck
180178
def load_one_doc(

DocToolsLLM/utils/misc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
TextSplitter = lazy_import.lazy_class('langchain.text_splitter.TextSplitter')
3232
RecursiveCharacterTextSplitter = lazy_import.lazy_class('langchain.text_splitter.RecursiveCharacterTextSplitter')
3333

34+
# will be replaced when load_one_doc is called, by the path to the file where the loaders can store temporary file
35+
global_temp_dir = [None]
36+
3437
try:
3538
import ftlangdetect
3639
except Exception as err:

0 commit comments

Comments
 (0)