Skip to content

Commit ec7e9da

Browse files
davidanthoffgithub-actions[bot]
authored andcommitted
Format files using DocumentFormat
1 parent 0020f4e commit ec7e9da

File tree

3 files changed

+81
-81
lines changed

3 files changed

+81
-81
lines changed

docs/make.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Documenter, ExcelReaders
22

3-
makedocs(modules = [ExcelReaders],
4-
sitename = "ExcelReaders.jl",
5-
analytics = "UA-132838790-1",
6-
pages = [
3+
makedocs(modules=[ExcelReaders],
4+
sitename="ExcelReaders.jl",
5+
analytics="UA-132838790-1",
6+
pages=[
77
"Introduction" => "index.md"
88
])
99

10-
deploydocs(repo = "github.com/queryverse/ExcelReaders.jl.git")
10+
deploydocs(repo="github.com/queryverse/ExcelReaders.jl.git")

src/ExcelReaders.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using PyCall, DataValues, Dates
44

55
export openxl, readxl, readxlsheet, ExcelErrorCell, ExcelFile, readxlnames, readxlrange
66

7-
const xlrd = PyNULL()
7+
const xlrd = PyNULL()
88

99
include("package_documentation.jl")
1010

@@ -90,7 +90,7 @@ function readxlsheet(file::ExcelFile, sheetname::AbstractString; args...)
9090
end
9191

9292
# Function converts "relative" range like skip rows/cols and size of range to "absolute" from row/col to row/col
93-
function convert_args_to_row_col(sheet;skipstartrows::Union{Int,Symbol} = :blanks, skipstartcols::Union{Int,Symbol} = :blanks, nrows::Union{Int,Symbol} = :all, ncols::Union{Int,Symbol} = :all)
93+
function convert_args_to_row_col(sheet; skipstartrows::Union{Int,Symbol}=:blanks, skipstartcols::Union{Int,Symbol}=:blanks, nrows::Union{Int,Symbol}=:all, ncols::Union{Int,Symbol}=:all)
9494
isa(skipstartrows, Symbol) && skipstartrows != :blanks && error("Only :blank or an integer is a valid argument for skipstartrows")
9595
isa(skipstartrows, Int) && skipstartrows < 0 && error("Can't skip a negative number of rows")
9696
isa(skipstartcols, Symbol) && skipstartcols != :blanks && error("Only :blank or an integer is a valid argument for skipstartcols")
@@ -178,7 +178,7 @@ function convert_ref_to_sheet_row_col(range::AbstractString)
178178
endrow = parse(Int, m.captures[6])
179179
endcol = colnum(m.captures[5])
180180
end
181-
if (startrow > endrow ) || (startcol > endcol)
181+
if (startrow > endrow) || (startcol > endcol)
182182
error("Please provide rectangular region from top left to bottom right corner")
183183
end
184184
return sheetname, startrow, startcol, endrow, endcol
@@ -234,7 +234,7 @@ function readxl_internal(file::ExcelFile, sheetname::AbstractString, startrow::I
234234

235235
for row in startrow:endrow
236236
for col in startcol:endcol
237-
data[row - startrow + 1, col - startcol + 1] = get_cell_value(ws, row, col, wb)
237+
data[row-startrow+1, col-startcol+1] = get_cell_value(ws, row, col, wb)
238238
end
239239
end
240240

test/test_excelreaders.jl

+72-72
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@testitem "ExcelReaders" begin
22
using Dates, PyCall, DataValues
33

4-
# TODO Throw julia specific exceptions for these errors
4+
# TODO Throw julia specific exceptions for these errors
55
@test_throws PyCall.PyError openxl("FileThatDoesNotExist.xls")
66
@test_throws PyCall.PyError openxl("runtests.jl")
77

@@ -10,104 +10,104 @@
1010
@test file.filename == "TestData.xls"
1111

1212
buffer = IOBuffer()
13-
13+
1414
@test sprint(show, file) == "ExcelFile <TestData.xls>"
1515

1616
for (k, v) in Dict(0 => "#NULL!", 7 => "#DIV/0!", 23 => "#REF!", 42 => "#N/A", 29 => "#NAME?", 36 => "#NUM!", 15 => "#VALUE!")
1717
errorcell = ExcelErrorCell(k)
1818
@test sprint(show, errorcell) == v
1919
end
2020

21-
# Read into DataValueArray
21+
# Read into DataValueArray
2222
for f in [file, filename]
2323
@test_throws ErrorException readxl(f, "Sheet1!C4:G3")
2424
@test_throws ErrorException readxl(f, "Sheet1!G2:B5")
2525
@test_throws ErrorException readxl(f, "Sheet1!G5:B2")
2626

2727
data = readxl(f, "Sheet1!C3:N7")
2828
@test size(data) == (5, 12)
29-
@test data[4,1] == 2.0
30-
@test data[2,2] == "A"
31-
@test data[2,3] == true
32-
@test DataValues.isna(data[4,5])
33-
@test data[2,9] == Date(2015, 3, 3)
34-
@test data[3,9] == DateTime(2015, 2, 4, 10, 14)
35-
@test data[4,9] == DateTime(1988, 4, 9, 0, 0)
36-
@test data[5,9] == Time(15, 2, 0)
37-
@test data[3,10] == DateTime(1950, 8, 9, 18, 40)
38-
@test DataValues.isna(data[5,10])
39-
@test isa(data[2,11], ExcelErrorCell)
40-
@test isa(data[3,11], ExcelErrorCell)
41-
@test isa(data[4,12], ExcelErrorCell)
42-
@test DataValues.isna(data[5,12])
43-
44-
# Test readxlsheet function
29+
@test data[4, 1] == 2.0
30+
@test data[2, 2] == "A"
31+
@test data[2, 3] == true
32+
@test DataValues.isna(data[4, 5])
33+
@test data[2, 9] == Date(2015, 3, 3)
34+
@test data[3, 9] == DateTime(2015, 2, 4, 10, 14)
35+
@test data[4, 9] == DateTime(1988, 4, 9, 0, 0)
36+
@test data[5, 9] == Time(15, 2, 0)
37+
@test data[3, 10] == DateTime(1950, 8, 9, 18, 40)
38+
@test DataValues.isna(data[5, 10])
39+
@test isa(data[2, 11], ExcelErrorCell)
40+
@test isa(data[3, 11], ExcelErrorCell)
41+
@test isa(data[4, 12], ExcelErrorCell)
42+
@test DataValues.isna(data[5, 12])
43+
44+
# Test readxlsheet function
4545
@test_throws ErrorException readxlsheet(f, "Empty Sheet")
4646
for sheetinfo = ["Second Sheet", 2]
47-
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartrows = -1)
48-
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartrows = :nonsense)
47+
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartrows=-1)
48+
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartrows=:nonsense)
4949

