[Biopython-dev] Bio.File

Peter Cock p.j.a.cock at googlemail.com
Wed Oct 19 04:49:27 EDT 2011


On Wed, Oct 19, 2011 at 3:39 AM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
> Hi Peter,
>
>> That leaves Bio/SCOP/__init__.py as the only existing or
>> imminent code using Bio.File, so if we can sort that out,
>> we can deprecate Bio.File as you suggested.
>
> In Bio/SCOP/__init__.py, Bio.File.UndoHandle is used in the _open
> function, which is an internal function used in the "search" function
> in Bio.SCOP. The UndoHandle is used to wrap a handle returned
> by urllib.urlopen.

Should we change that to use urllib2 for better error handling,
as in Bio.Entrez's _open?

> This search function returns a handle to data in HTML format.
> I don't think we have a parser for it. This suggests that there is
> no specific purpose for UndoHandle in Bio.SCOP._open.

I wonder if that is a sign of URL rot, it would make more sense
to get plain text back. Sadly there were no unit tests for this at
all until now, and I don't yet do anything with the handle other
than confirm we get one!

https://github.com/biopython/biopython/commit/10b94a7b5611edde5fe05f95406d927e5a6a02d9

> So I would suggest to just remove the UndoHandle from
> Bio.SCOP._open and return the urllib.urlopen handle directly.
>
> Any objections?

Sounds fine.

Peter


More information about the Biopython-dev mailing list