Run the tool to get all symbols of a Python file. Args: path_to_file (str): The path to the Python file. preview_size (int, optional): The number of symbols to preview. Defaults to 5. Returns: Union[List[str], str]: The list of symbols o
(self, path_to_file: str, keyword: Optional[str] = None)
| 223 | self.path = path |
| 224 | |
| 225 | def _run(self, path_to_file: str, keyword: Optional[str] = None): |
| 226 | """ |
| 227 | Run the tool to get all symbols of a Python file. |
| 228 | |
| 229 | Args: |
| 230 | path_to_file (str): The path to the Python file. |
| 231 | preview_size (int, optional): The number of symbols to preview. Defaults to 5. |
| 232 | |
| 233 | Returns: |
| 234 | Union[List[str], str]: The list of symbols or an error message. |
| 235 | """ |
| 236 | try: |
| 237 | return get_symbol_verbose(osp.join(self.path, path_to_file), self.path, keyword) |
| 238 | except IsADirectoryError: |
| 239 | return "The relative path is a folder, please specify the file path instead. Consider using get_tree_structure to find the file name then use this tool one file path at a time" |
| 240 | except FileNotFoundError: |
| 241 | return "The file is not found, please check the path again" |
| 242 | except lsp_protocol_handler.server.Error: |
| 243 | return "Internal error, please use other tool" |
| 244 | |
| 245 | class GetTreeStructureArgs(BaseModel): |
| 246 | relative_path: str = Field(..., description="The relative path of the folder we want to explore") |
nothing calls this directly
no test coverage detected