Python:
import ast
def list_classes_in_file(file_path):
with open(file_path, "r") as file:
tree = ast.parse(file.read(), filename=file_path)
class_names = [node.name for node in ast.walk(tree) if isinstance(node, ast.ClassDef)]
return class_names
# Example usage
if __name__ == "__main__":
file_path = "your_script.py" # Replace with your .py file path
classes = list_classes_in_file(file_path)
print("Classes found:", classes)
PERSONALITY