Skip to content

[ENH] owfile: allow multiple readers with same extension#2644

Merged
astaric merged 4 commits intobiolab:masterfrom
markotoplak:reader_select
Oct 5, 2017
Merged

[ENH] owfile: allow multiple readers with same extension#2644
astaric merged 4 commits intobiolab:masterfrom
markotoplak:reader_select

Conversation

@markotoplak
Copy link
Member

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

@borondics
Copy link
Member

borondics commented Oct 2, 2017 via email

@markotoplak
Copy link
Member Author

markotoplak commented Oct 3, 2017

@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-io
Copy link

codecov-io commented Oct 4, 2017

Codecov Report

Merging #2644 into master will increase coverage by 0.07%.
The diff coverage is 97.9%.

@@            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

@markotoplak markotoplak force-pushed the reader_select branch 3 times, most recently from 78e112e to 0551325 Compare October 4, 2017 14:51
return cls.__module__ + '.' + cls.__name__


def file_format_from_qualified_name(format_name):
Copy link
Member

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):
Copy link
Member

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open_iris_with_tab

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
Copy link
Member

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

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
Copy link
Member

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.
@astaric astaric changed the title [RFC] owfile: select reader [ENH] owfile: allow multiple readers with same extension Oct 5, 2017
@astaric astaric merged commit 70803f4 into biolab:master Oct 5, 2017
@markotoplak markotoplak deleted the reader_select branch October 5, 2017 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants