Skip to content
This repository was archived by the owner on Oct 9, 2019. It is now read-only.

Commit aa86ff1

Browse files
committed
Update Py.jl
1 parent b63e293 commit aa86ff1

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

REQUIRE

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
julia 0.6
2+
PyCall 1.14.0

src/Py.jl

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
module Py
22

3-
# package code goes here
3+
using PyCall
4+
5+
function traverse!{T}(arg::T)::T
6+
return arg
7+
end
8+
9+
function traverse!(expr::Expr)
10+
11+
if expr.head == :ref
12+
expr.head = :call
13+
unshift!(expr.args, :get)
14+
end
15+
16+
for (i, arg) in enumerate(expr.args)
17+
traverse!(expr.args[i])
18+
end
19+
20+
if expr.head == :.
21+
expr.head = :ref
22+
end
23+
24+
return expr
25+
end
26+
27+
macro Py(expr::Expr)
28+
29+
traverse!(expr)
30+
31+
return expr
32+
end
433

534
end # module

0 commit comments

Comments
 (0)