Skip to content

Commit c2033bd

Browse files
author
Christopher Doris
committed
add JlWrap functions to API
1 parent 24f5820 commit c2033bd

File tree

8 files changed

+39
-11
lines changed

8 files changed

+39
-11
lines changed

src/API/exports.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,18 @@ export PyPandasDataFrame
121121
export PySet
122122
export PyTable
123123

124+
# JlWrap
125+
export pyfunc
126+
export pyclassmethod
127+
export pystaticmethod
128+
export pyproperty
129+
export pyjl
130+
export pyjltype
131+
export pyisjl
132+
export pyjlvalue
133+
export pyjlraw
134+
export pybinaryio
135+
export pytextio
136+
124137
# Compat
125138
export pytable

src/API/functions.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ function pyconvert_add_rule end
112112
function pyconvert_return end
113113
function pyconvert_unconverted end
114114

115+
# JlWrap
116+
function pyfunc end
117+
function pyclassmethod end
118+
function pystaticmethod end
119+
function pyproperty end
120+
function pyjl end
121+
function pyjltype end
122+
function pyisjl end
123+
function pyjlvalue end
124+
function pyjlraw end
125+
function pybinaryio end
126+
function pytextio end
127+
115128
# Compat
116129
function event_loop_on end
117130
function event_loop_off end

src/JlWrap/JlWrap.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ using ..Convert
1313
using ..GC: GC
1414
using ..GIL
1515

16+
import ..PythonCall:
17+
pyfunc,
18+
pyclassmethod,
19+
pystaticmethod,
20+
pyproperty,
21+
pyjl,
22+
pyjltype,
23+
pyisjl,
24+
pyjlvalue,
25+
pyjlraw,
26+
pybinaryio,
27+
pytextio
28+
1629
using Pkg: Pkg
1730
using Base: @propagate_inbounds, allocatedinline
1831

src/JlWrap/any.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ This object will satisfy the Python sequence interface, so for example uses 0-up
397397
To define a custom conversion for your type `T`, overload `pyjltype(::T)`.
398398
"""
399399
pyjl(v) = pyjl(pyjltype(v), v)
400-
export pyjl
401400

402401
"""
403402
pyjltype(x)
@@ -407,4 +406,3 @@ The subtype of `juliacall.AnyValue` which the Julia object `x` is wrapped as by
407406
Overload `pyjltype(::T)` to define a custom conversion for your type `T`.
408407
"""
409408
pyjltype(::Any) = pyjlanytype
410-
export pyjltype

src/JlWrap/base.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pyjl(t, v) = pynew(errcheck(@autopy t Cjl.PyJuliaValue_New(getptr(t_), v)))
1212
Test whether `x` is a wrapped Julia value, namely an instance of `juliacall.ValueBase`.
1313
"""
1414
pyisjl(x) = pytypecheck(x, pyjlbasetype)
15-
export pyisjl
1615

1716
pyjlisnull(x) = @autopy x begin
1817
if pyisjl(x_)
@@ -34,7 +33,6 @@ pyjlvalue(x) = @autopy x begin
3433
_pyjl_getvalue(x_)
3534
end
3635
end
37-
export pyjlvalue
3836

3937
function init_base()
4038
setptr!(pyjlbasetype, incref(Cjl.PyJuliaBase_Type[]))

src/JlWrap/callback.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ function pyfunc(
111111
end
112112
return f3
113113
end
114-
export pyfunc
115114

116115
"""
117116
pyclassmethod(f; ...)
@@ -123,7 +122,6 @@ If `f` is not a Python object (e.g. if `f` is a `Function`) then it is converted
123122
`Py`. Keyword arguments are passed to `pyfunc`.
124123
"""
125124
pyclassmethod(f; kw...) = pybuiltins.classmethod(ispy(f) ? f : pyfunc(f; kw...))
126-
export pyclassmethod
127125

128126
"""
129127
pystaticmethod(f; ...)
@@ -135,7 +133,6 @@ If `f` is not a Python object (e.g. if `f` is a `Function`) then it is converted
135133
`Py`. Any keyword arguments are passed to `pyfunc`.
136134
"""
137135
pystaticmethod(f; kw...) = pybuiltins.staticmethod(ispy(f) ? f : pyfunc(f; kw...))
138-
export pystaticmethod
139136

140137
"""
141138
pyproperty(; get=nothing, set=nothing, del=nothing, doc=nothing)
@@ -155,4 +152,3 @@ pyproperty(; get = nothing, set = nothing, del = nothing, doc = nothing) =
155152
doc = doc,
156153
)
157154
pyproperty(get) = pyproperty(get = get)
158-
export pyproperty

src/JlWrap/io.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,12 @@ Wrap `io` as a Python binary IO object.
337337
This is the default behaviour of `Py(io)`.
338338
"""
339339
pybinaryio(v::IO) = pyjl(pyjlbinaryiotype, v)
340-
export pybinaryio
341340

342341
"""
343342
pytextio(io::IO)
344343
345344
Wrap `io` as a Python text IO object.
346345
"""
347346
pytextio(v::IO) = pyjl(pyjltextiotype, v)
348-
export pytextio
349347

350348
pyjltype(::IO) = pyjlbinaryiotype

src/JlWrap/raw.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,3 @@ It has type `juliacall.RawValue`. This has a much more rigid "Julian" interface
172172
For example, accessing attributes or calling this object will always return a `RawValue`.
173173
"""
174174
pyjlraw(v) = pyjl(pyjlrawtype, v)
175-
export pyjlraw

0 commit comments

Comments
 (0)