Tribler / anydex-core

The Universal Decentralized Exchange
GNU Lesser General Public License v3.0
9 stars 6 forks source link

Remove json_util.py since it's currently unneeded #62

Closed Solomon1732 closed 3 years ago

Solomon1732 commented 3 years ago

https://github.com/Tribler/anydex-core/blob/deeb9b32a22ad7b4da913c877b46cd60a3929998/anydex/util/json_util.py#L21 As it stands, this function unites a number of disparate functionalities. Not only that, but the functionalities depend on the type of the first parameter object. It might be possible for it to benefit from breaking it up via @functools.singledispatch. The single dispatch decorator operates on the first parameter's type, which looks to me to be what the function in question does.

The flip side is that I'm not sure about the performance costs of doing such a thing. Having a new branch can be a cheap way to test it, since a branch can always be ignored/deleted later on.

Even if single dispatch turns out to not be worth it, I still think that, for code maintenance, the function might benefit from breaking it up into sub-functions (which are then called from the "head" function).

Edit: If such a move will be deemed as beneficial I don't mind making a PR for it.

devos50 commented 3 years ago

Thanks for your suggestion! I'm not even sure if we want to keep that json_util file since it was mostly for Python 3 compatibility (when we migrated from Python 2).

devos50 commented 3 years ago

@Solomon1732 given the discussion in the Tribler repository, could you try to remove this file? 😃

Solomon1732 commented 3 years ago

Will be happy to! :smiley:

devos50 commented 3 years ago

Thank you!