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.
Attributes
classes
Get a recursive list of all classes in the directory and its subdirectories.
dirpath
str
Relative path of the directory.
exports
Get a recursive list of all exports 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.
imports
Get a recursive list of all imports in the directory and its subdirectories.
name
str
Get the base name of the directory's path.
parent
The parent directory, if any.
path
Path
Absolute path of the directory.
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.
Returns
None
add_subdirectory
Add a subdirectory to the directory.
Returns
None
get_class
Get a class by name in the directory and its subdirectories.
Returns
get_export
Get an export by name in the directory and its subdirectories (supports only typescript).
Returns
get_file
Get a file by its name relative to the directory.
Returns
get_function
Get a function by name in the directory and its subdirectories.
Returns
get_global_var
Get a global variable by name in the directory and its subdirectories.
Returns
get_import
Get an import by name in the directory and its subdirectories.
Returns
get_import_statement
Get an import statement by name in the directory and its subdirectories.
Returns
get_subdirectory
Get a subdirectory by its path relative to the directory.
Returns
get_symbol
Get a symbol by name in the directory and its subdirectories.
Returns
remove
Remove the directory and all its files and subdirectories.
Returns
None
remove_file
Remove a file from the directory.
Returns
None
remove_file_by_path
Remove a file from the directory by its path.
Returns
None
remove_subdirectory
Remove a subdirectory from the directory.
Returns
None
remove_subdirectory_by_path
Remove a subdirectory from the directory by its path.
Returns
None
rename
Rename the directory.
Returns
None
update_filepath
Update the filepath of the directory.
Returns
None