Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for comment lines starting with '#' in databases #987

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SpiralBrad
Copy link
Contributor

This patch allows database files to have comment lines starting with '#'.

Useful for dates, descriptions, data source info...

Copy link
Owner

@frederic-mahe frederic-mahe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@hotelvictorcharlie
Copy link
Contributor

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?

@SpiralBrad
Copy link
Contributor Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants