Use logger.warning since logger.warn is deprecated

This commit is contained in:
Debanjum Singh Solanky 2023-06-28 22:07:52 -07:00
parent 5f7eaa7ded
commit 5f2717cc4b
6 changed files with 10 additions and 8 deletions

View file

@ -37,7 +37,7 @@ def configure_server(args, required=False):
logger.error(f"Exiting as Khoj is not configured.\nConfigure it via GUI or by editing {state.config_file}.")
sys.exit(1)
else:
logger.warn(
logger.warning(
f"Khoj is not configured.\nConfigure it via khoj GUI, plugins or by editing {state.config_file}."
)
return
@ -88,7 +88,7 @@ def configure_search_types(config: FullConfig):
def configure_search(model: SearchModels, config: FullConfig, regenerate: bool, t: Optional[state.SearchType] = None):
if config is None or config.content_type is None or config.search_type is None:
logger.warn("🚨 No Content or Search type is configured.")
logger.warning("🚨 No Content or Search type is configured.")
return
# Initialize Org Notes Search

View file

@ -113,7 +113,7 @@ def extract_questions(text, model="text-davinci-003", conversation_log={}, api_k
.replace("', '", '", "')
)
except json.decoder.JSONDecodeError:
logger.warn(f"GPT returned invalid JSON. Falling back to using user message as search query.\n{response}")
logger.warning(f"GPT returned invalid JSON. Falling back to using user message as search query.\n{response}")
questions = [text]
logger.debug(f"Extracted Questions by GPT: {questions}")
return questions

View file

@ -92,7 +92,7 @@ class MarkdownToJsonl(TextToJsonl):
}
if any(files_with_non_markdown_extensions):
logger.warn(
logger.warning(
f"[Warning] There maybe non markdown-mode files in the input set: {files_with_non_markdown_extensions}"
)

View file

@ -88,7 +88,7 @@ class OrgToJsonl(TextToJsonl):
files_with_non_org_extensions = {org_file for org_file in all_org_files if not org_file.endswith(".org")}
if any(files_with_non_org_extensions):
logger.warn(f"There maybe non org-mode files in the input set: {files_with_non_org_extensions}")
logger.warning(f"There maybe non org-mode files in the input set: {files_with_non_org_extensions}")
logger.debug(f"Processing files: {all_org_files}")

View file

@ -83,7 +83,9 @@ class PdfToJsonl(TextToJsonl):
files_with_non_pdf_extensions = {pdf_file for pdf_file in all_pdf_files if not pdf_file.endswith(".pdf")}
if any(files_with_non_pdf_extensions):
logger.warn(f"[Warning] There maybe non pdf-mode files in the input set: {files_with_non_pdf_extensions}")
logger.warning(
f"[Warning] There maybe non pdf-mode files in the input set: {files_with_non_pdf_extensions}"
)
logger.debug(f"Processing files: {all_pdf_files}")

View file

@ -147,10 +147,10 @@ async def search(
# Run validation checks
results: List[SearchResponse] = []
if q is None or q == "":
logger.warn(f"No query param (q) passed in API call to initiate search")
logger.warning(f"No query param (q) passed in API call to initiate search")
return results
if not state.model or not any(state.model.__dict__.values()):
logger.warn(f"No search models loaded. Configure a search model before initiating search")
logger.warning(f"No search models loaded. Configure a search model before initiating search")
return results
# initialize variables