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
  from ._exporter import AnsiCExporter, AnsiCCableExporter, AnsiCEulerExporter
11
8
  from ._ewriter import AnsiCExpressionWriter
12
9
 
@@ -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 AnsiCExpressionWriter(PythonExpressionWriter):
17
15
  equations for variables in a C-style syntax.
18
16
  """
19
17
  def __init__(self):
20
- super(AnsiCExpressionWriter, self).__init__()
18
+ super().__init__()
21
19
  self._function_prefix = ''
22
20
  self._fcond = None
23
21
 
@@ -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,13 +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
-
10
7
  from ._abf import AbfFile, Sweep, Channel # noqa
11
8
  from ._atf import AtfFile, load_atf, save_atf # noqa
12
9
  from ._importer import AbfImporter
13
10
 
11
+
14
12
  # Importers
15
13
  _importers = {
16
14
  'abf': AbfImporter,
@@ -139,23 +139,22 @@
139
139
  # Information - but no direct code - from the matlab script get_abf_header.m
140
140
  # was also used: http://neurodata.hg.sourceforge.net/hgweb/neurodata/neurodata/
141
141
  #------------------------------------------------------------------------------
142
- from __future__ import absolute_import, division
143
- from __future__ import print_function, unicode_literals
144
-
145
- from collections import OrderedDict
146
- import numpy as np
147
- import traceback
148
142
  import datetime
149
143
  import logging
150
- import struct
151
144
  import os
145
+ import struct
146
+ import traceback
147
+
148
+ import numpy as np
149
+
150
+ from collections import OrderedDict
152
151
 
153
152
 
154
153
  # Encoding for text parts of files
155
154
  _ENC = 'latin-1'
156
155
 
157
156
 
158
- class AbfFile(object):
157
+ class AbfFile:
159
158
  """
160
159
  Represents a read-only Axon Binary Format file (``.abf``), stored at the
161
160
  location pointed to by ``filepath``.
@@ -199,7 +198,6 @@ class AbfFile(object):
199
198
  """
200
199
  def __init__(self, filepath, is_protocol_file=None):
201
200
  # The path to the file and its basename
202
- # Ensure it's a `str` for Python2/3 compatibility
203
201
  filepath = str(filepath)
204
202
  self._filepath = os.path.abspath(filepath)
205
203
  self._filename = os.path.basename(filepath)
@@ -702,7 +700,6 @@ class AbfFile(object):
702
700
  """
703
701
  Read and unpack a file section using the given format ``form``.
704
702
  """
705
- # Form must be a str (so bytes on Python 2)
706
703
  form = str(form)
707
704
  if offset is not None:
708
705
  f.seek(offset)
@@ -1306,14 +1303,14 @@ class AbfFile(object):
1306
1303
  self._adc_offsets.append(s)
1307
1304
 
1308
1305
 
1309
- class Sweep(object):
1306
+ class Sweep:
1310
1307
  """
1311
1308
  Represents a single sweep (also called an 'episode')
1312
1309
 
1313
1310
  A sweep is represented as a fixed-size list of channels.
1314
1311
  """
1315
1312
  def __init__(self, n):
1316
- super(Sweep, self).__init__()
1313
+ super().__init__()
1317
1314
  n = int(n)
1318
1315
  if n < 0: # pragma: no cover
1319
1316
  raise ValueError('Number channels cannot be negative.')
@@ -1336,14 +1333,14 @@ class Sweep(object):
1336
1333
  self._channels[key] = value
1337
1334
 
1338
1335
 
1339
- class Channel(object):
1336
+ class Channel:
1340
1337
  """
1341
1338
  Represents an analog signal for a single channel.
1342
1339
 
1343
1340
  To obtain this channel's formatted data, use times() and trace()
1344
1341
  """
1345
1342
  def __init__(self, parent_file):
1346
- super(Channel, self).__init__()
1343
+ super().__init__()
1347
1344
  self._parent_file = parent_file # The abf file this channel is from
1348
1345
  self._type = TYPE_UNKNOWN # Type of recording
1349
1346
 
@@ -1386,7 +1383,7 @@ class Channel(object):
1386
1383
  def number(self):
1387
1384
  """
1388
1385
  Returns the channel index used by pClamp. Note that this does not
1389
- necessarily equal its index in the python sweep data!
1386
+ necessarily equal its index in the Python sweep data!
1390
1387
  """
1391
1388
  return self._numb
1392
1389
 
@@ -4,20 +4,19 @@
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
- from collections import OrderedDict
11
- import numpy as np
12
7
  import os
13
8
  import re
14
9
 
10
+ import numpy as np
11
+
12
+ from collections import OrderedDict
13
+
15
14
 
16
15
  # Format used for any text
17
16
  _ENC = 'ascii'
18
17
 
19
18
 
20
- class AtfFile(object):
19
+ class AtfFile:
21
20
  """
22
21
  Represents an Axon Text File (ATF) stored on disk.
23
22
 
@@ -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
 
@@ -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 CellMLExporter, CellML1Exporter, CellML2Exporter
11
8
  from ._ewriter import CellMLExpressionWriter
12
9
  from ._importer import CellMLImporter, CellMLImporterError # noqa
@@ -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
@@ -24,8 +21,8 @@ class CellMLExpressionWriter(MathMLExpressionWriter):
24
21
  unit names with :meth:`set_unit_function()`.
25
22
  """
26
23
  def __init__(self, version='1.0'):
27
- super(CellMLExpressionWriter, self).__init__()
28
- super(CellMLExpressionWriter, self).set_mode(presentation=False)
24
+ super().__init__()
25
+ super().set_mode(presentation=False)
29
26
 
30
27
  # Units lookup method
31
28
  self._funits = None
@@ -54,7 +51,7 @@ class CellMLExpressionWriter(MathMLExpressionWriter):
54
51
  self._funits = f
55
52
 
56
53
  def _ex_number(self, e, t):
57
- x = super(CellMLExpressionWriter, self)._ex_number(e, t)
54
+ x = super()._ex_number(e, t)
58
55
  unit = e.unit()
59
56
  if self._funits is not None and unit is not None:
60
57
  units = self._funits(e.unit())
@@ -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
11
8
  import myokit.lib.guess
12
9
 
@@ -18,7 +15,7 @@ class CellMLExporter(myokit.formats.Exporter):
18
15
  This:class:`Exporter <myokit.formats.Exporter>` creates a CellML model.
19
16
  """
20
17
  def __init__(self):
21
- super(CellMLExporter, self).__init__()
18
+ super().__init__()
22
19
 
23
20
  def model(self, path, model, protocol=None, version='1.0'):
24
21
  """
@@ -69,7 +66,7 @@ class CellML1Exporter(CellMLExporter):
69
66
  This:class:`Exporter <myokit.formats.Exporter>` creates a CellML 1.0 model.
70
67
  """
71
68
  def model(self, path, model, protocol=None):
72
- super(CellML1Exporter, self).model(path, model, protocol, '1.0')
69
+ super().model(path, model, protocol, '1.0')
73
70
 
74
71
 
75
72
  class CellML2Exporter(CellMLExporter):
@@ -77,5 +74,5 @@ class CellML2Exporter(CellMLExporter):
77
74
  This:class:`Exporter <myokit.formats.Exporter>` creates a CellML 2.0 model.
78
75
  """
79
76
  def model(self, path, model, protocol=None):
80
- super(CellML2Exporter, self).model(path, model, protocol, '2.0')
77
+ super().model(path, model, protocol, '2.0')
81
78
 
@@ -5,9 +5,6 @@
5
5
  # This file is part of Myokit.
6
6
  # See http://myokit.org for copyright, sharing, and licensing details.
7
7
  #
8
- from __future__ import absolute_import, division
9
- from __future__ import print_function, unicode_literals
10
-
11
8
  from lxml import etree
12
9
 
13
10
  import myokit
@@ -28,7 +25,7 @@ class CellMLImporter(myokit.formats.Importer):
28
25
  from CellML.
29
26
  """
30
27
  def __init__(self, verbose=False):
31
- super(CellMLImporter, self).__init__()
28
+ super().__init__()
32
29
 
33
30
  def model(self, path):
34
31
  """
@@ -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
  AnnotatableElement,
12
9
  CellMLError,
@@ -22,7 +19,6 @@ from ._api import ( # noqa
22
19
  is_valid_identifier,
23
20
  )
24
21
 
25
-
26
22
  from ._parser import ( # noqa
27
23
  parse_file,
28
24
  parse_string,
@@ -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 re
12
9
  import warnings
@@ -116,7 +113,7 @@ def create_unit_name(unit):
116
113
  return name
117
114
 
118
115
 
119
- class AnnotatableElement(object):
116
+ class AnnotatableElement:
120
117
  """
121
118
  Represents a CellML 1.0 or 1.1 element that can have a cmeta:id.
122
119
 
@@ -187,7 +184,7 @@ class UnsupportedBaseUnitsError(UnitsError):
187
184
  """
188
185
  def __init__(self, units):
189
186
  self.units = units
190
- super(UnsupportedBaseUnitsError, self).__init__(
187
+ super().__init__(
191
188
  'Unsupported base units "' + units + '".')
192
189
 
193
190
 
@@ -196,7 +193,7 @@ class UnsupportedUnitOffsetError(UnitsError):
196
193
  Raised when units with non-zero offsets are used.
197
194
  """
198
195
  def __init__(self):
199
- super(UnsupportedUnitOffsetError, self).__init__(
196
+ super().__init__(
200
197
  'Units with non-zero offsets are not supported.')
201
198
 
202
199
 
@@ -206,7 +203,7 @@ class Component(AnnotatableElement):
206
203
  :meth:`Model.add_component()`.
207
204
  """
208
205
  def __init__(self, model, name):
209
- super(Component, self).__init__(model)
206
+ super().__init__(model)
210
207
 
211
208
  # Store model
212
209
  self._model = model
@@ -474,7 +471,7 @@ class Model(AnnotatableElement):
474
471
 
475
472
  """
476
473
  def __init__(self, name, version='1.0'):
477
- super(Model, self).__init__(self)
474
+ super().__init__(self)
478
475
 
479
476
  # Check and store name
480
477
  if not is_valid_identifier(name):
@@ -1165,7 +1162,7 @@ class Model(AnnotatableElement):
1165
1162
  return self._version
1166
1163
 
1167
1164
 
1168
- class Units(object):
1165
+ class Units:
1169
1166
  """
1170
1167
  Represents a CellML units definition, should not be created directly but
1171
1168
  only via :meth:`Model.add_units()` or :meth:`Component.add_units()`.
@@ -1470,7 +1467,7 @@ class Variable(AnnotatableElement):
1470
1467
  """
1471
1468
  def __init__(self, component, name, units, public_interface='none',
1472
1469
  private_interface='none'):
1473
- super(Variable, self).__init__(component.model())
1470
+ super().__init__(component.model())
1474
1471
 
1475
1472
  # Store component
1476
1473
  self._component = component
@@ -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 warnings
12
9
 
@@ -60,10 +57,10 @@ class CellMLParsingError(myokit.ImportError):
60
57
  message = 'Error on line ' + line + '. ' + message
61
58
  except AttributeError:
62
59
  pass
63
- super(CellMLParsingError, self).__init__(message)
60
+ super().__init__(message)
64
61
 
65
62
 
66
- class CellMLParser(object):
63
+ class CellMLParser:
67
64
  """
68
65
  Parses CellML 1.0 and 1.1 documents, and performs (partial) validation of a
69
66
  CellML document.
@@ -4,21 +4,12 @@
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
8
+ from urllib.parse import quote
11
9
 
12
10
  import myokit
13
11
  import myokit.formats.cellml as cellml
14
12
 
15
- # Quoting URI strings in Python2 and Python3
16
- try:
17
- from urllib.parse import quote
18
- except ImportError: # pragma: no python 3 cover
19
- # Python 2
20
- from urllib import quote
21
-
22
13
 
23
14
  # Left-over from old exporter. Not sure if this had any function.
24
15
  # Add name in 'tmp-documentation' format
@@ -45,7 +36,7 @@ def write_string(model):
45
36
  return CellMLWriter().write_string(model)
46
37
 
47
38
 
48
- class CellMLWriter(object):
39
+ class CellMLWriter:
49
40
  """
50
41
  Writes CellML 1.0 or 1.1 documents.
51
42
  """
@@ -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
  AnnotatableElement,
12
9
  CellMLError,
@@ -4,21 +4,12 @@
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 re
12
9
  import warnings
13
10
 
14
11
  import myokit
15
12
 
16
- # Strings in Python2 and Python3
17
- try:
18
- basestring
19
- except NameError: # pragma: no cover
20
- basestring = str
21
-
22
13
 
23
14
  # Data types
24
15
  _cellml_identifier = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$')
@@ -142,7 +133,7 @@ def create_unit_name(unit):
142
133
  return name
143
134
 
144
135
 
145
- class AnnotatableElement(object):
136
+ class AnnotatableElement:
146
137
  """
147
138
  Represents a CellML 2.0 element that can be annotated (using a public dict
148
139
  ``meta`` that stores key:value pairs).
@@ -167,7 +158,7 @@ class Component(AnnotatableElement):
167
158
  :meth:`Model.add_component()`.
168
159
  """
169
160
  def __init__(self, model, name):
170
- super(Component, self).__init__()
161
+ super().__init__()
171
162
 
172
163
  # Store model
173
164
  self._model = model
@@ -323,7 +314,7 @@ class Model(AnnotatableElement):
323
314
 
324
315
  """
325
316
  def __init__(self, name, version='2.0'):
326
- super(Model, self).__init__()
317
+ super().__init__()
327
318
 
328
319
  # Check and store name
329
320
  if not is_identifier(name):
@@ -1068,7 +1059,7 @@ class Model(AnnotatableElement):
1068
1059
  return self._version
1069
1060
 
1070
1061
 
1071
- class Units(object):
1062
+ class Units:
1072
1063
  """
1073
1064
  Represents a CellML units definition; should not be created directly but
1074
1065
  only via :meth:`Model.add_units()` or :meth:`Component.add_units()`.
@@ -1359,7 +1350,7 @@ class Variable(AnnotatableElement):
1359
1350
 
1360
1351
  """
1361
1352
  def __init__(self, component, name, units, interface='none'):
1362
- super(Variable, self).__init__()
1353
+ super().__init__()
1363
1354
 
1364
1355
  # Store model and component
1365
1356
  self._model = component.model()
@@ -1615,7 +1606,7 @@ class Variable(AnnotatableElement):
1615
1606
  if value is not None:
1616
1607
 
1617
1608
  # Check value is a real number string
1618
- if isinstance(value, basestring):
1609
+ if isinstance(value, str):
1619
1610
  if is_real_number_string(value):
1620
1611
  value = float(value)
1621
1612
  else:
@@ -1642,7 +1633,7 @@ class Variable(AnnotatableElement):
1642
1633
  return self._units
1643
1634
 
1644
1635
 
1645
- class ConnectedVariableSet(object):
1636
+ class ConnectedVariableSet:
1646
1637
  """
1647
1638
  Represents a set of connected variables.
1648
1639
 
@@ -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 warnings
11
8
 
12
9
  from lxml import etree
@@ -59,10 +56,10 @@ class CellMLParsingError(myokit.ImportError):
59
56
  message = 'Error on line ' + line + '. ' + message
60
57
  except AttributeError:
61
58
  pass
62
- super(CellMLParsingError, self).__init__(message)
59
+ super().__init__(message)
63
60
 
64
61
 
65
- class CellMLParser(object):
62
+ class CellMLParser:
66
63
  """
67
64
  Parses CellML 2.0 documents, and performs (partial) validation.
68
65
 
@@ -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
@@ -27,7 +24,7 @@ def write_string(model):
27
24
  return CellMLWriter().write_string(model)
28
25
 
29
26
 
30
- class CellMLWriter(object):
27
+ class CellMLWriter:
31
28
  """
32
29
  Writes CellML 2.0 documents.
33
30
  """
@@ -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 ._importer import ChannelMLImporter, ChannelMLError # noqa
11
8
 
12
9
 
@@ -4,23 +4,13 @@
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 io
10
8
  import os
11
9
  import textwrap
10
+ import warnings
12
11
  import xml.dom
13
12
  import xml.dom.minidom
14
13
 
15
- import warnings
16
-
17
- try:
18
- # Python 2
19
- from cStringIO import StringIO
20
- except ImportError:
21
- # Python3
22
- from io import StringIO
23
-
24
14
  import myokit
25
15
  from myokit import formats
26
16
  from myokit import Name, Number, Minus, Multiply, Divide, Power
@@ -71,7 +61,7 @@ class ChannelMLImporter(formats.Importer):
71
61
  from the ChannelML format.
72
62
  """
73
63
  def __init__(self, verbose=False):
74
- super(ChannelMLImporter, self).__init__()
64
+ super().__init__()
75
65
  self.generated_name_index = 0
76
66
 
77
67
  def component(self, path, model):
@@ -373,7 +363,7 @@ class ChannelMLImporter(formats.Importer):
373
363
  if not root.hasAttribute('xmlns:meta'):
374
364
  return None
375
365
  ns = root.getAttribute('xmlns:meta')
376
- b = StringIO()
366
+ b = io.StringIO()
377
367
 
378
368
  def scan(parent):
379
369
  kid = dom_child(parent)
@@ -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.formats.ansic
8
+
11
9
  from ._ewriter import CppExpressionWriter
12
10
 
13
11
 
@@ -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.ansic import AnsiCExpressionWriter
11
8
 
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 ._exporter import CudaKernelExporter, CudaKernelRLExporter
11
8
  from ._ewriter import CudaExpressionWriter
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 CudaExpressionWriter(PythonExpressionWriter):
17
15
  Myokit :class:`expressions <myokit.Expression>` to their CUDA equivalents.
18
16
  """
19
17
  def __init__(self, precision=myokit.SINGLE_PRECISION):
20
- super(CudaExpressionWriter, self).__init__()
18
+ super().__init__()
21
19
  self._function_prefix = ''
22
20
  self._sp = (precision == myokit.SINGLE_PRECISION)
23
21