mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-01 03:00:13 -04:00
Python strings are all unicode everywhere, even python 27.
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
@@ -5,16 +5,6 @@ cimport cython
|
||||
from libcpp.vector cimport vector
|
||||
|
||||
include "AbstractState.pxd"
|
||||
|
||||
# Default string in Python 3.x is a unicode string (type str)
|
||||
# Default string in Python 2.x is a byte string(type bytes)
|
||||
#
|
||||
# Create a fused type that allows for either unicode string or bytestring
|
||||
# We encode unicode strings using the ASCII encoding since we know they are all
|
||||
# ASCII strings
|
||||
ctypedef fused string_like:
|
||||
cython.bytes
|
||||
cython.unicode
|
||||
|
||||
cdef extern from "CoolPropTools.h" namespace "CoolProp":
|
||||
bint _ValidNumber "ValidNumber"(double)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#cython: embedsignature = True, c_string_type=bytes, c_string_encoding=ascii
|
||||
#cython: embedsignature = True, c_string_type = unicode, c_string_encoding = ascii
|
||||
from __future__ import division
|
||||
#
|
||||
# This file provides wrapper functions of all the CoolProp functions
|
||||
@@ -13,7 +13,7 @@ import math
|
||||
import warnings
|
||||
|
||||
try:
|
||||
import numpy as np
|
||||
import numpy as npp
|
||||
_numpy_supported = True
|
||||
except ImportError:
|
||||
_numpy_supported = False
|
||||
@@ -202,14 +202,14 @@ cpdef list FluidsList():
|
||||
In [1]: FluidsList()
|
||||
|
||||
"""
|
||||
return _get_global_param_string("FluidsList").decode('ascii').split(',')
|
||||
return _get_global_param_string("FluidsList").split(',')
|
||||
|
||||
cpdef get_aliases(string Fluid):
|
||||
"""
|
||||
Return a comma separated string of aliases for the given fluid
|
||||
"""
|
||||
cdef bytes _Fluid = Fluid.encode('ascii')
|
||||
return [F.encode('ascii') for F in (_get_fluid_param_string(_Fluid,'aliases').encode('ascii')).decode('ascii').split(',')]
|
||||
return [F for F in _get_fluid_param_string(_Fluid, 'aliases').split(',')]
|
||||
|
||||
cpdef string get_REFPROPname(string Fluid):
|
||||
"""
|
||||
@@ -251,6 +251,7 @@ cpdef string get_REFPROPname(string Fluid):
|
||||
# empty string if Fluid not in CoolProp, "Bad key" if key is invalid
|
||||
# """
|
||||
# return _get_BibTeXKey(Fluid, key)
|
||||
|
||||
cpdef string get_errstr():
|
||||
"""
|
||||
Return the current error string
|
||||
|
||||
@@ -6,11 +6,11 @@ from . import HumidAirProp
|
||||
from . import State
|
||||
from .constants import *
|
||||
|
||||
__fluids__ = CoolProp.get_global_param_string('fluids_list').decode('ascii').split(',')
|
||||
__incompressibles_pure__ = CoolProp.get_global_param_string('incompressible_list_pure').decode('ascii').split(',')
|
||||
__incompressibles_solution__ = CoolProp.get_global_param_string('incompressible_list_solution').decode('ascii').split(',')
|
||||
__version__ = CoolProp.get_global_param_string('version').decode('ascii')
|
||||
__gitrevision__ = CoolProp.get_global_param_string('gitrevision').decode('ascii')
|
||||
__fluids__ = CoolProp.get_global_param_string('fluids_list').split(',')
|
||||
__incompressibles_pure__ = CoolProp.get_global_param_string('incompressible_list_pure').split(',')
|
||||
__incompressibles_solution__ = CoolProp.get_global_param_string('incompressible_list_solution').split(',')
|
||||
__version__ = CoolProp.get_global_param_string('version')
|
||||
__gitrevision__ = CoolProp.get_global_param_string('gitrevision')
|
||||
|
||||
def get(s):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user