sourabhzanwar commited on
Commit
974f253
·
1 Parent(s): 6ec3347

updateed app.py, added file to check if v1 is already changed

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -1,24 +1,24 @@
1
- #import pydantic
2
- #module_file_path = pydantic.__file__
3
 
4
- #module_file_path = module_file_path.split('pydantic')[0] + 'haystack'
5
 
6
- #import os
7
- #import fileinput
8
 
9
 
10
- #def replace_string_in_files(folder_path, old_str, new_str):
11
- # for subdir, dirs, files in os.walk(folder_path):
12
- # for file in files:
13
- # file_path = os.path.join(subdir, file)
14
 
15
  # Check if the file is a text file (you can modify this condition based on your needs)
16
- # if file.endswith(".txt") or file.endswith(".py"):
17
- # # Open the file in place for editing
18
- # with fileinput.FileInput(file_path, inplace=True) as f:
19
- # for line in f:
20
- # # Replace the old string with the new string
21
- # print(line.replace(old_str, new_str), end='')
22
 
23
  #with open('change_log.txt','r') as f:
24
  # status = f.readlines()
 
1
+ import pydantic
2
+ module_file_path = pydantic.__file__
3
 
4
+ module_file_path = module_file_path.split('pydantic')[0] + 'haystack'
5
 
6
+ import os
7
+ import fileinput
8
 
9
 
10
+ def replace_string_in_files(folder_path, old_str, new_str):
11
+ for subdir, dirs, files in os.walk(folder_path):
12
+ for file in files:
13
+ file_path = os.path.join(subdir, file)
14
 
15
  # Check if the file is a text file (you can modify this condition based on your needs)
16
+ if file.endswith(".txt") or file.endswith(".py"):
17
+ # Open the file in place for editing
18
+ with fileinput.FileInput(file_path, inplace=True) as f:
19
+ for line in f:
20
+ # Replace the old string with the new string
21
+ print(line.replace(old_str, new_str), end='')
22
 
23
  #with open('change_log.txt','r') as f:
24
  # status = f.readlines()