Directory
Directory representation for codebase. GraphSitter abstraction of a file directory that can be used to look for files and symbols within a specific directory.
Properties
classes
Get a recursive list of all classes in the directory and its subdirectories.
files
Get a recursive list of all files in the directory and its subdirectories.
functions
Get a recursive list of all functions in the directory and its subdirectories.
global_vars
Get a recursive list of all global variables in the directory and its subdirectories.
import_statements
Get a recursive list of all import statements in the directory and its subdirectories.
name
Get the base name of the directory’s path.
Extracts the final component of the directory path. For example, for a path ‘/home/user/project’, returns ‘project’.
Returns: str: The directory’s base name.
subdirectories
Get a recursive list of all subdirectories in the directory and its subdirectories.
symbols
Get a recursive list of all symbols in the directory and its subdirectories.
Methods
add_file
Add a file to the directory.
add_subdirectory
Add a subdirectory to the directory.
get_class
Get a class by name in the directory and its subdirectories.
get_file
Get a file by its name relative to the directory.
get_function
Get a function by name in the directory and its subdirectories.
get_global_var
Get a global variable by name in the directory and its subdirectories.
get_import_statement
Get an import statement by name in the directory and its subdirectories.
get_subdirectory
Get a subdirectory by its path relative to the directory.
get_symbol
Get a symbol by name in the directory and its subdirectories.
remove
Remove the directory and all its files and subdirectories.
remove_file
Remove a file from the directory.
remove_file_by_path
Remove a file from the directory by its path.
remove_subdirectory
Remove a subdirectory from the directory.
remove_subdirectory_by_path
Remove a subdirectory from the directory by its path.
rename
Rename the directory.
update_filepath
Update the filepath of the directory.