Skip to content

Commit f42e34a

Browse files
committed
Inline pyconvert registration
1 parent 5524df0 commit f42e34a

File tree

7 files changed

+324
-97
lines changed

7 files changed

+324
-97
lines changed

src/Convert/ctypes.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,3 @@ function ctypes_rule_specs()
7272
return specs
7373
end
7474

75-
function register_ctypes_rules!()
76-
for rule in ctypes_rule_specs()
77-
pyconvert_add_rule(rule.func, rule.tname, rule.type, rule.scope)
78-
end
79-
end

src/Convert/numpy.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,3 @@ function numpy_rule_specs()
183183
return specs
184184
end
185185

186-
function register_numpy_rules!()
187-
for rule in numpy_rule_specs()
188-
pyconvert_add_rule(rule.func, rule.tname, rule.type, rule.scope)
189-
end
190-
end

src/Convert/pandas.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@ function pandas_rule_specs()
1313
]
1414
end
1515

16-
function register_pandas_rules!()
17-
for rule in pandas_rule_specs()
18-
pyconvert_add_rule(rule.func, rule.tname, rule.type, rule.scope)
19-
end
20-
end

src/Convert/pyconvert.jl

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -435,49 +435,3 @@ function init_pyconvert_extratypes()
435435
pyimport("collections.abc" => ("Iterable", "Sequence", "Set", "Mapping"))...,
436436
)
437437
end
438-
439-
function register_pyconvert_rules!()
440-
pyconvert_add_rule(pyconvert_rule_none, "builtins:NoneType", Nothing, Any)
441-
pyconvert_add_rule(pyconvert_rule_bool, "builtins:bool", Bool, Any)
442-
pyconvert_add_rule(pyconvert_rule_float, "builtins:float", Float64, Any)
443-
pyconvert_add_rule(pyconvert_rule_complex, "builtins:complex", Complex{Float64}, Any)
444-
pyconvert_add_rule(pyconvert_rule_int, "numbers:Integral", Integer, Any)
445-
pyconvert_add_rule(pyconvert_rule_str, "builtins:str", String, Any)
446-
pyconvert_add_rule(pyconvert_rule_bytes, "builtins:bytes", Base.CodeUnits{UInt8,String}, Any)
447-
pyconvert_add_rule(pyconvert_rule_range, "builtins:range", StepRange{<:Integer,<:Integer}, Any)
448-
pyconvert_add_rule(pyconvert_rule_fraction, "numbers:Rational", Rational{<:Integer}, Any)
449-
pyconvert_add_rule(pyconvert_rule_iterable, "builtins:tuple", NamedTuple, Any)
450-
pyconvert_add_rule(pyconvert_rule_iterable, "builtins:tuple", Tuple, Any)
451-
pyconvert_add_rule(pyconvert_rule_datetime, "datetime:datetime", DateTime, Any)
452-
pyconvert_add_rule(pyconvert_rule_date, "datetime:date", Date, Any)
453-
pyconvert_add_rule(pyconvert_rule_time, "datetime:time", Time, Any)
454-
pyconvert_add_rule(pyconvert_rule_timedelta, "datetime:timedelta", Microsecond, Any)
455-
pyconvert_add_rule(pyconvert_rule_exception, "builtins:BaseException", PyException, Any)
456-
pyconvert_add_rule(pyconvert_rule_none, "builtins:NoneType", Missing, Missing)
457-
pyconvert_add_rule(pyconvert_rule_bool, "builtins:bool", Number, Number)
458-
pyconvert_add_rule(pyconvert_rule_float, "numbers:Real", Number, Number)
459-
pyconvert_add_rule(pyconvert_rule_float, "builtins:float", Nothing, Nothing)
460-
pyconvert_add_rule(pyconvert_rule_float, "builtins:float", Missing, Missing)
461-
pyconvert_add_rule(pyconvert_rule_complex, "numbers:Complex", Number, Number)
462-
pyconvert_add_rule(pyconvert_rule_int, "numbers:Integral", Number, Number)
463-
pyconvert_add_rule(pyconvert_rule_str, "builtins:str", Symbol, Symbol)
464-
pyconvert_add_rule(pyconvert_rule_str, "builtins:str", Char, Char)
465-
pyconvert_add_rule(pyconvert_rule_bytes, "builtins:bytes", Vector{UInt8}, Vector{UInt8})
466-
pyconvert_add_rule(pyconvert_rule_range, "builtins:range", UnitRange{<:Integer}, UnitRange{<:Integer})
467-
pyconvert_add_rule(pyconvert_rule_fraction, "numbers:Rational", Number, Number)
468-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Iterable", Vector, Vector)
469-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Iterable", Tuple, Tuple)
470-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Iterable", Pair, Pair)
471-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Iterable", Set, Set)
472-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Sequence", Vector, Vector)
473-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Sequence", Tuple, Tuple)
474-
pyconvert_add_rule(pyconvert_rule_iterable, "collections.abc:Set", Set, Set)
475-
pyconvert_add_rule(pyconvert_rule_mapping, "collections.abc:Mapping", Dict, Dict)
476-
pyconvert_add_rule(pyconvert_rule_timedelta, "datetime:timedelta", Millisecond, Millisecond)
477-
pyconvert_add_rule(pyconvert_rule_timedelta, "datetime:timedelta", Second, Second)
478-
pyconvert_add_rule(pyconvert_rule_timedelta, "datetime:timedelta", Nanosecond, Nanosecond)
479-
end
480-
481-
function register_pyconvert_fallback_rules!()
482-
pyconvert_add_rule(pyconvert_rule_object, "builtins:object", Py, Any)
483-
end

src/JlWrap/base.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ function init_base()
2525
pyjuliacallmodule.JlBase = pyjlbasetype
2626
end
2727

28-
function register_jlwrap_rules!()
29-
pyconvert_add_rule(pyconvert_rule_jlvalue, "juliacall:JlBase", Any, Any)
30-
end
31-
3228
pyconvert_rule_jlvalue(::Type{T}, x::Py) where {T} =
3329
pyconvert_tryconvert(T, _pyjl_getvalue(x))
3430

0 commit comments

Comments
 (0)