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

Adding support for Unknown Extra block and appended data after Terminal block #28

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

gdesmar
Copy link
Contributor

@gdesmar gdesmar commented Mar 5, 2024

No description provided.

Copy link
Owner

@Matmaus Matmaus left a comment

Choose a reason for hiding this comment

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

Thank you for driving this improvement. Most of my remarks are responses to your questions asked in the related issue. I did not realize all the difficulties so it is good you have pointed them out. Also, could you please add two files mentioned in the issue as new tests?

LnkParse3/extra/terminal.py Outdated Show resolved Hide resolved
LnkParse3/extra/terminal.py Outdated Show resolved Hide resolved
LnkParse3/extra/terminal.py Show resolved Hide resolved
LnkParse3/extra_data.py Outdated Show resolved Hide resolved
LnkParse3/extra_data.py Outdated Show resolved Hide resolved
LnkParse3/extra/terminal.py Outdated Show resolved Hide resolved
LnkParse3/extra_data.py Outdated Show resolved Hide resolved
@Matmaus Matmaus self-assigned this Mar 5, 2024
@Matmaus Matmaus linked an issue Mar 5, 2024 that may be closed by this pull request
@gdesmar
Copy link
Contributor Author

gdesmar commented Mar 7, 2024

I modified the Unknown block to not use a property, since none of the other block does.
I regenerated the tests to pass, and realized you already had a file with data following the Terminal block, so I added it also as a txt output test.

Regarding text output, I modified the print_lnk_file function to fit the current coding style, but I'm not a fan of hard-coding keys for which there is different behaviour. I went down a very deep rabbit hole to make it all agnostic. It would make those hard-coded list items re-use their parent instead: Serialized property values having many Property under it, in the agnostic first version, those got transformed from Property: to Serialized property values - <N>: with being the index, and Storage: under Property store: to Property store - <N>:, thinking that now any list would be handled. I then decided that the extra layers for lists were long and probably not needed and did something similar to yaml where list items have a - in front. It's nice looking but the code got a little complicated, I would rather open a new PR if I was to offer it. :D
There is one little tweak I did in the text output, for the nice_id, it will uppercase the key name if it's a hash algorithm, so that SHA256 does not show up as Sha256.

@gdesmar
Copy link
Contributor Author

gdesmar commented Mar 7, 2024

If you were curious to see what difference the agnostic+yaml changes makes in the output (and the code 😨), I uploaded a new branch with it.
I tried to stick as closely to the original for the early print levels, such that level 1 are not nice'd but has a colon, level 2 are not nice'd and no colon, while other levels are nice'd and has a colon. It was an interesting journey. 😃

Copy link
Owner

@Matmaus Matmaus left a comment

Choose a reason for hiding this comment

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

LGTM, just two last remarks (also, please fix linting issues so that all the tests will pass).

Regarding you agnostic print approach, I like it. Let's discuss it in the follow up PR.

LnkParse3/extra/terminal.py Outdated Show resolved Hide resolved
tests/test_samples.py Show resolved Hide resolved
@Matmaus Matmaus merged commit ffb9dd7 into Matmaus:master Mar 12, 2024
4 checks passed
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.

Extraction of data following the Extra Data/Terminal Block
2 participants