50-
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartcols = -1)
51-
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartcols = :nonsense)
50+
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartcols=-1)
51+
@test_throws ErrorException readxlsheet(f, sheetinfo, skipstartcols=:nonsense)
5252

53-
@test_throws ErrorException readxlsheet(f, sheetinfo, nrows = -1)
54-
@test_throws ErrorException readxlsheet(f, sheetinfo, nrows = :nonsense)
53+
@test_throws ErrorException readxlsheet(f, sheetinfo, nrows=-1)
54+
@test_throws ErrorException readxlsheet(f, sheetinfo, nrows=:nonsense)
5555

56-
@test_throws ErrorException readxlsheet(f, sheetinfo, ncols = -1)
57-
@test_throws ErrorException readxlsheet(f, sheetinfo, ncols = :nonsense)
56+
@test_throws ErrorException readxlsheet(f, sheetinfo, ncols=-1)
57+
@test_throws ErrorException readxlsheet(f, sheetinfo, ncols=:nonsense)
5858

5959
data = readxlsheet(f, sheetinfo)
6060
@test size(data) == (6, 6)
61-
@test data[2,1] == 1.
62-
@test data[5,2] == "CCC"
63-
@test data[3,3] == false
64-
@test data[6,6] == Time(15, 2, 00)
65-
@test DataValues.isna(data[4,3])
66-
@test DataValues.isna(data[4,6])
67-
68-
data = readxlsheet(f, sheetinfo, skipstartrows = :blanks, skipstartcols = :blanks)
61+
@test data[2, 1] == 1.
62+
@test data[5, 2] == "CCC"
63+
@test data[3, 3] == false
64+
@test data[6, 6] == Time(15, 2, 00)
65+
@test DataValues.isna(data[4, 3])
66+
@test DataValues.isna(data[4, 6])
67+
68+
data = readxlsheet(f, sheetinfo, skipstartrows=:blanks, skipstartcols=:blanks)
6969
@test size(data) == (6, 6)
70-
@test data[2,1] == 1.
71-
@test data[5,2] == "CCC"
72-
@test data[3,3] == false
73-
@test data[6,6] == Time(15, 2, 00)
74-
@test DataValues.isna(data[4,3])
75-
@test DataValues.isna(data[4,6])
76-
77-
data = readxlsheet(f, sheetinfo, skipstartrows = 0, skipstartcols = 0)
70+
@test data[2, 1] == 1.
71+
@test data[5, 2] == "CCC"
72+
@test data[3, 3] == false
73+
@test data[6, 6] == Time(15, 2, 00)
74+
@test DataValues.isna(data[4, 3])
75+
@test DataValues.isna(data[4, 6])
76+
77+
data = readxlsheet(f, sheetinfo, skipstartrows=0, skipstartcols=0)
7878
@test size(data) == (6 + 7, 6 + 3)
79-
@test data[2 + 7,1 + 3] == 1.
80-
@test data[5 + 7,2 + 3] == "CCC"
81-
@test data[3 + 7,3 + 3] == false
82-
@test data[6 + 7,6 + 3] == Time(15, 2, 00)
83-
@test DataValues.isna(data[4 + 7,3 + 3])
84-
@test DataValues.isna(data[4 + 7,6 + 3])
85-
86-
data = readxlsheet(f, sheetinfo, skipstartrows = 0, )
79+
@test data[2+7, 1+3] == 1.
80+
@test data[5+7, 2+3] == "CCC"
81+
@test data[3+7, 3+3] == false
82+
@test data[6+7, 6+3] == Time(15, 2, 00)
83+
@test DataValues.isna(data[4+7, 3+3])
84+
@test DataValues.isna(data[4+7, 6+3])
85+
86+
data = readxlsheet(f, sheetinfo, skipstartrows=0,)
8787
@test size(data) == (6 + 7, 6)
88-
@test data[2 + 7,1] == 1.
89-
@test data[5 + 7,2] == "CCC"
90-
@test data[3 + 7,3] == false
91-
@test data[6 + 7,6] == Time(15, 2, 00)
92-
@test DataValues.isna(data[4 + 7,3])
93-
@test DataValues.isna(data[4 + 7,6])
94-
95-
data = readxlsheet(f, sheetinfo, skipstartcols = 0)
88+
@test data[2+7, 1] == 1.
89+
@test data[5+7, 2] == "CCC"
90+
@test data[3+7, 3] == false
91+
@test data[6+7, 6] == Time(15, 2, 00)
92+
@test DataValues.isna(data[4+7, 3])
93+
@test DataValues.isna(data[4+7, 6])
94+
95+
data = readxlsheet(f, sheetinfo, skipstartcols=0)
9696
@test size(data) == (6, 6 + 3)
97-
@test data[2,1 + 3] == 1.
98-
@test data[5,2 + 3] == "CCC"
99-
@test data[3,3 + 3] == false
100-
@test data[6,6 + 3] == Time(15, 2, 00)
101-
@test DataValues.isna(data[4,3 + 3])
102-
@test DataValues.isna(data[4,6 + 3])
103-
104-
data = readxlsheet(f, sheetinfo, skipstartrows = 1, skipstartcols = 1, nrows = 11, ncols = 7)
97+
@test data[2, 1+3] == 1.
98+
@test data[5, 2+3] == "CCC"
99+
@test data[3, 3+3] == false
100+
@test data[6, 6+3] == Time(15, 2, 00)
101+
@test DataValues.isna(data[4, 3+3])
102+
@test DataValues.isna(data[4, 6+3])
103+
104+
data = readxlsheet(f, sheetinfo, skipstartrows=1, skipstartcols=1, nrows=11, ncols=7)
105105
@test size(data) == (11, 7)
106-
@test data[2 + 6,1 + 2] == 1.
107-
@test data[5 + 6,2 + 2] == "CCC"
108-
@test data[3 + 6,3 + 2] == false
109-
@test_throws BoundsError data[6 + 6,6 + 2] == Time(15, 2, 00)
110-
@test DataValues.isna(data[4 + 6,2 + 2])
106+
@test data[2+6, 1+2] == 1.
107+
@test data[5+6, 2+2] == "CCC"
108+
@test data[3+6, 3+2] == false
109+
@test_throws BoundsError data[6+6, 6+2] == Time(15, 2, 00)
110+
@test DataValues.isna(data[4+6, 2+2])
111111
end
112112
end
113113

0 commit comments

Comments
 (0)