def eval(self, cmds, verbose=True, timeout=None, stream_handler=None,<EOL>temp_dir=None, plot_dir=None, plot_name='<STR_LIT>', plot_format='<STR_LIT>',<EOL>plot_width=None, plot_height=None, plot_res=None,<EOL>nout=<NUM_LIT:0>, **kwargs):
if isinstance(cmds, (str, unicode)):<EOL><INDENT>cmds = [cmds]<EOL><DEDENT>prev_temp_dir = self.temp_dir<EOL>self.temp_dir = temp_dir or self.temp_dir<EOL>prev_log_level = self.logger.level<EOL>if kwargs.get('<STR_LIT>') is False:<EOL><INDENT>self.logger.setLevel(logging.WARN)<EOL><DEDENT>for name in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if name not in kwargs:<EOL><INDENT>continue<EOL><DEDENT>msg = '<STR_LIT>'<EOL>warnings.warn(msg % name, stacklevel=<NUM_LIT:2>)<EOL><DEDENT>return_both = kwargs.pop('<STR_LIT>', False)<EOL>lines = []<EOL>if return_both and not stream_handler:<EOL><INDENT>stream_handler = lines.append<EOL><DEDENT>ans = None<EOL>for cmd in cmds:<EOL><INDENT>resp = self.feval('<STR_LIT>', '<STR_LIT>', cmd,<EOL>nout=nout, timeout=timeout,<EOL>stream_handler=stream_handler,<EOL>verbose=verbose, plot_dir=plot_dir,<EOL>plot_name=plot_name, plot_format=plot_format,<EOL>plot_width=plot_width, plot_height=plot_height,<EOL>plot_res=plot_res)<EOL>if resp is not None:<EOL><INDENT>ans = resp<EOL><DEDENT><DEDENT>self.temp_dir = prev_temp_dir<EOL>self.logger.setLevel(prev_log_level)<EOL>if return_both:<EOL><INDENT>return '<STR_LIT:\n>'.join(lines), ans<EOL><DEDENT>return ans<EOL>
Evaluate an Octave command or commands.

Parameters
----------
cmds : str or list
    Commands(s) to pass to Octave.
verbose : bool, optional
     Log Octave output at INFO level.  If False, log at DEBUG level.
stream_handler: callable, optional
    A function that is called for each line of output from the
    evaluation.
timeout : float, optional
    Time to wait for response from Octave (per line).  If not given,
    the instance `timeout` is used.
nout : int, optional.
    The desired number of returned values, defaults to 0.  If nout
    is 0, the `ans` will be returned as the return value.
temp_dir: str, optional
    If specified, the session's MAT files will be created in the
    directory, otherwise a the instance `temp_dir` is used.
    a shared memory (tmpfs) path.
plot_dir: str, optional
    If specificed, save the session's plot figures to the plot
    directory instead of displaying the plot window.
plot_name : str, optional
    Saved plots will start with `plot_name` and
    end with "_%%.xxx' where %% is the plot number and
    xxx is the `plot_format`.
plot_format: str, optional
    The format in which to save the plot (PNG by default).
plot_width: int, optional
    The plot with in pixels.
plot_height: int, optional
    The plot height in pixels.
plot_res: int, optional
    The plot resolution in pixels per inch.
**kwargs Deprectated kwargs.

Examples
--------
>>> from oct2py import octave
>>> octave.eval('disp("hello")') # doctest: +SKIP
hello
>>> x = octave.eval('round(quad(@sin, 0, pi/2));')
>>> x
1.0

>>> a = octave.eval('disp("hello");1;')  # doctest: +SKIP
hello
>>> a = octave.eval('disp("hello");1;', verbose=False)
>>> a
1.0

>>> from oct2py import octave
>>> lines = []
>>> octave.eval('for i = 1:3; disp(i);end', \
                stream_handler=lines.append)
>>> lines  # doctest: +SKIP
[' 1', ' 2', ' 3']

Returns
-------
out : object
    Octave "ans" variable, or None.

Notes
-----
The deprecated `log` kwarg will temporarily set the `logger` level to
`WARN`.  Using the `logger` settings directly is preferred.
The deprecated `return_both` kwarg will still work, but the preferred
method is to use the `stream_handler`.  If `stream_handler` is given,
the `return_both` kwarg will be honored but will give an empty string
as the reponse.

Raises
------
Oct2PyError
    If the command(s) fail.