Code Renamer is a Python tool that automatically renames classes, functions, and variables in a given directory containing Python files. The tool uses the Abstract Syntax Tree (AST) library to parse and modify the code before generating new files with the renamed assets.
Ensure you have Python 3.6 or higher installed on your system. Clone the repository:
git clone https://github.com/yourusername/code-renamer.gitNavigate to the project directory:
cd code-renamerInstall the required dependencies:
pip install -r requirements.txtRun the starter.bat file (Windows) or use the following command:
python main.py path/to/your/repositoryReplace path/to/your/repository with the path to the directory containing the Python files you want to process.
The tool will traverse the provided directory, process each Python file, and generate new files with the renamed assets. The new files will have the same name as the original files, but with a _renamed.py suffix.
Suppose you have the following Python file in your target directory (sample.py):
class TestClass:
def testMethod(self):
test_variable = 10After running Code Renamer, a new file named sample_renamed.py will be generated with the following content:
class PascalCaseTestClass:
def snake_case_testMethod(self):
snake_case_test_variable = 10Fork the repository on GitHub.
git clone https://github.com/yourusername/code-renamer.gitCreate a new branch for your changes:
git checkout -b my-feature-branchMake your changes and commit them with a descriptive message.
Push your changes to your fork:
git push origin my-feature-branchCreate a pull request on the original repository.
This project is licensed under the MIT License. See the LICENSE file for details.