Skip to content

Commit 43202aa

Browse files
authored
Merge pull request #63 from queryverse/new-pycall
Update to PyCall 1.90.0
2 parents 301e68d + 46afc8d commit 43202aa

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# ExcelReaders.jl v0.11.0 Release Notes
2+
* Update to PyCall.jl 1.90.0
3+
14
# ExcelReaders.jl v0.10.3 Release Notes
25
* Fix julia 1.0 compat bug
36

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
julia 0.7
22
DataValues 0.4.4
3-
PyCall 1.18.2
3+
PyCall 1.90.0

src/ExcelReaders.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Base.show(io::IO, o::ExcelFile)
4141
end
4242

4343
function Base.show(io::IO, o::ExcelErrorCell)
44-
print(io, xlrd[:error_text_from_code][o.errorcode])
44+
print(io, xlrd.error_text_from_code[o.errorcode])
4545
end
4646

4747
"""
@@ -61,7 +61,7 @@ data = readxl(f, "Sheet1!A1:C4")
6161
````
6262
"""
6363
function openxl(filename::AbstractString)
64-
wb = xlrd[:open_workbook](filename)
64+
wb = xlrd.open_workbook(filename)
6565
return ExcelFile(wb, basename(filename))
6666
end
6767

@@ -71,7 +71,7 @@ function readxlsheet(filename::AbstractString, sheetindex::Int; args...)
7171
end
7272

7373
function readxlsheet(file::ExcelFile, sheetindex::Int; args...)
74-
sheetnames = file.workbook[:sheet_names]()
74+
sheetnames = file.workbook.sheet_names()
7575
return readxlsheet(file, sheetnames[sheetindex]; args...)
7676
end
7777

@@ -81,7 +81,7 @@ function readxlsheet(filename::AbstractString, sheetname::AbstractString; args..
8181
end
8282

8383
function readxlsheet(file::ExcelFile, sheetname::AbstractString; args...)
84-
sheet = file.workbook[:sheet_by_name](sheetname)
84+
sheet = file.workbook.sheet_by_name(sheetname)
8585
startrow, startcol, endrow, endcol = convert_args_to_row_col(sheet; args...)
8686

8787
data = readxl_internal(file, sheetname, startrow, startcol, endrow, endcol)
@@ -99,10 +99,10 @@ function convert_args_to_row_col(sheet;skipstartrows::Union{Int,Symbol}=:blanks,
9999
isa(nrows, Int) && nrows<0 && error("nrows should be :all or positive")
100100
isa(ncols, Symbol) && ncols!=:all && error("Only :all or an integer is a valid argument for ncols")
101101
isa(ncols, Int) && ncols<0 && error("ncols should be :all or positive")
102-
sheet_rows = sheet[:nrows]
103-
sheet_cols = sheet[:ncols]
102+
sheet_rows = sheet.nrows
103+
sheet_cols = sheet.ncols
104104

105-
cell_value = sheet[:cell_value]
105+
cell_value = sheet.cell_value
106106

107107
if skipstartrows==:blanks
108108
startrow = -1
@@ -196,25 +196,25 @@ function readxl(file::ExcelFile, range::AbstractString)
196196
end
197197

198198
function get_cell_value(ws, row, col, wb)
199-
cellval = ws[:cell_value](row-1,col-1)
199+
cellval = ws.cell_value(row-1,col-1)
200200
if cellval==""
201201
return NA
202202
else
203-
celltype = ws[:cell_type](row-1,col-1)
204-
if celltype == xlrd[:XL_CELL_TEXT]
203+
celltype = ws.cell_type(row-1,col-1)
204+
if celltype == xlrd.XL_CELL_TEXT
205205
return convert(String, cellval)
206-
elseif celltype == xlrd[:XL_CELL_NUMBER]
206+
elseif celltype == xlrd.XL_CELL_NUMBER
207207
return convert(Float64, cellval)
208-
elseif celltype == xlrd[:XL_CELL_DATE]
209-
date_year,date_month,date_day,date_hour,date_minute,date_sec = xlrd[:xldate_as_tuple](cellval, wb[:datemode])
208+
elseif celltype == xlrd.XL_CELL_DATE
209+
date_year,date_month,date_day,date_hour,date_minute,date_sec = xlrd.xldate_as_tuple(cellval, wb.datemode)
210210
if date_month==0
211211
return Time(date_hour, date_minute, date_sec)
212212
else
213213
return DateTime(date_year, date_month, date_day, date_hour, date_minute, date_sec)
214214
end
215-
elseif celltype == xlrd[:XL_CELL_BOOLEAN]
215+
elseif celltype == xlrd.XL_CELL_BOOLEAN
216216
return convert(Bool, cellval)
217-
elseif celltype == xlrd[:XL_CELL_ERROR]
217+
elseif celltype == xlrd.XL_CELL_ERROR
218218
return ExcelErrorCell(cellval)
219219
else
220220
error("Unknown cell type")
@@ -224,7 +224,7 @@ end
224224

225225
function readxl_internal(file::ExcelFile, sheetname::AbstractString, startrow::Integer, startcol::Integer, endrow::Integer, endcol::Integer)
226226
wb = file.workbook
227-
ws = wb[:sheet_by_name](sheetname)
227+
ws = wb.sheet_by_name(sheetname)
228228

229229
if startrow==endrow && startcol==endcol
230230
return get_cell_value(ws, startrow, startcol, wb)
@@ -243,16 +243,16 @@ function readxl_internal(file::ExcelFile, sheetname::AbstractString, startrow::I
243243
end
244244

245245
function readxlnames(f::ExcelFile)
246-
return [lowercase(i[:name]) for i in f.workbook[:name_obj_list] if i[:hidden]==0]
246+
return [lowercase(i.name) for i in f.workbook.name_obj_list if i.hidden==0]
247247
end
248248

249249
function readxlrange(f::ExcelFile, range::AbstractString)
250-
name = f.workbook[:name_map][lowercase(range)]
250+
name = f.workbook.name_map[lowercase(range)]
251251
if length(name)!=1
252252
error("More than one reference per name, this case is not yet handled by ExcelReaders.")
253253
end
254254

255-
formula_text = name[1][:formula_text]
255+
formula_text = name[1].formula_text
256256
formula_text = replace(formula_text, "\$"=>"")
257257
formula_text = replace(formula_text, "'"=>"")
258258

0 commit comments

Comments
 (0)