sepandhaghighi / pycm

Multi-class confusion matrix library in Python
http://pycm.io
MIT License
1.45k stars 124 forks source link

Deprecation Decorator #505

Closed sadrasabouri closed 1 year ago

sadrasabouri commented 1 year ago

Reference Issues/PRs

499

What does this implement/fix? Explain your changes.

You can now use a deprecated decorator for those functions which will be removed in future releases to warn users to change their use-cases. It may need more complex structures like function suggestion mapping, etc., which look far from this PR's scope. To wrap up the change is:

Any other comments?

I tested it locally for __len__method and it works fine:

from pycm import ConfusionMatrix
cm  = ConfusionMatrix([0, 1, 0, 1], [1, 1, 1, 1])
len(cm)
/home/sadra/local/pycm/tmp.py:3: DeprecationWarning: `__len__` function is deprecated and may be removed in future releases.
  len(cm)
codecov[bot] commented 1 year ago

Codecov Report

Merging #505 (ff8a1ca) into dev (a9abd61) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #505      +/-   ##
==========================================
+ Coverage   99.31%   99.31%   +0.01%     
==========================================
  Files          13       13              
  Lines        3024     3031       +7     
  Branches      451      451              
==========================================
+ Hits         3003     3010       +7     
  Misses          8        8              
  Partials       13       13              
Impacted Files Coverage Δ
pycm/pycm_param.py 100.00% <100.00%> (ø)
pycm/pycm_util.py 99.71% <100.00%> (+0.01%) :arrow_up: