about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-05-27 14:39:38 +0300
committerAlexander_Kabui2024-05-27 14:39:38 +0300
commit58fbc6527537cb229ded87eea57949c3cf02621f (patch)
tree0fe01f83c8f514d61219b30c0cc042c20c06a315
parent8aeb4e00af2651cf7ec55f2ace23c600f537ff77 (diff)
downloadgenenetwork3-58fbc6527537cb229ded87eea57949c3cf02621f.tar.gz
Remove duplicate code for loading files.
-rw-r--r--gn3/llms/process.py13
1 files changed, 2 insertions, 11 deletions
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():