delete_symbol
Deletes a function or class definition, including its decorators and leading comment block, from a source file.
Instructions
Delete an entire function or class definition, including its decorators.
By default, also removes the contiguous leading comment block above the
symbol (Godoc, Javadoc /** ... */, # or // comment runs) so the
doc doesn't become orphaned floating text. Pass
include_leading_comments=False to leave that comment in place.
Use this when: You want to remove a function, method, or class entirely from a
source file -- along with its doc comment by default.
Don't use this when: You want to remove a config key -> use delete_key. You
want to remove an import -> use remove_import. You want to remove lines
inside a function -> use delete_in_body (or replace_function_body to
rewrite the whole body without the unwanted lines).
Example: target="LRUCache.old_method" # deletes a method + its leading comment target="DeprecatedClass" # deletes class, all methods, and preceding Javadoc target="Foo", include_leading_comments=False # keep the comment, delete only the symbol
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| target | Yes | ||
| include_leading_comments | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |