Skip to content

Commit 28de738

Browse files
Ingmar Schoeglischoegl
authored andcommitted
Use FutureWarning for deprecated keywords
1 parent c2d693d commit 28de738

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

interfaces/cython/cantera/base.pyx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ cdef class _SolutionBase:
1414
if phase is not '':
1515
raise AttributeError('duplicate specification of phase name')
1616

17-
warnings.warn("To be removed after Cantera 2.5. "
18-
"Keyword `phaseid` is replaced by `phase`",
19-
DeprecationWarning)
17+
warnings.warn("Keyword `phase` replaces `phaseid`",
18+
FutureWarning)
2019
phase = kwargs['phaseid']
2120

2221
if 'phases' in kwargs:
2322
if len(adjacent)>0:
2423
raise AttributeError(
2524
'duplicate specification of adjacent phases')
2625

27-
warnings.warn("To be removed after Cantera 2.5. "
28-
"Keyword `phases` is replaced by `adjacent`",
29-
DeprecationWarning)
26+
warnings.warn("Keyword `adjacent` replaces `phases`",
27+
FutureWarning)
3028
adjacent = kwargs['phases']
3129

3230
# Shallow copy of an existing Solution (for slicing support)

interfaces/cython/cantera/composite.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@ class Solution(ThermoPhase, Kinetics, Transport):
2323
The most common way to instantiate `Solution` objects is by using a phase
2424
definition, species and reactions defined in an input file::
2525
26-
gas = ct.Solution('gri30.cti')
26+
gas = ct.Solution('gri30.yaml')
2727
28-
If an input file defines multiple phases, the phase *name* (in CTI), *id*
29-
(in XML) or *phases* entry (in YAML) can be used to specify the desired
28+
If an input file defines multiple phases, the *phases* entry (in YAML),
29+
*name* (in CTI), or *id* (in XML) can be used to specify the desired
3030
phase via the ``phase`` keyword argument of the constructor::
3131
32-
gas = ct.Solution('diamond.cti', phase='gas')
33-
diamond = ct.Solution('diamond.cti', phase='diamond')
32+
gas = ct.Solution('diamond.yaml', phase='gas')
33+
diamond = ct.Solution('diamond.yaml', phase='diamond')
3434
3535
The name of the `Solution` object needs to be unique and defaults to the
3636
*phase* specified in the input file. If another object using the same
3737
constituting information already exists, the name is automatically appended
3838
by a suffix. A custom name can be set via the ``name`` keyword argument of
3939
the constructor, i.e.::
4040
41-
gas = ct.Solution('gri30.cti', name='my_custom_name')
41+
gas = ct.Solution('gri30.yaml', name='my_custom_name')
4242
4343
`Solution` objects can also be constructed using `Species` and `Reaction`
4444
objects which can themselves either be imported from input files or defined
4545
directly in Python::
4646
47-
spec = ct.Species.listFromFile('gri30.cti')
48-
rxns = ct.Reaction.listFromFile('gri30.cti')
47+
spec = ct.Species.listFromFile('gri30.yaml')
48+
rxns = ct.Reaction.listFromFile('gri30.yaml')
4949
gas = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
5050
species=spec, reactions=rxns)
5151
@@ -89,9 +89,9 @@ class Interface(InterfacePhase, InterfaceKinetics):
8989
in reactions need to be created and then passed in as a list in the
9090
``adjacent`` argument to the constructor::
9191
92-
gas = ct.Solution('diamond.cti', phase='gas')
93-
diamond = ct.Solution('diamond.cti', phase='diamond')
94-
diamond_surf = ct.Interface('diamond.cti', phase='diamond_100',
92+
gas = ct.Solution('diamond.yaml', phase='gas')
93+
diamond = ct.Solution('diamond.yaml', phase='diamond')
94+
diamond_surf = ct.Interface('diamond.yaml', phase='diamond_100',
9595
adjacent=[gas, diamond])
9696
"""
9797
__slots__ = ('_phase_indices',)
@@ -316,7 +316,7 @@ class SolutionArray:
316316
with shapes described in the same way as Numpy arrays. All of the states
317317
can be set in a single call::
318318
319-
>>> gas = ct.Solution('gri30.cti')
319+
>>> gas = ct.Solution('gri30.yaml')
320320
>>> states = ct.SolutionArray(gas, (6, 10))
321321
>>> T = np.linspace(300, 1000, 10) # row vector
322322
>>> P = ct.one_atm * np.linspace(0.1, 5.0, 6)[:,np.newaxis] # column vector

interfaces/cython/cantera/test/test_thermo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ def test_phase(self):
345345
with warnings.catch_warnings(record=True) as w:
346346
gas = ct.Solution('h2o2.cti', phaseid='ohmech')
347347
self.assertTrue(len(w) == 1)
348-
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
349-
self.assertTrue("To be removed after Cantera 2.5. "
348+
self.assertTrue(issubclass(w[-1].category, FutureWarning))
349+
self.assertTrue("Keyword `phase` replaces `phaseid`"
350350
in str(w[-1].message))
351351

352352
def test_badLength(self):

0 commit comments

Comments
 (0)