Skip to content

Commit

Permalink
Merge pull request #22 from qlenlen/q_branch
Browse files Browse the repository at this point in the history
contextpatch: neglect blank rows
  • Loading branch information
ColdWindScholar authored Jul 5, 2024
2 parents f3df2c8 + 19c4ce8 commit f2878ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contextpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
def scan_context(file) -> dict: # 读取context文件返回一个字典
context = {}
with open(file, "r", encoding='utf-8') as file_:
for i in file_.readlines():
for line_number, i in enumerate(file_.readlines(), start=1):
if not i.strip():
print(f"[Warn] line {line_number} is empty.Skip.")
continue
filepath, *other = i.strip().split()
filepath = filepath.replace(r'\@', '@')
context[filepath] = other
Expand Down

0 comments on commit f2878ab

Please sign in to comment.