Skip to content

Commit 7ee43fd

Browse files
authored
🤖 Format .jl files
1 parent ffd4ffb commit 7ee43fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+333
-381
lines changed

docs/make.jl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ using DocumenterTools: Themes
33

44
using TransformsBase
55

6-
Themes.compile(joinpath(@__DIR__,"src/assets/light.scss"), joinpath(@__DIR__,"src/assets/themes/documenter-light.css"))
7-
Themes.compile(joinpath(@__DIR__,"src/assets/dark.scss"), joinpath(@__DIR__,"src/assets/themes/documenter-dark.css"))
6+
Themes.compile(
7+
joinpath(@__DIR__, "src/assets/light.scss"),
8+
joinpath(@__DIR__, "src/assets/themes/documenter-light.css")
9+
)
10+
Themes.compile(joinpath(@__DIR__, "src/assets/dark.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-dark.css"))
811

912
DocMeta.setdocmeta!(TableTransforms, :DocTestSetup, :(using TableTransforms); recursive=true)
1013

@@ -19,17 +22,12 @@ makedocs(;
1922
format=Documenter.HTML(;
2023
prettyurls=get(ENV, "CI", "false") == "true",
2124
canonical="https://JuliaML.github.io/TableTransforms.jl",
22-
assets=["assets/favicon.ico", asset("https://fonts.googleapis.com/css?family=Montserrat|Source+Code+Pro&display=swap", class=:css)]
25+
assets=[
26+
"assets/favicon.ico",
27+
asset("https://fonts.googleapis.com/css?family=Montserrat|Source+Code+Pro&display=swap", class=:css)
28+
]
2329
),
24-
pages=[
25-
"Home" => "index.md",
26-
"Transforms" => "transforms.md",
27-
"Related" => "related.md"
28-
]
30+
pages=["Home" => "index.md", "Transforms" => "transforms.md", "Related" => "related.md"]
2931
)
3032

31-
deploydocs(;
32-
repo="github.com/JuliaML/TableTransforms.jl",
33-
devbranch="master",
34-
push_preview=true
35-
)
33+
deploydocs(; repo="github.com/JuliaML/TableTransforms.jl", devbranch="master", push_preview=true)

src/TableTransforms.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ export
6767
Quantile,
6868
Functional,
6969
EigenAnalysis,
70-
PCA, DRS, SDS,
70+
PCA,
71+
DRS,
72+
SDS,
7173
ProjectionPursuit,
7274
RowTable,
7375
ColTable,
74-
,
76+
,
77+
7578
end

src/assertions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ struct SciTypeAssertion{T,S<:ColSpec}
1111
colspec::S
1212
end
1313

14-
SciTypeAssertion{T}(colspec::S) where {T,S<:ColSpec} =
15-
SciTypeAssertion{T,S}(colspec)
14+
SciTypeAssertion{T}(colspec::S) where {T,S<:ColSpec} = SciTypeAssertion{T,S}(colspec)
1615

1716
SciTypeAssertion{T}() where {T} = SciTypeAssertion{T}(AllSpec())
1817

src/distributions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ function cdf(d::EmpiricalDistribution{T}, x::T) where {T<:Real}
4848
return (pu - pl) * (x - l) / (u - l) + pl
4949
end
5050
end
51-
end
51+
end

src/tableselection.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ struct TableSelection{T,C}
2020
end
2121

2222
function Base.:(==)(a::TableSelection, b::TableSelection)
23-
a.names != b.names && return false
23+
a.names != b.names && return false
2424
a.onames != b.onames && return false
2525
all(nm -> Tables.getcolumn(a, nm) == Tables.getcolumn(b, nm), a.names)
2626
end
2727

2828
function Base.show(io::IO, t::TableSelection)
2929
println(io, "TableSelection")
30-
pretty_table(io, t,
31-
vcrop_mode=:middle,
32-
newline_at_end=false
33-
)
30+
pretty_table(io, t, vcrop_mode=:middle, newline_at_end=false)
3431
end
3532

3633
# Tables.jl interface
@@ -49,13 +46,12 @@ function Tables.getcolumn(t::TableSelection, nm::Symbol)
4946
Tables.getcolumn(t.cols, t.mapnames[nm])
5047
end
5148

52-
Tables.materializer(t::TableSelection) =
53-
Tables.materializer(t.table)
49+
Tables.materializer(t::TableSelection) = Tables.materializer(t.table)
5450

5551
function Tables.schema(t::TableSelection)
5652
schema = Tables.schema(t.cols)
57-
names = schema.names
58-
types = schema.types
59-
inds = indexin(t.onames, collect(names))
53+
names = schema.names
54+
types = schema.types
55+
inds = indexin(t.onames, collect(names))
6056
Tables.Schema(t.names, types[inds])
6157
end

