(->jvm item & [options])
Copy an object into the jvm (if it wasn't there already.)
Copy an object into the jvm (if it wasn't there already.)
(->py-fn fn-obj)
(->py-fn fn-obj
{:keys [method-name documentation py-self]
:or {method-name "unnamed_function" documentation "not documented"}})
Create a python callback from a clojure fn. If clojure fn, then tuple arguments are used. If keyword arguments are desired, the pass in something derived from: libpython-clj.jna.CFunction$KeyWordFunction. If a pure fn is passed in, arguments are marshalled from python if possible and then to-python in the case of successful execution. An exception will set the error indicator.
Create a python callback from a clojure fn. If clojure fn, then tuple arguments are used. If keyword arguments are desired, the pass in something derived from: libpython-clj.jna.CFunction$KeyWordFunction. If a pure fn is passed in, arguments are marshalled from python if possible and then to-python in the case of successful execution. An exception will set the error indicator.
(->python item & [options])
Completely convert a jvm object to a python copy.
Completely convert a jvm object to a python copy.
(add-module modname)
Add a python module. Returns a bridge
Add a python module. Returns a bridge
(as-jvm item & [options])
Bridge a python object into the jvm. Attempts to build a jvm bridge that 'hides' the python type. This bridge is lazy and noncaching so use it wisely; it may be better to just copy the type once into the JVM. Bridging is recursive so any subtypes are also bridged if possible or represented by a hashmap of {:type :value} if not.
Bridge a python object into the jvm. Attempts to build a jvm bridge that 'hides' the python type. This bridge is lazy and noncaching so use it wisely; it may be better to just copy the type once into the JVM. Bridging is recursive so any subtypes are also bridged if possible or represented by a hashmap of {:type :value} if not.
(as-list item)
Return a List implementation using getitem, setitem.
Return a List implementation using __getitem__, __setitem__.
(as-map item)
Return a Map implementation using getitem, setitem. Note that it may be incomplete especially if the object has no 'keys' attribute.
Return a Map implementation using __getitem__, __setitem__. Note that it may be incomplete especially if the object has no 'keys' attribute.
(as-python item & [options])
Bridge a jvm object into python
Bridge a jvm object into python
(as-tensor item)
Return a tech.v2.tensor object from the item that shares the data backing store.
Return a tech.v2.tensor object from the item that shares the data backing store.
(att-type-map item)
Get hashmap of att name to keyword datatype.
Get hashmap of att name to keyword datatype.
(call-attr item att-name & args)
Call an object attribute
Call an object attribute
(dir item)
Get sorted list of all attribute names.
Get sorted list of all attribute names.
(import-module modname)
Import a python module. Returns a bridge
Import a python module. Returns a bridge
(module-dict module)
Get the module dictionary. Returns bridge.
Get the module dictionary. Returns bridge.
(run-simple-string program & {:keys [globals locals]})
Run a string expression returning a map of {:globals :locals :result}. This uses the global main dict under the covers so it matches the behavior of the cpython implementation with the exception of returning the various maps used.
Note this will never return the result of the expression: https://mail.python.org/pipermail/python-list/1999-April/018011.html
Globals, locals may be provided but are not necessary.
Implemented in cpython as:
PyObject *m, *d, *v; m = PyImport_AddModule("main"); if (m == NULL) return -1; d = PyModule_GetDict(m); v = PyRun_StringFlags(command, Py_file_input, d, d, flags); if (v == NULL) { PyErr_Print(); return -1; } Py_DECREF(v); return 0;
Run a string expression returning a map of {:globals :locals :result}. This uses the global __main__ dict under the covers so it matches the behavior of the cpython implementation with the exception of returning the various maps used. Note this will never return the result of the expression: https://mail.python.org/pipermail/python-list/1999-April/018011.html Globals, locals may be provided but are not necessary. Implemented in cpython as: PyObject *m, *d, *v; m = PyImport_AddModule("__main__"); if (m == NULL) return -1; d = PyModule_GetDict(m); v = PyRun_StringFlags(command, Py_file_input, d, d, flags); if (v == NULL) { PyErr_Print(); return -1; } Py_DECREF(v); return 0;
(run-string program & {:keys [globals locals]})
Wrapper around the python c runtime PyRun_String method. This requires you to understand what needs to be in the globals and locals dict in order for everything to work out right and for this reason we recommend run-simple-string.
Wrapper around the python c runtime PyRun_String method. This requires you to understand what needs to be in the globals and locals dict in order for everything to work out right and for this reason we recommend run-simple-string.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close