-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathConvert.jl
72 lines (65 loc) · 1.38 KB
/
Convert.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
module PythonCall.Convert
Implements `pyconvert`.
"""
module Convert
using ..Core
using ..Core:
C,
Utils,
@autopy,
getptr,
incref,
pynew,
PyNULL,
pyisnull,
pydel!,
pyisint,
iserrset_ambig,
pyisnone,
pyisTrue,
pyisFalse,
pyfloat_asdouble,
pycomplex_ascomplex,
pyisstr,
pystr_asstring,
pyisbytes,
pybytes_asvector,
pybytes_asUTF8string,
pyisfloat,
pyisrange,
pytuple_getitem,
unsafe_pynext,
pyistuple,
pydatetimetype,
pytime_isaware,
pydatetime_isaware,
_base_pydatetime,
_base_datetime,
errmatches,
errclear,
errset,
pyiscomplex,
pythrow,
pybool_asbool
using Dates: Date, Time, DateTime, Second, Millisecond, Microsecond, Nanosecond
using Dates: Year, Month, Day, Hour, Minute, Week, Period, CompoundPeriod, canonicalize
import ..Core: pyconvert
# patch conversion to Period types for julia <= 1.7
@static if VERSION < v"1.8.0-"
for T in (:Year, :Month, :Week, :Day, :Hour, :Minute, :Second, :Millisecond, :Microsecond, :Nanosecond)
@eval Base.convert(::Type{$T}, x::CompoundPeriod) = sum($T, x.periods; init = zero($T))
end
end
include("pyconvert.jl")
include("rules.jl")
include("ctypes.jl")
include("numpy.jl")
include("pandas.jl")
function __init__()
init_pyconvert()
init_ctypes()
init_numpy()
init_pandas()
end
end