Skip to content

Directory Translation

osa_tool.operations.codebase.directory_translation.dirs_and_files_translator

RepositoryStructureTranslator

rename_directories()

Translates directory names into English and updates code to reflect changes.

rename_directories_and_files()

The complete process of translating directories and files in the repository.

rename_files()

Translates all file names into English, preserving their extensions.

update_code(file_path, rename_map) staticmethod

Updates imported modules and paths in the file, replacing old names with new ones.

The function opens the file at the specified path, reads its contents and replaces the names of imported modules and paths according to the rename_map dictionary. If changes were made, the file is overwritten.

Parameters:

Name Type Description Default
file_path str

Path to the file in which imports and paths need to be updated.

required
rename_map dict

Dictionary of {old_name:new_name} matches for replacement.

required