Skip to content

Commit da9d49d

Browse files
committed
chore(gen): remove whole file approach
1 parent 1aee5b6 commit da9d49d

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

replace_concepts.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,9 @@ def check_if_concept_in_other_concept(concepts_list):
6262
skip_concept = True
6363
print(f"Concept \"{i}\" is contained in \n{j}\n")
6464
return skip_concept
65+
6566

66-
# Working implementation
67-
def replace_string_in_file(self, current_file, old_string, new_string):
68-
with open(current_file, "r+") as file_to_process:
69-
content = file_to_process.read()
70-
new_content = content.replace(old_string, new_string, 1)
71-
file_to_process.seek(0)
72-
file_to_process.truncate(0)
73-
print(file_to_process)
74-
file_to_process.write(new_content)
75-
return
76-
77-
# Version with line-by-line processing
67+
# WORKING - Version with line-by-line processing
7868
def line_by_line_replace(self, current_file, old_string, new_string):
7969
with open(current_file, "r") as file_to_process:
8070
lines_of_file = file_to_process.readlines()

0 commit comments

Comments
 (0)