-
Notifications
You must be signed in to change notification settings - Fork 42
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
Review tree_mft.py with mypy --strict #81
Review tree_mft.py with mypy --strict #81
Conversation
The `Mmap` class in `tree_mft.py` appears to be a redundant and fallen- behind implementation of the `Mmap` class in `BinaryParser.py`. This patch uses the central implementation instead, which happens to enable `mpy --strict` to pass. These changes were tested in Pythons 3.8 through 3.12. No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson <[email protected]>
Sorry, converting to draft.
Changing
I had thought
I'll work through this tomorrow. |
memory is cheap these days (it wasn't when the script was first written) so i think it might be reasonable to remove the mmap code. just read the whole MFT into memory as a bytearray. alternatively, since Python 3.2 mmap supports being used as a context manager directly, so we should use that, not our own (probably broken) implementation. |
This patch includes some updates to type signatures so `mypy` continues to pass as called in the top Makefile. These changes were tested in Pythons 3.8 through 3.12. No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson <[email protected]>
This patch adds type annotations along the flow from some parameters named `buf` were changed from being typed `array.array` to `mmap.mmap`. This review seems to show there are no type conflicts along these specific changes, according to `mypy` as it runs in CI. These changes were tested in Pythons 3.8 through 3.12. No effects were observed on Make-managed files. Disclaimer: Participation by NIST in the creation of the documentation of mentioned software is not intended to imply a recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that any specific software is necessarily the best available for the purpose. Signed-off-by: Alex Nelson <[email protected]>
Removing So, if the overall decision is to keep If the overall decision is instead to just read everything into memory, we keep type uniformity at the expense of RAM pressure from significant MFT sizes. Unfortunately, I'm not sure there is currently a clean solution that lets some paths into the So, it'd be fine to me whichever way this decision goes - keep |
sounds good to me - lets keep mmap. I do recall seeing some MFTs from file servers that were multiple GBs, which would put pressure on some laptops these days. |
All righty! Keeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
No description provided.