[Python/Input] Make function names more Pythonic

This commit is contained in:
Ray Speth
2021-04-12 18:00:34 -04:00
committed by Ingmar Schoegl
parent 716e397c2e
commit 65dd8e9511
6 changed files with 11 additions and 11 deletions

View File

@@ -230,7 +230,7 @@ cdef class _SolutionBase:
definition.
"""
def __get__(self):
return anymapToPython(self.base.parameters(True))
return anymap_to_dict(self.base.parameters(True))
def write_yaml(self, filename, phases=None, units=None, precision=None,
skip_user_defined=None):

View File

@@ -327,7 +327,7 @@ cdef class Reaction:
definition.
"""
def __get__(self):
return anymapToPython(self.reaction.parameters(True))
return anymap_to_dict(self.reaction.parameters(True))
def __repr__(self):
return '<{}: {}>'.format(self.__class__.__name__, self.equation)

View File

@@ -88,7 +88,7 @@ cdef class SpeciesThermo:
property input_data:
def __get__(self):
return anymapToPython(self.spthermo.parameters(True))
return anymap_to_dict(self.spthermo.parameters(True))
def cp(self, T):
"""

View File

@@ -265,7 +265,7 @@ cdef class Species:
property input_data:
def __get__(self):
cdef CxxThermoPhase* phase = self._phase.thermo if self._phase else NULL
return anymapToPython(self.species.parameters(phase))
return anymap_to_dict(self.species.parameters(phase))
def __repr__(self):
return '<Species {}>'.format(self.name)

View File

@@ -58,7 +58,7 @@ cdef class GasTransportData:
property input_data:
def __get__(self):
return anymapToPython(self.data.parameters(True))
return anymap_to_dict(self.data.parameters(True))
property geometry:
"""

View File

@@ -73,7 +73,7 @@ class CanteraError(RuntimeError):
cdef public PyObject* pyCanteraError = <PyObject*>CanteraError
cdef anyvalueToPython(string name, CxxAnyValue& v):
cdef anyvalue_to_python(string name, CxxAnyValue& v):
cdef CxxAnyMap a
cdef CxxAnyValue b
if v.isScalar():
@@ -86,9 +86,9 @@ cdef anyvalueToPython(string name, CxxAnyValue& v):
elif v.isType[cbool]():
return v.asType[cbool]()
elif v.isType[CxxAnyMap]():
return anymapToPython(v.asType[CxxAnyMap]())
return anymap_to_dict(v.asType[CxxAnyMap]())
elif v.isType[vector[CxxAnyMap]]():
return [anymapToPython(a) for a in v.asType[vector[CxxAnyMap]]()]
return [anymap_to_dict(a) for a in v.asType[vector[CxxAnyMap]]()]
elif v.isType[vector[double]]():
return v.asType[vector[double]]()
elif v.isType[vector[string]]():
@@ -98,7 +98,7 @@ cdef anyvalueToPython(string name, CxxAnyValue& v):
elif v.isType[vector[cbool]]():
return v.asType[vector[cbool]]()
elif v.isType[vector[CxxAnyValue]]():
return [anyvalueToPython(name, b)
return [anyvalue_to_python(name, b)
for b in v.asType[vector[CxxAnyValue]]()]
elif v.isType[vector[vector[double]]]():
return v.asType[vector[vector[double]]]()
@@ -115,7 +115,7 @@ cdef anyvalueToPython(string name, CxxAnyValue& v):
pystr(name), v.type_str()))
cdef anymapToPython(CxxAnyMap& m):
cdef anymap_to_dict(CxxAnyMap& m):
m.applyUnits()
return {pystr(item.first): anyvalueToPython(item.first, item.second)
return {pystr(item.first): anyvalue_to_python(item.first, item.second)
for item in m.ordered()}