I am using TreeSitter to parse python code.
I need to understand check_files_in_directory
is invoked from GPT4Readability.utils
. I already captured all the function calls. I have to do this programatically.
But now I have to find out from which file check_files_in_directory
is called. I am struggling to understand what would the logic to do it. Can anyone please suggest?
I have to implement this with a Tree sitter AST parser from scratch. I would appreciate links to proper resources, high-level logic. I am not looking for actual code implementation and instead high-level reasoning.
import os
from getpass import getpass
from GPT4Readability.utils import *
import importlib.resources as pkg_resources
def generate_readme(root_dir, output_name, model):
"""Generates a README.md file based on the python files in the provided directory
Args:
root_dir (str): The root directory of the python package to parse and generate a readme for
"""
# prompt_folder_name = os.path.join(os.path.dirname(__file__), "prompts")
# prompt_path = os.path.join(prompt_folder_name, "readme_prompt.txt")
with pkg_resources.open_text('GPT4Readability.prompts','readme_prompt.txt') as f:
inb_msg = f.read()
# with open(prompt_path) as f:
# lines = f.readlines()
# inb_msg = "".join(lines)
file_check_result = check_files_in_directory(root_dir)
from how to understand from where a function call is made?
No comments:
Post a Comment