Skip to content

Commit

Permalink
database.jedec: fix SyntaxWarning.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanda-phi committed Nov 2, 2023
1 parent adf0d9f commit 91e40d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions software/glasgow/database/jedec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ def jedec_mfg_name_from_bank_num(bank, mfg_num):
]

def _jedec_update_mfg_from_pdf():
import fitz
import fitz
import re
import argparse

Expand All @@ -1843,14 +1843,14 @@ def _jedec_update_mfg_from_pdf():
with fitz.open(args.pdf_filepath) as doc:
for page in doc:
pdf_text += page.get_text()
jep106_matches = re.findall('^(\d+) (.+(?:\n.+){0,1})(?:(?:\n\d ){8})(?:\n)([0-9A-F]{2})',pdf_text, re.MULTILINE)
jep106_matches = re.findall(r'^(\d+) (.+(?:\n.+){0,1})(?:(?:\n\d ){8})(?:\n)([0-9A-F]{2})', pdf_text, re.MULTILINE)

output_text = ""
with open(__file__, 'r') as source_file:
output_text += source_file.read()

# Update version string
output_text = re.sub("^# Version.*", f"# Version: JEDEC {args.pdf_filepath}", output_text)
output_text = re.sub(r"^# Version.*", f"# Version: JEDEC {args.pdf_filepath}", output_text)

manufacturers_array = "_manufacturers = [\n"
bank_no = 0
Expand All @@ -1863,9 +1863,9 @@ def _jedec_update_mfg_from_pdf():
manufacturers_array += f" [ # Bank {bank_no}\n"
manufacturers_array += f" ({int(entry[0])}, \"{entry[1]}\", 0x{int(entry[2], 16):02X}),\n"
manufacturers_array += " ]\n]"

# Update Manufacturers array
output_text = re.sub("_manufacturers = \[(.|\n)*^\]", manufacturers_array, output_text, flags=re.MULTILINE)
output_text = re.sub(r"_manufacturers = \[(.|\n)*^\]", manufacturers_array, output_text, flags=re.MULTILINE)

with open(args.output_filepath, 'w') as f:
print(output_text, file=f, end='')
Expand Down

0 comments on commit 91e40d3

Please sign in to comment.