Repository navigation
Resolve wildcard classifiers in FileSet.convertible_from() - #166
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
convertible_from()included the unresolved source types of generic converters (e.g.SetOf[T],DirectoryOf[T]inFileSet.convertible_from()). These can't be instantiated, so sourcing items through the union failed withFormatDefinitionError(seen in frametree). It also left out sources thatget_converter()can actually use, e.g.Zip[TextFile]forTextFile.Changes
Source types with unresolved wildcard classifiers are no longer included.
The wildcards of generic converters are resolved from the target type:
Zip[Compressed]→Compressed(andTar,TarGzip):TextFileis convertible fromZip[TextFile]etc.SetOf[T]→DirectoryOf[T]:DirectoryOf[TextFile]is convertible fromSetOf[TextFile].Compressed→Zip[Compressed]:Zip[TextFile]is convertible fromTextFile.A resolved source is only added if
get_converter()finds a converter for it. Invalid resolved types (e.g. clashing classifiers) and ones needing no conversion are skipped.The extras modules of generically classifiable formats (e.g. archives) are imported first, so the result doesn't depend on which extras happen to be imported already.
Fixed
WithClassifiers.register_converterchecking for duplicate generic converters in aconvertersdict inherited from a base class (e.g.FsObject's, which can hold unclassified archive types), instead of the unclassified type's dict that the converter is stored inBehaviour change: every format's
convertible_from()now includes archives of itself (Zip[X],Tar[X],TarGzip[X]).Tests
test_convertible_from_wildcards.pyfor the resolved cases, and checks that there are no wildcard members.