-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[ENH] owfile: allow multiple readers with same extension #2644
Conversation
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
@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
Orange/data/io.py
Outdated
return cls.__module__ + '.' + cls.__name__ | ||
|
||
|
||
def file_format_from_qualified_name(format_name): |
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.
object_from_qualified_name?
def test_read_format(self): | ||
iris = Table("iris") | ||
|
||
def iris_with_no_specific_format(a, b, c, filters, e): |
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.
open_iris_with_no_specific_format
|
||
self.assertIsNone(self.widget.recent_paths[0].file_format) | ||
|
||
def iris_with_tab(a, b, c, filters, e): |
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.
open_iris_with_tab
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 |
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.
This does not match
return filename, file_format, filter
class RecentPath: | ||
abspath = '' | ||
prefix = None #: Option[str] # BASEDIR | SAMPLE-DATASETS | ... | ||
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 |
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.
preferred_reader?
FileFormat uses PRIORITY for preference. When formats share extension, use the format with the lowest priority.
0551325
to
e6b3cbb
Compare
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