Skip to content

Commit 8b54ef6

Browse files
committed
format(".") with blue style from scratch
1 parent 2232432 commit 8b54ef6

24 files changed

+567
-483
lines changed

docs/make.jl

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ DocMeta.setdocmeta!(
1616
@scalar_rule(sin(x), cos(x)) # frule and rrule doctest
1717
@scalar_rule(sincos(x), @setup((sinx, cosx) = Ω), cosx, -sinx) # frule doctest
1818
@scalar_rule(hypot(x::Real, y::Real), (x / Ω, y / Ω)) # rrule doctest
19-
end
19+
end,
2020
)
2121

2222
indigo = DocThemeIndigo.install(ChainRulesCore)
2323

2424
makedocs(
25-
modules=[ChainRulesCore],
26-
format=Documenter.HTML(
27-
prettyurls=false,
28-
assets=[indigo],
29-
mathengine=MathJax3(
25+
modules = [ChainRulesCore],
26+
format = Documenter.HTML(
27+
prettyurls = false,
28+
assets = [indigo],
29+
mathengine = MathJax3(
3030
Dict(
3131
:tex => Dict(
32-
"inlineMath" => [["\$","\$"], ["\\(","\\)"]],
32+
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
3333
"tags" => "ams",
3434
# TODO: remove when using physics package
3535
"macros" => Dict(
@@ -42,9 +42,9 @@ makedocs(
4242
),
4343
),
4444
),
45-
sitename="ChainRules",
46-
authors="Jarrett Revels and other contributors",
47-
pages=[
45+
sitename = "ChainRules",
46+
authors = "Jarrett Revels and other contributors",
47+
pages = [
4848
"Introduction" => "index.md",
4949
"FAQ" => "FAQ.md",
5050
"Rule configurations and calling back into AD" => "config.md",
@@ -63,11 +63,8 @@ makedocs(
6363
],
6464
"API" => "api.md",
6565
],
66-
strict=true,
67-
checkdocs=:exports,
66+
strict = true,
67+
checkdocs = :exports,
6868
)
6969

70-
deploydocs(
71-
repo = "github.com/JuliaDiff/ChainRulesCore.jl.git",
72-
push_preview=true,
73-
)
70+
deploydocs(repo = "github.com/JuliaDiff/ChainRulesCore.jl.git", push_preview = true)

docs/src/assets/make_logo.jl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ using Random
88

99
const bridge_len = 50
1010

11-
function chain(jiggle=0)
12-
shaky_rotate(θ) = rotate+ jiggle*(rand()-0.5))
13-
11+
function chain(jiggle = 0)
12+
shaky_rotate(θ) = rotate+ jiggle * (rand() - 0.5))
13+
1414
### 1
1515
shaky_rotate(0)
1616
sethue(Luxor.julia_red)
1717
link()
1818
m1 = getmatrix()
19-
20-
19+
20+
2121
### 2
2222
sethue(Luxor.julia_green)
23-
translate(-50, 130);
24-
shaky_rotate/3);
23+
translate(-50, 130)
24+
shaky_rotate / 3)
2525
link()
2626
m2 = getmatrix()
27-
27+
2828
setmatrix(m1)
2929
sethue(Luxor.julia_red)
3030
overlap(-1.3π)
3131
setmatrix(m2)
32-
32+
3333
### 3
34-
shaky_rotate(-π/3);
35-
translate(-120,80);
34+
shaky_rotate(-π / 3)
35+
translate(-120, 80)
3636
sethue(Luxor.julia_purple)
3737
link()
38-
38+
3939
setmatrix(m2)
4040
setcolor(Luxor.julia_green)
4141
overlap(-1.5π)
@@ -45,24 +45,24 @@ end
4545
function link()
4646
sector(50, 90, π, 0, :fill)
4747
sector(Point(0, bridge_len), 50, 90, 0, -π, :fill)
48-
49-
50-
rect(50,-3,40, bridge_len+6, :fill)
51-
rect(-50-40,-3,40, bridge_len+6, :fill)
52-
48+
49+
50+
rect(50, -3, 40, bridge_len + 6, :fill)
51+
rect(-50 - 40, -3, 40, bridge_len + 6, :fill)
52+
5353
sethue("black")
5454
move(Point(-50, bridge_len))
55-
arc(Point(0,0), 50, π, 0, :stoke)
55+
arc(Point(0, 0), 50, π, 0, :stoke)
5656
arc(Point(0, bridge_len), 50, 0, -π, :stroke)
57-
57+
5858
move(Point(-90, bridge_len))
59-
arc(Point(0,0), 90, π, 0, :stoke)
59+
arc(Point(0, 0), 90, π, 0, :stoke)
6060
arc(Point(0, bridge_len), 90, 0, -π, :stroke)
6161
strokepath()
6262
end
6363

6464
function overlap(ang_end)
65-
sector(Point(0, bridge_len), 50, 90, -0., ang_end, :fill)
65+
sector(Point(0, bridge_len), 50, 90, -0.0, ang_end, :fill)
6666
sethue("black")
6767
arc(Point(0, bridge_len), 50, 0, ang_end, :stoke)
6868
move(Point(90, bridge_len))
@@ -75,13 +75,13 @@ end
7575

7676
function save_logo(filename)
7777
Random.seed!(16)
78-
Drawing(450,450, filename)
78+
Drawing(450, 450, filename)
7979
origin()
80-
translate(50, -130);
80+
translate(50, -130)
8181
chain(0.5)
8282
finish()
8383
preview()
8484
end
8585

8686
save_logo("logo.svg")
87-
save_logo("logo.png")
87+
save_logo("logo.png")

src/accumulation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ end
2626

2727
add!!(x::AbstractArray, y::Thunk) = add!!(x, unthunk(y))
2828

29-
function add!!(x::AbstractArray{<:Any, N}, y::AbstractArray{<:Any, N}) where N
29+
function add!!(x::AbstractArray{<:Any,N}, y::AbstractArray{<:Any,N}) where {N}
3030
return if is_inplaceable_destination(x)
3131
x .+= y
3232
else
@@ -75,8 +75,8 @@ end
7575

7676
struct BadInplaceException <: Exception
7777
ithunk::InplaceableThunk
78-
accumuland
79-
returned_value
78+
accumuland::Any
79+
returned_value::Any
8080
end
8181

8282
function Base.showerror(io::IO, err::BadInplaceException)
@@ -88,7 +88,7 @@ function Base.showerror(io::IO, err::BadInplaceException)
8888
if err.accumuland == err.returned_value
8989
println(
9090
io,
91-
"Which in this case happenned to be equal. But they are not the same object."
91+
"Which in this case happenned to be equal. But they are not the same object.",
9292
)
9393
end
9494
end

src/compat.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ end
55
if VERSION < v"1.1"
66
# Note: these are actually *better* than the ones in julia 1.1, 1.2, 1.3,and 1.4
77
# See: https://github.com/JuliaLang/julia/issues/34292
8-
function fieldtypes(::Type{T}) where T
8+
function fieldtypes(::Type{T}) where {T}
99
if @generated
1010
ntuple(i -> fieldtype(T, i), fieldcount(T))
1111
else
1212
ntuple(i -> fieldtype(T, i), fieldcount(T))
1313
end
1414
end
1515

16-
function fieldnames(::Type{T}) where T
16+
function fieldnames(::Type{T}) where {T}
1717
if @generated
1818
ntuple(i -> fieldname(T, i), fieldcount(T))
1919
else

src/deprecated.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

src/ignore_derivatives.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ ignore_derivatives(x) = x
4545
Tells the AD system to ignore the expression. Equivalent to `ignore_derivatives() do (...) end`.
4646
"""
4747
macro ignore_derivatives(ex)
48-
return :(ChainRulesCore.ignore_derivatives() do
49-
$(esc(ex))
50-
end)
48+
return :(
49+
ChainRulesCore.ignore_derivatives() do
50+
$(esc(ex))
51+
end
52+
)
5153
end

0 commit comments

Comments
 (0)