|
| 1 | +--- |
| 2 | +title: "Directory" |
| 3 | +sidebarTitle: "Directory" |
| 4 | +icon: "" |
| 5 | +description: "Directory representation for codebase. |
| 6 | +GraphSitter abstraction of a file directory that can be used to look for files and symbols within a specific directory. |
| 7 | +" |
| 8 | +--- |
| 9 | +import {Parameter} from '/snippets/Parameter.mdx'; |
| 10 | +import {ParameterWrapper} from '/snippets/ParameterWrapper.mdx'; |
| 11 | +import {Return} from '/snippets/Return.mdx'; |
| 12 | +import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx'; |
| 13 | +import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx'; |
| 14 | +import {Attribute} from '/snippets/Attribute.mdx'; |
| 15 | + |
| 16 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L30-L216" /> |
| 17 | + |
| 18 | + |
| 19 | +## Attributes |
| 20 | +<HorizontalDivider /> |
| 21 | +### <span className="text-primary">classes</span> |
| 22 | +<HorizontalDivider light={true} /> |
| 23 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all classes in the directory and its subdirectories." /> |
| 24 | + |
| 25 | +### <span className="text-primary">dirpath</span> |
| 26 | +<HorizontalDivider light={true} /> |
| 27 | +<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description=" |
| 28 | +" /> |
| 29 | + |
| 30 | +### <span className="text-primary">files</span> |
| 31 | +<HorizontalDivider light={true} /> |
| 32 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/File" style={ {fontWeight: "inherit", fontSize: "inherit"} }>File</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all files in the directory and its subdirectories." /> |
| 33 | + |
| 34 | +### <span className="text-primary">functions</span> |
| 35 | +<HorizontalDivider light={true} /> |
| 36 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all functions in the directory and its subdirectories." /> |
| 37 | + |
| 38 | +### <span className="text-primary">global_vars</span> |
| 39 | +<HorizontalDivider light={true} /> |
| 40 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all global variables in the directory and its subdirectories." /> |
| 41 | + |
| 42 | +### <span className="text-primary">import_statements</span> |
| 43 | +<HorizontalDivider light={true} /> |
| 44 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/ImportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportStatement</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all import statements in the directory and its subdirectories." /> |
| 45 | + |
| 46 | +### <span className="text-primary">items</span> |
| 47 | +<HorizontalDivider light={true} /> |
| 48 | +<Attribute type={ <><span className="text-gray-200">dict[str,</span> <a href="/api-reference/core/File" style={ {fontWeight: "inherit", fontSize: "inherit"} }>File</a> <span className="text-gray-200">|</span> <a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span className="text-gray-200">]</span></> } description=" |
| 49 | +" /> |
| 50 | + |
| 51 | +### <span className="text-primary">name</span> |
| 52 | +<HorizontalDivider light={true} /> |
| 53 | +<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">str</code> } description="Get the base name of the directory's path." /> |
| 54 | + |
| 55 | +### <span className="text-primary">parent</span> |
| 56 | +<HorizontalDivider light={true} /> |
| 57 | +<Attribute type={ <><a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span className="text-gray-200">| None</span></> } description=" |
| 58 | +" /> |
| 59 | + |
| 60 | +### <span className="text-primary">path</span> |
| 61 | +<HorizontalDivider light={true} /> |
| 62 | +<Attribute type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">Path</code> } description=" |
| 63 | +" /> |
| 64 | + |
| 65 | +### <span className="text-primary">subdirectories</span> |
| 66 | +<HorizontalDivider light={true} /> |
| 67 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all subdirectories in the directory and its subdirectories." /> |
| 68 | + |
| 69 | +### <span className="text-primary">symbols</span> |
| 70 | +<HorizontalDivider light={true} /> |
| 71 | +<Attribute type={ <><span className="text-gray-200">list[</span> <a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span className="text-gray-200">]</span></> } description="Get a recursive list of all symbols in the directory and its subdirectories." /> |
| 72 | + |
| 73 | + |
| 74 | +## Methods |
| 75 | +<HorizontalDivider /> |
| 76 | +### <span className="text-primary">add_file</span> |
| 77 | +Add a file to the directory. |
| 78 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L156-L159" /> |
| 79 | + |
| 80 | + |
| 81 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 82 | + |
| 83 | + |
| 84 | +### <span className="text-primary">add_subdirectory</span> |
| 85 | +Add a subdirectory to the directory. |
| 86 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L179-L182" /> |
| 87 | + |
| 88 | + |
| 89 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 90 | + |
| 91 | + |
| 92 | +### <span className="text-primary">get_class</span> |
| 93 | +Get a class by name in the directory and its subdirectories. |
| 94 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L148-L150" /> |
| 95 | + |
| 96 | + |
| 97 | +<Return return_type={ <><a href="/api-reference/core/Class" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Class</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 98 | + |
| 99 | + |
| 100 | +### <span className="text-primary">get_file</span> |
| 101 | +Get a file by its name relative to the directory. |
| 102 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L171-L177" /> |
| 103 | + |
| 104 | + |
| 105 | +<Return return_type={ <><a href="/api-reference/core/File" style={ {fontWeight: "inherit", fontSize: "inherit"} }>File</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 106 | + |
| 107 | + |
| 108 | +### <span className="text-primary">get_function</span> |
| 109 | +Get a function by name in the directory and its subdirectories. |
| 110 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L152-L154" /> |
| 111 | + |
| 112 | + |
| 113 | +<Return return_type={ <><a href="/api-reference/core/Function" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Function</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 114 | + |
| 115 | + |
| 116 | +### <span className="text-primary">get_global_var</span> |
| 117 | +Get a global variable by name in the directory and its subdirectories. |
| 118 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L144-L146" /> |
| 119 | + |
| 120 | + |
| 121 | +<Return return_type={ <><a href="/api-reference/core/Assignment" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Assignment</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 122 | + |
| 123 | + |
| 124 | +### <span className="text-primary">get_import_statement</span> |
| 125 | +Get an import statement by name in the directory and its subdirectories. |
| 126 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L140-L142" /> |
| 127 | + |
| 128 | + |
| 129 | +<Return return_type={ <><a href="/api-reference/core/ImportStatement" style={ {fontWeight: "inherit", fontSize: "inherit"} }>ImportStatement</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 130 | + |
| 131 | + |
| 132 | +### <span className="text-primary">get_subdirectory</span> |
| 133 | +Get a subdirectory by its path relative to the directory. |
| 134 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L194-L196" /> |
| 135 | + |
| 136 | + |
| 137 | +<Return return_type={ <><a href="/api-reference/core/Directory" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Directory</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 138 | + |
| 139 | + |
| 140 | +### <span className="text-primary">get_symbol</span> |
| 141 | +Get a symbol by name in the directory and its subdirectories. |
| 142 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L136-L138" /> |
| 143 | + |
| 144 | + |
| 145 | +<Return return_type={ <><a href="/api-reference/core/Symbol" style={ {fontWeight: "inherit", fontSize: "inherit"} }>Symbol</a> <span className="text-gray-200">| None</span></> } description=""/> |
| 146 | + |
| 147 | + |
| 148 | +### <span className="text-primary">remove_file</span> |
| 149 | +Remove a file from the directory. |
| 150 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L161-L164" /> |
| 151 | + |
| 152 | + |
| 153 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 154 | + |
| 155 | + |
| 156 | +### <span className="text-primary">remove_file_by_path</span> |
| 157 | +Remove a file from the directory by its path. |
| 158 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L166-L169" /> |
| 159 | + |
| 160 | + |
| 161 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 162 | + |
| 163 | + |
| 164 | +### <span className="text-primary">remove_subdirectory</span> |
| 165 | +Remove a subdirectory from the directory. |
| 166 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L184-L187" /> |
| 167 | + |
| 168 | + |
| 169 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 170 | + |
| 171 | + |
| 172 | +### <span className="text-primary">remove_subdirectory_by_path</span> |
| 173 | +Remove a subdirectory from the directory by its path. |
| 174 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L189-L192" /> |
| 175 | + |
| 176 | + |
| 177 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 178 | + |
| 179 | + |
| 180 | +### <span className="text-primary">rename</span> |
| 181 | +Rename the directory. |
| 182 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L212-L216" /> |
| 183 | + |
| 184 | + |
| 185 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 186 | + |
| 187 | + |
| 188 | +### <span className="text-primary">update_filepath</span> |
| 189 | +Update the filepath of the directory. |
| 190 | +<GithubLinkNote link="https://github.com/codegen-sh/codegen-sdk/blob/mintlify-doc-fix/src/codegen/sdk/core/directory.py#L203-L210" /> |
| 191 | + |
| 192 | + |
| 193 | +<Return return_type={ <code className="text-sm bg-gray-100 px-2 py-0.5 rounded">None</code> } description=""/> |
| 194 | + |
| 195 | + |
| 196 | + |
0 commit comments