Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused Tricks dependency #309

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Tricks = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"

[weakdeps]
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Expand Down Expand Up @@ -57,7 +56,6 @@ SpecialFunctions = "0.10.1, 1, 2"
StatsBase = "0.33, 0.34"
SymbolicUtils = "0.19, ^1.0.5"
TOML = "1"
Tricks = "0.1"
julia = "1.6"

[extras]
Expand Down
13 changes: 4 additions & 9 deletions src/DimensionalAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module DimensionalAnalysisModule

using DynamicExpressions: AbstractExpressionNode
using DynamicQuantities: Quantity, DimensionError, AbstractQuantity, uparse, constructorof
using Tricks: static_hasmethod

using ..CoreModule: Options, Dataset
using ..UtilsModule: safe_call
Expand Down Expand Up @@ -130,7 +129,7 @@ end
l.violates && return l
!isfinite(l) && return W(one(Q), false, true)

static_hasmethod(op, Tuple{W}) && @maybe_return_call(W, op, (l,))
hasmethod(op, Tuple{W}) && @maybe_return_call(W, op, (l,))
l.wildcard && return W(Quantity(op(ustrip(l))::T), false, false)
return W(one(Q), false, true)
end
Expand All @@ -140,13 +139,9 @@ end
l.violates && return l
r.violates && return r
(!isfinite(l) || !isfinite(r)) && return W(one(Q), false, true)
static_hasmethod(op, Tuple{W,W}) && @maybe_return_call(W, op, (l, r))
static_hasmethod(op, Tuple{T,W}) &&
l.wildcard &&
@maybe_return_call(W, op, (ustrip(l), r))
static_hasmethod(op, Tuple{W,T}) &&
r.wildcard &&
@maybe_return_call(W, op, (l, ustrip(r)))
hasmethod(op, Tuple{W,W}) && @maybe_return_call(W, op, (l, r))
hasmethod(op, Tuple{T,W}) && l.wildcard && @maybe_return_call(W, op, (ustrip(l), r))
hasmethod(op, Tuple{W,T}) && r.wildcard && @maybe_return_call(W, op, (l, ustrip(r)))
l.wildcard &&
r.wildcard &&
return W(Quantity(op(ustrip(l), ustrip(r))::T), false, false)
Expand Down