Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

handling .z files as gzip#191

Open
seanmacavaney wants to merge 2 commits intomasterfrom
trecdocs_misc
Open

handling .z files as gzip#191
seanmacavaney wants to merge 2 commits intomasterfrom
trecdocs_misc

Conversation

Copy link
Collaborator

seanmacavaney commented May 5, 2022

regarding #189

Took the opportunity to improve the tests here for the variety of formats, etc. that TrecDocs may encounter.

@ArthurCamara -- mind running python -m tests.integration.disks45 when using your .z files when you have a chance?

seanmacavaney added 2 commits May 5, 2022 21:59
Copy link
Contributor

ArthurCamara commented May 5, 2022

That did not work, actually. seems like Python's Gzip implementation does not recognize it as a gzip file (however, gunzip can decompress it no problem)
Digging deeper, .z is a REALLY old file format, created by using Pack: https://en.wikipedia.org/wiki/Pack_(compression)
and Gzip's documentation says that it cannot handle it:

Note that additional file formats which can be decompressed by the gzip and gunzip programs, such as those produced by compress and pack, are not supported by this module.

I've searched for a bit, but couldn't find any Python library that can deal with it properly, it seems.

Copy link
Collaborator Author

seanmacavaney commented May 6, 2022

Hmmm, okay, I see.

Even though the format is relatively simple, I'm not so keen on writing my own parser for the format.

So the only other reasonable option for supporting it in the software itself would be to invoke gunzip (or similar) when it encounters these files. This comes with overhead and isn't good for cross-platform compatibility, but I think I could live with it to handle this (presumably) uncommon format.

Copy link
Contributor

ArthurCamara commented May 6, 2022

I agree. I don't see a reason to worry too much about it. We can either 1. Pip everything into gunzip using subprocess.Popen even only os.system if we don't care about the return value or 2. Throw an error message asking the user to do that by themselves.

ArthurCamara mentioned this pull request May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants