RedHatProductSecurity / cvss

CVSS2/3/4 library with interactive calculator for Python 2 and Python 3
GNU Lesser General Public License v3.0
79 stars 28 forks source link

Add kwarg to sort CVSS JSON dict before returning it #32

Closed juspence closed 2 years ago

juspence commented 2 years ago

In some cases you can use json.dumps(my_dict, sort_keys=True), but this PR will support cases where the Python dict should be sorted while remaining a Python dict (so is not dumped to JSON format).

skontar commented 2 years ago

Hi! Thanks for the contribution.

Please write tests to cover the new functionality.

Also I believe that dictionaries maintain order only starting with Python 3.7, so I think it should check for Python version and if it is <3.7 throw NotImplementedError or maybe return OrderedDict?

skontar commented 2 years ago

@mprpic, are you planning to review this change?