INNER CODE UNIT · Python
run_add_license
crocs-muni/javacard-curated-list · scripts/process_curated_list.py:531
def run_add_license(path):
if path.startswith("http://") or path.startswith("https://"):
print("Error: --add-license overwrites the source file in place and only "
"supports a local file path, not a URL", file=sys.stderr)
sys.exit(1)
print(f"Reading {path} ...", file=sys.stderr)
with open(path, encoding="utf-8") as f:
original_text = f.read()
markdown_text = original_text.replace("\r\n", "\n").replace("\r", "\n")
lines = markdown_text.split("\n")
entries = parse_entries(markdown_text)
print(f" found {len(entries)} entries", file=sys.stderr)
added = 0
skipped = 0
for e in entries: