From 0c51834e6e81fdd759cc8f8b966d181c1f36bf06 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Sun, 18 Aug 2019 05:43:19 -0500 Subject: [PATCH] Use FutureWarning for deprecated keywords --- interfaces/cython/cantera/base.pyx | 10 ++++------ interfaces/cython/cantera/composite.py | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/interfaces/cython/cantera/base.pyx b/interfaces/cython/cantera/base.pyx index fd08b7d7d2e..290898bcca5 100644 --- a/interfaces/cython/cantera/base.pyx +++ b/interfaces/cython/cantera/base.pyx @@ -14,9 +14,8 @@ cdef class _SolutionBase: if phase is not '': raise AttributeError('duplicate specification of phase name') - warnings.warn("To be removed after Cantera 2.5. " - "Keyword `phaseid` is replaced by `phase`", - DeprecationWarning) + warnings.warn("Keyword `phase` replaces `phaseid`", + FutureWarning) phase = kwargs['phaseid'] if 'phases' in kwargs: @@ -24,9 +23,8 @@ cdef class _SolutionBase: raise AttributeError( 'duplicate specification of adjacent phases') - warnings.warn("To be removed after Cantera 2.5. " - "Keyword `phases` is replaced by `adjacent`", - DeprecationWarning) + warnings.warn("Keyword `adjacent` replaces `phases`", + FutureWarning) adjacent = kwargs['phases'] # Shallow copy of an existing Solution (for slicing support) diff --git a/interfaces/cython/cantera/composite.py b/interfaces/cython/cantera/composite.py index 917418c55f7..77fb69f555a 100644 --- a/interfaces/cython/cantera/composite.py +++ b/interfaces/cython/cantera/composite.py @@ -23,14 +23,14 @@ class Solution(ThermoPhase, Kinetics, Transport): The most common way to instantiate `Solution` objects is by using a phase definition, species and reactions defined in an input file:: - gas = ct.Solution('gri30.cti') + gas = ct.Solution('gri30.yaml') - If an input file defines multiple phases, the phase *name* (in CTI), *id* - (in XML) or *phases* entry (in YAML) can be used to specify the desired + If an input file defines multiple phases, the *phases* entry (in YAML), + *name* (in CTI), or *id* (in XML) can be used to specify the desired phase via the ``phase`` keyword argument of the constructor:: - gas = ct.Solution('diamond.cti', phase='gas') - diamond = ct.Solution('diamond.cti', phase='diamond') + gas = ct.Solution('diamond.yaml', phase='gas') + diamond = ct.Solution('diamond.yaml', phase='diamond') The name of the `Solution` object needs to be unique and defaults to the *phase* specified in the input file. If another object using the same @@ -38,14 +38,14 @@ class Solution(ThermoPhase, Kinetics, Transport): by a suffix. A custom name can be set via the ``name`` keyword argument of the constructor, i.e.:: - gas = ct.Solution('gri30.cti', name='my_custom_name') + gas = ct.Solution('gri30.yaml', name='my_custom_name') `Solution` objects can also be constructed using `Species` and `Reaction` objects which can themselves either be imported from input files or defined directly in Python:: - spec = ct.Species.listFromFile('gri30.cti') - rxns = ct.Reaction.listFromFile('gri30.cti') + spec = ct.Species.listFromFile('gri30.yaml') + rxns = ct.Reaction.listFromFile('gri30.yaml') gas = ct.Solution(thermo='IdealGas', kinetics='GasKinetics', species=spec, reactions=rxns) @@ -89,9 +89,9 @@ class Interface(InterfacePhase, InterfaceKinetics): in reactions need to be created and then passed in as a list in the ``adjacent`` argument to the constructor:: - gas = ct.Solution('diamond.cti', phase='gas') - diamond = ct.Solution('diamond.cti', phase='diamond') - diamond_surf = ct.Interface('diamond.cti', phase='diamond_100', + gas = ct.Solution('diamond.yaml', phase='gas') + diamond = ct.Solution('diamond.yaml', phase='diamond') + diamond_surf = ct.Interface('diamond.yaml', phase='diamond_100', adjacent=[gas, diamond]) """ __slots__ = ('_phase_indices',) @@ -316,7 +316,7 @@ class SolutionArray: with shapes described in the same way as Numpy arrays. All of the states can be set in a single call:: - >>> gas = ct.Solution('gri30.cti') + >>> gas = ct.Solution('gri30.yaml') >>> states = ct.SolutionArray(gas, (6, 10)) >>> T = np.linspace(300, 1000, 10) # row vector >>> P = ct.one_atm * np.linspace(0.1, 5.0, 6)[:,np.newaxis] # column vector