Skip to content

Commit 92ee4fd

Browse files
committed
Add comment and docstring to emphasize only supporting native python object
1 parent 1591be3 commit 92ee4fd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

rmgpy/rmg/reactors.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,26 @@
6161

6262
def to_julia(obj):
6363
"""
64-
Convert python object to julia object. If the object is a Python dict, it will be converted to a Julia Dict. If the object is a Python list, it will be converted to a Julia Vector. If the object is a 1-d numpy array, it will be converted to a Julia Array. If the object is a n-d (n > 1) numpy array, it will be converted to a Julia Matrix. Otherwise, the object will be returned as is.
64+
Convert native Python object to julia object. If the object is a Python dict, it will be converted to a Julia Dict. If the object is a Python list, it will be converted to a Julia Vector. If the object is a 1-d numpy array, it will be converted to a Julia Array. If the object is a n-d (n > 1) numpy array, it will be converted to a Julia Matrix.
65+
Otherwise, the object will be returned as is. Doesn't support RMG objects.
6566
6667
Parameters
6768
----------
6869
obj : dict | list | np.ndarray | object
69-
The python object to convert
70+
The native Python object to convert
7071
7172
Returns
7273
-------
7374
object : Main.Dict | Main.Vector | Main.Matrix | object
74-
The julia object
75+
The Julia object
7576
"""
7677
if isinstance(obj, dict):
7778
return Main.PythonCall.pyconvert(Main.Dict, obj)
7879
elif isinstance(obj, (list, np.ndarray)):
7980
if obj.getattr("shape", False) and len(obj.shape) > 1:
8081
return Main.PythonCall.pyconvert(Main.Matrix, obj)
8182
return Main.PythonCall.pyconvert(Main.Vector, obj)
82-
else:
83+
else: # Other native Python project does not need special conversion.
8384
return obj
8485

8586

0 commit comments

Comments
 (0)