-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
got rid of non-working square brackets with dollar sign
- Loading branch information
1 parent
d9d25fd
commit 871eb16
Showing
5 changed files
with
45 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
|
||
def find_lines_with_brackets(file_path): | ||
with open(file_path, 'r', encoding='utf-8') as file: | ||
lines = file.readlines() | ||
|
||
lines_with_brackets = [] | ||
inside_exclude_block = False | ||
|
||
for index, line in enumerate(lines): | ||
stripped_line = line.strip() | ||
|
||
if "begin" in stripped_line: | ||
inside_exclude_block = True | ||
if "end" in stripped_line: | ||
inside_exclude_block = False | ||
continue | ||
|
||
if not inside_exclude_block and ('[' in stripped_line or ']' in stripped_line): | ||
lines_with_brackets.append((index + 1, stripped_line)) | ||
|
||
return lines_with_brackets | ||
|
||
def process_directory(directory): | ||
for root, _, files in os.walk(directory): | ||
for file in files: | ||
if file == 'solution.md': | ||
file_path = os.path.join(root, file) | ||
lines_with_brackets = find_lines_with_brackets(file_path) | ||
if lines_with_brackets: | ||
print(f"File: {file_path}") | ||
for line_number, line in lines_with_brackets: | ||
print(f" Line {line_number}: {line}") | ||
print() | ||
|
||
if __name__ == "__main__": | ||
directory = os.path.dirname(os.path.abspath(__file__)) | ||
process_directory(directory) |