From 58fbc6527537cb229ded87eea57949c3cf02621f Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Mon, 27 May 2024 14:39:38 +0300 Subject: Remove duplicate code for loading files. --- gn3/llms/process.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'gn3') diff --git a/gn3/llms/process.py b/gn3/llms/process.py index 2ce6b2b..40e53c5 100644 --- a/gn3/llms/process.py +++ b/gn3/llms/process.py @@ -21,19 +21,10 @@ class DocIDs(): * doc_ids.json: opens doc)ids for gn references * sugar_doc_ids: open doci_ids for diabetes references """ - self.doc_ids = self.load_file("doc_ids.json") - self.sugar_doc_ids = self.load_file("all_files.json") + self.doc_ids = load_file("doc_ids.json", BASEDIR) + self.sugar_doc_ids = load_file("all_files.json", BASEDIR) self.format_doc_ids(self.sugar_doc_ids) - def load_file(self, file_name): - """Method to load and read doc_id files""" - file_path = os.path.join(BASEDIR, file_name) - if os.path.isfile(file_path): - with open(file_path, "rb") as file_handler: - return json.load(file_handler) - else: - raise FileNotFoundError(f"{file_path}-- FIle does not exist\n") - def format_doc_ids(self, docs): """method to format doc_ids for list items doc_id and doc_name""" for _key, val in docs.items(): -- cgit v1.2.3