MCPcopy Create free account
hub / github.com/LearnPrompt/LearnPrompt / update_paths

Function update_paths

scripts/convert_to_webp.py:33–46  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

31 print(f'Could not convert file {source} due to error: {e}')
32
33def update_paths(file_path):
34 try:
35 with open(file_path, 'r') as file:
36 data = file.read()
37
38 new_data = data
39 for image_type in image_types:
40 new_data = new_data.replace(image_type, '.webp')
41
42 if new_data != data:
43 with open(file_path, 'w') as file:
44 file.write(new_data)
45 except UnicodeDecodeError:
46 print(f'Could not read file {file_path} due to UnicodeDecodeError.')
47
48def main():
49 current_path = Path('../')

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected