Skip to content

Commit da49994

Browse files
author
Rob Levy
committed
fix docstrings
1 parent d14d179 commit da49994

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To experiment with it:
2020

2121
To include as a dependency:
2222

23-
Copy the config section found at http://clojars.org/clojure-python into your dependencies in project.clj.
23+
Copy the config section found at http://clojars.org/clojure-python into your dependencies in your project's project.clj.
2424

2525
## License
2626

src/clojure_python/core.clj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@
4747
`(do (import-fn ~lib ~fun)
4848
(import-fn ~lib ~@more-funs))))
4949

50-
(defmacro py-fn [lib fun]
50+
(defmacro py-fn
5151
"create a native clojure function applying the python
5252
wrapper calls on a python function at the top level of the library
5353
use this where lambda is preferred over named function"
54+
[lib fun]
5455
`(let [f# (.__finditem__
5556
~lib
5657
~(name fun))]
@@ -74,28 +75,31 @@
7475
non-keywords (filter (fn [a] (not (keyword? a))) args)]
7576
`(call (__ ~class ~@attrs) [~@non-keywords] ~@keywords))))
7677

77-
(defn dir [x]
78+
(defn dir
7879
"it's slightly nicer to call the dir method in this way"
80+
[x]
7981
(seq (.__dir__ x)))
8082

81-
(defn iter [o start end]
83+
(defn iter
8284
"Jython sometimes represents things as 'PyObjectDerived', which has no direct method to get their items as a seq"
85+
[o start end]
8386
(for [i (range start end)]
8487
(.__getitem__ o i)))
8588

86-
(defn java2py [args]
89+
(defn java2py
8790
"to wrap java objects for input as jython, and unwrap jython output as java
88-
(thanks to Marc Downie on Clojure list for suggesting this)"
91+
(thanks to Marc Downie on Clojure list for suggesting this)"[args]
8992
(into-array
9093
org.python.core.PyObject
9194
(map
9295
(fn [n] (. org.python.core.Py java2py n))
9396
args)))
9497

95-
(defn call [fun args & key-args]
98+
(defn call
9699
"The first len(args)-len(keywords) members of args[]
97100
are plain arguments. The last len(keywords) arguments
98101
are the values of the keyword arguments."
102+
[fun args & key-args]
99103
(.__tojava__
100104
(if key-args
101105
(.__call__ fun (java2py args) (into-array java.lang.String key-args))

0 commit comments

Comments
 (0)