From f2f81fbeeb0ca6c484467a74773f9823fbabdae0 Mon Sep 17 00:00:00 2001 From: Oren Ben-Kiki Date: Sat, 6 Apr 2024 13:18:59 +0300 Subject: [PATCH] Add static_link and aqua verifications. --- Makefile | 16 +- Manifest.toml | 25 +- Project.toml | 2 - deps/add_pkgs.jl | 14 +- deps/aqua.jl | 6 + deps/aqua.sh | 2 + deps/static_analysis.jl | 74 +++++ deps/static_analysis.sh | 3 + docs/v0.1.0/.documenter-siteinfo.json | 2 +- src/adapters.jl | 6 +- src/anndata_format.jl | 24 +- src/chains.jl | 34 +- src/computations.jl | 18 +- src/concat.jl | 154 +++++---- src/contracts.jl | 32 +- src/copies.jl | 44 +-- src/files_format.jl | 59 ++-- src/formats.jl | 49 ++- src/generic_functions.jl | 4 +- src/generic_logging.jl | 8 +- src/groups.jl | 2 +- src/h5df_format.jl | 13 +- src/matrix_layouts.jl | 16 +- src/memory_format.jl | 36 +-- src/messages.jl | 14 +- src/operations.jl | 55 ++-- src/queries.jl | 434 ++++++++++++-------------- src/read_only.jl | 6 +- src/readers.jl | 35 +-- src/reconstruction.jl | 20 +- src/registry.jl | 13 +- src/tokens.jl | 4 +- src/views.jl | 36 +-- src/writers.jl | 8 +- test/chains.jl | 40 +-- test/computations.jl | 6 +- test/contracts.jl | 110 +++---- test/copies.jl | 192 ++++++------ test/data.jl | 228 +++++++------- test/matrix_layouts.jl | 2 +- 40 files changed, 939 insertions(+), 907 deletions(-) create mode 100644 deps/aqua.jl create mode 100755 deps/aqua.sh create mode 100644 deps/static_analysis.jl create mode 100755 deps/static_analysis.sh diff --git a/Makefile b/Makefile index ef25ee7..9d7223c 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,14 @@ deps/.format: */*.jl deps/format.sh deps/format.jl @touch deps/.format .PHONY: check -check: jet untested_lines +check: static_analysis jet aqua untested_lines + +.PHONY: static_analysis +static_analysis: deps/.static_analysis + +deps/.static_analysis: *.toml src/*.jl test/*.toml test/*.jl deps/static_analysis.sh deps/static_analysis.jl + deps/static_analysis.sh + @touch deps/.static_analysis .PHONY: jet jet: deps/.jet @@ -30,6 +37,13 @@ deps/.jet: *.toml src/*.jl test/*.toml test/*.jl deps/jet.sh deps/jet.jl deps/je deps/jet.sh @touch deps/.jet +.PHONY: aqua +aqua: deps/.aqua + +deps/.aqua: *.toml src/*.jl test/*.toml test/*.jl deps/aqua.sh deps/aqua.jl + deps/aqua.sh + @touch deps/.aqua + .PHONY: test test: tracefile.info diff --git a/Manifest.toml b/Manifest.toml index 038b9b9..0495562 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.2" manifest_format = "2.0" -project_hash = "59e7df362cbccf9b3489ca11436d43634605ed35" +project_hash = "8e03bb75bf6f51f8955793f4a225b42fdf673d0d" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -118,11 +118,6 @@ deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" version = "1.6.0" -[[deps.EnumX]] -git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237" -uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" -version = "1.0.4" - [[deps.ExprTools]] git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" @@ -148,9 +143,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.HDF5]] deps = ["Compat", "HDF5_jll", "Libdl", "MPIPreferences", "Mmap", "Preferences", "Printf", "Random", "Requires", "UUIDs"] -git-tree-sha1 = "26407bd1c60129062cec9da63dc7d08251544d53" +git-tree-sha1 = "e856eef26cf5bf2b0f95f8f4fc37553c72c8641c" uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" -version = "0.17.1" +version = "0.17.2" [deps.HDF5.extensions] MPIExt = "MPI" @@ -160,9 +155,9 @@ version = "0.17.1" [[deps.HDF5_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "LibCURL_jll", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "OpenSSL_jll", "TOML", "Zlib_jll", "libaec_jll"] -git-tree-sha1 = "e4591176488495bf44d7456bd73179d87d5e6eab" +git-tree-sha1 = "6384c847ff5056c5624e30e75b3ca48902cae0ac" uuid = "0234f1f7-429e-5d53-9886-15a909be8d59" -version = "1.14.3+1" +version = "1.14.3+2" [[deps.Hwloc_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -266,12 +261,6 @@ version = "0.3.27" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" -[[deps.LoggingExtras]] -deps = ["Dates", "Logging"] -git-tree-sha1 = "c1dd6d7978c12545b4179fb6153b9250c96b0075" -uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" -version = "1.0.3" - [[deps.MPICH_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"] git-tree-sha1 = "656036b9ed6f942d35e536e249600bc31d0f9df8" @@ -459,9 +448,9 @@ version = "1.7.0" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "1d77abd07f617c4868c33d4f5b9e1dbb2643c9cf" +git-tree-sha1 = "5cf7606d6cef84b543b483848d4ae08ad9832b21" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.34.2" +version = "0.34.3" [[deps.StringManipulation]] deps = ["PrecompileTools"] diff --git a/Project.toml b/Project.toml index cb820b7..0c386f5 100644 --- a/Project.toml +++ b/Project.toml @@ -10,13 +10,11 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56" ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04" HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" -LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" Mmap = "a63ad114-7e13-5084-954f-fe012c677804" Muon = "446846d7-b4ce-489d-bf74-72da18fe3629" NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673" diff --git a/deps/add_pkgs.jl b/deps/add_pkgs.jl index babe4cc..a759b11 100644 --- a/deps/add_pkgs.jl +++ b/deps/add_pkgs.jl @@ -1,6 +1,18 @@ using Pkg -for pkg in ("Coverage", "Documenter", "JET", "JuliaFormatter", "Logging", "LoggingExtras", "SnoopCompile") +for pkg in ( + "Aqua", + "Coverage", + "Documenter", + "JET", + "JuliaFormatter", + "LanguageServer", + "Logging", + "LoggingExtras", + "SnoopCompile", + "StaticLint", + "SymbolServer", +) println("Adding $(pkg):") Pkg.add(pkg) end diff --git a/deps/aqua.jl b/deps/aqua.jl new file mode 100644 index 0000000..297fa26 --- /dev/null +++ b/deps/aqua.jl @@ -0,0 +1,6 @@ +push!(LOAD_PATH, ".") + +using Aqua +using Daf +Aqua.test_ambiguities([Daf]) +Aqua.test_all(Daf; ambiguities = false, unbound_args = false, deps_compat = false) diff --git a/deps/aqua.sh b/deps/aqua.sh new file mode 100755 index 0000000..cc5799a --- /dev/null +++ b/deps/aqua.sh @@ -0,0 +1,2 @@ +#!/bin/bash +julia deps/aqua.jl diff --git a/deps/static_analysis.jl b/deps/static_analysis.jl new file mode 100644 index 0000000..49da939 --- /dev/null +++ b/deps/static_analysis.jl @@ -0,0 +1,74 @@ +using LanguageServer +using StaticLint +using SymbolServer + +language_server = LanguageServerInstance(Pipe(), stdout, ".") +_, symbols = SymbolServer.getstore(language_server.symbol_server, ".") +language_server.global_env.symbols = symbols +language_server.global_env.extended_methods = SymbolServer.collect_extended_methods(language_server.global_env.symbols) +language_server.global_env.project_deps = collect(keys(language_server.global_env.symbols)) + +file = StaticLint.loadfile(language_server, abspath("src/Daf.jl")) +StaticLint.semantic_pass(LanguageServer.getroot(file)) + +global errors = 0 +global skipped = 0 +global unused = 0 +for doc in LanguageServer.getdocuments_value(language_server) + StaticLint.check_all( + LanguageServer.getcst(doc), + language_server.lint_options, + LanguageServer.getenv(doc, language_server), + ) + LanguageServer.mark_errors(doc, doc.diagnostics) + no_lint_lines = Set{Int}() + unused_no_lint_lines = Set{Int}() + for (line_number, line_text) in enumerate(readlines(doc._path)) + if contains(line_text, "NOLINT") + push!(no_lint_lines, line_number) + push!(unused_no_lint_lines, line_number) + end + end + for diagnostic in doc.diagnostics + line_number = diagnostic.range.start.line + 1 + character_number = diagnostic.range.start.character + 1 + if line_number in no_lint_lines + delete!(unused_no_lint_lines, line_number) + global skipped + skipped += 1 + else + println("$(doc._path):$(line_number):$(character_number): $(diagnostic.message)") + global errors + errors += 1 + end + end + for line_number in sort(collect(unused_no_lint_lines)) + global unused + unused += 1 + println("$(doc._path):$(line_number): unused NOLINT directive)") + end +end + +message = "StaticLint:" +separator = "" +if errors > 0 + message *= " $(errors) errors" + separator = "," +end +if skipped > 0 + message *= "$(separator) $(skipped) skipped" + separator = "," +end +if unused > 0 + message *= "$(separator) $(unused) unused" +end + +if errors + skipped + unused > 0 + println(message) +else + println("StaticLint: clean!") +end + +if errors + unused > 0 + exit(1) +end diff --git a/deps/static_analysis.sh b/deps/static_analysis.sh new file mode 100755 index 0000000..beeaaab --- /dev/null +++ b/deps/static_analysis.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -e -o pipefail +julia deps/static_analysis.jl diff --git a/docs/v0.1.0/.documenter-siteinfo.json b/docs/v0.1.0/.documenter-siteinfo.json index 2a4f4cb..e872054 100644 --- a/docs/v0.1.0/.documenter-siteinfo.json +++ b/docs/v0.1.0/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-04T20:19:23","documenter_version":"1.3.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-06T13:17:46","documenter_version":"1.3.0"}} \ No newline at end of file diff --git a/src/adapters.jl b/src/adapters.jl index 6166a4e..98bbcfa 100644 --- a/src/adapters.jl +++ b/src/adapters.jl @@ -117,7 +117,7 @@ function adapter( end function get_adapter_capture_name(view::Union{DafWriter, DafReadOnly}; name::Maybe{AbstractString})::AbstractString - _base, prefix = get_base(view, name) + _, prefix = get_base(view, name) return prefix * ".capture" end @@ -126,7 +126,7 @@ function get_adapter_input( name::Maybe{AbstractString}, writer::DafWriter, )::DafWriter - _base, prefix = get_base(view, name) + _, prefix = get_base(view, name) return chain_writer([view, writer]; name = "$(prefix).adapted") end @@ -153,7 +153,7 @@ function get_base(view::Union{DafWriter, DafReadOnly}, name::Maybe{AbstractStrin @assert base isa DafWriter end - if name == nothing + if name === nothing prefix = base.name else prefix = name # untested diff --git a/src/anndata_format.jl b/src/anndata_format.jl index d5b8575..8fe5230 100644 --- a/src/anndata_format.jl +++ b/src/anndata_format.jl @@ -160,9 +160,9 @@ function by_annotation( name::AbstractString, default::AbstractString, )::AbstractString - if value == nothing + if value === nothing value = get(adata.uns, name, default) - @assert value != nothing + @assert value !== nothing end return value end @@ -218,7 +218,7 @@ function verify_is_supported_type( unsupported_handler::AbnormalHandler, )::Nothing if value isa StorageMatrix && - major_axis(value) == nothing && + major_axis(value) === nothing && !(value isa Muon.TransposedDataset) && !(value isa Muon.SparseDataset) report_unsupported( # untested @@ -332,11 +332,11 @@ function copy_supported_matrices( end function copy_supported_matrix( # untested - matrix::Any, - memory::MemoryDaf, - rows_axis::AbstractString, - columns_axis::AbstractString, - name::AbstractString, + ::Any, + ::MemoryDaf, + ::AbstractString, + ::AbstractString, + ::AbstractString, )::Nothing return nothing end @@ -380,7 +380,7 @@ function copy_supported_matrix( matrix = transpose(matrix) rows_axis, columns_axis = columns_axis, rows_axis end - if matrix_major_axis != nothing + if matrix_major_axis !== nothing set_matrix!(memory, rows_axis, columns_axis, name, matrix; relayout = false) end end @@ -459,7 +459,7 @@ function daf_as_anndata( copy_matrices(daf, obs_is, var_is, X_is, adata.layers) - if h5ad != nothing + if h5ad !== nothing writeh5ad(h5ad, adata; compress = UInt8(0)) # NOJET end @@ -472,9 +472,9 @@ function by_scalar( name::AbstractString, default::AbstractString, )::AbstractString - if value == nothing + if value === nothing value = get_scalar(daf, name; default = default) - @assert value != nothing + @assert value !== nothing end return value end diff --git a/src/chains.jl b/src/chains.jl index 6a59d59..7fb3015 100644 --- a/src/chains.jl +++ b/src/chains.jl @@ -80,9 +80,9 @@ function chain_reader( return read_only(dafs[1]; name = name) end - if name == nothing + if name === nothing name = join([daf.name for daf in dafs], ";") - @assert name != nothing + @assert name !== nothing end internal_dafs = reader_internal_dafs(dafs, name) @@ -110,12 +110,12 @@ function chain_writer(dafs::AbstractVector{F}; name::Maybe{AbstractString} = not error("read-only final data: $(dafs[end].name)\n" * "in write chain$(name_suffix(name))") end - if name == nothing + if name === nothing if length(dafs) == 1 return dafs[1] end name = join([daf.name for daf in dafs], ";") - @assert name != nothing + @assert name !== nothing end internal_dafs = reader_internal_dafs(dafs, name) @@ -134,7 +134,7 @@ function reader_internal_dafs(dafs::AbstractVector{F}, name::AbstractString)::Ve for axis in axis_names(daf) new_axis_entries = get_axis(daf, axis) old_axis_entries = get(axes_entries, axis, nothing) - if old_axis_entries == nothing + if old_axis_entries === nothing axes_entries[axis] = (daf.name, new_axis_entries) elseif new_axis_entries != old_axis_entries error( @@ -150,7 +150,7 @@ function reader_internal_dafs(dafs::AbstractVector{F}, name::AbstractString)::Ve end function name_suffix(name::Maybe{AbstractString})::String - if name == nothing + if name === nothing return "" else return ": $(name)" @@ -180,7 +180,7 @@ function Formats.format_delete_scalar!(chain::WriteChain, name::AbstractString; error( "failed to delete the scalar: $(name)\n" * "from the daf data: $(chain.daf.name)\n" * - "of the chain: $(chain.name)\n" * + "of the chain: $(chain.name)\n" * # NOLINT "because it exists in the earlier: $(daf.name)", ) end @@ -224,7 +224,7 @@ function Formats.format_delete_axis!(chain::WriteChain, axis::AbstractString)::N error( "failed to delete the axis: $(axis)\n" * "from the daf data: $(chain.daf.name)\n" * - "of the chain: $(chain.name)\n" * + "of the chain: $(chain.name)\n" * # NOLINT "because it exists in the earlier: $(daf.name)", ) end @@ -327,7 +327,7 @@ function Formats.format_delete_vector!( "failed to delete the vector: $(name)\n" * "of the axis: $(axis)\n" * "from the daf data: $(chain.daf.name)\n" * - "of the chain: $(chain.name)\n" * + "of the chain: $(chain.name)\n" * # NOLINT "because it exists in the earlier: $(daf.name)", ) end @@ -461,7 +461,7 @@ function Formats.format_delete_matrix!( "for the rows axis: $(rows_axis)\n" * "and the columns axis: $(columns_axis)\n" * "from the daf data: $(chain.daf.name)\n" * - "of the chain: $(chain.name)\n" * + "of the chain: $(chain.name)\n" * # NOLINT "because it exists in the earlier: $(daf.name)", ) end @@ -506,12 +506,12 @@ function Formats.format_get_matrix( @assert false end -function Formats.format_description_header(chain::ReadOnlyChain, indent::AbstractString, lines::Vector{String})::Nothing +function Formats.format_description_header(::ReadOnlyChain, indent::AbstractString, lines::Vector{String})::Nothing push!(lines, "$(indent)type: ReadOnly Chain") return nothing end -function Formats.format_description_header(chain::WriteChain, indent::AbstractString, lines::Vector{String})::Nothing +function Formats.format_description_header(::WriteChain, indent::AbstractString, lines::Vector{String})::Nothing push!(lines, "$(indent)type: Write Chain") return nothing end @@ -546,21 +546,21 @@ function Formats.format_increment_version_counter(chain::WriteChain, version_key end function Messages.describe(value::ReadOnlyChain; name::Maybe{AbstractString} = nothing)::String - if name == nothing - name = value.name + if name === nothing + name = value.name # NOLINT end return "ReadOnly Chain $(name)" end function Messages.describe(value::WriteChain; name::Maybe{AbstractString} = nothing)::String - if name == nothing - name = value.name + if name === nothing + name = value.name # NOLINT end return "Write Chain $(name)" end function ReadOnly.read_only(daf::ReadOnlyChain; name::Maybe{AbstractString} = nothing)::ReadOnlyChain - if name == nothing + if name === nothing return daf else return ReadOnlyChain(Formats.renamed_internal(daf.internal, name), daf.dafs) diff --git a/src/computations.jl b/src/computations.jl index b94730e..cf1a3d5 100644 --- a/src/computations.jl +++ b/src/computations.jl @@ -21,7 +21,7 @@ using ExprTools import Daf.Contracts.contract_documentation import Daf.GenericLogging.pass_args -function computation_wrapper(name::AbstractString, inner_function) +function computation_wrapper(::AbstractString, inner_function) return inner_function end @@ -98,7 +98,7 @@ macro computation(definition) outer_definition = copy(inner_definition) function_name = get(inner_definition, :name, nothing) - if function_name == nothing + if function_name === nothing error("@computation requires a named function") end @assert function_name isa Symbol @@ -127,7 +127,7 @@ macro computation(contract, definition) outer_definition = copy(inner_definition) function_name = get(inner_definition, :name, nothing) - if function_name == nothing + if function_name === nothing error("@computation requires a named function") end @assert function_name isa Symbol @@ -160,7 +160,7 @@ macro computation(first_contract, second_contract, definition) outer_definition = copy(inner_definition) function_name = get(inner_definition, :name, nothing) - if function_name == nothing + if function_name === nothing error("@computation requires a named function") end @assert function_name isa Symbol @@ -203,7 +203,7 @@ function collect_defaults(function_module::Module, inner_definition)::Dict{Abstr return defaults end -function collect_arg_default(function_module::Module, defaults::Dict{AbstractString, Any}, arg::Symbol)::Nothing # untested +function collect_arg_default(::Module, ::Dict{AbstractString, Any}, ::Symbol)::Nothing # untested return nothing end @@ -282,7 +282,7 @@ end function DocStringExtensions.format(what::DefaultValue, buffer::IOBuffer, doc_str::Base.Docs.DocStr)::Nothing full_name, metadata = get_metadata(doc_str) default = get(metadata.defaults, what.name, nothing) - if default == nothing + if default === nothing error("no default for a parameter: $(what.name)\n" * "in the computation: $(full_name)") end return print(buffer, default) @@ -290,7 +290,7 @@ end struct DefaultContainer end -function Base.getproperty(defaults::DefaultContainer, parameter::Symbol)::DefaultValue +function Base.getproperty(::DefaultContainer, parameter::Symbol)::DefaultValue return DefaultValue(string(parameter)) end @@ -331,12 +331,12 @@ function get_metadata(doc_str::Base.Docs.DocStr)::Tuple{AbstractString, Function catch # untested end end - if object_module == nothing + if object_module === nothing metadata = nothing # untested else metadata = get(object_module.__DAF_FUNCTION_METADATA__, Symbol(object), nothing) end - if metadata == nothing + if metadata === nothing error( "no contract(s) associated with: $(object_module).$(object)\n" * "use: @computation Contract(...) function $(object_module).$(object)(...)", diff --git a/src/concat.jl b/src/concat.jl index f4cdc6d..39f62cf 100644 --- a/src/concat.jl +++ b/src/concat.jl @@ -182,13 +182,13 @@ function concatenate( @assert length(sources) > 0 - if names == nothing + if names === nothing names = [source.name for source in sources] end @assert length(names) == length(sources) @assert allunique(names) - if dataset_axis != nothing + if dataset_axis !== nothing @assert !(dataset_axis in axes) require_no_axis(destination, dataset_axis) for source in sources @@ -206,9 +206,9 @@ function concatenate( if prefixed isa AbstractStringSet prefixed = [prefixed] end - @assert prefixed == nothing || length(prefixed) == length(axes) + @assert prefixed === nothing || length(prefixed) == length(axes) - @assert empty == nothing || !(CollectAxis in values(empty)) || dataset_axis != nothing + @assert empty === nothing || !(CollectAxis in values(empty)) || dataset_axis !== nothing axes_set = Set(axes) other_axes_entry_names = Dict{AbstractString, Tuple{AbstractString, AbstractStringVector}}() @@ -217,7 +217,7 @@ function concatenate( if !(axis_name in axes_set) other_axis_entry_names = get_axis(source, axis_name) previous_axis_data = get(other_axes_entry_names, axis_name, nothing) - if previous_axis_data == nothing + if previous_axis_data === nothing other_axes_entry_names[axis_name] = (source.name, other_axis_entry_names) else (previous_source_name, previous_axis_entry_names) = previous_axis_data @@ -235,7 +235,7 @@ function concatenate( end other_axes_set = keys(other_axes_entry_names) - if dataset_axis != nothing + if dataset_axis !== nothing add_axis!(destination, dataset_axis, names) end @@ -243,22 +243,22 @@ function concatenate( add_axis!(destination, other_axis, other_axis_entry_names[2]) end - for axis_index in 1:length(axes) - if prefixed == nothing + for (axis_index, (axis, prefix)) in enumerate(zip(axes, prefixes)) + if prefixed === nothing axis_prefixed = nothing else axis_prefixed = prefixed[axis_index] end concatenate_axis( destination, - axes[axis_index], + axis, sources; axes = axes, other_axes_set = other_axes_set, names = names, dataset_axis = dataset_axis, dataset_property = dataset_property, - prefix = prefixes[axis_index], + prefix, prefixes = prefixes, prefixed = axis_prefixed, empty = empty, @@ -267,13 +267,12 @@ function concatenate( ) end - if merge != nothing + if merge !== nothing concatenate_merge( destination, sources; dataset_axis = dataset_axis, other_axes_set = other_axes_set, - names = names, empty = empty, merge = merge, sparse_if_saves_storage_fraction = sparse_if_saves_storage_fraction, @@ -318,7 +317,7 @@ function concatenate_axis( concatenated_axis_size = concatenated_axis_size, ) - if dataset_axis != nothing && dataset_property + if dataset_axis !== nothing && dataset_property concatenate_axis_dataset_property( destination, axis; @@ -337,7 +336,7 @@ function concatenate_axis( end for vector_property in vector_properties_set - if prefixed != nothing + if prefixed !== nothing prefix_axis = vector_property in prefixed else prefix_axis = false @@ -389,7 +388,6 @@ function concatenate_axis( sparse_if_saves_storage_fraction = sparse_if_saves_storage_fraction, offsets = offsets, sizes = sizes, - concatenated_axis_size = concatenated_axis_size, overwrite = overwrite, ) end @@ -409,22 +407,16 @@ function concatenate_axis_entry_names( concatenated_axis_size::Integer, )::Nothing axis_entry_names = Vector{AbstractString}(undef, concatenated_axis_size) - - if prefix - @threads for index in 1:length(sources) - source = sources[index] - offset = offsets[index] - size = sizes[index] + n_sources = length(sources) + @threads for index in 1:n_sources + source = sources[index] + offset = offsets[index] + size = sizes[index] + from_axis_entry_names = get_axis(source, axis) + if prefix name = names[index] - from_axis_entry_names = get_axis(source, axis) axis_entry_names[(offset + 1):(offset + size)] = (name * ".") .* from_axis_entry_names - end - else - @threads for index in 1:length(sources) - source = sources[index] - offset = offsets[index] - size = sizes[index] - from_axis_entry_names = get_axis(source, axis) + else axis_entry_names[(offset + 1):(offset + size)] .= from_axis_entry_names[:] end end @@ -446,7 +438,8 @@ function concatenate_axis_dataset_property( )::Nothing axis_datasets = Vector{AbstractString}(undef, concatenated_axis_size) - @threads for index in 1:length(names) + n_sources = length(offsets) + @threads for index in 1:n_sources offset = offsets[index] size = sizes[index] name = names[index] @@ -494,7 +487,7 @@ function concatenate_axis_vector( @assert empty_value isa Maybe{StorageScalar} sparse_saves = sparse_storage_fraction(empty_value, dtype, sizes, vectors, 1, 1) # NOJET if sparse_saves >= sparse_if_saves_storage_fraction - @assert empty_value == nothing || empty_value == 0 + @assert empty_value === nothing || empty_value == 0 sparse_vectors = sparsify_vectors(vectors, dtype, sizes) concatenate_axis_sparse_vectors( destination, @@ -502,9 +495,7 @@ function concatenate_axis_vector( vector_property; dtype = dtype, offsets = offsets, - sizes = sizes, vectors = sparse_vectors, - concatenated_axis_size = concatenated_axis_size, overwrite = overwrite, ) @@ -543,13 +534,14 @@ function concatenate_axis_string_vectors( )::Nothing concatenated_vector = Vector{AbstractString}(undef, concatenated_axis_size) - @threads for index in 1:length(vectors) + n_sources = length(sources) + @threads for index in 1:n_sources + vector = vectors[index] source = sources[index] offset = offsets[index] size = sizes[index] name = names[index] - vector = vectors[index] - if vector == nothing + if vector === nothing concatenated_vector[(offset + 1):(offset + size)] .= require_empty_value_for_vector(empty_value, vector_property, axis, source, destination) else @@ -575,19 +567,18 @@ function concatenate_axis_sparse_vectors( vector_property::AbstractString; dtype::Type, offsets::AbstractVector{<:Integer}, - sizes::AbstractVector{<:Integer}, vectors::AbstractVector{<:SparseVector}, - concatenated_axis_size::Integer, overwrite::Bool, )::Nothing nnz_offsets, nnz_sizes, total_nnz = nnz_arrays(vectors) empty_sparse_vector!(destination, axis, vector_property, dtype, total_nnz; overwrite = overwrite) do nzind, nzval - @threads for index in 1:length(vectors) + n_sources = length(vectors) + @threads for index in 1:n_sources + vector = vectors[index] offset = offsets[index] nnz_offset = nnz_offsets[index] nnz_size = nnz_sizes[index] - vector = vectors[index] nzval[(nnz_offset + 1):(nnz_offset + nnz_size)] = vector.nzval nzind[(nnz_offset + 1):(nnz_offset + nnz_size)] = vector.nzind nzind[(nnz_offset + 1):(nnz_offset + nnz_size)] .+= offset @@ -610,12 +601,13 @@ function concatenate_axis_dense_vectors( overwrite::Bool, )::Nothing empty_dense_vector!(destination, axis, vector_property, dtype; overwrite = overwrite) do concatenated_vector - @threads for index in 1:length(vectors) + n_sources = length(sources) + @threads for index in 1:n_sources source = sources[index] + vector = vectors[index] offset = offsets[index] size = sizes[index] - vector = vectors[index] - if vector == nothing + if vector === nothing concatenated_vector[(offset + 1):(offset + size)] .= require_empty_value_for_vector(empty_value, vector_property, axis, source, destination) else @@ -639,7 +631,6 @@ function concatenate_axis_matrix( sparse_if_saves_storage_fraction::AbstractFloat, offsets::AbstractVector{<:Integer}, sizes::AbstractVector{<:Integer}, - concatenated_axis_size::Integer, overwrite::Bool, )::Nothing matrices = [get_matrix(source, other_axis, axis, matrix_property; default = nothing) for source in sources] @@ -648,7 +639,7 @@ function concatenate_axis_matrix( nrows = axis_length(destination, other_axis) sparse_saves = sparse_storage_fraction(empty_value, dtype, sizes, matrices, axis_length(destination, other_axis), 2) if sparse_saves >= sparse_if_saves_storage_fraction - @assert empty_value == nothing || empty_value == 0 + @assert empty_value === nothing || empty_value == 0 sparse_matrices = sparsify_matrices(matrices, dtype, nrows, sizes) concatenate_axis_sparse_matrices( destination, @@ -659,7 +650,6 @@ function concatenate_axis_matrix( offsets = offsets, sizes = sizes, matrices = sparse_matrices, - concatenated_axis_size = concatenated_axis_size, overwrite = overwrite, ) @@ -691,7 +681,6 @@ function concatenate_axis_sparse_matrices( offsets::AbstractVector{<:Integer}, sizes::AbstractVector{<:Integer}, matrices::AbstractVector{<:SparseMatrixCSC}, - concatenated_axis_size::Integer, overwrite::Bool, )::Nothing nnz_offsets, nnz_sizes, total_nnz = nnz_arrays(matrices) @@ -705,12 +694,13 @@ function concatenate_axis_sparse_matrices( total_nnz; overwrite = overwrite, ) do colptr, rowval, nzval - @threads for index in 1:length(matrices) + n_sources = length(matrices) + @threads for index in 1:n_sources + matrix = matrices[index] column_offset = offsets[index] ncols = sizes[index] nnz_offset = nnz_offsets[index] nnz_size = nnz_sizes[index] - matrix = matrices[index] nzval[(nnz_offset + 1):(nnz_offset + nnz_size)] = matrix.nzval rowval[(nnz_offset + 1):(nnz_offset + nnz_size)] = matrix.rowval colptr[(column_offset + 1):(column_offset + ncols)] = matrix.colptr[1:ncols] @@ -743,12 +733,13 @@ function concatenate_axis_dense_matrices( dtype; overwrite = overwrite, ) do concatenated_matrix - @threads for index in 1:length(matrices) + n_sources = length(sources) + @threads for index in 1:n_sources source = sources[index] + matrix = matrices[index] column_offset = offsets[index] ncols = sizes[index] - matrix = matrices[index] - if matrix == nothing + if matrix === nothing concatenated_matrix[:, (column_offset + 1):(column_offset + ncols)] .= require_empty_value_for_matrix(empty_value, matrix_property, other_axis, axis, source, destination) else @@ -767,7 +758,6 @@ function concatenate_merge( sources::AbstractVector{<:DafReader}; dataset_axis::Maybe{AbstractString}, other_axes_set::AbstractStringSet, - names::AbstractStringVector, empty::Maybe{EmptyData}, merge::MergeData, sparse_if_saves_storage_fraction::AbstractFloat, @@ -821,7 +811,6 @@ function concatenate_merge( for square_matrix_property in square_matrix_properties_set merge_action = get_merge_action(merge, (axis, axis, square_matrix_property)) - empty_value = get_empty_value(empty, (axis, axis, square_matrix_property)) if merge_action != SkipProperty concatenate_merge_matrix( destination, @@ -846,11 +835,6 @@ function concatenate_merge( for matrix_property in matrix_properties_set merge_action = get_merge_action(merge, (rows_axis, columns_axis, matrix_property)) - empty_value = get_empty_value( - empty, - (rows_axis, columns_axis, matrix_property), - (columns_axis, rows_axis, matrix_property), - ) if merge_action != SkipProperty concatenate_merge_matrix( destination, @@ -882,7 +866,7 @@ function concatenate_merge_scalar( if merge_action == LastValue for source in reverse(sources) value = get_scalar(source, scalar_property; default = nothing) - if value != nothing + if value !== nothing set_scalar!(destination, scalar_property, value; overwrite = overwrite) return nothing end @@ -890,7 +874,7 @@ function concatenate_merge_scalar( @assert false elseif merge_action == CollectAxis - if dataset_axis == nothing + if dataset_axis === nothing error( "can't collect axis for the scalar: $(scalar_property)\n" * "of the daf data sets concatenated into the daf data: $(destination.name)\n", @@ -923,7 +907,7 @@ function concatenate_merge_vector( if merge_action == LastValue for source in reverse(sources) value = get_vector(source, axis, vector_property; default = nothing) - if value != nothing + if value !== nothing set_vector!(destination, axis, vector_property, value; overwrite = overwrite) return nothing end @@ -931,7 +915,7 @@ function concatenate_merge_vector( @assert false elseif merge_action == CollectAxis - if dataset_axis == nothing + if dataset_axis === nothing error( "can't collect axis for the vector: $(vector_property)\n" * "of the axis: $(axis)\n" * @@ -944,19 +928,19 @@ function concatenate_merge_vector( size = nothing for vector in vectors - if vector != nothing + if vector !== nothing size = length(vector) break end end - @assert size != nothing + @assert size !== nothing sizes = repeat([size]; outer = length(vectors)) dtype = reduce(merge_dtypes, vectors; init = typeof(empty_value)) if dtype != String sparse_saves = sparse_storage_fraction(empty_value, dtype, sizes, vectors, 1, 1) # NOJET if sparse_saves >= sparse_if_saves_storage_fraction - @assert empty_value == nothing || empty_value == 0 + @assert empty_value === nothing || empty_value == 0 sparse_vectors = sparsify_vectors(vectors, dtype, sizes) concatenate_merge_sparse_vector( destination, @@ -964,7 +948,6 @@ function concatenate_merge_vector( dataset_axis, vector_property; dtype = dtype, - nrows = size, vectors = sparse_vectors, overwrite = overwrite, ) @@ -996,7 +979,6 @@ function concatenate_merge_sparse_vector( dataset_axis::AbstractString, vector_property::AbstractString; dtype::Type, - nrows::Integer, vectors::AbstractVector{<:SparseVector}, overwrite::Bool, )::Nothing @@ -1012,10 +994,11 @@ function concatenate_merge_sparse_vector( overwrite = overwrite, ) do colptr, rowval, nzval colptr[1] == 1 - @threads for index in 1:length(vectors) + n_sources = length(vectors) + @threads for index in 1:n_sources + vector = vectors[index] nnz_offset = nnz_offsets[index] nnz_size = nnz_sizes[index] - vector = vectors[index] nzval[(nnz_offset + 1):(nnz_offset + nnz_size)] = vector.nzval rowval[(nnz_offset + 1):(nnz_offset + nnz_size)] = vector.nzind colptr[index + 1] = nnz_offset + nnz_size + 1 @@ -1044,10 +1027,11 @@ function concatenate_merge_dense_vector( dtype; overwrite = overwrite, ) do concatenated_matrix - @threads for index in 1:length(vectors) + n_sources = length(sources) + @threads for index in 1:n_sources source = sources[index] vector = vectors[index] - if vector == nothing + if vector === nothing concatenated_matrix[:, index] .= require_empty_value_for_vector(empty_value, vector_property, axis, source, destination) else @@ -1072,7 +1056,7 @@ function concatenate_merge_matrix( if merge_action == LastValue for source in reverse(sources) matrix = get_matrix(source, rows_axis, columns_axis, matrix_property; relayout = false, default = nothing) - if matrix != nothing + if matrix !== nothing set_matrix!( destination, rows_axis, @@ -1108,7 +1092,7 @@ function require_empty_value_for_vector( daf::DafReader, destination::DafWriter, )::StorageScalar - if empty_value == nothing + if empty_value === nothing error( "no empty value for the vector: $(vector_property)\n" * "of the axis: $(axis)\n" * @@ -1127,7 +1111,7 @@ function require_empty_value_for_matrix( daf::DafReader, destination::DafWriter, )::StorageNumber - if empty_value == nothing + if empty_value === nothing error( "no empty value for the matrix: $(matrix_property)\n" * "of the rows axis: $(rows_axis)\n" * @@ -1140,11 +1124,11 @@ function require_empty_value_for_matrix( end function get_empty_value(empty::Maybe{EmptyData}, first_key::Any, second_key::Any = nothing)::Maybe{StorageScalar} - if empty == nothing + if empty === nothing return nothing else value = get(empty, first_key, nothing) - if value == nothing && second_key != nothing + if value === nothing && second_key !== nothing value = get(empty, second_key, nothing) end return value @@ -1242,7 +1226,7 @@ function sparse_storage_fraction( for (size, array) in zip(sizes, arrays) dense_size += size * scale - if array != nothing + if array !== nothing array = array.array if array isa AbstractSparseArray sparse_size += nnz(array) @@ -1267,10 +1251,11 @@ function sparsify_vectors( )::Vector{SparseVector} sparse_vectors = Vector{SparseVector}(undef, length(vectors)) - @threads for index in 1:length(vectors) - size = sizes[index] + n_sources = length(vectors) + @threads for index in 1:n_sources vector = vectors[index] - if vector == nothing + size = sizes[index] + if vector === nothing sparse_vectors[index] = spzeros(dtype, size) else @assert length(vector) == size @@ -1293,10 +1278,11 @@ function sparsify_matrices( )::Vector{SparseMatrixCSC} sparse_matrices = Vector{SparseMatrixCSC}(undef, length(matrices)) - @threads for index in 1:length(matrices) - ncols = sizes[index] + n_sources = length(matrices) + @threads for index in 1:n_sources matrix = matrices[index] - if matrix == nothing + ncols = sizes[index] + if matrix === nothing sparse_matrices[index] = spzeros(dtype, nrows, ncols) else @assert size(matrix) == (nrows, ncols) diff --git a/src/contracts.jl b/src/contracts.jl index 92cba2e..24192df 100644 --- a/src/contracts.jl +++ b/src/contracts.jl @@ -120,7 +120,7 @@ function verify_output(contract::Contract, computation::AbstractString, daf::Daf end function verify_contract(contract::Contract, computation::AbstractString, daf::DafReader; is_output::Bool)::Nothing - if contract.axes != nothing + if contract.axes !== nothing for (axis_name, axis_term) in contract.axes @assert axis_name isa AbstractString @assert axis_term isa Tuple{ContractExpectation, AbstractString} @@ -128,7 +128,7 @@ function verify_contract(contract::Contract, computation::AbstractString, daf::D end end - if contract.data != nothing + if contract.data !== nothing for (data_key, data_term) in contract.data @assert data_key isa DataKey @assert data_term isa Tuple{ContractExpectation, Type, AbstractString} @@ -152,11 +152,11 @@ function verify_scalar_contract( name::AbstractString, expectation::ContractExpectation, data_type::T, - description::AbstractString; + ::AbstractString; is_output::Bool, )::Nothing where {T <: Type} value = get_scalar(daf, name; default = nothing) - if is_mandatory(expectation; is_output = is_output) && value == nothing + if is_mandatory(expectation; is_output = is_output) && value === nothing error( "missing $(direction_name(is_output)) scalar: $(name)\n" * "with type: $(data_type)\n" * @@ -164,7 +164,7 @@ function verify_scalar_contract( "on the daf data: $(daf.name)", ) end - if is_possible(expectation; is_output = is_output) && value != nothing && !(value isa data_type) + if is_possible(expectation; is_output = is_output) && value !== nothing && !(value isa data_type) error( "unexpected type: $(typeof(value))\n" * "instead of type: $(data_type)\n" * @@ -180,7 +180,7 @@ function verify_axis_contract( daf::DafReader, name::AbstractString, expectation::ContractExpectation, - description::AbstractString; + ::AbstractString; is_output::Bool, )::Bool axis_exists = has_axis(daf, name) @@ -201,14 +201,14 @@ function verify_vector_contract( name::AbstractString, expectation::ContractExpectation, data_type::T, - description::AbstractString; + ::AbstractString; is_output::Bool, )::Nothing where {T <: Type} value = nothing if verify_axis_contract(computation, daf, axis, expectation, ""; is_output = is_output) value = get_vector(daf, axis, name; default = nothing) end - if is_mandatory(expectation; is_output = is_output) && value == nothing + if is_mandatory(expectation; is_output = is_output) && value === nothing error( "missing $(direction_name(is_output)) vector: $(name)\n" * "of the axis: $(axis)\n" * @@ -217,7 +217,7 @@ function verify_vector_contract( "on the daf data: $(daf.name)", ) end - if is_possible(expectation; is_output = is_output) && value != nothing && !(eltype(value) <: data_type) + if is_possible(expectation; is_output = is_output) && value !== nothing && !(eltype(value) <: data_type) error( "unexpected type: $(eltype(value))\n" * "instead of type: $(data_type)\n" * @@ -237,7 +237,7 @@ function verify_matrix_contract( name::AbstractString, expectation::ContractExpectation, data_type::T, - description::AbstractString; + ::AbstractString; is_output::Bool, )::Nothing where {T <: Type} has_rows_axis = verify_axis_contract(computation, daf, rows_axis, expectation, ""; is_output = is_output) @@ -246,7 +246,7 @@ function verify_matrix_contract( if has_rows_axis && has_columns_axis value = get_matrix(daf, rows_axis, columns_axis, name; default = nothing) end - if is_mandatory(expectation; is_output = is_output) && value == nothing + if is_mandatory(expectation; is_output = is_output) && value === nothing error( "missing $(direction_name(is_output)) matrix: $(name)\n" * "of the rows axis: $(rows_axis)\n" * @@ -256,7 +256,7 @@ function verify_matrix_contract( "on the daf data: $(daf.name)", ) end - if is_possible(expectation; is_output = is_output) && value != nothing && !(eltype(value) <: data_type) + if is_possible(expectation; is_output = is_output) && value !== nothing && !(eltype(value) <: data_type) error( # NOJET "unexpected type: $(eltype(value))\n" * "instead of type: $(data_type)\n" * @@ -301,7 +301,7 @@ function contract_documentation(contract::Contract, buffer::IOBuffer)::Nothing end function scalar_documentation(contract::Contract, buffer::IOBuffer; is_output::Bool, has_any::Bool)::Bool - if contract.data != nothing + if contract.data !== nothing is_first = true for (name, (expectation, data_type, description)) in contract.data if name isa AbstractString && ( @@ -324,7 +324,7 @@ function scalar_documentation(contract::Contract, buffer::IOBuffer; is_output::B end function axes_documentation(contract::Contract, buffer::IOBuffer; is_output::Bool, has_any::Bool)::Bool - if contract.axes != nothing + if contract.axes !== nothing is_first = true for (name, (expectation, description)) in contract.axes if (is_output && (expectation == GuaranteedOutput || expectation == OptionalOutput)) || @@ -345,7 +345,7 @@ function axes_documentation(contract::Contract, buffer::IOBuffer; is_output::Boo end function vectors_documentation(contract::Contract, buffer::IOBuffer; is_output::Bool, has_any::Bool)::Bool - if contract.data != nothing + if contract.data !== nothing is_first = true for (key, (expectation, data_type, description)) in contract.data if key isa Tuple{AbstractString, AbstractString} @@ -372,7 +372,7 @@ function vectors_documentation(contract::Contract, buffer::IOBuffer; is_output:: end function matrices_documentation(contract::Contract, buffer::IOBuffer; is_output::Bool, has_any::Bool)::Bool - if contract.data != nothing + if contract.data !== nothing is_first = true for (key, (expectation, data_type, description)) in contract.data if key isa Tuple{AbstractString, AbstractString, AbstractString} diff --git a/src/copies.jl b/src/copies.jl index ce99108..635888c 100644 --- a/src/copies.jl +++ b/src/copies.jl @@ -54,7 +54,7 @@ function copy_scalar!(; )::Nothing @debug "copy_scalar! $(destination.name) <$(overwrite ? "=" : "-") $(source.name) : $(name) || $(describe(default))" value = get_scalar(source, name; default = default) - if value != nothing + if value !== nothing rename = new_name(rename, name) set_scalar!(destination, rename, value; overwrite = overwrite) end @@ -80,13 +80,13 @@ function copy_axis!(; rename::Maybe{AbstractString} = nothing, default::Union{Nothing, UndefInitializer} = undef, )::Nothing - if rename == nothing + if rename === nothing @debug "copy_axis! $(destination.name) <- $(source.name) : $(axis) || $(describe(default))" else @debug "copy_axis! $(destination.name) <- $(source.name) : $(rename) <- $(axis) || $(describe(default))" # untested end value = get_axis(source, axis; default = default) - if value != nothing + if value !== nothing rename = new_name(rename, axis) add_axis!(destination, rename, value) end @@ -127,7 +127,7 @@ function copy_vector!(; overwrite::Bool = false, relation::Maybe{Symbol} = nothing, )::Nothing - if rename == nothing + if rename === nothing @debug "copy_vector! $(destination.name) <$(overwrite ? "-" : "=") $(source.name) / $(axis) : $(name) || $(describe(default))" else @debug "copy_vector! $(destination.name) <$(overwrite ? "-" : "=") $(source.name) / $(axis) : $(rename) <- $(name) || $(describe(default))" # untested @@ -136,14 +136,14 @@ function copy_vector!(; reaxis = new_name(reaxis, axis) rename = new_name(rename, name) - what_for = empty == nothing ? "the vector: $(name)\nto the vector: $(rename)" : nothing - if relation == nothing + what_for = empty === nothing ? "the vector: $(name)\nto the vector: $(rename)" : nothing + if relation === nothing relation = verify_axis(destination, reaxis, source, axis; allow_missing = false, what_for = what_for) - @assert relation != nothing + @assert relation !== nothing end value = get_vector(source, axis, name; default = default) - if value == nothing + if value === nothing return nothing end @@ -230,7 +230,7 @@ function copy_matrix!(; columns_relation::Maybe{Symbol} = nothing, )::Nothing relayout = relayout && rows_axis != columns_axis - if rename == nothing + if rename === nothing @debug "copy_matrix! $(destination.name) <$(relayout ? "%" : "#")$(overwrite ? "-" : "=") $(source.name) / $(rows_axis)($(rows_relation)) / $(columns_axis)($(columns_relation)) : $(name) || $(describe(default)) ?? $(describe(empty))" else @debug "copy_matrix! $(destination.name) <$(relayout ? "%" : "#")$(overwrite ? "-" : "=") $(source.name) / $(rows_axis)($(rows_relation)) / $(columns_axis)($(columns_relation)) : $(rename) <- $(name) || $(describe(default)) ?? $(describe(empty))" @@ -240,20 +240,20 @@ function copy_matrix!(; columns_reaxis = new_name(columns_reaxis, columns_axis) rename = new_name(rename, name) - what_for = empty == nothing ? "the matrix: $(name)\nto the matrix: $(rename)" : nothing - if rows_relation == nothing + what_for = empty === nothing ? "the matrix: $(name)\nto the matrix: $(rename)" : nothing + if rows_relation === nothing rows_relation = verify_axis(destination, rows_reaxis, source, rows_axis; allow_missing = false, what_for = what_for) - @assert rows_relation != nothing + @assert rows_relation !== nothing end - if columns_relation == nothing + if columns_relation === nothing columns_relation = verify_axis(destination, columns_reaxis, source, columns_axis; allow_missing = false, what_for = what_for) - @assert columns_relation != nothing + @assert columns_relation !== nothing end value = get_matrix(source, rows_axis, columns_axis, name; default = default, relayout = relayout) - if value == nothing + if value === nothing return nothing end @@ -392,14 +392,14 @@ function copy_all!(; overwrite::Bool = false, relayout::Bool = true, )::Nothing - if empty != nothing + if empty !== nothing for (key, value) in empty @assert key isa DataKey @assert value isa StorageScalar end end - what_for = empty == nothing ? ": data" : nothing + what_for = empty === nothing ? ": data" : nothing axis_relations = verify_axes(destination, source; what_for = what_for) copy_scalars(destination, source, overwrite) copy_axes(destination, source) @@ -464,7 +464,7 @@ function verify_subset( destination_axis::AbstractString, what_for::Maybe{AbstractString}, )::Nothing - if what_for != nothing + if what_for !== nothing error( "missing entries in the axis: $(source_axis)\n" * "of the source daf data: $(source_name)\n" * @@ -499,7 +499,7 @@ function copy_vectors( empty_value = nothing for (axis, relation) in axis_relations for name in vector_names(source, axis) - if empty != nothing + if empty !== nothing empty_value = get(empty, (axis, name), nothing) end copy_vector!(; @@ -528,9 +528,9 @@ function copy_matrices( for (columns_axis, columns_relation) in axis_relations if !relayout || columns_axis >= rows_axis for name in matrix_names(source, rows_axis, columns_axis; relayout = relayout) - if empty != nothing + if empty !== nothing empty_value = get(empty, (rows_axis, columns_axis, name), nothing) - if empty_value == nothing + if empty_value === nothing empty_value = get(empty, (columns_axis, rows_axis, name), nothing) end end @@ -552,7 +552,7 @@ function copy_matrices( end function new_name(rename::Maybe{AbstractString}, name::AbstractString)::AbstractString - return rename == nothing ? name : rename + return rename === nothing ? name : rename end end # module diff --git a/src/files_format.jl b/src/files_format.jl index 59fbc00..d2e99a3 100644 --- a/src/files_format.jl +++ b/src/files_format.jl @@ -216,7 +216,7 @@ function FilesDaf( ) end - if name == nothing + if name === nothing name_path = "$(path)/scalars/name.json" if ispath(name_path) name = string(read_scalar(name_path)) @@ -251,7 +251,7 @@ function Formats.format_set_scalar!(files::FilesDaf, name::AbstractString, value return nothing end -function Formats.format_delete_scalar!(files::FilesDaf, name::AbstractString; for_set::Bool)::Nothing +function Formats.format_delete_scalar!(files::FilesDaf, name::AbstractString; for_set::Bool)::Nothing # NOLINT return rm("$(files.path)/scalars/$(name).json"; force = true) end @@ -273,7 +273,7 @@ function read_scalar(path::AbstractString)::StorageScalar value = json_value else dtype = get(DTYPE_BY_NAME, dtype_name, nothing) - @assert dtype != nothing + @assert dtype !== nothing value = convert(dtype, json_value) end @@ -282,12 +282,12 @@ end function Formats.format_scalar_names(files::FilesDaf)::AbstractStringSet Formats.upgrade_to_write_lock(files) - names_set = get_names_set(files, "$(files.path)/scalars", ".json") + names_set = get_names_set("$(files.path)/scalars", ".json") Formats.cache_scalar_names!(files, names_set, MemoryData) return names_set end -function Formats.format_has_axis(files::FilesDaf, axis::AbstractString; for_change::Bool)::Bool +function Formats.format_has_axis(files::FilesDaf, axis::AbstractString; for_change::Bool)::Bool # NOLINT return ispath("$(files.path)/axes/$(axis).txt") end @@ -326,7 +326,7 @@ end function Formats.format_axis_names(files::FilesDaf)::AbstractStringSet Formats.upgrade_to_write_lock(files) - names_set = get_names_set(files, "$(files.path)/axes", ".txt") + names_set = get_names_set("$(files.path)/axes", ".txt") Formats.cache_axis_names!(files, names_set, MemoryData) return names_set end @@ -392,7 +392,7 @@ function Formats.format_empty_dense_vector!( files::FilesDaf, axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, )::AbstractVector{T} where {T <: StorageNumber} Formats.upgrade_to_write_lock(files) @@ -411,9 +411,9 @@ function Formats.format_empty_sparse_vector!( files::FilesDaf, axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, nnz::StorageInteger, - indtype::Type{I}, + ::Type{I}, )::Tuple{AbstractVector{I}, AbstractVector{T}, Nothing} where {T <: StorageNumber, I <: StorageInteger} Formats.upgrade_to_write_lock(files) @@ -434,7 +434,7 @@ function Formats.format_filled_sparse_vector!( files::FilesDaf, axis::AbstractString, name::AbstractString, - extra::Nothing, + ::Nothing, filled::SparseVector{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} Formats.cache_vector!(files, axis, name, filled, MappedData) @@ -445,7 +445,7 @@ function Formats.format_delete_vector!( files::FilesDaf, axis::AbstractString, name::AbstractString; - for_set::Bool, + for_set::Bool, # NOLINT )::Nothing for suffix in (".json", ".data", ".nzind", ".nzval") rm("$(files.path)/vectors/$(axis)/$(name)$(suffix)"; force = true) @@ -454,7 +454,7 @@ end function Formats.format_vector_names(files::FilesDaf, axis::AbstractString)::AbstractStringSet Formats.upgrade_to_write_lock(files) - names_set = get_names_set(files, "$(files.path)/vectors/$(axis)", ".json") + names_set = get_names_set("$(files.path)/vectors/$(axis)", ".json") Formats.cache_vector_names!(files, axis, names_set, MemoryData) return names_set end @@ -475,7 +475,7 @@ function Formats.format_get_vector(files::FilesDaf, axis::AbstractString, name:: @assert length(vector) == size else eltype = DTYPE_BY_NAME[eltype_name] - @assert eltype != nothing + @assert eltype !== nothing vector = mmap_file_data("$(files.path)/vectors/$(axis)/$(name).data", Vector{eltype}, size, files.files_mode) end @@ -484,10 +484,10 @@ function Formats.format_get_vector(files::FilesDaf, axis::AbstractString, name:: indtype_name = json["indtype"] eltype = DTYPE_BY_NAME[eltype_name] - @assert eltype != nothing + @assert eltype !== nothing indtype = DTYPE_BY_NAME[indtype_name] - @assert indtype != nothing + @assert indtype !== nothing nzind_path = "$(files.path)/vectors/$(axis)/$(name).nzind" nzval_path = "$(files.path)/vectors/$(axis)/$(name).nzval" @@ -554,7 +554,7 @@ function Formats.format_empty_dense_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, )::AbstractMatrix{T} where {T <: StorageNumber} write_array_json("$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).json", "dense", T) path = "$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).data" @@ -573,9 +573,9 @@ function Formats.format_empty_sparse_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, nnz::StorageInteger, - indtype::Type{I}, + ::Type{I}, )::Tuple{ AbstractVector{I}, AbstractVector{I}, @@ -584,7 +584,6 @@ function Formats.format_empty_sparse_matrix!( } where {T <: StorageNumber, I <: StorageInteger} write_array_json("$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).json", "sparse", T, I) - nrows = Formats.format_axis_length(files, rows_axis) ncols = Formats.format_axis_length(files, columns_axis) colptr_path = "$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).colptr" @@ -606,7 +605,7 @@ function Formats.format_filled_sparse_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString, - extra::Nothing, + ::Nothing, filled::SparseMatrixCSC{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} Formats.cache_matrix!(files, rows_axis, columns_axis, name, filled, MappedData) @@ -648,7 +647,7 @@ function Formats.format_delete_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString; - for_set::Bool, + for_set::Bool, # NOLINT )::Nothing for suffix in (".json", ".data", ".colptr", ".rowval", "nzval") rm("$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name)$(suffix)"; force = true) @@ -662,7 +661,7 @@ function Formats.format_matrix_names( columns_axis::AbstractString, )::AbstractStringSet Formats.upgrade_to_write_lock(files) - names_set = get_names_set(files, "$(files.path)/matrices/$(rows_axis)/$(columns_axis)", ".json") + names_set = get_names_set("$(files.path)/matrices/$(rows_axis)/$(columns_axis)", ".json") Formats.cache_matrix_names!(files, rows_axis, columns_axis, names_set, MemoryData) return names_set end @@ -681,7 +680,7 @@ function Formats.format_get_matrix( @assert format == "dense" || format == "sparse" eltype_name = json["eltype"] eltype = DTYPE_BY_NAME[eltype_name] - @assert eltype != nothing + @assert eltype !== nothing nrows = Formats.format_axis_length(files, rows_axis) ncols = Formats.format_axis_length(files, columns_axis) @@ -698,10 +697,10 @@ function Formats.format_get_matrix( indtype_name = json["indtype"] eltype = DTYPE_BY_NAME[eltype_name] - @assert eltype != nothing + @assert eltype !== nothing indtype = DTYPE_BY_NAME[indtype_name] - @assert indtype != nothing + @assert indtype !== nothing colptr_path = "$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).colptr" rowval_path = "$(files.path)/matrices/$(rows_axis)/$(columns_axis)/$(name).rowval" @@ -720,7 +719,7 @@ function Formats.format_get_matrix( return matrix end -function get_names_set(files::FilesDaf, path::AbstractString, suffix::AbstractString)::AbstractStringSet +function get_names_set(path::AbstractString, suffix::AbstractString)::AbstractStringSet names_set = Set{AbstractString}() suffix_length = length(suffix) @@ -744,7 +743,7 @@ end function mmap_file_data( path::AbstractString, - array_type::Type{T}, + ::Type{T}, size::Union{Integer, Tuple{<:Integer, <:Integer}}, mode::AbstractString, )::T where {T <: Union{StorageVector, StorageMatrix}} @@ -786,18 +785,18 @@ function write_zeros_file(path::AbstractString, size::Integer)::Nothing return nothing end -function write_array_json( +function write_array_json( # NOLINT path::AbstractString, format::AbstractString, eltype::Type{T}, indtype::Maybe{Type{I}} = nothing, )::Nothing where {T <: StorageScalar, I <: StorageInteger} if format == "dense" - @assert indtype == nothing + @assert indtype === nothing write(path, "{\"format\":\"dense\",\"eltype\":\"$(eltype)\"}\n") else @assert format == "sparse" - @assert indtype != nothing + @assert indtype !== nothing write(path, "{\"format\":\"sparse\",\"eltype\":\"$(eltype)\",\"indtype\":\"$(indtype)\"}\n") end return nothing diff --git a/src/formats.jl b/src/formats.jl index a0ad78a..985f2a9 100644 --- a/src/formats.jl +++ b/src/formats.jl @@ -377,11 +377,11 @@ function format_empty_sparse_vector! end Allow the `format` to perform caching once the empty sparse vector has been `filled`. By default this does nothing. """ function format_filled_sparse_vector!( # untested - format::FormatWriter, - axis::AbstractString, - name::AbstractString, - extra::Any, - filled::SparseVector{T, I}, + ::FormatWriter, + ::AbstractString, + ::AbstractString, + ::Any, + ::SparseVector{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} return nothing end @@ -509,12 +509,12 @@ function format_empty_sparse_matrix! end Allow the `format` to perform caching once the empty sparse matrix has been `filled`. By default this does nothing. """ function format_filled_sparse_matrix!( # untested - format::FormatWriter, - rows_axis::AbstractString, - columns_axis::AbstractString, - name::AbstractString, - extra::Any, - filled::SparseMatrixCSC{T, I}, + ::FormatWriter, + ::AbstractString, + ::AbstractString, + ::AbstractString, + ::Any, + ::SparseMatrixCSC{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} return nothing end @@ -600,19 +600,13 @@ nested in this one, if any. This trusts that we have a read lock on the data set. """ -function format_description_footer( - format::FormatReader, - indent::AbstractString, - lines::Vector{String}, - cache::Bool, - deep::Bool, -)::Nothing +function format_description_footer(::FormatReader, ::AbstractString, ::Vector{String}, ::Bool, ::Bool)::Nothing return nothing end function get_from_cache(format::FormatReader, cache_key::AbstractString, ::Type{T})::Maybe{T} where {T} result = get(format.internal.cache, cache_key, nothing) - if result == nothing + if result === nothing return nothing else return result.data @@ -621,7 +615,7 @@ end function get_through_cache(getter::Function, format::FormatReader, cache_key::AbstractString, ::Type{T})::T where {T} cached = get_from_cache(format, cache_key, T) - if cached == nothing + if cached === nothing return getter() else return cached @@ -779,13 +773,13 @@ function cache_matrix!( return nothing end -function as_named_vector(format::FormatReader, axis::AbstractString, vector::NamedVector)::NamedArray +function as_named_vector(::FormatReader, ::AbstractString, vector::NamedVector)::NamedArray return vector end function as_named_vector(format::FormatReader, axis::AbstractString, vector::AbstractVector)::NamedArray axis_names_dict = get(format.internal.axes, axis, nothing) - if axis_names_dict == nothing + if axis_names_dict === nothing names = as_read_only_array(Formats.get_axis_through_cache(format, axis)) named_array = NamedArray(vector; names = (names,), dimnames = (axis,)) format.internal.axes[axis] = named_array.dicts[1] @@ -796,12 +790,7 @@ function as_named_vector(format::FormatReader, axis::AbstractString, vector::Abs end end -function as_named_matrix( - format::FormatReader, - rows_axis::AbstractString, - columns_axis::AbstractString, - matrix::NamedMatrix, -)::NamedArray +function as_named_matrix(::FormatReader, ::AbstractString, ::AbstractString, matrix::NamedMatrix)::NamedArray return matrix end @@ -813,7 +802,7 @@ function as_named_matrix( )::NamedArray rows_axis_names_dict = get(format.internal.axes, rows_axis, nothing) columns_axis_names_dict = get(format.internal.axes, columns_axis, nothing) - if rows_axis_names_dict == nothing || columns_axis_names_dict == nothing + if rows_axis_names_dict === nothing || columns_axis_names_dict === nothing rows_names = as_read_only_array(Formats.get_axis_through_cache(format, rows_axis)) columns_names = as_read_only_array(Formats.get_axis_through_cache(format, columns_axis)) named_array = NamedArray(matrix; names = (rows_names, columns_names), dimnames = (rows_axis, columns_axis)) @@ -909,7 +898,7 @@ function invalidate_cached!(format::FormatReader, cache_key::AbstractString)::No delete!(format.internal.cache, cache_key) dependent_keys = pop!(format.internal.dependency_cache_keys, cache_key, nothing) - if dependent_keys != nothing + if dependent_keys !== nothing for dependent_key in dependent_keys delete!(format.internal.cache, dependent_key) end diff --git a/src/generic_functions.jl b/src/generic_functions.jl index dde5fe2..33114b7 100644 --- a/src/generic_functions.jl +++ b/src/generic_functions.jl @@ -67,12 +67,12 @@ function dedent(string::AbstractString; indent::AbstractString = "")::String first_non_space = nothing for line in lines line_non_space = findfirst(character -> character != ' ', line) - if first_non_space == nothing || (line_non_space != nothing && line_non_space < first_non_space) + if first_non_space === nothing || (line_non_space !== nothing && line_non_space < first_non_space) first_non_space = line_non_space end end - if first_non_space == nothing + if first_non_space === nothing return indent * string # untested NOJET else return join([indent * line[first_non_space:end] for line in lines], "\n") # NOJET diff --git a/src/generic_logging.jl b/src/generic_logging.jl index 1d754ef..5828e82 100644 --- a/src/generic_logging.jl +++ b/src/generic_logging.jl @@ -7,7 +7,7 @@ code, explicitly write `using Daf.GenericLogging`. """ module GenericLogging -export logged +export @logged export setup_logger using Daf.GenericTypes @@ -63,7 +63,7 @@ macro logged(definition) outer_definition = copy(inner_definition) function_name = get(inner_definition, :name, nothing) - if function_name == nothing + if function_name === nothing error("@logged requires a named function") end @assert function_name isa Symbol @@ -119,8 +119,8 @@ function metafmt( # untested show_location::Bool, level::LogLevel, _module::Module, - _id::Symbol, - _group::Symbol, + ::Symbol, + ::Symbol, file::AbstractString, line::Integer, )::Tuple{Symbol, AbstractString, AbstractString} diff --git a/src/groups.jl b/src/groups.jl index 663fdfb..7db7e78 100644 --- a/src/groups.jl +++ b/src/groups.jl @@ -62,7 +62,7 @@ function compact_groups!(group_indices::AbstractVector{<:Integer})::Int for (entry_index, group_index) in enumerate(group_indices) if group_index != 0 compact_of_group = get(compacts_of_groups, group_index, nothing) - if compact_of_group == nothing + if compact_of_group === nothing n_groups += 1 compact_of_group = n_groups compacts_of_groups[group_index] = compact_of_group diff --git a/src/h5df_format.jl b/src/h5df_format.jl index ba3af78..8fc5df0 100644 --- a/src/h5df_format.jl +++ b/src/h5df_format.jl @@ -195,7 +195,7 @@ function H5df( end end - if name == nothing && haskey(root, "scalars") + if name === nothing && haskey(root, "scalars") scalars_group = root["scalars"] @assert scalars_group isa HDF5.Group if haskey(scalars_group, "name") @@ -205,7 +205,7 @@ function H5df( end end - if name == nothing + if name === nothing if root isa HDF5.Group name = "$(root.file.filename):$(HDF5.name(root))" else @@ -295,7 +295,7 @@ function Formats.format_set_scalar!(h5df::H5df, name::AbstractString, value::Sto return nothing end -function Formats.format_delete_scalar!(h5df::H5df, name::AbstractString; for_set::Bool)::Nothing +function Formats.format_delete_scalar!(h5df::H5df, name::AbstractString; for_set::Bool)::Nothing # NOLINT scalars_group = h5df.root["scalars"] @assert scalars_group isa HDF5.Group delete_object(scalars_group, name) @@ -321,7 +321,7 @@ function Formats.format_scalar_names(h5df::H5df)::AbstractStringSet return names end -function Formats.format_has_axis(h5df::H5df, axis::AbstractString; for_change::Bool)::Bool +function Formats.format_has_axis(h5df::H5df, axis::AbstractString; for_change::Bool)::Bool # NOLINT axes_group = h5df.root["axes"] @assert axes_group isa HDF5.Group return haskey(axes_group, axis) @@ -531,7 +531,7 @@ function Formats.format_filled_sparse_vector!( return nothing end -function Formats.format_delete_vector!(h5df::H5df, axis::AbstractString, name::AbstractString; for_set::Bool)::Nothing +function Formats.format_delete_vector!(h5df::H5df, axis::AbstractString, name::AbstractString; for_set::Bool)::Nothing # NOLINT vectors_group = h5df.root["vectors"] @assert vectors_group isa HDF5.Group @@ -695,7 +695,6 @@ function Formats.format_empty_sparse_matrix!( @assert columns_axis_group isa HDF5.Group matrix_group = create_group(columns_axis_group, name) - nrows = Formats.format_axis_length(h5df, rows_axis) ncols = Formats.format_axis_length(h5df, columns_axis) colptr_dataset = create_dataset(matrix_group, "colptr", indtype, ncols + 1) @@ -767,7 +766,7 @@ function Formats.format_delete_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString; - for_set::Bool, + for_set::Bool, # NOLINT )::Nothing matrices_group = h5df.root["matrices"] @assert matrices_group isa HDF5.Group diff --git a/src/matrix_layouts.jl b/src/matrix_layouts.jl index 22b821d..7cb1d64 100644 --- a/src/matrix_layouts.jl +++ b/src/matrix_layouts.jl @@ -61,7 +61,7 @@ Columns = 2 Return the name of the axis (for messages). """ function axis_name(axis::Maybe{Integer})::String - if axis == nothing + if axis === nothing return "nothing" end @@ -94,7 +94,7 @@ function major_axis(matrix::Union{Transpose, Adjoint})::Maybe{Int8} return other_axis(major_axis(matrix.parent)) end -function major_axis(matrix::AbstractSparseMatrix)::Maybe{Int8} +function major_axis(::AbstractSparseMatrix)::Maybe{Int8} return Columns end @@ -109,7 +109,7 @@ function major_axis(matrix::AbstractMatrix)::Maybe{Int8} end return nothing - catch MethodError + catch MethodError # NOLINT return nothing end end @@ -121,7 +121,7 @@ Similar to [`major_axis`](@ref) but will `error` if the matrix isn't in either r """ function require_major_axis(matrix::AbstractMatrix)::Int8 axis = major_axis(matrix) - if axis == nothing + if axis === nothing error("type: $(typeof(matrix)) is not in any-major layout") # untested end return axis @@ -153,7 +153,7 @@ Return the other `matrix` `axis` (that is, convert between [`Rows`](@ref) and [` returns `nothing`. """ function other_axis(axis::Maybe{Integer})::Maybe{Int8} - if axis == nothing + if axis === nothing return nothing end @@ -175,7 +175,7 @@ Returns the previous handler. The default handler is `WarnHandler`. function inefficient_action_handler(handler::AbnormalHandler)::AbnormalHandler global GLOBAL_INEFFICIENT_ACTION_HANDLER previous_inefficient_action_handler = GLOBAL_INEFFICIENT_ACTION_HANDLER - GLOBAL_INEFFICIENT_ACTION_HANDLER = handler + GLOBAL_INEFFICIENT_ACTION_HANDLER = handler # NOLINT return previous_inefficient_action_handler end @@ -285,6 +285,10 @@ function relayout!(destination::AbstractMatrix, source::NamedMatrix)::NamedArray return NamedArray(relayout!(destination, source.array), source.dicts, source.dimnames) end +function relayout!(destination::DenseMatrix, source::NamedArrays.NamedMatrix) # untested + return NamedArray(relayout!(destination, source.array), source.dicts, source.dimnames) +end + function relayout!(destination::Union{Transpose, Adjoint}, source::NamedMatrix)::AbstractMatrix relayout!(parent(destination), transpose(source.array)) return destination diff --git a/src/memory_format.jl b/src/memory_format.jl index cd1b6a5..cc09cfd 100644 --- a/src/memory_format.jl +++ b/src/memory_format.jl @@ -59,7 +59,7 @@ function Formats.format_set_scalar!(memory::MemoryDaf, name::AbstractString, val return nothing end -function Formats.format_delete_scalar!(memory::MemoryDaf, name::AbstractString; for_set::Bool)::Nothing +function Formats.format_delete_scalar!(memory::MemoryDaf, name::AbstractString; for_set::Bool)::Nothing # NOLINT delete!(memory.scalars, name) return nothing end @@ -72,7 +72,7 @@ function Formats.format_scalar_names(memory::MemoryDaf)::AbstractStringSet return keys(memory.scalars) end -function Formats.format_has_axis(memory::MemoryDaf, axis::AbstractString; for_change::Bool)::Bool +function Formats.format_has_axis(memory::MemoryDaf, axis::AbstractString; for_change::Bool)::Bool # NOLINT return haskey(memory.axes, axis) end @@ -138,7 +138,7 @@ function Formats.format_empty_dense_vector!( memory::MemoryDaf, axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, )::AbstractVector{T} where {T <: StorageNumber} nelements = Formats.format_axis_length(memory, axis) vector = Vector{T}(undef, nelements) @@ -147,14 +147,13 @@ function Formats.format_empty_dense_vector!( end function Formats.format_empty_sparse_vector!( - memory::MemoryDaf, - axis::AbstractString, - name::AbstractString, - eltype::Type{T}, + ::MemoryDaf, + ::AbstractString, + ::AbstractString, + ::Type{T}, nnz::StorageInteger, - indtype::Type{I}, + ::Type{I}, )::Tuple{AbstractVector{I}, AbstractVector{T}, Nothing} where {T <: StorageNumber, I <: StorageInteger} - nelements = Formats.format_axis_length(memory, axis) nzind = Vector{I}(undef, nnz) nzval = Vector{T}(undef, nnz) return (nzind, nzval, nothing) @@ -164,7 +163,7 @@ function Formats.format_filled_sparse_vector!( memory::MemoryDaf, axis::AbstractString, name::AbstractString, - extra::Nothing, + ::Nothing, filled::SparseVector{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} memory.vectors[axis][name] = filled @@ -175,7 +174,7 @@ function Formats.format_delete_vector!( memory::MemoryDaf, axis::AbstractString, name::AbstractString; - for_set::Bool, + for_set::Bool, # NOLINT )::Nothing delete!(memory.vectors[axis], name) return nothing @@ -229,7 +228,7 @@ function Formats.format_empty_dense_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString, - eltype::Type{T}, + ::Type{T}, )::AbstractMatrix{T} where {T <: StorageNumber} nrows = Formats.format_axis_length(memory, rows_axis) ncols = Formats.format_axis_length(memory, columns_axis) @@ -240,19 +239,18 @@ end function Formats.format_empty_sparse_matrix!( memory::MemoryDaf, - rows_axis::AbstractString, + ::AbstractString, columns_axis::AbstractString, - name::AbstractString, - eltype::Type{T}, + ::AbstractString, + ::Type{T}, nnz::StorageInteger, - indtype::Type{I}, + ::Type{I}, )::Tuple{ AbstractVector{I}, AbstractVector{I}, AbstractVector{T}, Nothing, } where {T <: StorageNumber, I <: StorageInteger} - nrows = Formats.format_axis_length(memory, rows_axis) ncols = Formats.format_axis_length(memory, columns_axis) colptr = fill(I(nnz + 1), ncols + 1) colptr[1] = 1 @@ -266,7 +264,7 @@ function Formats.format_filled_sparse_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString, - extra::Nothing, + ::Nothing, filled::SparseMatrixCSC{T, I}, )::Nothing where {T <: StorageNumber, I <: StorageInteger} memory.matrices[rows_axis][columns_axis][name] = filled @@ -290,7 +288,7 @@ function Formats.format_delete_matrix!( rows_axis::AbstractString, columns_axis::AbstractString, name::AbstractString; - for_set::Bool, + for_set::Bool, # NOLINT )::Nothing delete!(memory.matrices[rows_axis][columns_axis], name) return nothing diff --git a/src/messages.jl b/src/messages.jl index 2c46207..52af44a 100644 --- a/src/messages.jl +++ b/src/messages.jl @@ -70,11 +70,11 @@ end function describe(value::Bool)::String return "$(value)" end -function describe(value::UndefInitializer)::String +function describe(::UndefInitializer)::String return "undef" end -function describe(value::Missing)::String +function describe(::Missing)::String return "missing" end @@ -110,12 +110,12 @@ end function present_vector(vector::AbstractVector, prefix::AbstractString)::String # untested try if strides(vector) == (1,) - return present_vector_size(vector, "$(typeof(vector)) - Dense") + return present_vector_size(vector, concat_prefixes(prefix, "$(typeof(vector)) - Dense")) else - return present_vector_size(vector, "$(typeof(vector)) - Strided") + return present_vector_size(vector, concat_prefixes(prefix, "$(typeof(vector)) - Strided")) end catch - return present_vector_size(vector, "$(typeof(vector))") + return present_vector_size(vector, concat_prefixes(prefix, "$(typeof(vector))")) end end @@ -152,7 +152,7 @@ function present_matrix(matrix::SparseMatrixCSC, prefix::AbstractString; transpo ) end -function present_matrix(matrix::AbstractMatrix, kind::AbstractString; transposed::Bool = false)::String # untested +function present_matrix(matrix::AbstractMatrix, ::AbstractString; transposed::Bool = false)::String # untested try matrix_strides = strides(matrix) matrix_sizes = size(matrix) @@ -172,7 +172,7 @@ function present_matrix_size(matrix::AbstractMatrix, kind::AbstractString; trans layout = other_axis(layout) end - if layout == nothing + if layout === nothing layout_suffix = "w/o major axis" # untested else layout_suffix = "in $(axis_name(layout))" diff --git a/src/operations.jl b/src/operations.jl index a16ff77..c617aa8 100644 --- a/src/operations.jl +++ b/src/operations.jl @@ -81,7 +81,7 @@ function float_dtype_for( element_type::Type{T}, dtype::Maybe{Type{D}}, )::Type where {T <: StorageNumber, D <: StorageNumber} - if dtype == nothing + if dtype === nothing global FLOAT_DTYPE_FOR return FLOAT_DTYPE_FOR[element_type] else @@ -117,7 +117,7 @@ function int_dtype_for( element_type::Type{T}, dtype::Maybe{Type{D}}, )::Type where {T <: StorageNumber, D <: StorageNumber} - if dtype == nothing + if dtype === nothing global INT_DTYPE_FOR return INT_DTYPE_FOR[element_type] else @@ -156,7 +156,7 @@ function sum_dtype_for( element_type::Type{T}, dtype::Maybe{Type{D}}, )::Type where {T <: StorageNumber, D <: StorageNumber} - if dtype == nothing + if dtype === nothing global SUM_DTYPE_FOR return SUM_DTYPE_FOR[element_type] else @@ -191,7 +191,7 @@ function unsigned_dtype_for( element_type::Type{T}, dtype::Maybe{Type{D}}, )::Type where {T <: StorageNumber, D <: StorageNumber} - if dtype == nothing + if dtype === nothing global UNSIGNED_DTYPE_FOR return UNSIGNED_DTYPE_FOR[element_type] else @@ -369,11 +369,11 @@ function parse_parameter_value( default::Any, )::Any parameter_value = get(parameters_values, parameter_name, nothing) - if parameter_value != nothing + if parameter_value !== nothing parameter_value = parse_value(parameter_value) end - if parameter_value != nothing + if parameter_value !== nothing return parameter_value elseif default !== missing return default @@ -606,7 +606,7 @@ function compute_eltwise(operation::Fraction, input::StorageVector{T})::StorageV return output end -function compute_eltwise(operation::Fraction, input::StorageNumber)::StorageNumber +function compute_eltwise(::Fraction, ::StorageNumber)::StorageNumber return error("applying Fraction eltwise operation to a scalar") end @@ -707,12 +707,8 @@ struct Significant <: EltwiseOperation end @query_operation Significant -function Significant(; - dtype::Maybe{Type} = nothing, - high::StorageNumber, - low::Maybe{StorageNumber} = nothing, -)::Significant - if low == nothing +function Significant(; high::StorageNumber, low::Maybe{StorageNumber} = nothing)::Significant + if low === nothing low = high end @assert high > 0 @@ -757,7 +753,8 @@ function compute_eltwise(operation::Significant, input::StorageMatrix{T})::Stora end dropzeros!(output) else - @threads for column_index in 1:size(output, 2) + n_columns = size(output, 2) + @threads for column_index in 1:n_columns column_vector = @view output[:, column_index] significant!(column_vector, operation.high, operation.low) end @@ -792,7 +789,7 @@ function significant!( return nothing end -function compute_eltwise(operation::Significant, input::T)::T where {T <: StorageNumber} +function compute_eltwise(::Significant, ::T)::T where {T <: StorageNumber} return error("applying Significant eltwise operation to a scalar") end @@ -812,7 +809,7 @@ end @query_operation Count function Count(; dtype::Maybe{Type} = nothing)::Count - @assert dtype == nothing || dtype <: Real + @assert dtype === nothing || dtype <: Real return Count(dtype) end @@ -835,8 +832,8 @@ function compute_reduction(operation::Count, input::StorageVector{T})::StorageNu return dtype(length(input)) end -function reduction_result_type(operation::Count, eltype::Type)::Type - return operation.dtype == nothing ? UInt32 : operation.dtype +function reduction_result_type(operation::Count, ::Type)::Type + return operation.dtype === nothing ? UInt32 : operation.dtype end """ @@ -847,7 +844,7 @@ Reduction operation that returns the most frequent value in the input (the "mode struct Mode <: ReductionOperation end @query_operation Mode -function Mode(operation_name::Token, parameters_values::Dict{String, Token})::Mode +function Mode(::Token, ::Dict{String, Token})::Mode return Mode() end @@ -860,11 +857,11 @@ function compute_reduction(operation::Mode, input::StorageMatrix{T})::StorageVec return output end -function compute_reduction(operation::Mode, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} +function compute_reduction(::Mode, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} return mode(input) end -function reduction_result_type(operation::Mode, eltype::Type)::Type +function reduction_result_type(::Mode, eltype::Type)::Type return eltype end @@ -917,19 +914,19 @@ Reduction operation that returns the maximal element. struct Max <: ReductionOperation end @query_operation Max -function Max(operation_name::Token, parameters_values::Dict{String, Token})::Max +function Max(::Token, ::Dict{String, Token})::Max return Max() end -function compute_reduction(operation::Max, input::StorageMatrix{T})::StorageVector where {T <: StorageNumber} +function compute_reduction(::Max, input::StorageMatrix{T})::StorageVector where {T <: StorageNumber} return vec(maximum(input; dims = 1)) # NOJET end -function compute_reduction(operation::Max, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} +function compute_reduction(::Max, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} return maximum(input) end -function reduction_result_type(operation::Max, eltype::Type)::Type +function reduction_result_type(::Max, eltype::Type)::Type return eltype end @@ -941,19 +938,19 @@ Reduction operation that returns the minimal element. struct Min <: ReductionOperation end @query_operation Min -function Min(operation_name::Token, parameters_values::Dict{String, Token})::Min +function Min(::Token, ::Dict{String, Token})::Min return Min() end -function compute_reduction(operation::Min, input::StorageMatrix{T})::StorageVector where {T <: StorageNumber} +function compute_reduction(::Min, input::StorageMatrix{T})::StorageVector where {T <: StorageNumber} return vec(minimum(input; dims = 1)) end -function compute_reduction(operation::Min, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} +function compute_reduction(::Min, input::StorageVector{T})::StorageNumber where {T <: StorageNumber} return minimum(input) end -function reduction_result_type(operation::Min, eltype::Type)::Type +function reduction_result_type(::Min, eltype::Type)::Type return eltype end diff --git a/src/queries.jl b/src/queries.jl index 1cf9e27..b35dd75 100644 --- a/src/queries.jl +++ b/src/queries.jl @@ -495,7 +495,7 @@ function next_query_operation(tokens::Vector{Token}, next_token_index::Int)::Tup for (operator, operation_type) in (("??", IfNot), ("!", AsAxis), ("?", Names)) if token.value == operator token = maybe_next_value_token(tokens, next_token_index) - if token == nothing + if token === nothing return (operation_type(), next_token_index) else return (operation_type(token.value), next_token_index + 1) @@ -524,7 +524,7 @@ function next_query_operation(tokens::Vector{Token}, next_token_index::Int)::Tup dtype = String else dtype = parse_number_dtype_value(token, "dtype", type_token) - if dtype != nothing + if dtype !== nothing value = parse_number_value(token, "value", value_token, dtype) end end @@ -572,7 +572,7 @@ function parse_registered_operation( )::Tuple{QueryOperation, Int} operation_name = next_value_token(tokens, next_token_index) registered_operation = get(registered_operations, operation_name.value, nothing) - if registered_operation == nothing + if registered_operation === nothing error_at_token(operation_name, "unknown $(kind) operation: $(operation_name.value)") end next_token_index += 1 @@ -712,7 +712,7 @@ end function Base.show(io::IO, names::Names)::Nothing kind = names.kind - if kind == nothing + if kind === nothing print(io, "?") else print(io, "? $(kind)") @@ -811,7 +811,7 @@ struct IfMissing <: ModifierQueryOperation end function IfMissing(value::StorageScalar; dtype::Maybe{Type} = nothing)::IfMissing - if dtype != nothing + if dtype !== nothing @assert value isa dtype elseif !(value isa AbstractString) dtype = typeof(value) # untested @@ -821,7 +821,7 @@ end function Base.show(io::IO, if_missing::IfMissing)::Nothing print(io, "|| $(escape_value(string(if_missing.missing_value)))") - if if_missing.dtype != nothing + if if_missing.dtype !== nothing print(io, " $(if_missing.dtype)") end return nothing @@ -854,7 +854,7 @@ end function Base.show(io::IO, if_not::IfNot)::Nothing not_value = if_not.not_value - if not_value == nothing + if not_value === nothing print(io, "??") else print(io, "?? $(escape_value(string(not_value)))") @@ -903,7 +903,7 @@ function AsAxis()::AsAxis end function Base.show(io::IO, as_axis::AsAxis)::Nothing - if as_axis.axis_name == nothing + if as_axis.axis_name === nothing print(io, "!") else print(io, "! $(escape_value(as_axis.axis_name))") @@ -970,15 +970,11 @@ struct And <: MaskOperation property_name::AbstractString end -function mask_operator(and::And)::String +function mask_operator(::And)::String return "&" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::And, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::And)::Nothing axis_mask .&= mask_vector return nothing end @@ -993,15 +989,11 @@ struct AndNot <: MaskOperation property_name::AbstractString end -function mask_operator(and_not::AndNot)::String +function mask_operator(::AndNot)::String return "&!" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::AndNot, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::AndNot)::Nothing axis_mask .&= .!mask_vector return nothing end @@ -1019,15 +1011,11 @@ struct Or <: MaskOperation property_name::AbstractString end -function mask_operator(or::Or)::String +function mask_operator(::Or)::String return "|" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::Or, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::Or)::Nothing axis_mask .|= mask_vector return nothing end @@ -1042,15 +1030,11 @@ struct OrNot <: MaskOperation property_name::AbstractString end -function mask_operator(or_not::OrNot)::String +function mask_operator(::OrNot)::String return "|!" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::OrNot, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::OrNot)::Nothing axis_mask .|= .!mask_vector return nothing end @@ -1068,15 +1052,11 @@ struct Xor <: MaskOperation property_name::AbstractString end -function mask_operator(xor::Xor)::String +function mask_operator(::Xor)::String return "^" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::Xor, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::Xor)::Nothing axis_mask .= @. xor(axis_mask, mask_vector) return nothing end @@ -1091,15 +1071,11 @@ struct XorNot <: MaskOperation property_name::AbstractString end -function mask_operator(xor_not::XorNot)::String +function mask_operator(::XorNot)::String return "^!" end -function update_axis_mask( - axis_mask::Vector{Bool}, - mask_vector::Union{Vector{Bool}, BitVector}, - mask_operation::XorNot, -)::Nothing +function update_axis_mask(axis_mask::Vector{Bool}, mask_vector::Union{Vector{Bool}, BitVector}, ::XorNot)::Nothing axis_mask .= @. xor(axis_mask, .!mask_vector) return nothing end @@ -1143,11 +1119,11 @@ struct IsLess <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_less::IsLess)::String +function comparison_operator(::IsLess)::String return "<" end -function compute_comparison(compared_value::StorageScalar, is_less::IsLess, comparison_value::StorageScalar)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsLess, comparison_value::StorageScalar)::Bool return compared_value < comparison_value end @@ -1160,15 +1136,11 @@ struct IsLessEqual <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_less_equal::IsLessEqual)::String +function comparison_operator(::IsLessEqual)::String return "<=" end -function compute_comparison( - compared_value::StorageScalar, - is_less_equal::IsLessEqual, - comparison_value::StorageScalar, -)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsLessEqual, comparison_value::StorageScalar)::Bool return compared_value <= comparison_value end @@ -1186,11 +1158,11 @@ struct IsEqual <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_equal::IsEqual)::String +function comparison_operator(::IsEqual)::String return "=" end -function compute_comparison(compared_value::StorageScalar, is_equal::IsEqual, comparison_value::StorageScalar)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsEqual, comparison_value::StorageScalar)::Bool return compared_value == comparison_value end @@ -1203,15 +1175,11 @@ struct IsNotEqual <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_not_equal::IsNotEqual)::String +function comparison_operator(::IsNotEqual)::String return "!=" end -function compute_comparison( - compared_value::StorageScalar, - is_not_equal::IsNotEqual, - comparison_value::StorageScalar, -)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsNotEqual, comparison_value::StorageScalar)::Bool return compared_value != comparison_value end @@ -1224,11 +1192,11 @@ struct IsGreater <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_greater::IsGreater)::String +function comparison_operator(::IsGreater)::String return ">" end -function compute_comparison(compared_value::StorageScalar, is_greater::IsGreater, comparison_value::StorageScalar)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsGreater, comparison_value::StorageScalar)::Bool return compared_value > comparison_value end @@ -1241,15 +1209,11 @@ struct IsGreaterEqual <: ComparisonOperation comparison_value::StorageScalar end -function comparison_operator(is_greater_equal::IsGreaterEqual)::String +function comparison_operator(::IsGreaterEqual)::String return ">=" end -function compute_comparison( - compared_value::StorageScalar, - is_greater_equal::IsGreaterEqual, - comparison_value::StorageScalar, -)::Bool +function compute_comparison(compared_value::StorageScalar, ::IsGreaterEqual, comparison_value::StorageScalar)::Bool return compared_value >= comparison_value end @@ -1265,11 +1229,11 @@ struct IsMatch <: MatchOperation comparison_value::Union{AbstractString, Regex} end -function comparison_operator(is_match::IsMatch)::String +function comparison_operator(::IsMatch)::String return "~" end -function compute_comparison(compared_value::AbstractString, is_match::IsMatch, comparison_regex::Regex)::Bool +function compute_comparison(compared_value::AbstractString, ::IsMatch, comparison_regex::Regex)::Bool return occursin(comparison_regex, compared_value) end @@ -1282,11 +1246,11 @@ struct IsNotMatch <: MatchOperation comparison_value::Union{AbstractString, Regex} end -function comparison_operator(is_not_match::IsNotMatch)::String +function comparison_operator(::IsNotMatch)::String return "!~" end -function compute_comparison(compared_value::AbstractString, is_not_match::IsNotMatch, comparison_regex::Regex)::Bool +function compute_comparison(compared_value::AbstractString, ::IsNotMatch, comparison_regex::Regex)::Bool return !occursin(comparison_regex, compared_value) end @@ -1377,7 +1341,7 @@ function show_computation_operation( print(io, operation_type) for field_name in fieldnames(operation_type) - if field_name != :dtype || getfield(computation_operation, :dtype) != nothing + if field_name != :dtype || getfield(computation_operation, :dtype) !== nothing print(io, " ") print(io, escape_value(string(field_name))) print(io, " ") @@ -1544,7 +1508,7 @@ function get_query( )::Union{AbstractStringSet, StorageScalar, NamedArray} cache_key = join([string(query_operation) for query_operation in query_sequence.query_operations], " ") cached_entry = get(daf.internal.cache, cache_key, nothing) - if cached_entry != nothing + if cached_entry !== nothing return cached_entry.data end @@ -1596,7 +1560,7 @@ function get_next_operation( query_operation_type::Type, )::Maybe{QueryOperation} query_operation = peek_next_operation(query_state, query_operation_type) - if query_operation != nothing + if query_operation !== nothing query_state.next_operation_index += 1 end return query_operation @@ -1696,11 +1660,11 @@ function get_matrix_result(query_state::QueryState)::Tuple{NamedArray, Set{Abstr return matrix_state.named_matrix, matrix_state.dependency_keys end -function apply_query_operation!(query_state::QueryState, modifier_operation::ModifierQueryOperation)::Nothing +function apply_query_operation!(query_state::QueryState, ::ModifierQueryOperation)::Nothing return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, modifier_operation::ModifierQueryOperation)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::ModifierQueryOperation)::Nothing return error_unexpected_operation(fake_query_state) end @@ -1716,8 +1680,8 @@ end function fake_query_operation!(fake_query_state::FakeQueryState, axis::Axis)::Nothing if isempty(fake_query_state.stack) || is_all(fake_query_state, (FakeAxisState,)) - is_entry = get_next_operation(fake_query_state, IsEqual) != nothing - is_slice = peek_next_operation(fake_query_state, MaskOperation) != nothing + is_entry = get_next_operation(fake_query_state, IsEqual) !== nothing + is_slice = peek_next_operation(fake_query_state, MaskOperation) !== nothing push!(fake_query_state.stack, FakeAxisState(axis.axis_name, is_entry, is_slice)) return nothing end @@ -1725,7 +1689,7 @@ function fake_query_operation!(fake_query_state::FakeQueryState, axis::Axis)::No return error_unexpected_operation(fake_query_state) end -function push_axis(query_state::QueryState, axis::Axis, is_equal::Nothing)::Nothing +function push_axis(query_state::QueryState, axis::Axis, ::Nothing)::Nothing require_axis(query_state.daf, axis.axis_name) query_sequence = QuerySequence((axis,)) dependency_keys = Set((axis_cache_key(axis.axis_name),)) @@ -1750,7 +1714,7 @@ function push_axis(query_state::QueryState, axis::Axis, is_equal::IsEqual)::Noth end axis_entry_index = get(axis_entries.dicts[1], comparison_value, nothing) - if axis_entry_index == nothing + if axis_entry_index === nothing error_at_state( query_state, "the entry: $(comparison_value)\n" * "does not exist in the axis: $(axis.axis_name)\n", @@ -1775,7 +1739,7 @@ function apply_query_operation!(query_state::QueryState, names::Names)::Nothing end function get_kind_names(query_state::QueryState, names::Names)::Nothing - if names.kind == nothing + if names.kind === nothing error_at_state(query_state, "no kind specified for names\n") end @@ -1791,12 +1755,12 @@ function get_kind_names(query_state::QueryState, names::Names)::Nothing end function get_vector_names(query_state::QueryState, names::Names)::Nothing - if names.kind != nothing + if names.kind !== nothing error_at_state(query_state, "unexpected kind: $(names.kind)\nspecified for vector names\n") end axis_state = pop!(query_state.stack) @assert axis_state isa AxisState - if axis_state.axis_modifier != nothing + if axis_state.axis_modifier !== nothing error_at_state(query_state, "sliced/masked axis for vector names\n") end @@ -1805,7 +1769,7 @@ function get_vector_names(query_state::QueryState, names::Names)::Nothing end function get_matrix_names(query_state::QueryState, names::Names)::Nothing - if names.kind != nothing + if names.kind !== nothing error_at_state(query_state, "unexpected kind: $(names.kind)\nspecified for matrix names\n") end @@ -1813,7 +1777,7 @@ function get_matrix_names(query_state::QueryState, names::Names)::Nothing @assert rows_axis_state isa AxisState columns_axis_state = pop!(query_state.stack) @assert columns_axis_state isa AxisState - if rows_axis_state.axis_modifier != nothing || columns_axis_state.axis_modifier != nothing + if rows_axis_state.axis_modifier !== nothing || columns_axis_state.axis_modifier !== nothing error_at_state(query_state, "sliced/masked axis for matrix names\n") end @@ -1834,7 +1798,7 @@ function fake_query_operation!(fake_query_state::FakeQueryState, names::Names):: end function fake_kind_names(fake_query_state::FakeQueryState, names::Names)::Nothing - if names.kind == nothing + if names.kind === nothing error_at_state(fake_query_state, "no kind specified for names\n") elseif names.kind != "scalars" && names.kind != "axes" error_at_state(fake_query_state, "invalid kind: $(names.kind)\n") @@ -1845,7 +1809,7 @@ function fake_kind_names(fake_query_state::FakeQueryState, names::Names)::Nothin end function fake_vector_names(fake_query_state::FakeQueryState, names::Names)::Nothing - if names.kind != nothing + if names.kind !== nothing error_at_state(fake_query_state, "unexpected kind: $(names.kind)\nspecified for vector names\n") end @@ -1860,7 +1824,7 @@ function fake_vector_names(fake_query_state::FakeQueryState, names::Names)::Noth end function fake_matrix_names(fake_query_state::FakeQueryState, names::Names)::Nothing - if names.kind != nothing + if names.kind !== nothing error_at_state(fake_query_state, "unexpected kind: $(names.kind)\nspecified for matrix names\n") end @@ -1891,7 +1855,7 @@ function apply_query_operation!(query_state::QueryState, lookup::Lookup)::Nothin return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, lookup::Lookup)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::Lookup)::Nothing if isempty(fake_query_state.stack) return fake_lookup_scalar(fake_query_state) elseif is_all(fake_query_state, (FakeAxisState,)) @@ -1942,8 +1906,8 @@ function lookup_axes(query_state::QueryState, lookup::Lookup)::Nothing rows_axis_modifier = rows_axis_state.axis_modifier columns_axis_modifier = columns_axis_state.axis_modifier - if rows_axis_modifier == nothing - if columns_axis_modifier == nothing + if rows_axis_modifier === nothing + if columns_axis_modifier === nothing return lookup_matrix(query_state, named_matrix, rows_axis_state, columns_axis_state, dependency_keys) elseif columns_axis_modifier isa Int return lookup_matrix_slice( @@ -1963,7 +1927,7 @@ function lookup_axes(query_state::QueryState, lookup::Lookup)::Nothing end elseif rows_axis_modifier isa Int - if columns_axis_modifier == nothing + if columns_axis_modifier === nothing return lookup_matrix_slice( query_state, named_matrix[rows_axis_modifier, :], @@ -1986,7 +1950,7 @@ function lookup_axes(query_state::QueryState, lookup::Lookup)::Nothing end elseif rows_axis_modifier isa Vector{Bool} - if columns_axis_modifier == nothing + if columns_axis_modifier === nothing return lookup_matrix( query_state, named_matrix[rows_axis_modifier, :], @@ -2091,11 +2055,11 @@ end function parse_if_missing_value(query_state::QueryState)::Union{UndefInitializer, StorageScalar} if_missing = get_next_operation(query_state, IfMissing) - if if_missing == nothing + if if_missing === nothing if_missing_value = undef else @assert if_missing isa IfMissing - if_missing_value = value_for_if_missing(if_missing) + if_missing_value = value_for_if_missing(query_state, if_missing) end return if_missing_value end @@ -2165,31 +2129,31 @@ function fetch_property(query_state::QueryState, axis_state::AxisState, fetch_op if_missing = get_next_operation(query_state, IfMissing) if_not = get_next_operation(query_state, IfNot) - if peek_next_operation(query_state, AsAxis) != nothing && - peek_next_operation(query_state, Fetch; skip = 1) != nothing + if peek_next_operation(query_state, AsAxis) !== nothing && + peek_next_operation(query_state, Fetch; skip = 1) !== nothing as_axis = get_next_operation(query_state, AsAxis) - @assert as_axis != nothing + @assert as_axis !== nothing else as_axis = nothing end next_fetch_operation = peek_next_operation(query_state, Fetch) - is_final = next_fetch_operation == nothing - if is_final && if_not != nothing + is_final = next_fetch_operation === nothing + if is_final && if_not !== nothing error_unexpected_operation(query_state) end - if if_missing == nothing + if if_missing === nothing if_missing_value = undef default_value = undef else @assert if_missing isa IfMissing - if_missing_value = value_for_if_missing(if_missing) + if_missing_value = value_for_if_missing(query_state, if_missing) default_value = nothing end next_named_vector = get_vector(query_state.daf, fetch_axis_name, fetch_property_name; default = default_value) - if !is_final && next_named_vector != nothing && !(eltype(next_named_vector) <: AbstractString) + if !is_final && next_named_vector !== nothing && !(eltype(next_named_vector) <: AbstractString) query_state.next_operation_index += 1 error_at_state( query_state, @@ -2213,7 +2177,7 @@ function fetch_property(query_state::QueryState, axis_state::AxisState, fetch_op fetch_state.common.axis_name = fetch_axis_name fetch_state.common.property_name = fetch_property_name - if next_fetch_operation == nothing + if next_fetch_operation === nothing base_query_operations = fetch_state.common.base_query_sequence.query_operations fetch_query_operations = query_state.query_sequence.query_operations[(fetch_state.common.first_operation_index):(query_state.next_operation_index - 1)] @@ -2233,21 +2197,21 @@ function fake_fetch_property(fake_query_state::FakeQueryState, fake_axis_state:: get_next_operation(fake_query_state, IfMissing) if_not = get_next_operation(fake_query_state, IfNot) - if peek_next_operation(fake_query_state, AsAxis) != nothing && - peek_next_operation(fake_query_state, Fetch; skip = 1) != nothing + if peek_next_operation(fake_query_state, AsAxis) !== nothing && + peek_next_operation(fake_query_state, Fetch; skip = 1) !== nothing as_axis = get_next_operation(fake_query_state, AsAxis) - @assert as_axis != nothing + @assert as_axis !== nothing else as_axis = nothing end next_fetch_operation = peek_next_operation(fake_query_state, Fetch) - is_final = next_fetch_operation == nothing - if is_final && if_not != nothing + is_final = next_fetch_operation === nothing + if is_final && if_not !== nothing error_unexpected_operation(fake_query_state) end - if next_fetch_operation == nothing + if next_fetch_operation === nothing if fake_axis_state.is_entry push!(fake_query_state.stack, FakeScalarState()) else @@ -2261,9 +2225,9 @@ function fake_fetch_property(fake_query_state::FakeQueryState, fake_axis_state:: end function axis_of_property(daf::DafReader, property_name::AbstractString, as_axis::Maybe{AsAxis})::AbstractString - if as_axis != nothing + if as_axis !== nothing axis_name = as_axis.axis_name - if axis_name != nothing + if axis_name !== nothing return axis_name end end @@ -2286,11 +2250,11 @@ function next_fetch_state( as_axis::Maybe{AsAxis}, is_final::Bool, )::Nothing - if entry_fetch_state.if_not_value != nothing + if entry_fetch_state.if_not_value !== nothing scalar_value = if_not_scalar_value(query_state, entry_fetch_state, next_named_vector, if_missing_value, is_final) - elseif next_named_vector == nothing + elseif next_named_vector === nothing scalar_value = missing_scalar_value(entry_fetch_state, if_missing_value, is_final) else @@ -2320,14 +2284,14 @@ function if_not_scalar_value( if !is_final return nothing else - if next_named_vector == nothing + if next_named_vector === nothing @assert if_missing_value != undef dtype = typeof(if_missing_value) else dtype = eltype(next_named_vector) end if_not_value = entry_fetch_state.if_not_value - @assert if_not_value != nothing + @assert if_not_value !== nothing return value_for(query_state, dtype, if_not_value) # NOJET end end @@ -2341,7 +2305,7 @@ function missing_scalar_value( if is_final return if_missing_value else - @assert entry_fetch_state.if_not_value == nothing + @assert entry_fetch_state.if_not_value === nothing entry_fetch_state.if_not_value = if_missing_value # NOJET return nothing end @@ -2358,7 +2322,7 @@ function entry_scalar_value( is_final::Bool, )::Maybe{StorageScalar} previous_scalar_value = entry_fetch_state.scalar_value - if previous_scalar_value == nothing + if previous_scalar_value === nothing scalar_value = next_named_vector.array[entry_fetch_state.axis_entry_index] else @@ -2366,7 +2330,7 @@ function entry_scalar_value( @assert previous_scalar_value != "" index_in_fetched = get(next_named_vector.dicts[1], previous_scalar_value, nothing) - if index_in_fetched == nothing + if index_in_fetched === nothing error_at_state( query_state, "invalid value: $(previous_scalar_value)\n" * @@ -2378,7 +2342,7 @@ function entry_scalar_value( scalar_value = next_named_vector[index_in_fetched] end - if if_not != nothing && (scalar_value == "" || scalar_value == 0 || scalar_value == false) + if if_not !== nothing && (scalar_value == "" || scalar_value == 0 || scalar_value == false) @assert !is_final entry_fetch_state.if_not_value = if_not.not_value scalar_value = nothing @@ -2386,7 +2350,7 @@ function entry_scalar_value( if !is_final && scalar_value == "" fetch = get_next_operation(query_state, Fetch) - @assert fetch != nothing + @assert fetch !== nothing next_axis_name = axis_of_property(query_state.daf, fetch_property_name, as_axis) error_at_state( query_state, @@ -2411,7 +2375,7 @@ function next_fetch_state( is_final::Bool, )::Nothing previous_named_vector = vector_fetch_state.named_vector - if previous_named_vector == nothing + if previous_named_vector === nothing base_named_vector, fetched_values = fetch_first_named_vector(query_state, vector_fetch_state, next_named_vector, if_missing_value) else @@ -2428,7 +2392,7 @@ function next_fetch_state( if_not_values = vector_fetch_state.if_not_values - if if_not != nothing + if if_not !== nothing base_named_vector, fetched_values = patch_fetched_values(vector_fetch_state, base_named_vector, fetched_values, if_not_values, if_not) elseif !is_final @@ -2447,13 +2411,13 @@ function fetch_first_named_vector( next_named_vector::Maybe{NamedVector}, if_missing_value::Union{UndefInitializer, StorageScalar}, )::Tuple{NamedVector, StorageVector} - @assert vector_fetch_state.if_not_values == nothing + @assert vector_fetch_state.if_not_values === nothing axis_mask = vector_fetch_state.common.axis_state.axis_modifier - if next_named_vector == nothing + if next_named_vector === nothing base_named_vector = get_vector(query_state.daf, vector_fetch_state.common.axis_state.axis_name, "name") @assert if_missing_value != undef - if axis_mask == nothing + if axis_mask === nothing size = axis_length(query_state.daf, vector_fetch_state.common.axis_state.axis_name) else @assert axis_mask isa Vector{Bool} @@ -2469,7 +2433,7 @@ function fetch_first_named_vector( else base_named_vector = next_named_vector - if axis_mask == nothing + if axis_mask === nothing vector_fetch_state.may_modify_named_vector = false else @assert axis_mask isa Vector{Bool} @@ -2492,17 +2456,15 @@ function fetch_second_named_vector( )::StorageVector @assert eltype(previous_named_vector) <: AbstractString - axis_mask = vector_fetch_state.common.axis_state.axis_modifier vector_fetch_state.may_modify_named_vector = true - if next_named_vector == nothing + if next_named_vector === nothing @assert if_missing_value != undef fetched_values = Vector{typeof(if_missing_value)}(undef, length(previous_named_vector)) if_not_values = ensure_if_not_values(vector_fetch_state, length(previous_named_vector)) if_not = IfNot(if_missing_value) - for index in 1:length(if_not_values) - if_not_value = if_not_values[index] - if if_not_value == nothing + for (index, if_not_value) in enumerate(if_not_values) + if if_not_value === nothing if_not_values[index] = if_not end end @@ -2510,13 +2472,14 @@ function fetch_second_named_vector( fetched_values = Vector{eltype(next_named_vector)}(undef, length(previous_named_vector)) if_not_values = vector_fetch_state.if_not_values - for index in 1:length(previous_named_vector) - if if_not_values == nothing || if_not_values[index] == nothing + n_values = length(previous_named_vector) + for index in 1:n_values + if if_not_values === nothing || if_not_values[index] === nothing previous_value = previous_named_vector[index] @assert previous_value != "" index_in_fetch = get(next_named_vector.dicts[1], previous_value, nothing) - if index_in_fetch == nothing + if index_in_fetch === nothing error_at_state( query_state, "invalid value: $(previous_value)\n" * @@ -2542,11 +2505,11 @@ function patch_fetched_values( if_not::IfNot, )::Tuple{NamedVector, StorageVector} fetched_mask = nothing - for index in 1:length(fetched_values) - if if_not_values == nothing || if_not_values[index] == nothing - fetched_value = fetched_values[index] - if fetched_value == "" || fetched_value == 0 || fetched_value == false - if if_not.not_value == nothing + n_values = length(fetched_values) + for index in 1:n_values + if if_not_values === nothing || if_not_values[index] === nothing + if fetched_values[index] in ("", 0, false) + if if_not.not_value === nothing fetched_mask = ensure_fetched_mask(fetched_mask, length(fetched_values)) fetched_mask[index] = false else @@ -2557,9 +2520,9 @@ function patch_fetched_values( end end - if fetched_mask != nothing + if fetched_mask !== nothing axis_mask = vector_fetch_state.common.axis_state.axis_modifier - if axis_mask == nothing + if axis_mask === nothing axis_mask = fetched_mask else @assert axis_mask isa Vector{Bool} @@ -2576,15 +2539,15 @@ function patch_fetched_values( base_named_vector = base_named_vector[fetched_mask] if_not_values = vector_fetch_state.if_not_values - if if_not_values == nothing + if if_not_values === nothing fetched_values = fetched_values[fetched_mask] else masked_fetched_values = Vector{eltype(fetched_values)}(undef, sum(fetched_mask)) masked_index = 0 - for unmasked_index in 1:length(fetched_mask) - if fetched_mask[unmasked_index] + for (unmasked_index, is_fetched) in enumerate(fetched_mask) + if is_fetched masked_index += 1 - if if_not_values[unmasked_index] == nothing + if if_not_values[unmasked_index] === nothing masked_fetched_values[masked_index] = fetched_values[unmasked_index] # untested end end @@ -2607,20 +2570,18 @@ function verify_fetched_values( as_axis::Maybe{AsAxis}, )::Nothing @assert eltype(fetched_values) <: AbstractString - for index in 1:length(fetched_values) - if if_not_values == nothing || if_not_values[index] == nothing - fetched_value = fetched_values[index] - if fetched_value == "" - fetch = get_next_operation(query_state, Fetch) - @assert fetch != nothing - next_axis_name = axis_of_property(query_state.daf, fetch_property_name, as_axis) - error_at_state( - query_state, - "empty value of the vector: $(fetch_property_name)\n" * - "of the axis: $(fetch_axis_name)\n" * - "used for the fetched axis: $(next_axis_name)\n", - ) - end + n_values = length(fetched_values) + for index in 1:n_values + if (if_not_values === nothing || if_not_values[index] === nothing) && fetched_values[index] == "" + fetch = get_next_operation(query_state, Fetch) + @assert fetch !== nothing + next_axis_name = axis_of_property(query_state.daf, fetch_property_name, as_axis) + error_at_state( + query_state, + "empty value of the vector: $(fetch_property_name)\n" * + "of the axis: $(fetch_axis_name)\n" * + "used for the fetched axis: $(next_axis_name)\n", + ) end end return nothing @@ -2628,7 +2589,7 @@ end function ensure_if_not_values(vector_fetch_state::VectorFetchState, size::Int)::Vector{Maybe{IfNot}} if_not_values = vector_fetch_state.if_not_values - if if_not_values == nothing + if if_not_values === nothing if_not_values = Vector{Maybe{IfNot}}(undef, size) fill!(if_not_values, nothing) vector_fetch_state.if_not_values = if_not_values @@ -2637,7 +2598,7 @@ function ensure_if_not_values(vector_fetch_state::VectorFetchState, size::Int):: end function ensure_fetched_mask(fetched_mask::Maybe{Vector{Bool}}, size::Int)::Vector{Bool} - if fetched_mask == nothing + if fetched_mask === nothing fetched_mask = ones(Bool, size) end return fetched_mask @@ -2649,7 +2610,7 @@ function fetch_result( fetch_query_sequence::QuerySequence, )::Nothing scalar_value = entry_fetch_state.scalar_value - @assert scalar_value != nothing + @assert scalar_value !== nothing push!(query_state.stack, ScalarState(fetch_query_sequence, entry_fetch_state.common.dependency_keys, scalar_value)) return nothing end @@ -2660,19 +2621,19 @@ function fetch_result( fetch_query_sequence::QuerySequence, )::Nothing named_vector = fetch_state.named_vector - @assert named_vector != nothing + @assert named_vector !== nothing if_not_values = fetch_state.if_not_values - if if_not_values != nothing + if if_not_values !== nothing if !fetch_state.may_modify_named_vector named_vector.array = copy(named_vector.array) # untested end for index in 1:length(named_vector) if_not = if_not_values[index] - if if_not != nothing + if if_not !== nothing if_not_value = if_not.not_value - @assert if_not_value != nothing + @assert if_not_value !== nothing named_vector.array[index] = value_for(query_state, eltype(named_vector), if_not_value) end end @@ -2712,7 +2673,7 @@ function apply_query_operation!(query_state::QueryState, mask_operation::MaskOpe return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, mask_operation::MaskOperation)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::MaskOperation)::Nothing if has_top(fake_query_state, (FakeAxisState,)) fake_axis_state = pop!(fake_query_state.stack) @assert fake_axis_state isa FakeAxisState @@ -2731,7 +2692,7 @@ end function apply_comparison(query_state::QueryState)::Nothing comparison_operation = get_next_operation(query_state, ComparisonOperation) - if comparison_operation == nothing + if comparison_operation === nothing return nothing end @@ -2742,7 +2703,7 @@ function apply_comparison(query_state::QueryState)::Nothing if comparison_operation isa MatchOperation if !(eltype(vector_state.named_vector) <: AbstractString) axis_state = vector_state.axis_state - @assert axis_state != nothing + @assert axis_state !== nothing error_at_state( query_state, "matching non-string vector: $(eltype(vector_state.named_vector))\n" * @@ -2779,7 +2740,7 @@ function apply_mask_to_axis_state( @assert mask_vector isa Union{Vector{Bool}, BitVector} axis_mask = axis_state.axis_modifier - if axis_mask == nothing + if axis_mask === nothing axis_mask = ones(Bool, length(mask_vector)) axis_state.axis_modifier = axis_mask end @@ -2794,7 +2755,7 @@ function apply_query_operation!(query_state::QueryState, as_axis::AsAxis)::Nothi if is_all(query_state, (VectorState,)) vector_state = query_state.stack[1] @assert vector_state isa VectorState - if !vector_state.is_processed && peek_next_operation(query_state, CountBy) != nothing + if !vector_state.is_processed && peek_next_operation(query_state, CountBy) !== nothing push!(query_state.stack, as_axis) return nothing end @@ -2803,11 +2764,11 @@ function apply_query_operation!(query_state::QueryState, as_axis::AsAxis)::Nothi return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, as_axis::AsAxis)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::AsAxis)::Nothing if is_all(fake_query_state, (FakeVectorState,)) fake_vector_state = fake_query_state.stack[1] @assert fake_vector_state isa FakeVectorState - if !fake_vector_state.is_processed && peek_next_operation(fake_query_state, CountBy) != nothing + if !fake_vector_state.is_processed && peek_next_operation(fake_query_state, CountBy) !== nothing return nothing end end @@ -2839,13 +2800,13 @@ function fetch_count_by(query_state::QueryState, count_by::CountBy, rows_as_axis rows_vector_state = pop!(query_state.stack) @assert rows_vector_state isa VectorState rows_axis_state = rows_vector_state.axis_state - @assert rows_axis_state != nothing + @assert rows_axis_state !== nothing fetch_property(query_state, rows_axis_state, count_by) columns_vector_state = pop!(query_state.stack) @assert columns_vector_state isa VectorState columns_axis_state = columns_vector_state.axis_state - @assert columns_axis_state != nothing + @assert columns_axis_state !== nothing columns_as_axis = get_next_operation(query_state, AsAxis) @@ -2853,8 +2814,8 @@ function fetch_count_by(query_state::QueryState, count_by::CountBy, rows_as_axis rows_name, rows_values, rows_index_of_value = unique_values(query_state, rows_vector_state, rows_as_axis, true) columns_name, columns_values, columns_index_of_value = unique_values(query_state, columns_vector_state, columns_as_axis, true) - @assert rows_index_of_value != nothing - @assert columns_index_of_value != nothing + @assert rows_index_of_value !== nothing + @assert columns_index_of_value !== nothing rows_names = values_to_names(rows_values) columns_names = values_to_names(columns_values) @@ -2884,7 +2845,7 @@ function fetch_count_by(query_state::QueryState, count_by::CountBy, rows_as_axis return nothing end -function fake_fetch_count_by(fake_query_state::FakeQueryState, count_by::CountBy)::Nothing +function fake_fetch_count_by(fake_query_state::FakeQueryState, ::CountBy)::Nothing rows_vector_state = pop!(fake_query_state.stack) @assert rows_vector_state isa FakeVectorState @@ -2900,32 +2861,32 @@ end function apply_mask_to_base_vector_state(base_vector_state::VectorState, masked_vector_state::VectorState)::Nothing base_axis_state = base_vector_state.axis_state - @assert base_axis_state != nothing + @assert base_axis_state !== nothing base_axis_mask = base_axis_state.axis_modifier masked_axis_state = masked_vector_state.axis_state - @assert masked_axis_state != nothing + @assert masked_axis_state !== nothing masked_axis_mask = masked_axis_state.axis_modifier if base_axis_mask != masked_axis_mask @assert masked_axis_mask isa Vector{Bool} - @assert base_axis_mask == nothing || !any(masked_axis_mask .& .!base_axis_mask) # NOJET + @assert base_axis_mask === nothing || !any(masked_axis_mask .& .!base_axis_mask) # NOJET apply_mask_to_vector_state(base_vector_state, masked_axis_mask) end end function apply_mask_to_base_matrix_state(base_matrix_state::MatrixState, masked_vector_state::VectorState)::Nothing base_axis_state = base_matrix_state.rows_axis_state - @assert base_axis_state != nothing + @assert base_axis_state !== nothing base_axis_mask = base_axis_state.axis_modifier masked_axis_state = masked_vector_state.axis_state - @assert masked_axis_state != nothing + @assert masked_axis_state !== nothing masked_axis_mask = masked_axis_state.axis_modifier if base_axis_mask != masked_axis_mask @assert masked_axis_mask isa Vector{Bool} - @assert base_axis_mask == nothing || !any(masked_axis_mask .& .!base_axis_mask) + @assert base_axis_mask === nothing || !any(masked_axis_mask .& .!base_axis_mask) apply_mask_to_matrix_state_rows(base_matrix_state, masked_axis_mask) end end @@ -2938,15 +2899,14 @@ function unique_values( )::Tuple{AbstractString, StorageVector, Maybe{Dict}} property_name = vector_state.property_name - if as_axis == nothing + if as_axis === nothing values = unique(vector_state.named_vector) sort!(values) if !need_index_of_values index_of_value = nothing else index_of_value = Dict{eltype(values), Int32}() - for index in 1:length(values) - value = values[index] + for (index, value) in enumerate(values) index_of_value[value] = index end end @@ -2982,12 +2942,10 @@ function compute_count_by( counts_matrix = zeros(matrix_type, length(rows_values), length(columns_values)) - for index in 1:length(rows_vector) - @inbounds row_value = rows_vector[index] - @inbounds column_value = columns_vector[index] + for (row_value, column_value) in zip(rows_vector, columns_vector) row_index = get(rows_index_of_value, row_value, nothing) column_index = get(columns_index_of_value, column_value, nothing) - if row_index != nothing && column_index != nothing + if row_index !== nothing && column_index !== nothing @inbounds counts_matrix[row_index, column_index] += 1 end end @@ -2997,9 +2955,9 @@ end function apply_mask_to_vector_state(vector_state::VectorState, new_axis_mask::Vector{Bool})::Nothing axis_state = vector_state.axis_state - @assert axis_state != nothing + @assert axis_state !== nothing old_axis_mask = axis_state.axis_modifier - if old_axis_mask == nothing + if old_axis_mask === nothing vector_state.named_vector = vector_state.named_vector[new_axis_mask] axis_state.axis_modifier = new_axis_mask else @@ -3012,9 +2970,9 @@ end function apply_mask_to_matrix_state_rows(matrix_state::MatrixState, new_rows_mask::Vector{Bool})::Nothing rows_axis_state = matrix_state.rows_axis_state - @assert rows_axis_state != nothing + @assert rows_axis_state !== nothing old_rows_mask = rows_axis_state.axis_modifier - if old_rows_mask == nothing + if old_rows_mask === nothing matrix_state.named_matrix = matrix_state.named_matrix[new_rows_mask, :] # NOJET rows_axis_state.axis_modifier = new_rows_mask else @@ -3035,7 +2993,7 @@ function apply_query_operation!(query_state::QueryState, group_by::GroupBy)::Not return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, group_by::GroupBy)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::GroupBy)::Nothing if is_all(fake_query_state, (FakeVectorState,)) return fake_fetch_group_by_vector(fake_query_state) elseif is_all(fake_query_state, (FakeMatrixState,)) @@ -3049,10 +3007,10 @@ function fetch_group_by_vector(query_state::QueryState, group_by::GroupBy)::Noth values_vector_state = pop!(query_state.stack) @assert values_vector_state isa VectorState axis_state = values_vector_state.axis_state - @assert axis_state != nothing + @assert axis_state !== nothing parsed_group_by = parse_group_by(query_state, axis_state, group_by) - if parsed_group_by == nothing + if parsed_group_by === nothing return nothing end groups_vector_state, groups_values, groups_names, groups_name, reduction_operation, if_missing = parsed_group_by @@ -3096,20 +3054,20 @@ function fetch_group_by_matrix(query_state::QueryState, group_by::GroupBy)::Noth values_matrix_state = pop!(query_state.stack) @assert values_matrix_state isa MatrixState axis_state = values_matrix_state.rows_axis_state - @assert axis_state != nothing + @assert axis_state !== nothing parsed_group_by = parse_group_by(query_state, axis_state, group_by) - if parsed_group_by == nothing + if parsed_group_by === nothing return nothing end groups_vector_state, groups_values, groups_names, groups_name, reduction_operation, if_missing = parsed_group_by columns_axis_state = values_matrix_state.columns_axis_state - @assert columns_axis_state != nothing + @assert columns_axis_state !== nothing columns_names = get_axis(query_state.daf, columns_axis_state.axis_name) axis_mask = columns_axis_state.axis_modifier - if axis_mask != nothing + if axis_mask !== nothing @assert axis_mask isa Vector{Bool} columns_names = columns_names[axis_mask] end @@ -3162,19 +3120,18 @@ function parse_group_by( groups_as_axis = get_next_operation(query_state, AsAxis) reduction_operation = get_next_operation(query_state, ReductionOperation) - if reduction_operation == nothing + if reduction_operation === nothing push!(query_state.stack, group_by) return nothing end - if groups_as_axis == nothing + if groups_as_axis === nothing if_missing = nothing else if_missing = get_next_operation(query_state, IfMissing) end - groups_name, groups_values, groups_index_of_value = - unique_values(query_state, groups_vector_state, groups_as_axis, false) + groups_name, groups_values, _ = unique_values(query_state, groups_vector_state, groups_as_axis, false) groups_names = values_to_names(groups_values) return (groups_vector_state, groups_values, groups_names, groups_name, reduction_operation, if_missing) @@ -3187,12 +3144,12 @@ function fake_parse_group_by(fake_query_state::FakeQueryState)::Bool groups_as_axis = get_next_operation(fake_query_state, AsAxis) reduction_operation = get_next_operation(fake_query_state, ReductionOperation) - if reduction_operation == nothing + if reduction_operation === nothing push!(fake_query_state.stack, FakeGroupBy()) return false end - if groups_as_axis != nothing + if groups_as_axis !== nothing get_next_operation(fake_query_state, IfMissing) end @@ -3210,10 +3167,10 @@ function compute_vector_group_by( dtype = reduction_result_type(reduction_operation, eltype(values_vector)) results_vector = Vector{dtype}(undef, length(groups_values)) - if if_missing == nothing + if if_missing === nothing empty_group_value = nothing else - empty_group_value = value_for_if_missing(if_missing; dtype = dtype) + empty_group_value = value_for_if_missing(query_state, if_missing; dtype = dtype) end collect_vector_group_by( @@ -3224,7 +3181,6 @@ function compute_vector_group_by( groups_values, empty_group_value, reduction_operation, - if_missing, ) return results_vector @@ -3241,10 +3197,10 @@ function compute_matrix_group_by( dtype = reduction_result_type(reduction_operation, eltype(values_matrix)) results_matrix = Matrix{dtype}(undef, length(groups_values), size(values_matrix)[2]) - if if_missing == nothing + if if_missing === nothing empty_group_value = nothing else - empty_group_value = value_for_if_missing(if_missing; dtype = dtype) + empty_group_value = value_for_if_missing(query_state, if_missing; dtype = dtype) end @threads for column_index in 1:size(values_matrix)[2] @@ -3258,7 +3214,6 @@ function compute_matrix_group_by( groups_values, empty_group_value, reduction_operation, - if_missing, ) end # untested @@ -3273,15 +3228,15 @@ function collect_vector_group_by( groups_values::StorageVector, empty_group_value::Maybe{StorageScalar}, reduction_operation::ReductionOperation, - if_missing::Maybe{IfMissing}, )::Nothing - @threads for group_index in 1:length(groups_values) + n_groups = length(groups_values) + @threads for group_index in 1:n_groups group_value = groups_values[group_index] group_mask = groups_vector .== group_value values_of_group = values_vector[group_mask] if length(values_of_group) > 0 - results_vector[group_index] = compute_reduction(reduction_operation, values_of_group) - elseif empty_group_value != nothing + results_vector[group_index] = compute_reduction(reduction_operation, values_of_group) # NOLINT + elseif empty_group_value !== nothing results_vector[group_index] = empty_group_value else error_at_state( @@ -3312,7 +3267,7 @@ function apply_query_operation!(query_state::QueryState, eltwise_operation::Eltw return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, eltwise_operation::EltwiseOperation)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, ::EltwiseOperation)::Nothing if is_all(fake_query_state, (FakeScalarState,)) || is_all(fake_query_state, (FakeVectorState,)) || is_all(fake_query_state, (FakeMatrixState,)) @@ -3334,7 +3289,7 @@ function eltwise_scalar(query_state::QueryState, eltwise_operation::EltwiseOpera ) end - scalar_state.scalar_value = compute_eltwise(eltwise_operation, scalar_value) + scalar_state.scalar_value = compute_eltwise(eltwise_operation, scalar_value) # NOLINT push!(query_state.stack, scalar_state) return nothing @@ -3352,7 +3307,7 @@ function eltwise_vector(query_state::QueryState, eltwise_operation::EltwiseOpera ) end - vector_value = compute_eltwise(eltwise_operation, vector_state.named_vector.array) + vector_value = compute_eltwise(eltwise_operation, vector_state.named_vector.array) # NOLINT vector_state.named_vector = NamedArray(vector_value, vector_state.named_vector.dicts, vector_state.named_vector.dimnames) vector_state.is_processed = true @@ -3365,7 +3320,7 @@ function eltwise_matrix(query_state::QueryState, eltwise_operation::EltwiseOpera matrix_state = pop!(query_state.stack) @assert matrix_state isa MatrixState - matrix_value = compute_eltwise(eltwise_operation, matrix_state.named_matrix.array) + matrix_value = compute_eltwise(eltwise_operation, matrix_state.named_matrix.array) # NOLINT matrix_state.named_matrix = NamedArray(matrix_value, matrix_state.named_matrix.dicts, matrix_state.named_matrix.dimnames) @@ -3387,7 +3342,7 @@ function apply_query_operation!(query_state::QueryState, reduction_operation::Re return error_unexpected_operation(query_state) end -function fake_query_operation!(fake_query_state::FakeQueryState, reduction_operation::ReductionOperation)::Nothing +function fake_query_operation!(fake_query_state::FakeQueryState, reduction_operation::ReductionOperation)::Nothing # NOLINT if is_all(fake_query_state, (FakeVectorState,)) fake_reduce_vector(fake_query_state) return nothing @@ -3411,7 +3366,7 @@ function reduce_vector(query_state::QueryState, reduction_operation::ReductionOp ) end - scalar_value = compute_reduction(reduction_operation, vector_state.named_vector.array) + scalar_value = compute_reduction(reduction_operation, vector_state.named_vector.array) # NOLINT scalar_state = ScalarState(query_state.query_sequence, vector_state.dependency_keys, scalar_value) push!(query_state.stack, scalar_state) @@ -3430,7 +3385,7 @@ function reduce_matrix(query_state::QueryState, reduction_operation::ReductionOp @assert matrix_state isa MatrixState named_matrix = matrix_state.named_matrix - vector_value = compute_reduction(reduction_operation, named_matrix.array) + vector_value = compute_reduction(reduction_operation, named_matrix.array) # NOLINT named_vector = NamedArray(vector_value, named_matrix.dicts[2:2], named_matrix.dimnames[2:2]) vector_state = VectorState( @@ -3504,14 +3459,25 @@ function guess_typed_value(value::AbstractString)::StorageScalar return string(value) end -function value_for_if_missing(if_missing::IfMissing; dtype::Maybe{Type} = nothing)::StorageScalar - if if_missing.dtype != nothing +function value_for_if_missing( + query_state::QueryState, + if_missing::IfMissing; + dtype::Maybe{Type} = nothing, +)::StorageScalar + if if_missing.dtype !== nothing @assert if_missing.missing_value isa if_missing.dtype return if_missing.missing_value end - @assert if_missing.missing_value isa AbstractString - return guess_typed_value(if_missing.missing_value) + if dtype === nothing + return guess_typed_value(if_missing.missing_value) + end + + if if_missing.missing_value isa dtype + return if_missing.missing_value # untested + end + + return value_for(query_state, dtype, if_missing.missing_value) end function regex_for(query_state::QueryState, value::StorageScalar)::Regex @@ -3527,7 +3493,7 @@ function regex_for(query_state::QueryState, value::StorageScalar)::Regex end end -function value_for(query_state::QueryState, type::Type{T}, value::StorageScalar)::T where {T <: StorageScalar} +function value_for(query_state::QueryState, ::Type{T}, value::StorageScalar)::T where {T <: StorageScalar} if value isa T return value elseif value isa AbstractString @@ -3612,7 +3578,7 @@ function get_frame( row_names = get_query(daf, axis_query; cache = cache).array @assert row_names isa AbstractStringVector - if columns == nothing + if columns === nothing columns = sort!(collect(vector_names(daf, axis_name))) insert!(columns, 1, "name") end @@ -3649,7 +3615,7 @@ function get_query_axis_name(fake_query_state::FakeQueryState)::AbstractString if is_all(fake_query_state, (FakeAxisState,)) fake_axis_state = fake_query_state.stack[1] @assert fake_axis_state isa FakeAxisState - if fake_axis_state.axis_name != nothing && !fake_axis_state.is_entry + if fake_axis_state.axis_name !== nothing && !fake_axis_state.is_entry return fake_axis_state.axis_name end end diff --git a/src/read_only.jl b/src/read_only.jl index 46b18cd..618b91b 100644 --- a/src/read_only.jl +++ b/src/read_only.jl @@ -48,14 +48,14 @@ Wrap `daf` with a [`DafReadOnlyWrapper`](@ref) to protect it against accidental `name` of the `daf` is reused. If `name` is not specified and `daf` isa [`DafReadOnly`](@ref), return it as-is. """ function read_only(daf::DafReader; name::Maybe{AbstractString} = nothing)::DafReadOnly - if name == nothing + if name === nothing name = daf.internal.name end return DafReadOnlyWrapper(name, daf) end function read_only(daf::DafReadOnly; name::Maybe{AbstractString} = nothing)::DafReadOnly - if name == nothing + if name === nothing return daf else return DafReadOnlyWrapper(name, daf.daf) @@ -142,7 +142,7 @@ function Formats.format_description_header( end function Messages.describe(value::DafReadOnlyWrapper; name::Maybe{AbstractString} = nothing)::String - if name == nothing + if name === nothing name = value.name end return "ReadOnly $(describe(value.daf; name = name))" diff --git a/src/readers.jl b/src/readers.jl index a5ccf7f..f392cc5 100644 --- a/src/readers.jl +++ b/src/readers.jl @@ -209,7 +209,7 @@ function get_axis( )::Maybe{AbstractStringVector} return with_read_lock(daf) do if !has_axis(daf, axis) - if default == nothing + if default === nothing # @debug "get_axis! $(daf.name) / $(axis) -> $(describe(missing))" return nothing else @@ -330,7 +330,7 @@ function get_vector( end cached_vector = Formats.get_from_cache(daf, Formats.vector_cache_key(axis, name), StorageVector) - if cached_vector != nothing + if cached_vector !== nothing if eltype(cached_vector) <: AbstractString cached_vector = as_read_only_array(cached_vector) end @@ -346,7 +346,7 @@ function get_vector( default_suffix = "" vector = nothing if !Formats.format_has_vector(daf, axis, name) - if default == nothing + if default === nothing @debug "get_vector $(daf.name) / $(axis) : $(name) -> $(describe(nothing))" return nothing end @@ -363,7 +363,7 @@ function get_vector( end end - if vector == nothing + if vector === nothing vector = Formats.get_vector_through_cache(daf, axis, name) if !(vector isa StorageVector) error( # untested @@ -468,7 +468,7 @@ function matrix_names( first_relayout_cache_key = Formats.matrix_relayout_names_cache_key(rows_axis, columns_axis) names = Formats.get_from_cache(daf, first_relayout_cache_key, AbstractStringSet) - if names == nothing + if names === nothing upgrade_to_write_lock(daf) first_names = Formats.get_matrix_names_through_cache(daf, rows_axis, columns_axis) @@ -569,7 +569,7 @@ function get_matrix( cached_matrix = Formats.get_from_cache(daf, Formats.matrix_cache_key(rows_axis, columns_axis, name), StorageMatrix) - if cached_matrix != nothing + if cached_matrix !== nothing return as_named_matrix(daf, rows_axis, columns_axis, cached_matrix) end @@ -594,7 +594,7 @@ function get_matrix( matrix = cache_entry.data end else - if default == nothing + if default === nothing @debug "get_matrix $(daf.name) / $(rows_axis) / $(columns_axis) : $(name) -> $(describe(nothing)) ?" return nothing end @@ -620,7 +620,7 @@ function get_matrix( end end - if matrix == nothing + if matrix === nothing matrix = Formats.get_matrix_through_cache(daf, rows_axis, columns_axis, name) if !(matrix isa StorageMatrix) error( # untested @@ -772,7 +772,7 @@ function description(daf::DafReader, indent::AbstractString, lines::Vector{Strin vectors_description(daf, axes, indent, lines) matrices_description(daf, axes, indent, lines) if cache - cache_description(daf, axes, indent, lines) + cache_description(daf, indent, lines) end end @@ -859,12 +859,7 @@ function matrices_description( return nothing end -function cache_description( - daf::DafReader, - axes::AbstractStringVector, - indent::AbstractString, - lines::Vector{String}, -)::Nothing +function cache_description(daf::DafReader, indent::AbstractString, lines::Vector{String})::Nothing is_first = true cache_keys = collect(keys(daf.internal.cache)) sort!(cache_keys) @@ -897,7 +892,7 @@ function base_array(array::NamedArray)::AbstractArray end function Messages.describe(daf::DafReader; name::Maybe{AbstractString} = nothing)::AbstractString - if name == nothing + if name === nothing name = daf.name end return "$(typeof(daf)) $(name)" @@ -916,20 +911,20 @@ specific [`CacheType`](@ref) (e.g., for clearing only `QueryData`), or `keep`, t """ function empty_cache!(daf::DafReader; clear::Maybe{CacheType} = nothing, keep::Maybe{CacheType} = nothing)::Nothing return with_write_lock(daf) do - @assert clear == nothing || keep == nothing - if clear == nothing && keep == nothing + @assert clear === nothing || keep === nothing + if clear === nothing && keep === nothing empty!(daf.internal.cache) else filter!(daf.internal.cache) do key_value cache_type = key_value[2].cache_type - return cache_type == keep || (cache_type != clear && clear != nothing) + return cache_type == keep || (cache_type != clear && clear !== nothing) end end if isempty(daf.internal.cache) empty!(daf.internal.dependency_cache_keys) else - for (cache_key, dependent_keys) in daf.internal.dependency_cache_keys + for (_, dependent_keys) in daf.internal.dependency_cache_keys filter(dependent_keys) do dependent_key return haskey(daf.internal.cache, dependent_key) end diff --git a/src/reconstruction.jl b/src/reconstruction.jl index 72bb701..011725b 100644 --- a/src/reconstruction.jl +++ b/src/reconstruction.jl @@ -77,18 +77,18 @@ function reconstruct_axis!( implicit_properties::Maybe{AbstractStringSet} = nothing, properties_defaults::Maybe{Dict} = nothing, )::AbstractDict{<:AbstractString, Maybe{StorageScalar}} - if rename_axis == nothing + if rename_axis === nothing rename_axis = implicit_axis end - if implicit_properties != nothing + if implicit_properties !== nothing @assert !(implicit_axis in implicit_properties) end implicit_values = get_vector(daf, existing_axis, implicit_axis) overwrite_implicit_values = - !(eltype(implicit_values) <: AbstractString) || (empty_implicit != nothing && empty_implicit != "") - if eltype(implicit_values) <: AbstractString && empty_implicit == nothing + !(eltype(implicit_values) <: AbstractString) || (empty_implicit !== nothing && empty_implicit != "") + if eltype(implicit_values) <: AbstractString && empty_implicit === nothing empty_implicit = "" end unique_values = unique(implicit_values[implicit_values .!= empty_implicit]) @@ -117,9 +117,9 @@ function reconstruct_axis!( value_of_empties_of_properties = Dict{AbstractString, Maybe{StorageScalar}}() vector_values_of_properties = Dict{AbstractString, StorageVector}() for property in vector_names(daf, existing_axis) - is_explicit = implicit_properties != nothing && property in implicit_properties - if is_explicit || (implicit_properties == nothing && property != implicit_axis) - if properties_defaults == nothing + is_explicit = implicit_properties !== nothing && property in implicit_properties + if is_explicit || (implicit_properties === nothing && property != implicit_axis) + if properties_defaults === nothing default_value = nothing else default_value = get(properties_defaults, property, nothing) @@ -134,7 +134,7 @@ function reconstruct_axis!( default_value; must_be_consistent = is_explicit, ) - if property_data != nothing + if property_data !== nothing value_of_empty_of_property, vector_value_of_property = property_data value_of_empties_of_properties[property] = value_of_empty_of_property vector_values_of_properties[property] = vector_value_of_property @@ -174,7 +174,7 @@ function collect_property_data( for (property_value, implicit_value) in zip(property_values, implicit_values) property_value_of_implicit = get(property_values_of_implicits, implicit_value, nothing) - if property_value_of_implicit == nothing + if property_value_of_implicit === nothing property_values_of_implicits[implicit_value] = property_value elseif property_value_of_implicit != property_value if must_be_consistent @@ -205,7 +205,7 @@ function value_of_implicit_property( default_value::Maybe{StorageScalar}, )::StorageScalar value = get(property_values_of_implicits, unique_value, default_value) - if value == nothing + if value === nothing error( "no default value specified for the unused entry: $(unique_value)\n" * "of the reconstructed property: $(property)\n" * diff --git a/src/registry.jl b/src/registry.jl index a2794a5..26604d1 100644 --- a/src/registry.jl +++ b/src/registry.jl @@ -140,7 +140,7 @@ operation. This is idempotent (safe to invoke multiple times). This isn't usually called directly. Instead, it is typically invoked by using the [`@query_operation`](@ref) macro. """ function register_query_operation( - type::Type{T}, + ::Type{T}, source_file::AbstractString, source_line::Integer, )::Nothing where {T <: Union{EltwiseOperation, ReductionOperation}} @@ -156,10 +156,10 @@ function register_query_operation( @assert false end - name = String(type.name.name) + name = String(T.name.name) if name in keys(registered_operations) previous_registration = registered_operations[name] - if previous_registration.type != type || + if previous_registration.type != T || previous_registration.source_file != source_file || previous_registration.source_line != source_line error( @@ -170,7 +170,7 @@ function register_query_operation( end end - registered_operations[name] = RegisteredOperation(type, source_file, source_line) + registered_operations[name] = RegisteredOperation(T, source_file, source_line) return nothing end @@ -186,14 +186,11 @@ Note this will import `Daf.Registry.register_query_operation`, so it may only be module. """ macro query_operation(operation_type_name) - name_string = String(operation_type_name) name_reference = esc(operation_type_name) source_line = __source__.line file = __source__.file - source_file = file == nothing ? "-" : String(file) - - module_name = Symbol("Daf_$(name_string)_$(source_line)") + source_file = file === nothing ? "-" : String(file) return quote import Daf.Registry.register_query_operation diff --git a/src/tokens.jl b/src/tokens.jl index 87197b0..96c4ad4 100644 --- a/src/tokens.jl +++ b/src/tokens.jl @@ -196,7 +196,7 @@ function tokenize(string::AbstractString, operators::Regex)::Vector{Token} end value = match(VALUE_REGEX, rest_of_string) - if value != nothing + if value !== nothing @assert value.offset == 1 value_string = value.match @assert !isempty(value_string) @@ -220,7 +220,7 @@ function tokenize(string::AbstractString, operators::Regex)::Vector{Token} end operator = match(operators, rest_of_string) - if operator != nothing + if operator !== nothing @assert operator.offset == 1 operator_string = operator.match @assert !isempty(operator_string) diff --git a/src/views.jl b/src/views.jl index 0558da1..62d107d 100644 --- a/src/views.jl +++ b/src/views.jl @@ -237,10 +237,10 @@ function viewer( axes::Maybe{ViewAxes} = nothing, data::Maybe{ViewData} = nothing, )::DafReadOnly - if axes == nothing + if axes === nothing axes = EMPTY_AXES end - if data == nothing + if data === nothing data = EMPTY_DATA end @@ -252,7 +252,7 @@ function viewer( daf = daf.daf end - if name == nothing + if name === nothing name = daf.name * ".view" end @@ -308,7 +308,7 @@ function collect_scalar( for scalar_name in scalar_names(daf) collect_scalar(view_name, daf, collected_scalars, scalar_name, scalar_query) end - elseif scalar_query == nothing + elseif scalar_query === nothing delete!(collected_scalars, scalar_name) else if scalar_query == "=" @@ -355,7 +355,7 @@ function collect_axis( for axis_name in axis_names(daf) collect_axis(view_name, daf, collected_axes, axis_name, axis_query) end - elseif axis_query == nothing + elseif axis_query === nothing delete!(collected_axes, axis_name) else if axis_query == "=" @@ -423,7 +423,7 @@ function collect_vector( for vector_name in vector_names(daf, base_axis) collect_vector(view_name, daf, collected_axes, collected_vectors, axis_name, vector_name, vector_query) end - elseif vector_query == nothing + elseif vector_query === nothing delete!(collected_vectors[axis_name], vector_name) else fetch_axis = get_fetch_axis(view_name, daf, collected_axes, axis_name) @@ -432,7 +432,7 @@ function collect_vector( else @assert vector_query isa Query end - if vector_query isa QuerySequence && vector_query.query_operations[1] isa Axis + if vector_query isa QuerySequence && vector_query.query_operations[1] isa Axis # NOLINT query_prefix, query_suffix = split_vector_query(vector_query) vector_query = query_prefix |> fetch_axis.query |> query_suffix else @@ -457,7 +457,7 @@ function split_vector_query(query_sequence::QuerySequence)::Tuple{QuerySequence, index = findfirst(query_sequence.query_operations) do query_operation return query_operation isa Lookup end - if index == nothing + if index === nothing return (query_sequence, QuerySequence(())) # untested else return ( @@ -551,7 +551,7 @@ function collect_matrix( matrix_query, ) end - elseif matrix_query == nothing + elseif matrix_query === nothing delete!(collected_matrices[rows_axis_name][columns_axis_name], matrix_name) delete!(collected_matrices[columns_axis_name][rows_axis_name], matrix_name) else @@ -594,7 +594,7 @@ function get_fetch_axis( axis::AbstractString, )::Fetch{AbstractStringVector} fetch_axis = get(collected_axes, axis, nothing) - if fetch_axis == nothing + if fetch_axis === nothing error("the axis: $(axis)\n" * "is not exposed by the view: $(view_name)\n" * "of the daf data: $(daf.name)") end return fetch_axis @@ -607,7 +607,7 @@ end function Formats.format_get_scalar(view::DafView, name::AbstractString)::StorageScalar fetch_scalar = view.scalars[name] scalar_value = fetch_scalar.value - if scalar_value == nothing + if scalar_value === nothing scalar_value = get_query(view.daf, fetch_scalar.query) fetch_scalar.value = scalar_value end @@ -618,7 +618,7 @@ function Formats.format_scalar_names(view::DafView)::AbstractStringSet return keys(view.scalars) end -function Formats.format_has_axis(view::DafView, axis::AbstractString; for_change::Bool)::Bool +function Formats.format_has_axis(view::DafView, axis::AbstractString; for_change::Bool)::Bool # NOLINT return haskey(view.axes, axis) end @@ -629,7 +629,7 @@ end function Formats.format_get_axis(view::DafView, axis::AbstractString)::AbstractStringVector fetch_axis = view.axes[axis] axis_names = fetch_axis.value - if axis_names == nothing + if axis_names === nothing axis_names = as_read_only_array(get_query(view.daf, fetch_axis.query).array) if !(eltype(axis_names) <: AbstractString) error( @@ -659,7 +659,7 @@ end function Formats.format_get_vector(view::DafView, axis::AbstractString, name::AbstractString)::StorageVector fetch_vector = view.vectors[axis][name] vector_value = fetch_vector.value - if vector_value == nothing + if vector_value === nothing vector_value = as_read_only_array(get_query(view.daf, fetch_vector.query)) fetch_vector.value = vector_value end @@ -691,7 +691,7 @@ function Formats.format_get_matrix( )::StorageMatrix fetch_matrix = view.matrices[rows_axis][columns_axis][name] matrix_value = fetch_matrix.value - if matrix_value == nothing + if matrix_value === nothing matrix_value = as_read_only_array(get_query(view.daf, fetch_matrix.query)) fetch_matrix.value = matrix_value end @@ -704,14 +704,14 @@ function Formats.format_description_header(view::DafView, indent::AbstractString end function Messages.describe(value::DafView; name::Maybe{AbstractString} = nothing)::String - if name == nothing - name = value.name + if name === nothing + name = value.name # NOLINT end return "View $(describe(value.daf; name = name))" end function ReadOnly.read_only(daf::DafView; name::Maybe{AbstractString} = nothing)::DafView - if name == nothing + if name === nothing return daf else return DafView( diff --git a/src/writers.jl b/src/writers.jl index 866e891..3a89f19 100644 --- a/src/writers.jl +++ b/src/writers.jl @@ -391,7 +391,7 @@ allows doing so directly into the data vector, avoiding a copy in case of memory This first verifies the `axis` exists in `daf` and that the property name isn't `name`. If not `overwrite` (the default), this also verifies the `name` vector does not exist for the `axis`. """ -function empty_sparse_vector!( +function empty_sparse_vector!( # NOLINT fill::Function, daf::DafWriter, axis::AbstractString, @@ -401,7 +401,7 @@ function empty_sparse_vector!( indtype::Maybe{Type{I}} = nothing; overwrite::Bool = false, )::Any where {T <: StorageNumber, I <: StorageInteger} - if indtype == nothing + if indtype === nothing indtype = indtype_for_size(axis_length(daf, axis)) end @assert isbitstype(eltype) @@ -697,7 +697,7 @@ It is the caller's responsibility to fill the three vectors with valid data. Spe This first verifies the `rows_axis` and `columns_axis` exist in `daf`. If not `overwrite` (the default), this also verifies the `name` matrix does not exist for the `rows_axis` and `columns_axis`. """ -function empty_sparse_matrix!( +function empty_sparse_matrix!( # NOLINT fill::Function, daf::DafWriter, rows_axis::AbstractString, @@ -708,7 +708,7 @@ function empty_sparse_matrix!( indtype::Maybe{Type{I}} = nothing; overwrite::Bool = false, )::Any where {T <: StorageNumber, I <: StorageInteger} - if indtype == nothing + if indtype === nothing nrows = axis_length(daf, rows_axis) ncolumns = axis_length(daf, columns_axis) indtype = indtype_for_size(max(nrows, ncolumns, nnz)) diff --git a/test/chains.jl b/test/chains.jl index 52e2e7f..873d12c 100644 --- a/test/chains.jl +++ b/test/chains.jl @@ -254,7 +254,7 @@ nested_test("chains") do @test !has_scalar(first, "version") @test get_scalar(second, "version") == 1.0 @test get_scalar(chain, "version") == 1.0 - @test delete_scalar!(chain, "version") == nothing + @test delete_scalar!(chain, "version") === nothing @test !has_scalar(second, "version") @test !has_scalar(chain, "version") end @@ -316,7 +316,7 @@ nested_test("chains") do @test !has_axis(first, "cell") @test get_axis(second, "cell") == ["A", "B"] @test get_axis(chain, "cell") == ["A", "B"] - @test delete_axis!(chain, "cell") == nothing + @test delete_axis!(chain, "cell") === nothing @test !has_axis(second, "cell") @test !has_axis(chain, "cell") end @@ -352,12 +352,12 @@ nested_test("chains") do nested_test("vector") do add_axis!(first, "cell", ["A", "B"]) nested_test("add") do - @test set_vector!(chain, "cell", "age", [1, 2]) == nothing + @test set_vector!(chain, "cell", "age", [1, 2]) === nothing @test !has_vector(first, "cell", "age") @test get_axis(second, "cell") == ["A", "B"] @test get_vector(second, "cell", "age") == [1, 2] @test get_vector(chain, "cell", "age") == [1, 2] - @test delete_vector!(chain, "cell", "age") == nothing + @test delete_vector!(chain, "cell", "age") === nothing @test has_axis(second, "cell") @test !has_vector(chain, "cell", "age") end @@ -371,7 +371,7 @@ nested_test("chains") do @test get_axis(second, "cell") == ["A", "B"] @test get_vector(second, "cell", "age") == [1, 2] @test get_vector(chain, "cell", "age") == [1, 2] - @test delete_vector!(chain, "cell", "age") == nothing + @test delete_vector!(chain, "cell", "age") === nothing @test has_axis(second, "cell") @test !has_vector(chain, "cell", "age") end @@ -387,15 +387,15 @@ nested_test("chains") do @test get_axis(second, "cell") == ["A", "B"] @test get_vector(second, "cell", "age") == [1, 2] @test get_vector(chain, "cell", "age") == [1, 2] - @test delete_vector!(chain, "cell", "age") == nothing + @test delete_vector!(chain, "cell", "age") === nothing @test has_axis(second, "cell") @test !has_vector(chain, "cell", "age") end nested_test("override") do - @test set_vector!(first, "cell", "age", [1, 2]) == nothing + @test set_vector!(first, "cell", "age", [1, 2]) === nothing @test get_vector(chain, "cell", "age") == [1, 2] - @test set_vector!(chain, "cell", "age", [2, 3]; overwrite = true) == nothing + @test set_vector!(chain, "cell", "age", [2, 3]; overwrite = true) === nothing @test get_vector(second, "cell", "age") == [2, 3] @test get_vector(chain, "cell", "age") == [2, 3] @test_throws dedent(""" @@ -409,10 +409,10 @@ nested_test("chains") do nested_test("change") do add_axis!(second, "cell", ["A", "B"]) - @test set_vector!(first, "cell", "age", [1, 2]) == nothing - @test set_vector!(second, "cell", "age", [2, 3]) == nothing + @test set_vector!(first, "cell", "age", [1, 2]) === nothing + @test set_vector!(second, "cell", "age", [2, 3]) === nothing @test get_vector(chain, "cell", "age") == [2, 3] - @test set_vector!(chain, "cell", "age", [3, 4]; overwrite = true) == nothing + @test set_vector!(chain, "cell", "age", [3, 4]; overwrite = true) === nothing @test get_vector(first, "cell", "age") == [1, 2] @test get_vector(second, "cell", "age") == [3, 4] @test get_vector(chain, "cell", "age") == [3, 4] @@ -430,13 +430,13 @@ nested_test("chains") do add_axis!(first, "cell", ["A", "B"]) add_axis!(first, "gene", ["X", "Y", "Z"]) nested_test("add") do - @test set_matrix!(chain, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) == nothing + @test set_matrix!(chain, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) === nothing @test !has_matrix(first, "cell", "gene", "UMIs") @test get_axis(second, "cell") == ["A", "B"] @test get_axis(second, "gene") == ["X", "Y", "Z"] @test get_matrix(second, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] @test get_matrix(chain, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] - @test delete_matrix!(chain, "cell", "gene", "UMIs") == nothing + @test delete_matrix!(chain, "cell", "gene", "UMIs") === nothing @test has_axis(second, "cell") @test has_axis(second, "gene") @test !has_matrix(chain, "cell", "gene", "UMIs") @@ -452,7 +452,7 @@ nested_test("chains") do @test get_axis(second, "gene") == ["X", "Y", "Z"] @test get_matrix(second, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] @test get_matrix(chain, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] - @test delete_matrix!(chain, "cell", "gene", "UMIs") == nothing + @test delete_matrix!(chain, "cell", "gene", "UMIs") === nothing @test has_axis(second, "cell") @test has_axis(second, "gene") @test !has_matrix(chain, "cell", "gene", "UMIs") @@ -471,16 +471,16 @@ nested_test("chains") do @test get_axis(second, "gene") == ["X", "Y", "Z"] @test get_matrix(second, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] @test get_matrix(chain, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] - @test delete_matrix!(chain, "cell", "gene", "UMIs") == nothing + @test delete_matrix!(chain, "cell", "gene", "UMIs") === nothing @test has_axis(second, "cell") @test has_axis(second, "gene") @test !has_matrix(chain, "cell", "gene", "UMIs") end nested_test("override") do - @test set_matrix!(first, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) == nothing + @test set_matrix!(first, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) === nothing @test get_matrix(chain, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] - @test set_matrix!(chain, "cell", "gene", "UMIs", [1 2 3; 4 5 6]; overwrite = true) == nothing + @test set_matrix!(chain, "cell", "gene", "UMIs", [1 2 3; 4 5 6]; overwrite = true) === nothing @test get_matrix(second, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] @test get_matrix(chain, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] @test_throws dedent(""" @@ -496,10 +496,10 @@ nested_test("chains") do nested_test("change") do add_axis!(second, "cell", ["A", "B"]) add_axis!(second, "gene", ["X", "Y", "Z"]) - @test set_matrix!(first, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) == nothing - @test set_matrix!(second, "cell", "gene", "UMIs", [1 2 3; 4 5 6]) == nothing + @test set_matrix!(first, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) === nothing + @test set_matrix!(second, "cell", "gene", "UMIs", [1 2 3; 4 5 6]) === nothing @test get_matrix(chain, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] - @test set_matrix!(chain, "cell", "gene", "UMIs", [2 3 4; 5 6 7]; overwrite = true) == nothing + @test set_matrix!(chain, "cell", "gene", "UMIs", [2 3 4; 5 6 7]; overwrite = true) === nothing @test get_matrix(first, "cell", "gene", "UMIs") == [0 1 2; 3 4 5] @test get_matrix(second, "cell", "gene", "UMIs") == [2 3 4; 5 6 7] @test get_matrix(chain, "cell", "gene", "UMIs") == [2 3 4; 5 6 7] diff --git a/test/computations.jl b/test/computations.jl index 0183b48..c971f5b 100644 --- a/test/computations.jl +++ b/test/computations.jl @@ -122,7 +122,7 @@ nested_test("computations") do add_axis!(daf, "cell", ["A", "B"]) add_axis!(daf, "gene", ["X", "Y", "Z"]) set_matrix!(daf, "cell", "gene", "UMIs", UInt8[0 1 2; 3 4 5]) - @test single(daf, 0.0) == nothing + @test single(daf, 0.0) === nothing end nested_test("missing") do @@ -175,7 +175,7 @@ nested_test("computations") do end nested_test("!docs") do - @test missing_single(daf) == nothing + @test missing_single(daf) === nothing @test_throws dedent(""" no contract(s) associated with: Main.missing_single use: @computation Contract(...) function Main.missing_single(...) @@ -190,7 +190,7 @@ nested_test("computations") do nested_test("()") do set_scalar!(first, "version", "0.0") set_scalar!(second, "quality", 0.0) - @test cross(first, second) == nothing + @test cross(first, second) === nothing end nested_test("missing") do diff --git a/test/contracts.jl b/test/contracts.jl index 36b7805..db46966 100644 --- a/test/contracts.jl +++ b/test/contracts.jl @@ -3,7 +3,7 @@ nested_test("contracts") do nested_test("scalar") do nested_test("()") do - @test set_scalar!(daf, "version", 1) == nothing + @test set_scalar!(daf, "version", 1) === nothing for (name, expectation) in ( ("required", RequiredInput), ("optional", OptionalInput), @@ -13,11 +13,11 @@ nested_test("contracts") do contract = Contract(; data = ["version" => (expectation, Int64, "description")]) nested_test(name) do nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -37,7 +37,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -45,11 +45,11 @@ nested_test("contracts") do contract = Contract(; data = ["version" => (OptionalInput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -57,7 +57,7 @@ nested_test("contracts") do contract = Contract(; data = ["version" => (GuaranteedOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -74,17 +74,17 @@ nested_test("contracts") do contract = Contract(; data = ["version" => (OptionalOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end nested_test("!type") do - @test set_scalar!(daf, "version", "1.0") == nothing + @test set_scalar!(daf, "version", "1.0") === nothing for (name, expectation) in (("required", RequiredInput), ("optional", OptionalInput)) nested_test(name) do @@ -101,7 +101,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -111,7 +111,7 @@ nested_test("contracts") do contract = Contract(; data = ["version" => (expectation, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -130,7 +130,7 @@ nested_test("contracts") do nested_test("axis") do nested_test("()") do - @test add_axis!(daf, "cell", ["A", "B"]) == nothing + @test add_axis!(daf, "cell", ["A", "B"]) === nothing for (name, expectation) in ( ("required", RequiredInput), ("optional", OptionalInput), @@ -140,11 +140,11 @@ nested_test("contracts") do contract = Contract(; axes = ["cell" => (expectation, "description")]) nested_test(name) do nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -163,7 +163,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -171,11 +171,11 @@ nested_test("contracts") do contract = Contract(; axes = ["cell" => (OptionalInput, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -183,7 +183,7 @@ nested_test("contracts") do contract = Contract(; axes = ["cell" => (GuaranteedOutput, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -199,21 +199,21 @@ nested_test("contracts") do contract = Contract(; axes = ["cell" => (OptionalOutput, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end end nested_test("vectors") do - @test add_axis!(daf, "cell", ["A", "B"]) == nothing + @test add_axis!(daf, "cell", ["A", "B"]) === nothing nested_test("()") do - @test set_vector!(daf, "cell", "age", [1, 2]) == nothing + @test set_vector!(daf, "cell", "age", [1, 2]) === nothing for (name, expectation) in ( ("required", RequiredInput), ("optional", OptionalInput), @@ -223,11 +223,11 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "age") => (expectation, Int64, "description")]) nested_test(name) do nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -248,7 +248,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -256,11 +256,11 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "age") => (OptionalInput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -268,7 +268,7 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "age") => (GuaranteedOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -286,17 +286,17 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "age") => (OptionalOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end nested_test("!type") do - @test set_vector!(daf, "cell", "age", [1.0, 2.0]) == nothing + @test set_vector!(daf, "cell", "age", [1.0, 2.0]) === nothing for (name, expectation) in (("required", RequiredInput), ("optional", OptionalInput)) nested_test(name) do @@ -314,7 +314,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -324,7 +324,7 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "age") => (expectation, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -343,11 +343,11 @@ nested_test("contracts") do end nested_test("matrix") do - @test add_axis!(daf, "cell", ["A", "B"]) == nothing - @test add_axis!(daf, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(daf, "cell", ["A", "B"]) === nothing + @test add_axis!(daf, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do - @test set_matrix!(daf, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", [0 1 2; 3 4 5]) === nothing for (name, expectation) in ( ("required", RequiredInput), ("optional", OptionalInput), @@ -357,11 +357,11 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "gene", "UMIs") => (expectation, Int64, "description")]) nested_test(name) do nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -383,7 +383,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -391,11 +391,11 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "gene", "UMIs") => (OptionalInput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -403,7 +403,7 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "gene", "UMIs") => (GuaranteedOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -422,11 +422,11 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "gene", "UMIs") => (OptionalOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -434,7 +434,7 @@ nested_test("contracts") do nested_test("!axis") do for axis in ("cell", "gene") nested_test(axis) do - @test delete_axis!(daf, axis) == nothing + @test delete_axis!(daf, axis) === nothing nested_test("required") do contract = @@ -449,7 +449,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -458,11 +458,11 @@ nested_test("contracts") do Contract(; data = [("cell", "gene", "UMIs") => (OptionalInput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end @@ -471,7 +471,7 @@ nested_test("contracts") do Contract(; data = [("cell", "gene", "UMIs") => (GuaranteedOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do @@ -488,11 +488,11 @@ nested_test("contracts") do Contract(; data = [("cell", "gene", "UMIs") => (OptionalOutput, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -500,7 +500,7 @@ nested_test("contracts") do end nested_test("!type") do - @test set_matrix!(daf, "cell", "gene", "UMIs", [0.0 1.0 2.0; 3.0 4.0 5.0]) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", [0.0 1.0 2.0; 3.0 4.0 5.0]) === nothing for (name, expectation) in (("required", RequiredInput), ("optional", OptionalInput)) nested_test(name) do @@ -519,7 +519,7 @@ nested_test("contracts") do end nested_test("output") do - @test verify_output(contract, "computation", daf) == nothing + @test verify_output(contract, "computation", daf) === nothing end end end @@ -529,7 +529,7 @@ nested_test("contracts") do contract = Contract(; data = [("cell", "gene", "UMIs") => (expectation, Int64, "description")]) nested_test("input") do - @test verify_input(contract, "computation", daf) == nothing + @test verify_input(contract, "computation", daf) === nothing end nested_test("output") do diff --git a/test/copies.jl b/test/copies.jl index 871f24b..06487d4 100644 --- a/test/copies.jl +++ b/test/copies.jl @@ -25,7 +25,7 @@ nested_test("copies") do destination = destination, name = "version", default = nothing, - ) == nothing + ) === nothing @test !has_scalar(destination, "version") end @@ -35,17 +35,17 @@ nested_test("copies") do destination = destination, name = "version", default = "2.0", - ) == nothing + ) === nothing @test get_scalar(destination, "version") == "2.0" end end end nested_test("existing") do - @test set_scalar!(source, "version", "1.0") == nothing + @test set_scalar!(source, "version", "1.0") === nothing nested_test("()") do - @test copy_scalar!(; source = source, destination = destination, name = "version") == nothing + @test copy_scalar!(; source = source, destination = destination, name = "version") === nothing @test get_scalar(destination, "version") == "1.0" end @@ -66,14 +66,14 @@ nested_test("copies") do end nested_test("existing") do - @test add_axis!(source, "cell", ["A", "B"]) == nothing - @test copy_axis!(; source = source, destination = destination, axis = "cell") == nothing + @test add_axis!(source, "cell", ["A", "B"]) === nothing + @test copy_axis!(; source = source, destination = destination, axis = "cell") === nothing @test get_axis(destination, "cell") == ["A", "B"] end end nested_test("vector") do - @test add_axis!(source, "cell", ["A", "B"]) == nothing + @test add_axis!(source, "cell", ["A", "B"]) === nothing nested_test("!axis") do nested_test("()") do @@ -107,7 +107,7 @@ nested_test("copies") do axis = "cell", name = "age", default = nothing, - ) == nothing + ) === nothing end nested_test("value") do @@ -120,13 +120,13 @@ nested_test("copies") do axis = "cell", name = "age", default = [1, 2], - ) == nothing + ) === nothing end end end nested_test("missing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -158,7 +158,7 @@ nested_test("copies") do axis = "cell", name = "age", default = nothing, - ) == nothing + ) === nothing @test !has_vector(destination, "cell", "age") end @@ -169,17 +169,17 @@ nested_test("copies") do axis = "cell", name = "age", default = [1, 2], - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 2] end end end nested_test("dense") do - @test set_vector!(source, "cell", "age", [1, 2]) == nothing + @test set_vector!(source, "cell", "age", [1, 2]) === nothing nested_test("existing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing nested_test("()") do @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") == @@ -194,20 +194,21 @@ nested_test("copies") do axis = "cell", name = "age", default = [2, 3], - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 2] end end nested_test("subset") do - @test add_axis!(destination, "cell", ["A"]) == nothing + @test add_axis!(destination, "cell", ["A"]) === nothing - @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") == nothing + @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") === + nothing @test get_vector(destination, "cell", "age") == [1] end nested_test("superset") do - @test add_axis!(destination, "cell", ["A", "B", "C"]) == nothing + @test add_axis!(destination, "cell", ["A", "B", "C"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -245,14 +246,14 @@ nested_test("copies") do axis = "cell", name = "age", empty = -1, - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 2, -1] end end end nested_test("disjoint") do - @test add_axis!(destination, "cell", ["B", "C"]) == nothing + @test add_axis!(destination, "cell", ["B", "C"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -298,10 +299,10 @@ nested_test("copies") do end nested_test("sparse") do - @test set_vector!(source, "cell", "age", sparse_vector([1, 0])) == nothing + @test set_vector!(source, "cell", "age", sparse_vector([1, 0])) === nothing nested_test("existing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing nested_test("()") do @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") == @@ -317,22 +318,23 @@ nested_test("copies") do axis = "cell", name = "age", default = [2, 3], - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 0] @test nnz(get_vector(destination, "cell", "age").array) == 1 end end nested_test("subset") do - @test add_axis!(destination, "cell", ["A"]) == nothing + @test add_axis!(destination, "cell", ["A"]) === nothing - @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") == nothing + @test copy_vector!(; source = source, destination = destination, axis = "cell", name = "age") === + nothing @test get_vector(destination, "cell", "age") == [1] @test nnz(get_vector(destination, "cell", "age").array) == 1 end nested_test("superset") do - @test add_axis!(destination, "cell", ["A", "B", "C"]) == nothing + @test add_axis!(destination, "cell", ["A", "B", "C"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -370,7 +372,7 @@ nested_test("copies") do axis = "cell", name = "age", empty = -1, - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 0, -1] @test nnz(get_vector(destination, "cell", "age").array) == 2 end @@ -382,7 +384,7 @@ nested_test("copies") do axis = "cell", name = "age", empty = 0, - ) == nothing + ) === nothing @test get_vector(destination, "cell", "age") == [1, 0, 0] @test nnz(get_vector(destination, "cell", "age").array) == 1 end @@ -390,7 +392,7 @@ nested_test("copies") do end nested_test("disjoint") do - @test add_axis!(destination, "cell", ["B", "C"]) == nothing + @test add_axis!(destination, "cell", ["B", "C"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -437,8 +439,8 @@ nested_test("copies") do end nested_test("matrix") do - @test add_axis!(source, "cell", ["A", "B"]) == nothing - @test add_axis!(source, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(source, "cell", ["A", "B"]) === nothing + @test add_axis!(source, "gene", ["X", "Y", "Z"]) === nothing nested_test("!axis") do nested_test("()") do @@ -453,7 +455,7 @@ nested_test("copies") do name = "age", ) - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing @test_throws dedent(""" missing axis: gene @@ -481,7 +483,7 @@ nested_test("copies") do default = undef, ) - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing @test_throws dedent(""" missing axis: gene @@ -509,7 +511,7 @@ nested_test("copies") do default = nothing, ) - @test add_axis!(destination, "cell", ["A", "B"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing @test_throws dedent(""" missing axis: gene @@ -527,8 +529,8 @@ nested_test("copies") do end nested_test("missing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -572,7 +574,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", default = nothing, - ) == nothing + ) === nothing @test !has_matrix(destination, "cell", "gene", "UMIs") end @@ -584,18 +586,18 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", default = [1 2 3; 4 5 6], - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] end end end nested_test("dense") do - @test set_matrix!(source, "cell", "gene", "UMIs", [1 2 3; 4 5 6]) == nothing + @test set_matrix!(source, "cell", "gene", "UMIs", [1 2 3; 4 5 6]) === nothing nested_test("existing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test copy_matrix!(; @@ -604,7 +606,7 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] end @@ -616,15 +618,15 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", default = [2 3 4; 5 6 7], - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2 3; 4 5 6] end end nested_test("subset") do nested_test("rows") do - @test add_axis!(destination, "cell", ["A"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing @test copy_matrix!(; source = source, @@ -632,13 +634,13 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2 3] end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y"]) === nothing @test copy_matrix!(; source = source, @@ -646,15 +648,15 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2; 4 5] end end nested_test("superset") do nested_test("rows") do - @test add_axis!(destination, "cell", ["A", "B", "C"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B", "C"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -700,15 +702,15 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = -1, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [1 2 3; 4 5 6; -1 -1 -1] end end end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["W", "X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["W", "X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -754,7 +756,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = -1, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [-1 1 2 3; -1 4 5 6] end end @@ -763,8 +765,8 @@ nested_test("copies") do nested_test("disjoint") do nested_test("rows") do - @test add_axis!(destination, "cell", ["B", "C"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["B", "C"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -817,8 +819,8 @@ nested_test("copies") do end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["W", "X", "Y"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["W", "X", "Y"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -873,11 +875,11 @@ nested_test("copies") do end nested_test("sparse") do - @test set_matrix!(source, "cell", "gene", "UMIs", sparse_matrix_csc([0 1 2; 3 4 0])) == nothing + @test set_matrix!(source, "cell", "gene", "UMIs", sparse_matrix_csc([0 1 2; 3 4 0])) === nothing nested_test("existing") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test copy_matrix!(; @@ -886,7 +888,7 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1 2; 3 4 0] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 4 end @@ -899,7 +901,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", default = [2 3 4; 5 6 7], - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1 2; 3 4 0] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 4 end @@ -907,8 +909,8 @@ nested_test("copies") do nested_test("subset") do nested_test("rows") do - @test add_axis!(destination, "cell", ["A"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing @test copy_matrix!(; source = source, @@ -916,14 +918,14 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1 2] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 2 end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y"]) === nothing @test copy_matrix!(; source = source, @@ -931,7 +933,7 @@ nested_test("copies") do rows_axis = "cell", columns_axis = "gene", name = "UMIs", - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1; 3 4] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 3 end @@ -939,8 +941,8 @@ nested_test("copies") do nested_test("superset") do nested_test("rows") do - @test add_axis!(destination, "cell", ["A", "B", "C"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B", "C"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -986,7 +988,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = -1, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1 2; 3 4 0; -1 -1 -1] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 7 end @@ -999,7 +1001,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = 0, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 1 2; 3 4 0; 0 0 0] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 4 end @@ -1007,8 +1009,8 @@ nested_test("copies") do end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["W", "X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["W", "X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -1054,7 +1056,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = -1, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [-1 0 1 2; -1 3 4 0] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 6 end @@ -1067,7 +1069,7 @@ nested_test("copies") do columns_axis = "gene", name = "UMIs", empty = 0, - ) == nothing + ) === nothing @test get_matrix(destination, "cell", "gene", "UMIs") == [0 0 1 2; 0 3 4 0] @test nnz(get_matrix(destination, "cell", "gene", "UMIs").array) == 4 end @@ -1077,8 +1079,8 @@ nested_test("copies") do nested_test("disjoint") do nested_test("rows") do - @test add_axis!(destination, "cell", ["B", "C"]) == nothing - @test add_axis!(destination, "gene", ["X", "Y", "Z"]) == nothing + @test add_axis!(destination, "cell", ["B", "C"]) === nothing + @test add_axis!(destination, "gene", ["X", "Y", "Z"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -1131,8 +1133,8 @@ nested_test("copies") do end nested_test("columns") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["W", "X", "Y"]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["W", "X", "Y"]) === nothing nested_test("()") do @test_throws dedent(""" @@ -1189,11 +1191,11 @@ nested_test("copies") do nested_test("all") do nested_test("empty") do - @test set_scalar!(source, "version", "1.0") == nothing - @test add_axis!(source, "cell", ["A"]) == nothing - @test add_axis!(source, "gene", ["W", "X"]) == nothing - @test set_vector!(source, "cell", "age", [1.0]) == nothing - @test set_matrix!(source, "cell", "gene", "UMIs", [1 2]) == nothing + @test set_scalar!(source, "version", "1.0") === nothing + @test add_axis!(source, "cell", ["A"]) === nothing + @test add_axis!(source, "gene", ["W", "X"]) === nothing + @test set_vector!(source, "cell", "age", [1.0]) === nothing + @test set_matrix!(source, "cell", "gene", "UMIs", [1 2]) === nothing copy_all!(; source = source, destination = destination) @@ -1204,14 +1206,14 @@ nested_test("copies") do end nested_test("subset") do - @test add_axis!(destination, "cell", ["A", "B"]) == nothing - @test add_axis!(destination, "gene", ["W", "X", "Z"]) == nothing - - @test set_scalar!(source, "version", "1.0") == nothing - @test add_axis!(source, "cell", ["A"]) == nothing - @test add_axis!(source, "gene", ["W", "X"]) == nothing - @test set_vector!(source, "cell", "age", [1.0]) == nothing - @test set_matrix!(source, "cell", "gene", "UMIs", [1 2]) == nothing + @test add_axis!(destination, "cell", ["A", "B"]) === nothing + @test add_axis!(destination, "gene", ["W", "X", "Z"]) === nothing + + @test set_scalar!(source, "version", "1.0") === nothing + @test add_axis!(source, "cell", ["A"]) === nothing + @test add_axis!(source, "gene", ["W", "X"]) === nothing + @test set_vector!(source, "cell", "age", [1.0]) === nothing + @test set_matrix!(source, "cell", "gene", "UMIs", [1 2]) === nothing copy_all!(; source = source, diff --git a/test/data.jl b/test/data.jl index 571fbb6..afa4159 100644 --- a/test/data.jl +++ b/test/data.jl @@ -42,8 +42,8 @@ function test_missing_scalar(daf::DafReader, depth::Int)::Nothing nested_test("default") do nested_test("missing") do - @test get_scalar(daf, "depth"; default = nothing) == nothing - @test get_scalar(daf, "version"; default = nothing) == nothing + @test get_scalar(daf, "depth"; default = nothing) === nothing + @test get_scalar(daf, "version"; default = nothing) === nothing end nested_test("scalar") do @@ -82,15 +82,15 @@ function test_missing_scalar(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_scalar!(daf, "depth"; must_exist = false) == nothing - @test delete_scalar!(daf, "version"; must_exist = false) == nothing + @test delete_scalar!(daf, "depth"; must_exist = false) === nothing + @test delete_scalar!(daf, "version"; must_exist = false) === nothing end end end nested_test("set_scalar!") do - @test set_scalar!(daf, "depth", depth + 1) == nothing - @test set_scalar!(daf, "version", "1.0") == nothing + @test set_scalar!(daf, "depth", depth + 1) === nothing + @test set_scalar!(daf, "version", "1.0") === nothing nested_test("created") do test_existing_scalar(daf, depth + 1) return nothing @@ -137,8 +137,8 @@ function test_existing_scalar(daf::DafReader, depth::Int)::Nothing nested_test("delete_scalar!") do nested_test("()") do - @test delete_scalar!(daf, "depth") == nothing - @test delete_scalar!(daf, "version") == nothing + @test delete_scalar!(daf, "depth") === nothing + @test delete_scalar!(daf, "version") === nothing nested_test("deleted") do test_missing_scalar(daf, depth + 1) return nothing @@ -147,8 +147,8 @@ function test_existing_scalar(daf::DafReader, depth::Int)::Nothing nested_test("must_exist") do nested_test("true") do - @test delete_scalar!(daf, "depth"; must_exist = true) == nothing - @test delete_scalar!(daf, "version"; must_exist = true) == nothing + @test delete_scalar!(daf, "depth"; must_exist = true) === nothing + @test delete_scalar!(daf, "version"; must_exist = true) === nothing nested_test("deleted") do test_missing_scalar(daf, depth + 1) return nothing @@ -156,8 +156,8 @@ function test_existing_scalar(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_scalar!(daf, "depth"; must_exist = false) == nothing - @test delete_scalar!(daf, "version"; must_exist = false) == nothing + @test delete_scalar!(daf, "depth"; must_exist = false) === nothing + @test delete_scalar!(daf, "version"; must_exist = false) === nothing nested_test("deleted") do test_missing_scalar(daf, depth + 1) return nothing @@ -191,8 +191,8 @@ function test_existing_scalar(daf::DafReader, depth::Int)::Nothing end nested_test("true") do - @test set_scalar!(daf, "depth", depth + 1; overwrite = true) == nothing - @test set_scalar!(daf, "version", "1.0"; overwrite = true) == nothing + @test set_scalar!(daf, "depth", depth + 1; overwrite = true) === nothing + @test set_scalar!(daf, "version", "1.0"; overwrite = true) === nothing nested_test("overwritten") do test_existing_scalar(daf, depth + 1) return nothing @@ -253,7 +253,7 @@ function test_missing_axis(daf::DafReader, depth::Int)::Nothing end nested_test("nothing") do - @test get_axis(daf, "gene"; default = nothing) == nothing + @test get_axis(daf, "gene"; default = nothing) === nothing end end end @@ -279,15 +279,15 @@ function test_missing_axis(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_axis!(daf, "gene"; must_exist = false) == nothing + @test delete_axis!(daf, "gene"; must_exist = false) === nothing end end end nested_test("add_axis") do nested_test("unique") do - @test add_axis!(daf, "gene", GENE_NAMES) == nothing - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "gene", GENE_NAMES) === nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test axis_version_counter(daf, "gene") == depth - 1 @test axis_version_counter(daf, "cell") == depth - 1 nested_test("created") do @@ -349,8 +349,8 @@ function test_existing_axis(daf::DafReader, depth::Int)::Nothing nested_test("delete_axis!") do nested_test("()") do - @test delete_axis!(daf, "gene") == nothing - @test delete_axis!(daf, "cell") == nothing + @test delete_axis!(daf, "gene") === nothing + @test delete_axis!(daf, "cell") === nothing nested_test("deleted") do test_missing_axis(daf, depth + 1) return nothing @@ -359,8 +359,8 @@ function test_existing_axis(daf::DafReader, depth::Int)::Nothing nested_test("must_exist") do nested_test("true") do - @test delete_axis!(daf, "gene"; must_exist = true) == nothing - @test delete_axis!(daf, "cell"; must_exist = true) == nothing + @test delete_axis!(daf, "gene"; must_exist = true) === nothing + @test delete_axis!(daf, "cell"; must_exist = true) === nothing nested_test("deleted") do test_missing_axis(daf, depth + 1) return nothing @@ -368,8 +368,8 @@ function test_existing_axis(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_axis!(daf, "gene"; must_exist = false) == nothing - @test delete_axis!(daf, "cell"; must_exist = false) == nothing + @test delete_axis!(daf, "gene"; must_exist = false) === nothing + @test delete_axis!(daf, "cell"; must_exist = false) === nothing nested_test("deleted") do test_missing_axis(daf, depth + 1) return nothing @@ -513,7 +513,7 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing end nested_test("nothing") do - @test get_vector(daf, "gene", "marker"; default = nothing) == nothing + @test get_vector(daf, "gene", "marker"; default = nothing) === nothing end nested_test("scalar") do @@ -591,7 +591,7 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing names = (["A", "B", "C", "D"],), dimnames = ("gene",), ), - ) == nothing + ) === nothing end end end @@ -620,34 +620,34 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_vector!(daf, "gene", "marker"; must_exist = false) == nothing - @test delete_vector!(daf, "cell", "type"; must_exist = false) == nothing + @test delete_vector!(daf, "gene", "marker"; must_exist = false) === nothing + @test delete_vector!(daf, "cell", "type"; must_exist = false) === nothing end end end nested_test("set_vector!") do nested_test("scalar") do - @test set_vector!(daf, "gene", "marker", 1.0) == nothing + @test set_vector!(daf, "gene", "marker", 1.0) === nothing @test get_vector(daf, "gene", "marker") == [1.0, 1.0, 1.0, 1.0] - @test set_vector!(daf, "gene", "noisy", 0.0) == nothing + @test set_vector!(daf, "gene", "noisy", 0.0) === nothing @test get_vector(daf, "gene", "noisy") == [0.0, 0.0, 0.0, 0.0] - @test set_vector!(daf, "cell", "type", "TCell") == nothing + @test set_vector!(daf, "cell", "type", "TCell") === nothing @test get_vector(daf, "cell", "type") == ["TCell", "TCell", "TCell"] end nested_test("vector") do nested_test("dense") do - @test set_vector!(daf, "gene", "marker", MARKER_GENES_BY_DEPTH[depth]) == nothing - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]) == nothing + @test set_vector!(daf, "gene", "marker", MARKER_GENES_BY_DEPTH[depth]) === nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]) === nothing test_existing_vector(daf, depth + 1) return nothing end nested_test("sparse") do - @test set_vector!(daf, "gene", "marker", sparse_vector(MARKER_GENES_BY_DEPTH[depth])) == nothing + @test set_vector!(daf, "gene", "marker", sparse_vector(MARKER_GENES_BY_DEPTH[depth])) === nothing # TODO: When SparseArrays supports strings, test it. - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]) == nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]) === nothing test_existing_vector(daf, depth + 1) return nothing end @@ -676,13 +676,13 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing "gene", "marker", NamedArray(MARKER_GENES_BY_DEPTH[depth]; names = (GENE_NAMES,), dimnames = ("gene",)), - ) == nothing + ) === nothing @test set_vector!( daf, "cell", "type", NamedArray(CELL_TYPES_BY_DEPTH[depth]; names = (CELL_NAMES,), dimnames = ("cell",)), - ) == nothing + ) === nothing test_existing_vector(daf, depth + 1) return nothing end @@ -710,7 +710,7 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing "gene", "marker", NamedArray(MARKER_GENES_BY_DEPTH[depth]; names = (["A", "B", "C", "D"],), dimnames = ("gene",)), - ) == nothing + ) === nothing end end end @@ -726,7 +726,7 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing @test vector_version_counter(daf, "gene", "marker") == previous_version_counter + 1 previous_version_counter = vector_version_counter(daf, "cell", "type") - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) == nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) === nothing @test vector_version_counter(daf, "gene", "marker") == previous_version_counter + 1 test_existing_vector(daf, depth + 1) @@ -751,7 +751,7 @@ function test_missing_vector(daf::DafReader, depth::Int)::Nothing @test vector_version_counter(daf, "gene", "marker") == previous_version_counter + 1 previous_version_counter = vector_version_counter(daf, "cell", "type") - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) == nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) === nothing @test vector_version_counter(daf, "gene", "marker") == previous_version_counter + 1 test_existing_vector(daf, depth + 1) @@ -815,8 +815,8 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing nested_test("delete_vector!") do nested_test("()") do - @test delete_vector!(daf, "gene", "marker") == nothing - @test delete_vector!(daf, "cell", "type") == nothing + @test delete_vector!(daf, "gene", "marker") === nothing + @test delete_vector!(daf, "cell", "type") === nothing nested_test("deleted") do test_missing_vector(daf, depth + 1) return nothing @@ -825,8 +825,8 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing nested_test("must_exist") do nested_test("true") do - @test delete_vector!(daf, "gene", "marker"; must_exist = true) == nothing - @test delete_vector!(daf, "cell", "type"; must_exist = true) == nothing + @test delete_vector!(daf, "gene", "marker"; must_exist = true) === nothing + @test delete_vector!(daf, "cell", "type"; must_exist = true) === nothing nested_test("deleted") do test_missing_vector(daf, depth + 1) return nothing @@ -834,8 +834,8 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_vector!(daf, "gene", "marker"; must_exist = false) == nothing - @test delete_vector!(daf, "cell", "type"; must_exist = false) == nothing + @test delete_vector!(daf, "gene", "marker"; must_exist = false) === nothing + @test delete_vector!(daf, "cell", "type"; must_exist = false) === nothing nested_test("deleted") do test_missing_vector(daf, depth + 1) return nothing @@ -845,7 +845,7 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing end nested_test("delete_axis!") do - @test delete_axis!(daf, "gene") == nothing + @test delete_axis!(daf, "gene") === nothing test_missing_vector_axis(daf, depth + 1) return nothing end @@ -869,8 +869,8 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing end nested_test("true") do - @test set_vector!(daf, "gene", "marker", MARKER_GENES_BY_DEPTH[depth]; overwrite = true) == nothing - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) == nothing + @test set_vector!(daf, "gene", "marker", MARKER_GENES_BY_DEPTH[depth]; overwrite = true) === nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) === nothing nested_test("overwritten") do test_existing_vector(daf, depth + 1) return nothing @@ -907,7 +907,7 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing empty_vector .= MARKER_GENES_BY_DEPTH[depth] return 7 end == 7 - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) == nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) === nothing nested_test("overwritten") do test_existing_vector(daf, depth + 1) @@ -969,7 +969,7 @@ function test_existing_vector(daf::DafReader, depth::Int)::Nothing empty_nzval .= sparse.nzval return 7 end == 7 - @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) == nothing + @test set_vector!(daf, "cell", "type", CELL_TYPES_BY_DEPTH[depth]; overwrite = true) === nothing test_existing_vector(daf, depth + 1) return nothing end @@ -997,7 +997,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing """) has_matrix(daf, "cell", "gene", "UMIs") if daf isa DafWriter - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1012,7 +1012,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing """) matrix_names(daf, "cell", "gene") if daf isa DafWriter - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1027,7 +1027,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing """) get_matrix(daf, "cell", "gene", "UMIs") if daf isa DafWriter - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1045,7 +1045,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) delete_matrix!(daf, "cell", "gene", "UMIs") - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1058,7 +1058,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = true) - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1070,7 +1070,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false) - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1085,7 +1085,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]) - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1098,7 +1098,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; overwrite = false) - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1110,7 +1110,7 @@ function test_missing_matrix_axis(daf::DafReader, depth::Int)::Nothing missing axis: cell in the daf data: $(daf.name) """) set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; overwrite = true) - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing @test_throws dedent(""" missing axis: gene in the daf data: $(daf.name) @@ -1186,7 +1186,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing nested_test("default") do nested_test("missing") do - @test get_matrix(daf, "cell", "gene", "UMIs"; default = nothing) == nothing + @test get_matrix(daf, "cell", "gene", "UMIs"; default = nothing) === nothing end nested_test("scalar") do @@ -1434,17 +1434,17 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false) === nothing end end end nested_test("set_matrix!") do nested_test("scalar") do - @test set_matrix!(daf, "cell", "gene", "UMIs", 1.0; relayout = false) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", 1.0; relayout = false) === nothing @test get_matrix(daf, "cell", "gene", "UMIs"; relayout = false) == [1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0; 1.0 1.0 1.0 1.0] - @test set_matrix!(daf, "cell", "gene", "LogUMIs", 0.0; relayout = false) == nothing + @test set_matrix!(daf, "cell", "gene", "LogUMIs", 0.0; relayout = false) === nothing @test get_matrix(daf, "cell", "gene", "LogUMIs"; relayout = false) == [0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0] end @@ -1452,25 +1452,25 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing nested_test("matrix") do nested_test("relayout") do nested_test("dense") do - @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]) === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end nested_test("sparse") do - @test set_matrix!(daf, "cell", "gene", "UMIs", sparse_matrix_csc(UMIS_BY_DEPTH[depth])) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", sparse_matrix_csc(UMIS_BY_DEPTH[depth])) === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end nested_test("true") do - @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; relayout = true) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; relayout = true) === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end nested_test("false") do - @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; relayout = false) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", UMIS_BY_DEPTH[depth]; relayout = false) === nothing nested_test("exists") do test_existing_matrix(daf, depth + 1) @@ -1478,7 +1478,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1523,7 +1523,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing "gene", "UMIs", NamedArray(UMIS_BY_DEPTH[depth]; names = (CELL_NAMES, GENE_NAMES), dimnames = ("cell", "gene")), - ) == nothing + ) === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1536,7 +1536,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing "UMIs", NamedArray(UMIS_BY_DEPTH[depth]; names = (CELL_NAMES, GENE_NAMES), dimnames = ("cell", "gene")); relayout = true, - ) == nothing + ) === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1550,7 +1550,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing "UMIs", NamedArray(UMIS_BY_DEPTH[depth]; names = (CELL_NAMES, GENE_NAMES), dimnames = ("cell", "gene")); relayout = false, - ) == nothing + ) === nothing @test matrix_version_counter(daf, "cell", "gene", "UMIs") == previous_version_counter + 1 nested_test("exists") do @@ -1559,7 +1559,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1651,7 +1651,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1682,7 +1682,7 @@ function test_missing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -1756,8 +1756,8 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("!axes") do - @test delete_axis!(daf, "cell") == nothing - @test delete_axis!(daf, "gene") == nothing + @test delete_axis!(daf, "cell") === nothing + @test delete_axis!(daf, "gene") === nothing test_missing_matrix_axis(daf, depth + 1) return nothing end @@ -1777,8 +1777,8 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("!axes") do - @test delete_axis!(daf, "cell") == nothing - @test delete_axis!(daf, "gene") == nothing + @test delete_axis!(daf, "cell") === nothing + @test delete_axis!(daf, "gene") === nothing test_missing_matrix_axis(daf, depth + 1) return nothing end @@ -2014,7 +2014,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing nested_test("delete_matrix!") do nested_test("()") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; relayout = false) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; relayout = false) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2023,7 +2023,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing nested_test("must_exist") do nested_test("true") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = true, relayout = false) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = true, relayout = false) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2031,7 +2031,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false, relayout = false) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false, relayout = false) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2041,8 +2041,8 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("delete_axis!") do - @test delete_axis!(daf, "gene") == nothing - @test delete_axis!(daf, "cell") == nothing + @test delete_axis!(daf, "gene") === nothing + @test delete_axis!(daf, "cell") === nothing test_missing_matrix_axis(daf, depth + 1) return nothing end @@ -2069,7 +2069,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("true") do - @test set_matrix!(daf, "cell", "gene", "UMIs", 1; overwrite = true, relayout = false) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", 1; overwrite = true, relayout = false) === nothing @test get_matrix(daf, "cell", "gene", "UMIs"; relayout = false) == [1 1 1 1; 1 1 1 1; 1 1 1 1] end end @@ -2115,7 +2115,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing UMIS_BY_DEPTH[depth]; overwrite = true, relayout = true, - ) == nothing + ) === nothing nested_test("overwritten") do test_existing_relayout_matrix(daf, depth + 1) return nothing @@ -2131,7 +2131,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing UMIS_BY_DEPTH[depth]; overwrite = true, relayout = false, - ) == nothing + ) === nothing nested_test("overwritten") do test_existing_matrix(daf, depth + 1) return nothing @@ -2180,7 +2180,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -2253,7 +2253,7 @@ function test_existing_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -2329,8 +2329,8 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("!axes") do - @test delete_axis!(daf, "cell") == nothing - @test delete_axis!(daf, "gene") == nothing + @test delete_axis!(daf, "cell") === nothing + @test delete_axis!(daf, "gene") === nothing test_missing_matrix_axis(daf, depth + 1) return nothing end @@ -2574,7 +2574,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing nested_test("delete_matrix!") do nested_test("relayout") do nested_test("default") do - @test delete_matrix!(daf, "gene", "cell", "UMIs") == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs") === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2582,7 +2582,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("true") do - @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = true) == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = true) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2590,7 +2590,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) === nothing nested_test("deleted") do test_existing_matrix(daf, depth) return nothing @@ -2600,7 +2600,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing nested_test("must_exist") do nested_test("true") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = true) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = true) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2608,7 +2608,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("false") do - @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false) == nothing + @test delete_matrix!(daf, "cell", "gene", "UMIs"; must_exist = false) === nothing nested_test("deleted") do test_missing_matrix(daf, depth + 1) return nothing @@ -2618,8 +2618,8 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("delete_axis!") do - @test delete_axis!(daf, "gene") == nothing - @test delete_axis!(daf, "cell") == nothing + @test delete_axis!(daf, "gene") === nothing + @test delete_axis!(daf, "cell") === nothing test_missing_matrix_axis(daf, depth + 1) return nothing end @@ -2646,7 +2646,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("true") do - @test set_matrix!(daf, "cell", "gene", "UMIs", 1; overwrite = true, relayout = false) == nothing + @test set_matrix!(daf, "cell", "gene", "UMIs", 1; overwrite = true, relayout = false) === nothing @test get_matrix(daf, "cell", "gene", "UMIs"; relayout = false) == [1 1 1 1; 1 1 1 1; 1 1 1 1] end end @@ -2692,7 +2692,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing UMIS_BY_DEPTH[depth]; overwrite = true, relayout = true, - ) == nothing + ) === nothing nested_test("overwritten") do test_existing_relayout_matrix(daf, depth + 1) return nothing @@ -2708,10 +2708,10 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing UMIS_BY_DEPTH[depth]; overwrite = true, relayout = false, - ) == nothing + ) === nothing nested_test("delete") do - @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) === nothing test_existing_matrix(daf, depth + 1) return nothing end @@ -2724,7 +2724,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing for the rows axis: gene and the columns axis: cell in the daf data: $(daf.name) - """) relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + """) relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing end nested_test("false") do @@ -2733,11 +2733,13 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing for the rows axis: gene and the columns axis: cell in the daf data: $(daf.name) - """) relayout_matrix!(daf, "cell", "gene", "UMIs"; overwrite = false) == nothing + """) relayout_matrix!(daf, "cell", "gene", "UMIs"; overwrite = false) === + nothing end nested_test("true") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs"; overwrite = true) == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs"; overwrite = true) === + nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -2780,7 +2782,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing empty_matrix .= UMIS_BY_DEPTH[depth] return 7 end == 7 - @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) === nothing nested_test("overwritten") do test_existing_matrix(daf, depth + 1) @@ -2788,7 +2790,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -2854,7 +2856,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing empty_nzval .= sparse.nzval return 7 end == 7 - @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) == nothing + @test delete_matrix!(daf, "gene", "cell", "UMIs"; relayout = false) === nothing nested_test("overwritten") do test_existing_matrix(daf, depth + 1) @@ -2862,7 +2864,7 @@ function test_existing_relayout_matrix(daf::DafReader, depth::Int)::Nothing end nested_test("relayout") do - @test relayout_matrix!(daf, "cell", "gene", "UMIs") == nothing + @test relayout_matrix!(daf, "cell", "gene", "UMIs") === nothing test_existing_relayout_matrix(daf, depth + 1) return nothing end @@ -2894,8 +2896,8 @@ function test_format(daf::DafWriter) end nested_test("axis") do - @test add_axis!(daf, "gene", GENE_NAMES) == nothing - @test add_axis!(daf, "cell", CELL_NAMES) == nothing + @test add_axis!(daf, "gene", GENE_NAMES) === nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing test_missing_vector(daf, 1) return nothing end @@ -2908,8 +2910,8 @@ function test_format(daf::DafWriter) end nested_test("axes") do - @test add_axis!(daf, "cell", CELL_NAMES) == nothing - @test add_axis!(daf, "gene", GENE_NAMES) == nothing + @test add_axis!(daf, "cell", CELL_NAMES) === nothing + @test add_axis!(daf, "gene", GENE_NAMES) === nothing test_missing_matrix(daf, 1) return nothing end diff --git a/test/matrix_layouts.jl b/test/matrix_layouts.jl index 5343cb9..aa40acd 100644 --- a/test/matrix_layouts.jl +++ b/test/matrix_layouts.jl @@ -10,7 +10,7 @@ nested_test("matrix_layouts") do nested_test("other") do @test other_axis(Rows) == Columns @test other_axis(Columns) == Rows - @test other_axis(nothing) == nothing + @test other_axis(nothing) === nothing @test_throws "invalid matrix axis: -1" other_axis(-1) end