Skip to content

Commit

Permalink
Replace == nothing by === nothing (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Jun 29, 2023
1 parent 3a076b5 commit 7b06fea
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions examples/FieldEnumeration/abelian_extensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ function main()
error("Input file must be specified by --input")
end

if dbound == nothing && rdbound == nothing
if dbound === nothing && rdbound === nothing
error("One of --disc-bound or --rootdisc-bound must be specified")
elseif dbound != nothing && rdbound != nothing
elseif dbound !== nothing && rdbound !== nothing
error("Only one of --disc-bound or --rootdisc-bound can be set")
end

Expand Down
4 changes: 2 additions & 2 deletions examples/FieldEnumeration/all_fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ function main()
set_verbose_level(:FieldsNonFancy, 3)
end

if dbound == nothing && rdbound == nothing
if dbound === nothing && rdbound === nothing
error("One of --disc-bound or --rootdisc-bound must be specified")
elseif dbound != nothing && rdbound != nothing
elseif dbound !== nothing && rdbound !== nothing
error("Only one of --disc-bound or --rootdisc-bound can be set")
end

Expand Down
2 changes: 1 addition & 1 deletion examples/MultDep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function mult_syzygies_units(A::Vector{FacElem{nf_elem, AnticNumberField}})
s = QQFieldElem[]
for x = k[1]
@vtime :qAdic 1 y = lift_reco(FlintQQ, x, reco = true)
if y == nothing
if y === nothing
prec *= 2
@vprint :qAdic 1 "increase prec to ", prec
lu = matrix([conjugates_log(x, C, prec, all = false, flat = true) for x = u])'
Expand Down
2 changes: 1 addition & 1 deletion src/AlgAssAbsOrd/Conjugacy/Conjugacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function _compute_decomposition!(C::CommutatorAlgebra)
M = invariant_factors_grouped[l][3]
for (i, j, e) in M
o = findfirst(x -> x[1] == e, D)
if o == nothing
if o === nothing
push!(D, (e, Tuple{Int, Int}[(i, j)]))
else
push!(D[o][2], (i, j))
Expand Down
2 changes: 1 addition & 1 deletion src/AlgAssAbsOrd/NEQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function _norm_equation_absolute(NC::NormCache, order_num::Int; max_num_fields::
if degree(K) == n
UK, mUK = unit_group_fac_elem(OK)
i = findfirst(x -> norm(mUK(x)) == -1, gens(UK))
if i != nothing
if i !== nothing
NC.norm_minus_one[order_num] = KtoA(evaluate(mUK(UK[i])))
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/EllCrv/Periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function period_real_embedding(E::EllCrv{T}, phi, prec::Int = 100) where T<: Uni
while true
precnew = attempt*prec

if phi == nothing
if phi === nothing
b2, b4, b6, b8 = map(ArbField(precnew), b_invars(E))
else
b2, b4, b6, b8 = map(real, (map(evaluation_function(phi, precnew), b_invars(E))))
Expand Down Expand Up @@ -130,7 +130,7 @@ function period_complex_embedding(E::EllCrv{T}, phi, prec = 100) where T <: Unio
while true
precnew = attempt*prec

if phi == nothing
if phi === nothing
b2, b4, b6, b8 = map(AcbField(precnew), b_invars(E))
else
b2, b4, b6, b8 = map(evaluation_function(phi, precnew), b_invars(E))
Expand Down
4 changes: 2 additions & 2 deletions src/Grp/Morphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Returns one element of the preimage of $g$ under $f$.
"""
function preimage(f::GrpGenToGrpGenMor, g::GrpGenElem)
h = findfirst(x -> f(x) == g, collect(f.domain))
if h == nothing
if h === nothing
error("$g has no preimage under $f")
end
return f.domain[h]
Expand All @@ -36,7 +36,7 @@ element $h$ with $f(h) = g$.
"""
function has_preimage(f::GrpGenToGrpGenMor, g::GrpGenElem)
h = findfirst(x -> f(x) == g, collect(f.domain))
if h == nothing
if h === nothing
return false
end
return (true, f.domain[h])
Expand Down
2 changes: 1 addition & 1 deletion src/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@ function find_isomorphism_with_abelian_group(G::Vector{NfToNfMor})
el = compose_mod(el, pow(Rx(S[i].prim_img), (x, y) -> Hecke.compose_mod(x, y, Rx(K.pol)), v[i], gen(Rx)), Rx(K.pol))
end
ind = findfirst(x -> Rx(x.prim_img) == el, G)
@assert ind != nothing
@assert ind !== nothing
AsnftoG[a] = G[ind]
end

Expand Down
4 changes: 2 additions & 2 deletions src/GrpAb/Lattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function update!(L::RelLattice)
Base.delete!(L.weak_vertices_rev, k)
continue
end
@assert L.weak_vertices_rev[k].value != nothing
@assert L.weak_vertices_rev[k].value !== nothing
a = L.weak_vertices_rev[k].value
@assert k == objectid(a)
@assert L.graph.degrees[k] < 2
Expand Down Expand Up @@ -524,7 +524,7 @@ function can_map_into_overstructure(L::RelLattice{T, D}, G::T, H::T) where {T, D
if b
@assert pG[1] == pH[1]
M = L.weak_vertices_rev[pG[1]].value::T
@assert M != nothing
@assert M !== nothing

mG = eval_path(L, M, pG)
mH = eval_path(L, M, pH)
Expand Down
4 changes: 2 additions & 2 deletions src/Misc/Integer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1037,15 +1037,15 @@ Base.eltype(::Divisors{T}) where T = T

function Base.iterate(D::Divisors)
x = iterate(D.s)
if x == nothing
if x === nothing
return x
end
return D.f(x[1]), x[2]
end

function Base.iterate(D::Divisors, i)
x = iterate(D.s, i)
if x == nothing
if x === nothing
return x
end
return D.f(x[1]), x[2]
Expand Down
2 changes: 1 addition & 1 deletion src/NumField/NfAbs/MPolyGcd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function Hecke.induce_crt(a::Hecke.Generic.MPoly{nf_elem}, p::ZZRingElem, b::Hec
while !(aa === nothing)
push_term!(c, Hecke.induce_inner_crt(coeff(aa, 1), z, pi, pq, pq2), exponent_vector(aa, 1))
aa = iterate(ta, sa)
if !aa == nothing
if !aa === nothing
aa, sa = aa
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/NumField/NfAbs/NormRelation/SUnits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ function _find_perm(v::Vector{NfOrdIdl}, w::Vector{NfOrdIdl})
p = Dict{Int, Int}()
for i = 1:length(v)
pi = findfirst(isequal(v[i]), w)
@assert pi != nothing
@assert pi !== nothing
p[pi] = i
end
return p
Expand Down
6 changes: 3 additions & 3 deletions src/NumFieldOrd/NfOrd/Clgp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ function unit_group_fac_elem(O::NfOrd; method::Int = 3, unit_method::Int = 1, us
end

U = get_attribute(O, :UnitGrpCtx)
if U != nothing && U.finished
if U !== nothing && U.finished
return unit_group_fac_elem(U::UnitGrpCtx)
end
c = get_attribute(O, :ClassGrpCtx)
if c == nothing
if c === nothing
O = lll(maximal_order(nf(O)))
end
_, UU, b = _class_unit_group(O, method = method, unit_method = unit_method, use_aut = use_aut, GRH = GRH, redo = redo)
Expand All @@ -488,7 +488,7 @@ Computes the regulator of $O$, i.e. the discriminant of the unit lattice.
"""
function regulator(O::NfOrd; method::Int = 3, unit_method::Int = 1, use_aut::Bool = false, GRH::Bool = true)
c = get_attribute(O, :ClassGrpCtx)
if c == nothing
if c === nothing
O = lll(maximal_order(nf(O)))
end
c, U, b = _class_unit_group(O, method = method, unit_method = unit_method, use_aut = use_aut, GRH = GRH)
Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/Clgp/Main_LLL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function single_env(c::ClassGrpCtx{T}, I::Hecke.SmallLLLRelationsCtx, rat::Float
if I.cnt > length(I.b)^2
break
end
if n == nothing
if n === nothing
#@show "BadNorm"
bad_norm += 1
if I.cnt > 100 && bad_norm / I.cnt > 0.1
Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/Clgp/Map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function _isprincipal_fac_elem(A::NfOrdIdl, support::Type{Val{U}} = Val{false})
end
end
c = get_attribute(O, :ClassGrpCtx)
if c == nothing
if c === nothing
L = lll(maximal_order(nf(O)))
class_group(L)
c = get_attribute(L, :ClassGrpCtx)::Hecke.ClassGrpCtx{SMat{ZZRingElem, ZZRingElem_Array_Mod.ZZRingElem_Array}}
Expand Down
2 changes: 1 addition & 1 deletion src/NumFieldOrd/NfOrd/Clgp/Sunits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function sunit_mod_units_group_fac_elem(I::Vector{NfOrdIdl})
@vprintln :ClassGroup 1 "calling sunit_mod_units_group_fac_elem with $(length(I)) ideals"

c = get_attribute(O, :ClassGrpCtx)
if c == nothing
if c === nothing
L = lll(maximal_order(nf(O)))
class_group(L)
c = get_attribute(L, :ClassGrpCtx)
Expand Down
4 changes: 2 additions & 2 deletions src/QuadForm/Quad/ZLattices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function quadratic_lattice(::QQField, gens::Vector{T}; gram = nothing, check::Bo
return quadratic_lattice(QQ, B, gram = gram, check = check)
end
@assert length(gens[1]) > 0
if gram == nothing
if gram === nothing
gram = identity_matrix(QQ, length(gens[1]))
end
if check
Expand Down Expand Up @@ -1730,7 +1730,7 @@ function _irreducible_components_pos_def(L::ZZLat, upper_bound=nothing)

# fall back to short vectors
for c in components3
if upper_bound == nothing
if upper_bound === nothing
ub = maximum([abs(i) for i in diagonal(gram_matrix(c))])
else
ub = upper_bound
Expand Down
4 changes: 2 additions & 2 deletions src/QuadForm/Torsion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto
A = abelian_group(rels)
n = dim(ambient_space(M))
BM = basis_matrix(M)
if gens != nothing && length(gens)>0
if gens !== nothing && length(gens)>0
gens_in_A = elem_type(A)[]
for g in gens
@req length(g) == n "Generator not an element of the ambient space"
Expand All @@ -70,7 +70,7 @@ function torsion_quadratic_module(M::ZZLat, N::ZZLat; gens::Union{Nothing, Vecto
end
# mS : S -> A
# generators of S lifted along M -> M/N = A -> S
if gens != nothing && length(gens)>0
if gens !== nothing && length(gens)>0
gens_lift = gens
else
gens_lift = Vector{QQFieldElem}[reshape(collect(change_base_ring(FlintQQ, mS(s).coeff) * BM), :) for s in Hecke.gens(S)]
Expand Down
2 changes: 1 addition & 1 deletion test/Map/NumberField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ end
for i = 1:length(lP)
I_new = A[2](lP1[1])
id = findfirst(isequal(I_new), lP1)
@test id != nothing
@test id !== nothing
end
f = hom(K, K, a^4//12+a//2)
E = EquationOrder(K)
Expand Down
2 changes: 1 addition & 1 deletion test/NfAbs/NfAbs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
if n % m != 0 && ! (isodd(n) && (2*n) % m == 0)
Fm, zm = CyclotomicField(m)
@test_throws ErrorException Hecke.force_coerce_cyclo(Fn, zm)
@test Hecke.force_coerce_cyclo(Fn, zm, Val{false}) == nothing
@test Hecke.force_coerce_cyclo(Fn, zm, Val{false}) === nothing
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/testdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function runtests(name, path; isolate=false, seed=nothing)
end
res_and_time_data = @timed @testset "$name" begin
# Random.seed!(nothing) will fail
seed != nothing && Random.seed!(seed)
seed !== nothing && Random.seed!(seed)
Base.include(m, "$path")
end
rss = Sys.maxrss()
Expand Down

0 comments on commit 7b06fea

Please sign in to comment.