[ENH] owfile: allow multiple readers with same extension#2644
Merged
astaric merged 4 commits intobiolab:masterfrom Oct 5, 2017
Merged
[ENH] owfile: allow multiple readers with same extension#2644astaric merged 4 commits intobiolab:masterfrom
astaric merged 4 commits intobiolab:masterfrom
Conversation
Member
|
Could you just simply cycle through the readers and whichever doesn't
produce an error would be the right one?
…On Mon, Oct 2, 2017 at 3:48 PM, Marko Toplak ***@***.***> wrote:
Issue
Same extension can describe different kinds of data files.
Description of changes
Users can explicitly select a reader in the file dialog. If they do not,
Orange uses the reader for that extension with the lowest priority.
Includes
- Code changes
- Tests
- Documentation
------------------------------
You can view, comment on, or merge this pull request online at:
#2644
Commit Summary
- owfile: use selected file format
- Lint
- owfile: refactored error handling
- owfile: test unknown format qualified name
- FileFormat uses PRIORITY for preference
- owfile: test a custom tab loader
- owfile: support readers with repeated extensions
File Changes
- *M* Orange/data/io.py
<https://github.com/biolab/orange3/pull/2644/files#diff-0> (31)
- *M* Orange/tests/test_io.py
<https://github.com/biolab/orange3/pull/2644/files#diff-1> (26)
- *M* Orange/widgets/data/owfile.py
<https://github.com/biolab/orange3/pull/2644/files#diff-2> (82)
- *M* Orange/widgets/data/tests/test_owfile.py
<https://github.com/biolab/orange3/pull/2644/files#diff-3> (96)
- *M* Orange/widgets/utils/filedialogs.py
<https://github.com/biolab/orange3/pull/2644/files#diff-4> (54)
Patch Links:
- https://github.com/biolab/orange3/pull/2644.patch
- https://github.com/biolab/orange3/pull/2644.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2644>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGA0Gumw_2gbJLqTuolvjOnOSAjbAmWCks5soOmTgaJpZM4Pqqln>
.
|
a106c5f to
6c203a2
Compare
Member
Author
|
@borondics, @astaric had an interesting idea: this pull request allows anyone (or an add-on) to register a meta-reader which does just what you propose. |
Codecov Report
@@ Coverage Diff @@
## master #2644 +/- ##
==========================================
+ Coverage 75.38% 75.46% +0.07%
==========================================
Files 331 331
Lines 57857 57961 +104
==========================================
+ Hits 43618 43738 +120
+ Misses 14239 14223 -16 |
78e112e to
0551325
Compare
astaric
reviewed
Oct 5, 2017
Orange/data/io.py
Outdated
| return cls.__module__ + '.' + cls.__name__ | ||
|
|
||
|
|
||
| def file_format_from_qualified_name(format_name): |
| def test_read_format(self): | ||
| iris = Table("iris") | ||
|
|
||
| def iris_with_no_specific_format(a, b, c, filters, e): |
Member
There was a problem hiding this comment.
open_iris_with_no_specific_format
|
|
||
| self.assertIsNone(self.widget.recent_paths[0].file_format) | ||
|
|
||
| def iris_with_tab(a, b, c, filters, e): |
Orange/widgets/utils/filedialogs.py
Outdated
| title (str): title of the dialog | ||
| dialog: a function that creates a QT dialog | ||
| Returns: | ||
| (filename, filter, file_format), or `(None, None, None)` on cancel |
Member
There was a problem hiding this comment.
This does not match
return filename, file_format, filter
| relpath = '' #: Option[str] # path relative to `prefix` | ||
| title = '' #: Option[str] # title of filename (e.g. from URL) | ||
| sheet = '' #: Option[str] # sheet | ||
| file_format = None #: Option[str] # file format as a string |
FileFormat uses PRIORITY for preference. When formats share extension, use the format with the lowest priority.
0551325 to
e6b3cbb
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.
Issue
Same extension can describe different kinds of data files.
Description of changes
Users can explicitly select a reader in the file dialog. If they do not, Orange uses the reader for that extension with the lowest priority.
Includes