src/tabletraits.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ divide(table) = table, nothing
1616
Combine a table with `features` and a `metadata`
1717
object into a special type of `table`.
1818
"""
19-
attach(features, ::Nothing) = features
19+
attach(features, ::Nothing) = features

src/transforms.jl

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function revert(transform::FeatureTransform, newtable, cache)
150150
@assert isrevertible(transform) "Transform is not revertible"
151151

152152
newfeat, newmeta = divide(newtable)
153-
fcache, mcache = cache
153+
fcache, mcache = cache
154154

155155
feat = revertfeat(transform, newfeat, fcache)
156156
meta = revertmeta(transform, newmeta, mcache)
@@ -159,7 +159,7 @@ function revert(transform::FeatureTransform, newtable, cache)
159159
end
160160

161161
function reapply(transform::FeatureTransform, table, cache)
162-
feat, meta = divide(table)
162+
feat, meta = divide(table)
163163
fcache, mcache = cache
164164

165165
for assertion in assertions(transform)
@@ -180,22 +180,20 @@ reapplymeta(::FeatureTransform, meta, mcache) = meta
180180
# STATELESS FALLBACKS
181181
# --------------------
182182

183-
reapply(transform::StatelessTableTransform, table, cache) =
184-
apply(transform, table) |> first
183+
reapply(transform::StatelessTableTransform, table, cache) = apply(transform, table) |> first
185184

186-
reapply(transform::StatelessFeatureTransform, table, cache) =
187-
apply(transform, table) |> first
185+
reapply(transform::StatelessFeatureTransform, table, cache) = apply(transform, table) |> first
188186

189187
# ------------------
190188
# COLWISE FALLBACKS
191189
# ------------------
192190

193191
function applyfeat(transform::ColwiseFeatureTransform, feat, prep)
194192
# retrieve column names and values
195-
cols = Tables.columns(feat)
196-
names = Tables.columnnames(cols)
193+
cols = Tables.columns(feat)
194+
names = Tables.columnnames(cols)
197195
snames = choose(transform.colspec, names)
198-
196+
199197
# function to transform a single column
200198
function colfunc(n)
201199
x = Tables.getcolumn(cols, n)
@@ -225,11 +223,11 @@ end
225223

226224
function revertfeat(transform::ColwiseFeatureTransform, newfeat, fcache)
227225
# transformed columns
228-
cols = Tables.columns(newfeat)
226+
cols = Tables.columns(newfeat)
229227
names = Tables.columnnames(cols)
230-
228+
231229
caches, snames = fcache
232-
230+
233231
# function to transform a single column
234232
function colfunc(i)
235233
n = names[i]
@@ -248,11 +246,11 @@ end
248246

249247
function reapplyfeat(transform::ColwiseFeatureTransform, feat, fcache)
250248
# retrieve column names and values
251-
cols = Tables.columns(feat)
249+
cols = Tables.columns(feat)
252250
names = Tables.columnnames(cols)
253251

254252
caches, snames = fcache
255-
253+
256254
# check that cache is valid
257255
@assert length(names) == length(caches) "invalid caches for feat"
258256

@@ -296,4 +294,4 @@ include("transforms/eigenanalysis.jl")
296294
include("transforms/projectionpursuit.jl")
297295
include("transforms/rowtable.jl")
298296
include("transforms/coltable.jl")
299-
include("transforms/parallel.jl")
297+
include("transforms/parallel.jl")

src/transforms/center.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ end
3333

3434
Center() = Center(AllSpec())
3535
Center(spec) = Center(colspec(spec))
36-
Center(cols::C...) where {C<:Col} =
37-
Center(colspec(cols))
36+
Center(cols::C...) where {C<:Col} = Center(colspec(cols))
3837

3938
assertions(transform::Center) = [SciTypeAssertion{Continuous}(transform.colspec)]
4039

4140
isrevertible(::Type{<:Center}) = true
4241

4342
colcache(::Center, x) = mean(x)
4443

45-
colapply(::Center, x, μ) = @. x - μ
44+
colapply(::Center, x, μ) = @. x - μ
4645

4746
colrevert(::Center, y, μ) = @. y + μ

src/transforms/coalesce.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ end
4040

4141
Coalesce(; value) = Coalesce(AllSpec(), value)
4242
Coalesce(spec; value) = Coalesce(colspec(spec), value)
43-
Coalesce(cols::C...; value) where {C<:Col} =
44-
Coalesce(colspec(cols), value)
43+
Coalesce(cols::C...; value) where {C<:Col} = Coalesce(colspec(cols), value)
4544

4645
isrevertible(::Type{<:Coalesce}) = true
4746

src/transforms/coerce.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,27 @@ struct Coerce{P} <: FeatureTransform
2222
verbosity::Int
2323
end
2424

25-
Coerce(pair::Pair{Symbol,<:Type}...; tight=false, verbosity=1) =
26-
Coerce(pair, tight, verbosity)
25+
Coerce(pair::Pair{Symbol,<:Type}...; tight=false, verbosity=1) = Coerce(pair, tight, verbosity)
2726

2827
isrevertible(::Type{<:Coerce}) = true
2928

3029
function applyfeat(transform::Coerce, feat, prep)
31-
newtable = coerce(feat, transform.pairs...;
32-
tight=transform.tight,
33-
verbosity=transform.verbosity)
30+
newtable = coerce(feat, transform.pairs...; tight=transform.tight, verbosity=transform.verbosity)
3431

3532
types = Tables.schema(feat).types
36-
33+
3734
newtable, types
3835
end
3936

4037
function revertfeat(::Coerce, newfeat, fcache)
4138
cols = Tables.columns(newfeat)
4239
names = Tables.columnnames(cols)
43-
40+
4441
oldcols = map(zip(fcache, names)) do (T, n)
4542
x = Tables.getcolumn(cols, n)
4643
collect(T, x)
4744
end
48-
45+
4946
𝒯 = (; zip(names, oldcols)...)
5047
𝒯 |> Tables.materializer(newfeat)
5148
end

0 commit comments

Comments
 (0)