coady / multimethod

Multiple argument dispatching.
https://coady.github.io/multimethod
Other
277 stars 24 forks source link

Employ function's inspect.Signature descriptor in lieu of dunder __annotations__ for overload calls. #15

Closed mierzejk closed 4 years ago

mierzejk commented 4 years ago

Overload call relies on function's __annotations__ to make up a list of predicates for arguments matching. Yet __annotations__ also includes return annotation if present, that should not provide a basis for the argument predicate list. The pull request replaces __annotations__ with more descriptive inspect.Signature.parameters, that is comprised of function arguments exclusively. That approach also solves the #14 issue.

codecov-commenter commented 4 years ago

Codecov Report

Merging #15 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #15   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          183       189    +6     
  Branches        34        36    +2     
=========================================
+ Hits           183       189    +6     
Impacted Files Coverage Δ
multimethod/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1bba115...1c11d88. Read the comment docs.

coady commented 4 years ago

Thanks!