Skip to content
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

[FIX] Table names set by readers #1481

Merged
merged 4 commits into from
Aug 3, 2016
Merged

[FIX] Table names set by readers #1481

merged 4 commits into from
Aug 3, 2016

Conversation

lanzagar
Copy link
Contributor

Although Tables should ideally be constructed using Table methods (e.g. from_file), sometimes readers are used directly (as in owfile.py). Currently names are not set properly in that case, leading to 'untitled' datasets.
This changes readers (csv,tab,excel) to return more complete data Tables with names set.

@astaric
Copy link
Member

astaric commented Jul 28, 2016

(Some) readers can work with data which is passed as a StreamIO (instead of the filename), which is used in tests to avoid writing unnecessary temp files. For those cases, name should still default to untitled (instead of crashing).

@astaric
Copy link
Member

astaric commented Jul 28, 2016

And some tests would be nice :)

Check that filename is actually a string with the file name
and not a StringIO object as used in some tests.
@codecov-io
Copy link

codecov-io commented Aug 1, 2016

Current coverage is 88.20% (diff: 100%)

Merging #1481 into master will increase coverage by 0.01%

@@             master      #1481   diff @@
==========================================
  Files            77         77          
  Lines          7617       7624     +7   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6718       6725     +7   
  Misses          899        899          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update f370866...39e597a

@lanzagar
Copy link
Contributor Author

lanzagar commented Aug 1, 2016

Yuck!

Parameters
----------
filename : str
    name of the file to open

And then one subclass (without a comment) abuses the filename parameter for StringIO objects and we hack open to not open in some cases. And we want to maintain this although it is never used anywhere in the code apart from tests...?

But that should be handled in another PR / refactoring if we want this PR closed before winter :)

@lanzagar lanzagar changed the title [WIP] Table names set by readers [FIX] Table names set by readers Aug 1, 2016
@astaric astaric merged commit 40ccac7 into biolab:master Aug 3, 2016
@kernc
Copy link
Contributor

kernc commented Aug 3, 2016

It's not uncommon for file-like objects to be supported in place of filename paths.

@lanzagar lanzagar deleted the filename branch March 14, 2022 14:42
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