genomoncology / related

Nested Object Models in Python with dictionary, YAML, and JSON transformation support
MIT License
198 stars 15 forks source link

Fix cmp deprecation warnings, pass **kwargs to attrib #43

Open dequis opened 4 years ago

dequis commented 4 years ago

Since attrs 19.2.0, the 'cmp' argument is deprecated and shows the following:

fields.py:27: DeprecationWarning: The usage of `cmp` is deprecated
and will be removed on or after 2021-06-01.  Please use `eq` and
`order` instead.
    metadata=dict(key=key))

There was no processing of the argument other than passing it through, and the old default value (True) is equivalent to the current default of attrs (None, like cmp=True but without the warning)

This commit solves the problem by not passing cmp explicitly, but letting the user pass cmp (and get the deprecation warning, if they still rely on it and shouldn't) or pass the new arguments, eq and order.

So the behavior should remain the same, but deprecation warnings won't be raised by related, but by the users who actually pass an explicit True or False to cmp.

codecov-io commented 4 years ago

Codecov Report

Merging #43 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #43   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files           9        9           
  Lines         538      538           
=======================================
  Hits          535      535           
  Misses          3        3
Impacted Files Coverage Δ
src/related/fields.py 100% <100%> (ø) :arrow_up:

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 3799cde...ee0728a. Read the comment docs.

dequis commented 3 years ago

@imaurer hello! friendly reminder that this pull request exists!