stefankoegl / python-json-patch

Applying JSON Patches in Python
https://python-json-patch.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
459 stars 97 forks source link

Declare json-patch operations as a class-based attribute #118

Closed tzoiker closed 3 years ago

tzoiker commented 4 years ago

I propose to declare available JSON-patch operations as class-based attributes rather than in the constructor.

Motivation:

Python 2.7 does not support MappingProxyType, so it should be handled with more care (due to dict mutability), although I suppose it is not much of a problem as python2.7 was deprecated.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.1%) to 65.846% when pulling 9310d48af5bfcde50f9b05fdd43deeafec11c805 on tzoiker:fix/json-patch-ops into f3c46e8d37833eb3cb7ff5f914d8dac85450fafb on stefankoegl:master.

tzoiker commented 4 years ago
  • the tests fail for most python versions

Fixed.

  • the diff contains a lot of unrelated changes which should be removed (possible whitespace-only changes)

I had to reorder JSONPatch and operations, otherwise, they are not found when JSONPatch is declared

stefankoegl commented 3 years ago

I just released version 1.28 with this change - thanks for your contribution!