Skip to content

Commit

Permalink
Merge pull request #309 from MilesCranmer/remove-tricks
Browse files Browse the repository at this point in the history
refactor: remove unused Tricks dependency
  • Loading branch information
MilesCranmer committed Apr 27, 2024
2 parents 758f991 + 4acd63e commit 830e809
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
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

0 comments on commit 830e809

Please sign in to comment.