Allow for comment lines starting with '#' in databases#987
Allow for comment lines starting with '#' in databases#987SpiralBrad wants to merge 1 commit intofrederic-mahe:masterfrom
Conversation
frederic-mahe
left a comment
There was a problem hiding this comment.
thanks @SpiralBrad that's a good idea! Could you please make the following changes?
1 - Isolate the conditional branch to limit the indentation level inside the loop, like in function extract_file().
for line in target_database:
# skip comments
if line.startswith("#"):
continue
hash_sha256, filename, _, _, hash_crc = line.strip().split("\t")[0:5]
...2 - (optional) Store the comment character '#' in a variable at the beginning of the function. Maybe comment_prefix = '#'? (naming is hard)
|
Whenever you update an SMDB file by running parse_pack (e.g. to create a commit/PR), all of the comments from the old file will get deleted. Is that what you want? |
Nope! Hadn't thought that far ahead - good point. Hold off on this PR thusly :) |
|
Why not inline comments instead? Might be easier to handle in parsing. |
This patch allows database files to have comment lines starting with '#'.
Useful for dates, descriptions, data source info...