Skip to content
Snippets Groups Projects

Support parsing from an already open file handle.

Merged Marek Szuba requested to merge feature/openhandlesupport into master

Created by: andrewyatz

This changes the code in TextParser to check if the given filename was a file handle. If it is a file handle the code just assigns it and assumes you know what you are doing.

There was also some cleaning up of the open_content() method to delegate to open() once it had created the in-memory filehandle. It seemed odd not to do once open() could support open filehandles.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: ens-ap5

    Seems reasonable - I hacked in the open_content method when I was trying to get the IO parsers to play nicely with the new web upload interface.

  • Created by: muffato

    Do you think TextParser::open() should do a seek() to reset the position to the beginning of the file ? I'm thinking of the scenario where some code opens a file, reads the first bytes to discover which type it is, and then give the file-handle to the relevant ensembl-io parser.

  • Created by: andrewyatz

    Hmmm. I would say no. In the code you’re describing I’d want the code doing that sniffing to reset the file handle position. Otherwise it’s just code second guessing a situation which we may never develop

    On 18 Aug 2015, at 17:24, Matthieu Muffato notifications@github.com wrote:

    Do you think TextParser::open() should do a seek() to reset the position to the beginning of the file ? I'm thinking of the scenario where some code opens a file, reads the first bytes to discover which type it is, and then give the file-handle to the relevant ensembl-io parser.

    — Reply to this email directly or view it on GitHub https://github.com/Ensembl/ensembl-io/pull/17#issuecomment-132265912.

  • Created by: muffato

    Sounds good to me !

  • Created by: andrewyatz

    That's two :thumbsup: so I'm going to merge

Please register or sign in to reply