Add more type annotations to dxtbx for refactoring efforts#845
Draft
Add more type annotations to dxtbx for refactoring efforts#845
Conversation
c307315 to
1efe782
Compare
f1ae2cb to
a10e625
Compare
This is used in several places. Annotate, but also make explicitly handle pathlib.Path objects, including returning a Path if the function is passed a Path in the first place. Technically there is a minor change in the outer API: Previously, if the function was passed None as the path=, it would change the return type to "" (empty string). Now, passing None is forbidden by the type annotations - but if a None is passed in anyway, it will return None (the same type).
In process of annotating, found several functions with unnecessarily packed arguments or with disused arguments. This removes those to tidy. Also, factor out some common format class logic.
And, reload that class on deserialization. At the moment, this doesn't validate that the behaviour of everything else under check_format conditions makes sense.
This should mean that any need for check_format will go away - because unless you try to access the data, the file will not be touched. Heavily WIP, specific known things to be done: - Pickle support, as these will probably be sent across process boundaries - Exhaustive testing
a10e625 to
8ec8981
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.