From eeab501987de61ae5935153e1b1a0b225878cb84 Mon Sep 17 00:00:00 2001 From: fomightez Date: Wed, 28 Aug 2013 16:41:05 -0400 Subject: [PATCH] Remove with_statement imports required under Python 2.5 Removed all the with statement imports (and any comment lines associated with them); from __future__ import with_statement --- Bio/AlignIO/__init__.py | 2 -- Bio/File.py | 2 -- Bio/Nexus/Nexus.py | 3 --- Bio/PDB/DSSP.py | 2 -- Bio/PDB/PDBList.py | 3 --- Bio/PDB/PDBParser.py | 3 --- Bio/PDB/parse_pdb_header.py | 2 -- Bio/Phylo/PAML/baseml.py | 3 --- Bio/Phylo/PAML/codeml.py | 3 --- Bio/Phylo/_io.py | 2 -- Bio/SearchIO/__init__.py | 3 --- Bio/SeqIO/PdbIO.py | 2 -- Bio/SeqIO/__init__.py | 3 --- Doc/Tutorial.tex | 5 ++--- Tests/test_Application.py | 2 -- Tests/test_BWA_tool.py | 2 -- Tests/test_File.py | 2 -- Tests/test_Phylo_NeXML.py | 2 -- Tests/test_SearchIO_blast_tab.py | 3 --- Tests/test_SearchIO_blast_text.py | 3 --- Tests/test_SeqIO_FastaIO.py | 2 -- Tests/test_SeqIO_QualityIO.py | 2 -- Tests/test_SeqIO_features.py | 2 -- Tests/test_SeqUtils.py | 2 -- Tests/test_SubsMat.py | 2 -- Tests/test_TogoWS.py | 2 -- Tests/test_Uniprot.py | 2 -- 27 files changed, 2 insertions(+), 64 deletions(-) diff --git a/Bio/AlignIO/__init__.py b/Bio/AlignIO/__init__.py index 19f313adf8f..bb37104d4d8 100644 --- a/Bio/AlignIO/__init__.py +++ b/Bio/AlignIO/__init__.py @@ -120,8 +120,6 @@ same length. """ -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement __docformat__ = "epytext en" # not just plaintext diff --git a/Bio/File.py b/Bio/File.py index 597f7190bf8..74cb7297feb 100644 --- a/Bio/File.py +++ b/Bio/File.py @@ -15,8 +15,6 @@ files are also defined under Bio.File but these are not intended for direct use. """ -# For with statement in Python 2.5 -from __future__ import with_statement import codecs import os import contextlib diff --git a/Bio/Nexus/Nexus.py b/Bio/Nexus/Nexus.py index 8bb0d15bc25..45a14785c45 100644 --- a/Bio/Nexus/Nexus.py +++ b/Bio/Nexus/Nexus.py @@ -9,9 +9,6 @@ Based upon 'NEXUS: An extensible file format for systematic information' Maddison, Swofford, Maddison. 1997. Syst. Biol. 46(4):590-621 """ -# For with in Python/Jython 2.5 -from __future__ import with_statement - import copy import math import random diff --git a/Bio/PDB/DSSP.py b/Bio/PDB/DSSP.py index ee40081793e..2e061c185d3 100644 --- a/Bio/PDB/DSSP.py +++ b/Bio/PDB/DSSP.py @@ -20,8 +20,6 @@ - - None """ -from __future__ import with_statement - import re from StringIO import StringIO import subprocess diff --git a/Bio/PDB/PDBList.py b/Bio/PDB/PDBList.py index 6c250ab11f9..b7cef2b6655 100644 --- a/Bio/PDB/PDBList.py +++ b/Bio/PDB/PDBList.py @@ -20,9 +20,6 @@ """ Access the PDB over the internet (e.g. to download structures). """ -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import contextlib import gzip import os diff --git a/Bio/PDB/PDBParser.py b/Bio/PDB/PDBParser.py index c3c60fe59e9..d337f381f30 100644 --- a/Bio/PDB/PDBParser.py +++ b/Bio/PDB/PDBParser.py @@ -5,9 +5,6 @@ """Parser for PDB files.""" -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import warnings try: diff --git a/Bio/PDB/parse_pdb_header.py b/Bio/PDB/parse_pdb_header.py index b20dcada645..b9720718d6f 100644 --- a/Bio/PDB/parse_pdb_header.py +++ b/Bio/PDB/parse_pdb_header.py @@ -23,8 +23,6 @@ """Parse the header of a PDB file.""" -# For 'with' on Python 2.5/Jython 2.5 -from __future__ import with_statement import re from Bio import File diff --git a/Bio/Phylo/PAML/baseml.py b/Bio/Phylo/PAML/baseml.py index 96c86ad3399..2876f1dc86e 100644 --- a/Bio/Phylo/PAML/baseml.py +++ b/Bio/Phylo/PAML/baseml.py @@ -3,9 +3,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import os import os.path from _paml import Paml, _relpath diff --git a/Bio/Phylo/PAML/codeml.py b/Bio/Phylo/PAML/codeml.py index a625a3f3d53..f99d7909ff5 100644 --- a/Bio/Phylo/PAML/codeml.py +++ b/Bio/Phylo/PAML/codeml.py @@ -3,9 +3,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import os import os.path from _paml import Paml, _relpath diff --git a/Bio/Phylo/_io.py b/Bio/Phylo/_io.py index 10802efcb8c..4564bab634f 100644 --- a/Bio/Phylo/_io.py +++ b/Bio/Phylo/_io.py @@ -8,8 +8,6 @@ This API follows the same semantics as Biopython's `SeqIO` and `AlignIO`. """ -# For with on Python/Jython 2.5 -from __future__ import with_statement __docformat__ = "restructuredtext en" from Bio import File diff --git a/Bio/SearchIO/__init__.py b/Bio/SearchIO/__init__.py index 096ab154e87..5a4477d6fb3 100644 --- a/Bio/SearchIO/__init__.py +++ b/Bio/SearchIO/__init__.py @@ -194,9 +194,6 @@ """ -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - __docformat__ = 'epytext en' import sys diff --git a/Bio/SeqIO/PdbIO.py b/Bio/SeqIO/PdbIO.py index 0c5b68beb22..9e40fb50ab4 100644 --- a/Bio/SeqIO/PdbIO.py +++ b/Bio/SeqIO/PdbIO.py @@ -2,8 +2,6 @@ # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - import collections import warnings diff --git a/Bio/SeqIO/__init__.py b/Bio/SeqIO/__init__.py index 5a3f362204d..67aae32c784 100644 --- a/Bio/SeqIO/__init__.py +++ b/Bio/SeqIO/__init__.py @@ -259,9 +259,6 @@ making up each alignment as SeqRecords. """ -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - __docformat__ = "epytext en" # not just plaintext #TODO diff --git a/Doc/Tutorial.tex b/Doc/Tutorial.tex index 50c4935d12b..1e7bb1f1b52 100644 --- a/Doc/Tutorial.tex +++ b/Doc/Tutorial.tex @@ -2675,11 +2675,10 @@ \section{Parsing sequences from compressed files} \noindent Here we use a file handle instead, using the \verb|with| statement -(Python 2.5 or later) to close the handle automatically: +to close the handle automatically: -%This doctest won't work on Python 2.5, even with the __future__ import. Odd. +%doctest examples \begin{verbatim} ->>> from __future__ import with_statement #Needed on Python 2.5 >>> from Bio import SeqIO >>> with open("ls_orchid.gbk") as handle: ... print sum(len(r) for r in SeqIO.parse(handle, "gb")) diff --git a/Tests/test_Application.py b/Tests/test_Application.py index 24dd33feed2..398475e79a1 100644 --- a/Tests/test_Application.py +++ b/Tests/test_Application.py @@ -9,8 +9,6 @@ stdin/stdout/stderr handling. """ -from __future__ import with_statement - import os import unittest diff --git a/Tests/test_BWA_tool.py b/Tests/test_BWA_tool.py index 476f45ad391..f80d0a77519 100644 --- a/Tests/test_BWA_tool.py +++ b/Tests/test_BWA_tool.py @@ -5,8 +5,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - from Bio import MissingExternalDependencyError import sys import os diff --git a/Tests/test_File.py b/Tests/test_File.py index 1242a4be673..fbcd8b92924 100644 --- a/Tests/test_File.py +++ b/Tests/test_File.py @@ -3,8 +3,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - import os.path import unittest import shutil diff --git a/Tests/test_Phylo_NeXML.py b/Tests/test_Phylo_NeXML.py index 65019fc1147..25aa793f29f 100644 --- a/Tests/test_Phylo_NeXML.py +++ b/Tests/test_Phylo_NeXML.py @@ -6,8 +6,6 @@ """Unit tests for the NeXML and NeXMLIO modules. """ -from __future__ import with_statement - import os import tempfile import unittest diff --git a/Tests/test_SearchIO_blast_tab.py b/Tests/test_SearchIO_blast_tab.py index 66af2557e17..691c3eb3251 100644 --- a/Tests/test_SearchIO_blast_tab.py +++ b/Tests/test_SearchIO_blast_tab.py @@ -5,9 +5,6 @@ """Tests for SearchIO BlastIO parsers.""" -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import os import unittest diff --git a/Tests/test_SearchIO_blast_text.py b/Tests/test_SearchIO_blast_text.py index 3088ef751f9..f4750a2670b 100644 --- a/Tests/test_SearchIO_blast_text.py +++ b/Tests/test_SearchIO_blast_text.py @@ -5,9 +5,6 @@ """Tests for SearchIO BlastIO plain text parsers.""" -# For using with statement in Python 2.5 or Jython -from __future__ import with_statement - import os import unittest diff --git a/Tests/test_SeqIO_FastaIO.py b/Tests/test_SeqIO_FastaIO.py index 2bc201de321..f73a3d4e532 100644 --- a/Tests/test_SeqIO_FastaIO.py +++ b/Tests/test_SeqIO_FastaIO.py @@ -4,8 +4,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - import unittest from StringIO import StringIO diff --git a/Tests/test_SeqIO_QualityIO.py b/Tests/test_SeqIO_QualityIO.py index d36778d7a99..3eacc4f959e 100644 --- a/Tests/test_SeqIO_QualityIO.py +++ b/Tests/test_SeqIO_QualityIO.py @@ -5,8 +5,6 @@ """Additional unit tests for Bio.SeqIO.QualityIO (covering FASTQ and QUAL).""" -from __future__ import with_statement - import os import unittest import warnings diff --git a/Tests/test_SeqIO_features.py b/Tests/test_SeqIO_features.py index b4860d0214b..cb4266ae190 100644 --- a/Tests/test_SeqIO_features.py +++ b/Tests/test_SeqIO_features.py @@ -8,8 +8,6 @@ Initially this takes matched tests of GenBank and FASTA files from the NCBI and confirms they are consistent using our different parsers. """ -from __future__ import with_statement - import os import unittest from Bio.Alphabet import generic_dna, generic_rna, generic_protein diff --git a/Tests/test_SeqUtils.py b/Tests/test_SeqUtils.py index 59603a8a389..09ef3516935 100644 --- a/Tests/test_SeqUtils.py +++ b/Tests/test_SeqUtils.py @@ -3,8 +3,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - import os import unittest diff --git a/Tests/test_SubsMat.py b/Tests/test_SubsMat.py index fcf3ead373d..029e431416a 100644 --- a/Tests/test_SubsMat.py +++ b/Tests/test_SubsMat.py @@ -2,8 +2,6 @@ # license. Please see the LICENSE file that should have been included # as part of this package. -from __future__ import with_statement - try: from numpy import corrcoef del corrcoef diff --git a/Tests/test_TogoWS.py b/Tests/test_TogoWS.py index eaab154fb33..ebf85cc3649 100644 --- a/Tests/test_TogoWS.py +++ b/Tests/test_TogoWS.py @@ -6,8 +6,6 @@ """Testing Bio.TogoWS online code. """ -from __future__ import with_statement - import unittest from StringIO import StringIO diff --git a/Tests/test_Uniprot.py b/Tests/test_Uniprot.py index 426fd299014..052f23b0d34 100644 --- a/Tests/test_Uniprot.py +++ b/Tests/test_Uniprot.py @@ -1,8 +1,6 @@ #!/usr/bin/env python """Test for the Uniprot parser on Uniprot XML files. """ -from __future__ import with_statement - import os import unittest