coolpropx.utils module#
- coolpropx.utils.check_lists_match(list1, list2)[source]#
Check if two lists contain the exact same elements, regardless of their order.
- Parameters:
- list1list
The first list for comparison.
- list2list
The second list for comparison.
- Returns:
- bool
Returns True if the lists contain the exact same elements, regardless of their order. Returns False otherwise.
Examples
>>> check_lists_match([1, 2, 3], [3, 2, 1]) True
>>> check_lists_match([1, 2, 3], [4, 5, 6]) False
- coolpropx.utils.is_float(element: any) bool [source]#
Check if the given element can be converted to a float.
- Parameters:
- elementany
The element to be checked.
- Returns:
- bool
True if the element can be converted to a float, False otherwise.
- coolpropx.utils.is_numeric(value)[source]#
Check if a value is a numeric type, including both Python and NumPy numeric types.
This function checks if the given value is a numeric type (int, float, complex) in the Python standard library or NumPy, while explicitly excluding boolean types.
- Parameters:
- valueany type
The value to be checked for being a numeric type.
- Returns:
- bool
Returns True if the value is a numeric type (excluding booleans), otherwise False.
- coolpropx.utils.print_dict(data, indent=0, return_output=False)[source]#
Recursively prints nested dictionaries with indentation or returns the formatted string.
- Parameters:
- datadict
The dictionary to print.
- indentint, optional
The initial level of indentation for the keys of the dictionary, by default 0.
- return_outputbool, optional
If True, returns the formatted string instead of printing it.
- Returns:
- str or None
The formatted string representation of the dictionary if return_output is True, otherwise None.
- coolpropx.utils.print_object(obj)[source]#
Prints all attributes and methods of an object, sorted alphabetically.
Methods are identified as callable and printed with the prefix ‘Method: ‘.
Attributes are identified as non-callable and printed with the prefix ‘Attribute: ‘.
- Parameters:
- objobject
The object whose attributes and methods are to be printed.
- Returns:
- None
This function does not return any value. It prints the attributes and methods of the given object.