diff --git a/docs/_notebooks/core/tellurium_examples.rst b/docs/_notebooks/core/tellurium_examples.rst index ddf64841..66601e3f 100644 --- a/docs/_notebooks/core/tellurium_examples.rst +++ b/docs/_notebooks/core/tellurium_examples.rst @@ -169,12 +169,12 @@ conditions resulting in different steady states reached. print(r.selections) initValue = 0.05 - m = r.simulate (0, 4, 100, selections=["time", "S1"]) + m = r.simulate (0, 4, 100, selections=["time", "[S1]"]) for i in range (0,12): r.reset() r['[S1]'] = initValue - res = r.simulate (0, 4, 100, selections=["S1"]) + res = r.simulate (0, 4, 100, selections=["[S1]"]) m = np.concatenate([m, res], axis=1) initValue += 1 diff --git a/tellurium/VERSION.txt b/tellurium/VERSION.txt index a6333e40..0d3ad67a 100644 --- a/tellurium/VERSION.txt +++ b/tellurium/VERSION.txt @@ -1 +1 @@ -2.2.9 +2.2.10 diff --git a/tellurium/__init__.py b/tellurium/__init__.py index 24d51a1d..812be966 100644 --- a/tellurium/__init__.py +++ b/tellurium/__init__.py @@ -136,13 +136,6 @@ executeInlineOmexFromFile, ) -# Package utilities -from tellurium.utils.package import ( - searchPackage, - installPackage, - upgradePackage, - uninstallPackage, -) from tellurium.utils.misc import( saveToFile, readFromFile, diff --git a/tellurium/teconverters/convert_omex.py b/tellurium/teconverters/convert_omex.py index 20daba37..7a9e4c5e 100644 --- a/tellurium/teconverters/convert_omex.py +++ b/tellurium/teconverters/convert_omex.py @@ -9,7 +9,6 @@ import getpass -import imp # reloads because numl is overwriting symbols try: import libcombine except ImportError: diff --git a/tellurium/tests/test_examples.py b/tellurium/tests/test_examples.py index 5dd24b05..525de0f5 100644 --- a/tellurium/tests/test_examples.py +++ b/tellurium/tests/test_examples.py @@ -6,8 +6,8 @@ import unittest import os -import imp from tellurium.tests.helpers import filesInDirectory +from importlib.machinery import SourceFileLoader # ---------------------------------------------------------------- # List of python files to test @@ -44,7 +44,7 @@ def test(self=None): """ Test failes if Exception in execution of f. """ if self is not None: print(filePath) - imp.load_source(os.path.basename(filePath)[:-3], filePath) + SourceFileLoader(os.path.basename(filePath)[:-3], filePath).load_module() return test diff --git a/tellurium/utils/misc.py b/tellurium/utils/misc.py index ee39188a..23a0c00f 100644 --- a/tellurium/utils/misc.py +++ b/tellurium/utils/misc.py @@ -85,7 +85,7 @@ def runTool (toolFileName): root, waste = os.path.split(p) toolFileName[0] = root + '\\telluriumTools\\' + toolFileName[0] + '\\' + toolFileName[0] + '.exe' return subprocess.check_output(toolFileName) - except subprocess.CalledProcessError as e: + except subprocess.CalledProcessError: raise Exception('Tool failed to run correctly or could not be found') # --------------------------------------------------------------------- @@ -98,7 +98,7 @@ def getODEsFromSBMLFile (fileName): >>> te.getODEsFromSBMLFile ('mymodel.xml') """ - sbmlStr = te.readFromFile (fileName) + sbmlStr = readFromFile (fileName) extractor = ODEExtractor (sbmlStr) return extractor.toString() @@ -197,7 +197,6 @@ def __init__(self, sbmlStr): self.use_species_names = False self.use_ids = True - from collections import defaultdict self.accumulators = {} self.accumulator_list = [] diff --git a/tellurium/utils/omex.py b/tellurium/utils/omex.py index 312b0c2c..9721efa2 100644 --- a/tellurium/utils/omex.py +++ b/tellurium/utils/omex.py @@ -57,9 +57,9 @@ def __init__(self, location, format=None, formatKey=None, master=False, descript def __str__(self): if self.master: - return '<*master* Entry {} | {}>'.format(self.master, self.location, self.format) + return '<*master* Entry {} | {}>'.format(self.location, self.format) else: - return ''.format(self.master, self.location, self.format) + return ''.format(self.location, self.format) class Creator(object): @@ -90,7 +90,7 @@ def combineArchiveFromDirectory(directory, omexPath, creators=None, creators_for print(manifest_path) if os.path.exists(manifest_path): - warnings.warn("Manifest file exists in directory, but not used in COMBINE archive creation: %s".format(manifest_path)) + warnings.warn("Manifest file exists in directory {}, but not used in COMBINE archive creation: %s".format(manifest_path)) # add the base entry entries = [ diff --git a/tellurium/utils/package.py b/tellurium/utils/package.py deleted file mode 100644 index ccadbbcb..00000000 --- a/tellurium/utils/package.py +++ /dev/null @@ -1,63 +0,0 @@ -""" -Provides trivial wrappers around pip and functionality -working with packages. -""" - -from __future__ import print_function, absolute_import -import sys, subprocess - -def check_macos_ver(): - import sys,platform - if sys.platform == 'darwin': - vstr, _, _ = platform.mac_ver() - from distutils.version import LooseVersion - import warnings - v = LooseVersion(vstr) - oldest_str = '10.9.0' - if v < LooseVersion(oldest_str): - warnings.warn('Your OS version is older than the oldest supported version ({} < {}). The operation may fail.'.format(vstr,oldest_str)) - -def searchPackage(name): - """ Search pip package for package name. - - :param name: package name - :type name: str - """ - check_macos_ver() - subprocess.check_call([sys.executable, '-m', 'pip', 'search', name]) - - -def installPackage(name): - """ Install pip package. - This has the advantage you don't have to - manually track down the currently running - Python interpreter and switch to the command line - (useful e.g. in the Tellurium notebook viewer). - - :param name: package name - :type name: str - """ - check_macos_ver() - try: - subprocess.check_call([sys.executable, '-m', 'pip', 'install', name]) - except subprocess.CalledProcessError as error: - print ("Error while calling installPackage:", error) - -def upgradePackage(name): - """ Upgrade pip package. - - :param name: package name - :type name: str - """ - check_macos_ver() - subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', name]) - - -def uninstallPackage(name): - """ Uninstall pip package. - - :param str name: package name - :type name: str - """ - check_macos_ver() - subprocess.check_call([sys.executable, '-m', 'pip', 'uninstall', '-y', name]) diff --git a/tellurium/utils/uncertainty.py b/tellurium/utils/uncertainty.py index f4e31ed1..a23a5284 100644 --- a/tellurium/utils/uncertainty.py +++ b/tellurium/utils/uncertainty.py @@ -8,7 +8,6 @@ te.setDefaultPlottingEngine("matplotlib") import numpy as np import random -import roadrunner import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gs