Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed deprecated Bio.Application.generic_run and ApplicationResult

  • Loading branch information...
commit 57b6b9da0a332906e0e11de90352d2266e88c17e 1 parent e0e37e1
@peterjc peterjc authored
Showing with 4 additions and 105 deletions.
  1. +0 −102 Bio/Application/__init__.py
  2. +4 −3 DEPRECATED
View
102 Bio/Application/__init__.py
@@ -54,50 +54,6 @@
#These are reserved names due to the way the wrappers work
_local_reserved_names = ["set_parameter"]
-def generic_run(commandline):
- """Run an application with the given commandline (DEPRECATED).
-
- This expects a pre-built commandline that derives from
- AbstractCommandline, and returns a ApplicationResult object
- to get results from a program, along with handles of the
- standard output and standard error.
-
- WARNING - This will read in the full program output into memory!
- This may be in issue when the program writes a large amount of
- data to standard output.
-
- NOTE - This function is deprecated, and we intend to remove it in
- future releases of Biopython.
- We now recommend you invoke subprocess directly, using str(commandline)
- to turn an AbstractCommandline wrapper into a command line string. This
- will give you full control of the tool's input and output as well.
- """
- import warnings
- import Bio
- warnings.warn("Bio.Application.generic_run and the associated "
- "Bio.Application.ApplicationResult are deprecated. "
- "Please use the Bio.Application based wrappers with "
- "the built in Python module subprocess instead, as "
- "described in the Biopython Tutorial.",
- Bio.BiopythonDeprecationWarning)
- #We don't need to supply any piped input, but we setup the
- #standard input pipe anyway as a work around for a python
- #bug if this is called from a Windows GUI program. For
- #details, see http://bugs.python.org/issue1124861
- child = subprocess.Popen(str(commandline),
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- universal_newlines=True,
- shell=(sys.platform!="win32"))
- #Use .communicate as might get deadlocks with .wait(), see Bug 2804/2806
- r_out, e_out = child.communicate()
- # capture error code:
- error_code = child.returncode
- return ApplicationResult(commandline, error_code), \
- File.UndoHandle(StringIO.StringIO(r_out)), \
- File.UndoHandle(StringIO.StringIO(e_out))
-
class ApplicationError(_ProcessCalledError):
"""Raised when an application returns a non-zero exit status.
@@ -140,64 +96,6 @@ def __repr__(self):
% (self.returncode, self.cmd, self.stdout, self.stderr)
-class ApplicationResult:
- """Make results of a program available through a standard interface (DEPRECATED).
-
- This tries to pick up output information available from the program
- and make it available programmatically.
-
- NOTE - This class hase been deprecated and we intend to remove it in
- a future release of Biopython.
- """
- def __init__(self, application_cl, return_code):
- """Intialize with the commandline from the program.
- """
- import warnings
- import Bio
- warnings.warn("Bio.Application.ApplicationResult and the "
- "associated function Bio.Application.generic_run "
- "are deprecated. Please use the Bio.Application "
- "based wrappers with the built in Python module "
- "subprocess instead, as described in the Biopython "
- "Tutorial.", Bio.BiopythonDeprecationWarning)
- self._cl = application_cl
-
- # provide the return code of the application
- self.return_code = return_code
-
- # get the application dependent results we can provide
- # right now the only results we handle are output files
- self._results = {}
-
- for parameter in self._cl.parameters:
- if "file" in parameter.param_types and \
- "output" in parameter.param_types:
- if parameter.is_set:
- self._results[parameter.names[-1]] = parameter.value
-
- def get_result(self, output_name):
- """Retrieve result information for the given output.
-
- Supports any of the defined parameters aliases (assuming the
- parameter is defined as an output).
- """
- try:
- return self._results[output_name]
- except KeyError, err:
- #Try the aliases...
- for parameter in self._cl.parameters:
- if output_name in parameter.names:
- return self._results[parameter.names[-1]]
- #No, really was a key error:
- raise err
-
- def available_results(self):
- """Retrieve a list of all available results.
- """
- result_names = self._results.keys()
- result_names.sort()
- return result_names
-
class AbstractCommandline(object):
"""Generic interface for constructing command line strings.
View
7 DEPRECATED
@@ -85,9 +85,10 @@ in Release 1.51, and removed in Release 1.55. Please use psycopg2 instead.
Bio.Application.generic_run and ApplicationResult
=================================================
-Declared obsolete in Release 1.51, and deprecated in Release 1.53.
-Please use the Python subprocess module instead, of as of Release 1.55 the
-application wrappers can be used directly to execute the command.
+Declared obsolete in Release 1.51, deprecated in Release 1.53, and removed in
+Release 1.57. Please use the Python subprocess module instead, or as of
+Release 1.55 the application wrappers can be used directly to execute the
+command.
Bio.Entrez.efetch and rettype="genbank"
=======================================
Please sign in to comment.
Something went wrong with that request. Please try again.