myokit 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. myokit/__init__.py +5 -23
  2. myokit/__main__.py +70 -117
  3. myokit/_aux.py +5 -8
  4. myokit/_config.py +22 -31
  5. myokit/_datablock.py +26 -70
  6. myokit/_datalog.py +23 -53
  7. myokit/_err.py +13 -15
  8. myokit/_expressions.py +35 -55
  9. myokit/_io.py +5 -22
  10. myokit/_model_api.py +34 -47
  11. myokit/_myokit_version.py +1 -5
  12. myokit/_parsing.py +17 -25
  13. myokit/_progress.py +4 -7
  14. myokit/_protocol.py +6 -9
  15. myokit/_sim/__init__.py +7 -24
  16. myokit/_sim/cable.c +1 -3
  17. myokit/_sim/cable.py +3 -5
  18. myokit/_sim/cmodel.h +1 -3
  19. myokit/_sim/cmodel.py +1 -4
  20. myokit/_sim/compiler.py +1 -4
  21. myokit/_sim/cvodessim.c +1 -4
  22. myokit/_sim/cvodessim.py +1 -4
  23. myokit/_sim/fiber_tissue.c +2 -6
  24. myokit/_sim/fiber_tissue.py +3 -5
  25. myokit/_sim/jacobian.py +6 -7
  26. myokit/_sim/mcl.h +51 -53
  27. myokit/_sim/opencl.py +9 -22
  28. myokit/_sim/openclsim.c +2 -6
  29. myokit/_sim/openclsim.py +6 -6
  30. myokit/_sim/pacing.h +2 -6
  31. myokit/_sim/rhs.c +3 -10
  32. myokit/_sim/rhs.py +4 -13
  33. myokit/_sim/sundials.py +1 -4
  34. myokit/_system.py +10 -16
  35. myokit/_unit.py +3 -12
  36. myokit/float.py +0 -3
  37. myokit/formats/__init__.py +8 -10
  38. myokit/formats/ansic/__init__.py +0 -3
  39. myokit/formats/ansic/_ewriter.py +2 -4
  40. myokit/formats/ansic/_exporter.py +0 -3
  41. myokit/formats/axon/__init__.py +1 -3
  42. myokit/formats/axon/_abf.py +12 -15
  43. myokit/formats/axon/_atf.py +5 -6
  44. myokit/formats/axon/_importer.py +0 -3
  45. myokit/formats/cellml/__init__.py +0 -3
  46. myokit/formats/cellml/_ewriter.py +3 -6
  47. myokit/formats/cellml/_exporter.py +3 -6
  48. myokit/formats/cellml/_importer.py +1 -4
  49. myokit/formats/cellml/v1/__init__.py +0 -4
  50. myokit/formats/cellml/v1/_api.py +7 -10
  51. myokit/formats/cellml/v1/_parser.py +2 -5
  52. myokit/formats/cellml/v1/_writer.py +2 -11
  53. myokit/formats/cellml/v2/__init__.py +0 -3
  54. myokit/formats/cellml/v2/_api.py +7 -16
  55. myokit/formats/cellml/v2/_parser.py +2 -5
  56. myokit/formats/cellml/v2/_writer.py +1 -4
  57. myokit/formats/channelml/__init__.py +0 -3
  58. myokit/formats/channelml/_importer.py +4 -14
  59. myokit/formats/cpp/__init__.py +1 -3
  60. myokit/formats/cpp/_ewriter.py +0 -3
  61. myokit/formats/cuda/__init__.py +0 -3
  62. myokit/formats/cuda/_ewriter.py +2 -4
  63. myokit/formats/cuda/_exporter.py +0 -3
  64. myokit/formats/easyml/__init__.py +0 -3
  65. myokit/formats/easyml/_ewriter.py +9 -11
  66. myokit/formats/easyml/_exporter.py +0 -3
  67. myokit/formats/html/__init__.py +0 -3
  68. myokit/formats/html/_exporter.py +0 -3
  69. myokit/formats/html/_flatten.py +5 -21
  70. myokit/formats/latex/__init__.py +0 -3
  71. myokit/formats/latex/_ewriter.py +1 -4
  72. myokit/formats/latex/_exporter.py +3 -5
  73. myokit/formats/mathml/__init__.py +0 -3
  74. myokit/formats/mathml/_ewriter.py +2 -11
  75. myokit/formats/mathml/_parser.py +3 -5
  76. myokit/formats/matlab/__init__.py +0 -3
  77. myokit/formats/matlab/_ewriter.py +1 -4
  78. myokit/formats/matlab/_exporter.py +0 -3
  79. myokit/formats/opencl/__init__.py +0 -3
  80. myokit/formats/opencl/_ewriter.py +2 -4
  81. myokit/formats/opencl/_exporter.py +0 -3
  82. myokit/formats/python/__init__.py +0 -3
  83. myokit/formats/python/_ewriter.py +2 -5
  84. myokit/formats/python/_exporter.py +0 -3
  85. myokit/formats/python/template/sim.py +10 -10
  86. myokit/formats/sbml/__init__.py +0 -3
  87. myokit/formats/sbml/_api.py +17 -11
  88. myokit/formats/sbml/_importer.py +1 -4
  89. myokit/formats/sbml/_parser.py +2 -5
  90. myokit/formats/stan/__init__.py +0 -3
  91. myokit/formats/stan/_ewriter.py +2 -4
  92. myokit/formats/stan/_exporter.py +1 -4
  93. myokit/formats/sympy/__init__.py +0 -3
  94. myokit/formats/sympy/_ereader.py +1 -4
  95. myokit/formats/sympy/_ewriter.py +2 -5
  96. myokit/formats/wcp/__init__.py +0 -3
  97. myokit/formats/wcp/_wcp.py +1 -7
  98. myokit/formats/xml/__init__.py +0 -3
  99. myokit/formats/xml/_exporter.py +0 -3
  100. myokit/formats/xml/_split.py +0 -3
  101. myokit/gui/__init__.py +75 -247
  102. myokit/gui/datablock_viewer.py +100 -83
  103. myokit/gui/datalog_viewer.py +32 -44
  104. myokit/gui/explorer.py +15 -21
  105. myokit/gui/ide.py +105 -125
  106. myokit/gui/progress.py +9 -9
  107. myokit/gui/source.py +405 -374
  108. myokit/gui/vargrapher.py +2 -12
  109. myokit/lib/deps.py +7 -8
  110. myokit/lib/guess.py +1 -2
  111. myokit/lib/hh.py +5 -7
  112. myokit/lib/markov.py +9 -11
  113. myokit/lib/multi.py +1 -3
  114. myokit/lib/plots.py +1 -3
  115. myokit/pacing.py +0 -3
  116. myokit/pype.py +7 -18
  117. myokit/tests/__init__.py +3 -6
  118. myokit/tests/ansic_event_based_pacing.py +1 -4
  119. myokit/tests/ansic_fixed_form_pacing.py +1 -4
  120. myokit/tests/test_aux.py +9 -23
  121. myokit/tests/test_cellml_v1_api.py +1 -16
  122. myokit/tests/test_cellml_v1_parser.py +0 -15
  123. myokit/tests/test_cellml_v1_writer.py +0 -9
  124. myokit/tests/test_cellml_v2_api.py +1 -16
  125. myokit/tests/test_cellml_v2_parser.py +0 -15
  126. myokit/tests/test_cellml_v2_writer.py +0 -9
  127. myokit/tests/test_cmodel.py +0 -9
  128. myokit/tests/test_compiler_detection.py +1 -11
  129. myokit/tests/test_component.py +0 -10
  130. myokit/tests/test_config.py +33 -66
  131. myokit/tests/test_datablock.py +1 -9
  132. myokit/tests/test_datalog.py +4 -21
  133. myokit/tests/test_dependency_checking.py +8 -23
  134. myokit/tests/test_expressions.py +0 -9
  135. myokit/tests/test_float.py +1 -5
  136. myokit/tests/test_formats.py +0 -9
  137. myokit/tests/test_formats_axon.py +1 -9
  138. myokit/tests/test_formats_cellml.py +0 -15
  139. myokit/tests/test_formats_channelml.py +0 -15
  140. myokit/tests/test_formats_easyml.py +0 -14
  141. myokit/tests/test_formats_exporters.py +1 -16
  142. myokit/tests/test_formats_expression_writers.py +1 -17
  143. myokit/tests/test_formats_html.py +0 -3
  144. myokit/tests/test_formats_importers.py +1 -16
  145. myokit/tests/test_formats_mathml_content.py +0 -9
  146. myokit/tests/test_formats_mathml_presentation.py +0 -9
  147. myokit/tests/test_formats_opencl.py +0 -10
  148. myokit/tests/test_formats_sbml.py +0 -15
  149. myokit/tests/test_formats_sympy.py +0 -9
  150. myokit/tests/test_formats_wcp.py +1 -3
  151. myokit/tests/test_io.py +6 -14
  152. myokit/tests/test_jacobian_calculator.py +1 -9
  153. myokit/tests/test_jacobian_tracer.py +0 -9
  154. myokit/tests/test_lib_deps.py +0 -9
  155. myokit/tests/test_lib_guess.py +0 -9
  156. myokit/tests/test_lib_hh.py +1 -9
  157. myokit/tests/test_lib_markov.py +1 -9
  158. myokit/tests/test_lib_multi.py +0 -9
  159. myokit/tests/test_lib_plots.py +0 -3
  160. myokit/tests/test_meta.py +0 -3
  161. myokit/tests/test_model.py +0 -10
  162. myokit/tests/test_model_building.py +2 -17
  163. myokit/tests/test_opencl_info.py +5 -14
  164. myokit/tests/test_pacing_factory.py +0 -3
  165. myokit/tests/test_pacing_system_c.py +0 -9
  166. myokit/tests/test_pacing_system_py.py +0 -9
  167. myokit/tests/test_parsing.py +5 -20
  168. myokit/tests/test_progress_reporters.py +0 -3
  169. myokit/tests/test_protocol.py +0 -9
  170. myokit/tests/test_protocol_floating_point.py +0 -9
  171. myokit/tests/test_protocol_time_series.py +0 -10
  172. myokit/tests/test_pype.py +0 -9
  173. myokit/tests/test_quantity.py +0 -9
  174. myokit/tests/test_rhs_benchmarker.py +1 -9
  175. myokit/tests/test_sbml_api.py +0 -15
  176. myokit/tests/test_sbml_parser.py +0 -15
  177. myokit/tests/test_simulation_1d.py +1 -10
  178. myokit/tests/test_simulation_cvodes.py +8 -16
  179. myokit/tests/test_simulation_cvodes_from_disk.py +0 -3
  180. myokit/tests/test_simulation_fiber_tissue.py +1 -10
  181. myokit/tests/test_simulation_log_interval.py +0 -9
  182. myokit/tests/test_simulation_opencl.py +1 -10
  183. myokit/tests/test_simulation_opencl_log_interval.py +1 -3
  184. myokit/tests/test_simulation_opencl_vs_cvode.py +1 -10
  185. myokit/tests/test_simulation_opencl_vs_sim1d.py +1 -10
  186. myokit/tests/test_system_info.py +1 -11
  187. myokit/tests/test_tools.py +0 -9
  188. myokit/tests/test_unit.py +0 -9
  189. myokit/tests/test_user_functions.py +0 -10
  190. myokit/tests/test_variable.py +0 -10
  191. myokit/tools.py +5 -21
  192. myokit/units.py +0 -3
  193. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/METADATA +7 -7
  194. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/RECORD +198 -200
  195. myokit/_exec_new.py +0 -15
  196. myokit/_exec_old.py +0 -15
  197. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/LICENSE.txt +0 -0
  198. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/WHEEL +0 -0
  199. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/entry_points.txt +0 -0
  200. {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import os
11
8
 
12
9
  import myokit.formats
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import EasyMLExporter
11
8
  from ._ewriter import EasyMLExpressionWriter
12
9
 
@@ -4,12 +4,10 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import warnings
11
8
 
12
9
  import myokit
10
+
13
11
  from myokit.formats.python import PythonExpressionWriter
14
12
 
15
13
 
@@ -19,7 +17,7 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
19
17
  equations for variables in EasyML syntax.
20
18
  """
21
19
  def __init__(self):
22
- super(EasyMLExpressionWriter, self).__init__()
20
+ super().__init__()
23
21
  self._function_prefix = ''
24
22
 
25
23
  #def _ex_name(self, e):
@@ -39,7 +37,7 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
39
37
  if isinstance(e[1], myokit.Exp) and isinstance(e[0], myokit.Number):
40
38
  if e[0].eval() == 1:
41
39
  return '-expm1(' + self.ex(e[1][0]) + ')'
42
- return super(EasyMLExpressionWriter, self)._ex_minus(e)
40
+ return super()._ex_minus(e)
43
41
 
44
42
  #def _ex_multiply(self, e):
45
43
  #def _ex_divide(self, e):
@@ -58,23 +56,23 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
58
56
 
59
57
  def _ex_sin(self, e):
60
58
  warnings.warn('Potentially unsupported function: sin()')
61
- return super(EasyMLExpressionWriter, self)._ex_sin(e)
59
+ return super()._ex_sin(e)
62
60
 
63
61
  #def _ex_cos(self, e):
64
62
 
65
63
  def _ex_tan(self, e):
66
64
  warnings.warn('Potentially unsupported function: tan()')
67
- return super(EasyMLExpressionWriter, self)._ex_tan(e)
65
+ return super()._ex_tan(e)
68
66
 
69
67
  def _ex_asin(self, e):
70
68
  warnings.warn('Potentially unsupported function: asin()')
71
- return super(EasyMLExpressionWriter, self)._ex_asin(e)
69
+ return super()._ex_asin(e)
72
70
 
73
71
  #def _ex_acos(self, e):
74
72
 
75
73
  def _ex_atan(self, e):
76
74
  warnings.warn('Potentially unsupported function: atan()')
77
- return super(EasyMLExpressionWriter, self)._ex_atan(e)
75
+ return super()._ex_atan(e)
78
76
 
79
77
  #def _ex_exp(self, e):
80
78
 
@@ -87,11 +85,11 @@ class EasyMLExpressionWriter(PythonExpressionWriter):
87
85
 
88
86
  def _ex_floor(self, e):
89
87
  warnings.warn('Potentially unsupported function: floor()')
90
- return super(EasyMLExpressionWriter, self)._ex_floor(e)
88
+ return super()._ex_floor(e)
91
89
 
92
90
  def _ex_ceil(self, e):
93
91
  warnings.warn('Potentially unsupported function: ceil()')
94
- return super(EasyMLExpressionWriter, self)._ex_ceil(e)
92
+ return super()._ex_ceil(e)
95
93
 
96
94
  def _ex_abs(self, e):
97
95
  return self._ex_function(e, 'fabs')
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import collections
11
8
  import os
12
9
  import warnings
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import HTMLExporter
11
8
  from ._flatten import html2ascii # noqa
12
9
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from lxml import etree
11
8
 
12
9
  import myokit
@@ -4,19 +4,11 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
7
+ import html
8
+ import html.parser
10
9
  import re
11
- import sys
12
10
  import textwrap
13
11
 
14
- # HTML Parser in Python 2 and 3
15
- try:
16
- from HTMLParser import HTMLParser
17
- except ImportError:
18
- from html.parser import HTMLParser
19
-
20
12
 
21
13
  def html2ascii(html, width=79, indent=' '):
22
14
  """
@@ -32,21 +24,13 @@ def html2ascii(html, width=79, indent=' '):
32
24
  return f.get_text()
33
25
 
34
26
 
35
- class Asciifier(HTMLParser):
27
+ class Asciifier(html.parser.HTMLParser):
36
28
  INDENT = 1
37
29
  DEDENT = -1
38
30
  WHITE = [' ', '\t', '\f', '\r', '\n']
39
31
 
40
32
  def __init__(self, line_width=79, indent=' '):
41
- if sys.hexversion < 0x03000000: # pragma: no python 3 cover
42
- # HTMLParser requires old-school constructor
43
- HTMLParser.__init__(self)
44
- else: # pragma: no python 2 cover
45
- super(Asciifier, self).__init__(convert_charrefs=False)
46
-
47
- # Unescape method is deprecated
48
- import html
49
- self.unescape = html.unescape
33
+ super().__init__(convert_charrefs=False)
50
34
 
51
35
  # In <head> yes/no
52
36
  self.inhead = False
@@ -226,7 +210,7 @@ class Asciifier(HTMLParser):
226
210
  return
227
211
 
228
212
  # Convert html characters
229
- data = self.unescape('&' + name + ';')
213
+ data = html.unescape('&' + name + ';')
230
214
 
231
215
  # Convert to ascii and back to strip out non-ascii content
232
216
  data = data.encode('ascii', 'ignore').decode('ascii')
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import PdfExporter, PosterExporter
11
8
  from ._ewriter import LatexExpressionWriter
12
9
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import myokit.formats
11
8
 
12
9
 
@@ -16,7 +13,7 @@ class LatexExpressionWriter(myokit.formats.ExpressionWriter):
16
13
  Myokit :class:`expressions <myokit.Expression>` to their Tex equivalent.
17
14
  """
18
15
  def __init__(self):
19
- super(LatexExpressionWriter, self).__init__()
16
+ super().__init__()
20
17
 
21
18
  # Default time variable
22
19
  self._time = None
@@ -4,12 +4,10 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import os
11
8
 
12
9
  import myokit
10
+
13
11
  from ._ewriter import LatexExpressionWriter
14
12
 
15
13
 
@@ -19,7 +17,7 @@ class PdfExporter(myokit.formats.Exporter):
19
17
  a simple latex document.
20
18
  """
21
19
  def __init__(self):
22
- super(PdfExporter, self).__init__()
20
+ super().__init__()
23
21
 
24
22
  def _clean(self, text):
25
23
  """
@@ -111,7 +109,7 @@ class PosterExporter(myokit.formats.Exporter):
111
109
  beholders.
112
110
  """
113
111
  def __init__(self):
114
- super(PosterExporter, self).__init__()
112
+ super().__init__()
115
113
 
116
114
  def post_export_info(self):
117
115
  return '\n'.join((
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._ewriter import MathMLExpressionWriter
11
8
  from ._parser import ( # noqa
12
9
  MathMLError,
@@ -4,19 +4,10 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from lxml import etree
11
8
 
12
9
  import myokit.formats
13
10
 
14
- # Strings in Python 2 and 3
15
- try:
16
- basestring
17
- except NameError: # pragma: no cover
18
- basestring = str
19
-
20
11
 
21
12
  class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
22
13
  """
@@ -25,7 +16,7 @@ class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
25
16
  Presentation MathML.
26
17
  """
27
18
  def __init__(self):
28
- super(MathMLExpressionWriter, self).__init__()
19
+ super().__init__()
29
20
 
30
21
  # Default mode
31
22
  self._pres = False
@@ -33,7 +24,7 @@ class MathMLExpressionWriter(myokit.formats.ExpressionWriter):
33
24
  # Default lhs conversion function
34
25
  def flhs(lhs):
35
26
  var = lhs.var()
36
- if isinstance(var, basestring):
27
+ if isinstance(var, str):
37
28
  # This can happen with time variable of derivative if the
38
29
  # proper variable isn't set!
39
30
  return var
@@ -4,10 +4,8 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import myokit
8
+
11
9
  from myokit.formats.xml import split
12
10
 
13
11
 
@@ -63,10 +61,10 @@ class MathMLError(myokit.ImportError):
63
61
  message = 'Error on line ' + line + '. ' + message
64
62
  except AttributeError:
65
63
  pass
66
- super(MathMLError, self).__init__(message)
64
+ super().__init__(message)
67
65
 
68
66
 
69
- class MathMLParser(object):
67
+ class MathMLParser:
70
68
  """
71
69
  Parses MathML expressions into :class:`myokit.Expression` objects.
72
70
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import MatlabExporter
11
8
  from ._ewriter import MatlabExpressionWriter
12
9
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from myokit.formats.python import PythonExpressionWriter
11
8
 
12
9
 
@@ -16,7 +13,7 @@ class MatlabExpressionWriter(PythonExpressionWriter):
16
13
  Myokit :class:`expressions <myokit.Expression>` to a Matlab syntax.
17
14
  """
18
15
  def __init__(self):
19
- super(MatlabExpressionWriter, self).__init__()
16
+ super().__init__()
20
17
  self._function_prefix = ''
21
18
  self._fcond = 'ifthenelse'
22
19
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import os
11
8
 
12
9
  import myokit.formats
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import OpenCLExporter, OpenCLRLExporter
11
8
  from ._ewriter import OpenCLExpressionWriter
12
9
  from myokit.formats import ansic
@@ -4,10 +4,8 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import myokit
8
+
11
9
  from myokit.formats.python import PythonExpressionWriter
12
10
 
13
11
 
@@ -17,7 +15,7 @@ class OpenCLExpressionWriter(PythonExpressionWriter):
17
15
  Myokit :class:`expressions <myokit.Expression>` to OpenCL syntax.
18
16
  """
19
17
  def __init__(self, precision=myokit.SINGLE_PRECISION, native_math=True):
20
- super(OpenCLExpressionWriter, self).__init__()
18
+ super().__init__()
21
19
  self._function_prefix = ''
22
20
  self._sp = (precision == myokit.SINGLE_PRECISION)
23
21
  self._nm = bool(native_math)
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import os
11
8
 
12
9
  import myokit.formats
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._exporter import PythonExporter
11
8
  from ._ewriter import PythonExpressionWriter, NumPyExpressionWriter
12
9
 
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import myokit.formats
11
8
 
12
9
 
@@ -17,7 +14,7 @@ class PythonExpressionWriter(myokit.formats.ExpressionWriter):
17
14
  equivalent.
18
15
  """
19
16
  def __init__(self):
20
- super(PythonExpressionWriter, self).__init__()
17
+ super().__init__()
21
18
 
22
19
  self._flhs = None
23
20
  self.set_lhs_function(lambda v: str(v))
@@ -192,7 +189,7 @@ class NumPyExpressionWriter(PythonExpressionWriter):
192
189
  intended for use in NumPy arrays.
193
190
  """
194
191
  def __init__(self):
195
- super(NumPyExpressionWriter, self).__init__()
192
+ super().__init__()
196
193
  self._function_prefix = 'numpy.'
197
194
  #def _ex_name(self, e):
198
195
  #def _ex_derivative(self, e):
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  import os
11
8
 
12
9
  import myokit.formats
@@ -73,7 +73,7 @@ for comp in components:
73
73
  w.set_lhs_function(lambda x: v(x, comp))
74
74
 
75
75
  ?>
76
- class <?= names[1] ?>(object):
76
+ class <?= names[1] ?>:
77
77
  def __init__(self):
78
78
  <?
79
79
  for var in comp.variables(deep=True):
@@ -118,7 +118,7 @@ class <?= names[1] ?>(object):
118
118
  #
119
119
  # Engine component
120
120
  #
121
- class Engine(object):
121
+ class Engine:
122
122
  """
123
123
  Calculates the derivatives in the current state
124
124
  """
@@ -213,10 +213,10 @@ def test_step():
213
213
  #
214
214
  # Pacing
215
215
  #
216
- class Protocol(object):
216
+ class Protocol:
217
217
  """ Holds an ordered set of ProtocolEvent objects """
218
218
  def __init__(self):
219
- super(Protocol, self).__init__()
219
+ super().__init__()
220
220
  self.head = None
221
221
  def add(self, e):
222
222
  """ Schedules an event """
@@ -238,9 +238,11 @@ class Protocol(object):
238
238
  if self.head is not None:
239
239
  self.head = self.head.next
240
240
  return e
241
- class ProtocolEvent(object):
241
+
242
+
243
+ class ProtocolEvent:
242
244
  def __init__(self, level, start, duration, period=0, multiplier=0):
243
- super(ProtocolEvent, self).__init__()
245
+ super().__init__()
244
246
  self.level = float(level)
245
247
  self.start = float(start)
246
248
  self.duration = float(duration)
@@ -256,6 +258,7 @@ class ProtocolEvent(object):
256
258
  raise Exception('Non-periodic event cannot occur more than once')
257
259
  self.next = None
258
260
 
261
+
259
262
  def pacing_protocol():
260
263
  pacing = Protocol()
261
264
  <?
@@ -377,10 +380,7 @@ if __name__ == '__main__':
377
380
  except ArithmeticError as e:
378
381
  print('Arithmetic error occurred')
379
382
  y = 'Continue with smaller stepsize? (y/n): '
380
- try:
381
- y = raw_input(y) # Python 2
382
- except NameError:
383
- y = input(y) # Python 3
383
+ y = input(y)
384
384
  if y.lower()[0:1] == 'y':
385
385
  small /= 2
386
386
  large /= 2
@@ -4,9 +4,6 @@
4
4
  # This file is part of Myokit.
5
5
  # See http://myokit.org for copyright, sharing, and licensing details.
6
6
  #
7
- from __future__ import absolute_import, division
8
- from __future__ import print_function, unicode_literals
9
-
10
7
  from ._api import ( # noqa
11
8
  Compartment,
12
9
  CSymbolVariable,
@@ -1,3 +1,9 @@
1
+ #
2
+ # SBML API
3
+ #
4
+ # This file is part of Myokit.
5
+ # See http://myokit.org for copyright, sharing, and licensing details.
6
+ #
1
7
  import collections
2
8
  import warnings
3
9
  import re
@@ -16,7 +22,7 @@ class SBMLError(Exception):
16
22
  """Raised if something goes wrong when working with an SBML model."""
17
23
 
18
24
 
19
- class Quantity(object):
25
+ class Quantity:
20
26
  """
21
27
  Base class for anything that has a numerical value in an SBML model, and
22
28
  can be set by rules, reactions, or initial assignments.
@@ -89,7 +95,7 @@ class Quantity(object):
89
95
  return self._value
90
96
 
91
97
 
92
- class CSymbolVariable(object):
98
+ class CSymbolVariable:
93
99
  """
94
100
  Represents a CSymbol that can appear in SBML expressions, but which has a
95
101
  predetermind value and/or meaning, e.g. "time".
@@ -122,7 +128,7 @@ class Compartment(Quantity):
122
128
 
123
129
  """
124
130
  def __init__(self, model, sid):
125
- super(Compartment, self).__init__()
131
+ super().__init__()
126
132
 
127
133
  if not isinstance(model, Model):
128
134
  raise SBMLError(
@@ -185,7 +191,7 @@ class Compartment(Quantity):
185
191
  return '<Compartment ' + self._sid + '>'
186
192
 
187
193
 
188
- class Model(object):
194
+ class Model:
189
195
  """
190
196
  Represents a model in SBML.
191
197
 
@@ -581,7 +587,7 @@ class Parameter(Quantity):
581
587
 
582
588
  """
583
589
  def __init__(self, model, sid):
584
- super(Parameter, self).__init__()
590
+ super().__init__()
585
591
 
586
592
  if not isinstance(model, Model):
587
593
  raise SBMLError(
@@ -612,7 +618,7 @@ class Parameter(Quantity):
612
618
  return self._units
613
619
 
614
620
 
615
- class Reaction(object):
621
+ class Reaction:
616
622
  """
617
623
  Represents an SBML reaction; to create a reaction use
618
624
  :meth:`Model.add_reaction()`.
@@ -772,7 +778,7 @@ class Species(Quantity):
772
778
 
773
779
  """
774
780
  def __init__(self, compartment, sid, is_amount, is_constant, is_boundary):
775
- super(Species, self).__init__()
781
+ super().__init__()
776
782
 
777
783
  if not isinstance(compartment, Compartment):
778
784
  raise SBMLError(
@@ -914,7 +920,7 @@ class SpeciesReference(Quantity):
914
920
  MODIFIER = 2
915
921
 
916
922
  def __init__(self, species, sid=None):
917
- super(SpeciesReference, self).__init__()
923
+ super().__init__()
918
924
 
919
925
  if not isinstance(species, Species):
920
926
  raise SBMLError(
@@ -936,11 +942,11 @@ class SpeciesReference(Quantity):
936
942
  return '<SpeciesReference ' + self._sid + '>'
937
943
 
938
944
 
939
- class ModifierSpeciesReference(object):
945
+ class ModifierSpeciesReference:
940
946
  """Represents a reference to a modifier species in an SBML reaction."""
941
947
 
942
948
  def __init__(self, species, sid=None):
943
- super(ModifierSpeciesReference, self).__init__()
949
+ super().__init__()
944
950
 
945
951
  if not isinstance(species, Species):
946
952
  raise SBMLError(
@@ -971,7 +977,7 @@ def convert_name(name):
971
977
  return name
972
978
 
973
979
 
974
- class _MyokitConverter(object):
980
+ class _MyokitConverter:
975
981
  """
976
982
  Converts SBML Models to Myokit models.
977
983
  """
@@ -7,9 +7,6 @@
7
7
  # This file is part of Myokit.
8
8
  # See http://myokit.org for copyright, sharing, and licensing details.
9
9
  #
10
- from __future__ import absolute_import, division
11
- from __future__ import print_function, unicode_literals
12
-
13
10
  import myokit.formats
14
11
 
15
12
 
@@ -22,7 +19,7 @@ class SBMLImporter(myokit.formats.Importer):
22
19
  :class:`myokit.formats.sbml.SBMLParser`.
23
20
  """
24
21
  def __init__(self):
25
- super(SBMLImporter, self).__init__()
22
+ super().__init__()
26
23
 
27
24
  def supports_model(self):
28
25
  """Returns ``True``."""
@@ -8,9 +8,6 @@
8
8
  # This file is part of Myokit.
9
9
  # See http://myokit.org for copyright, sharing, and licensing details.
10
10
  #
11
- from __future__ import absolute_import, division
12
- from __future__ import print_function, unicode_literals
13
-
14
11
  import re
15
12
  import warnings
16
13
 
@@ -76,10 +73,10 @@ class SBMLParsingError(myokit.ImportError):
76
73
  message = 'Error on line ' + line + '. ' + message
77
74
  except AttributeError: # pragma: no cover
78
75
  pass
79
- super(SBMLParsingError, self).__init__(message)
76
+ super().__init__(message)
80
77
 
81
78
 
82
- class SBMLParser(object):
79
+ class SBMLParser:
83
80
  """
84
81
  Parses SBML models, creating an SBML Model structure that can be converted
85
82
  to a :class:`myokit.Model` object.