Make HashablePartial work with partials (Pre Python 3.10)
Created by: inailuig
previously HashablePartial would error when the function passed to it was a partial (< Python 3.10):
from functools import partial
from netket.jax import HashablePartial
def f(a, b, c):
pass
g = partial(f, 2)
h = HashablePartial(g, 3)
h.__hash__()
AttributeError: 'functools.partial' object has no attribute '__code__'
This PR fixes this and adds the functionality that a functools.partial can be made hashable in terms of it's original args by wrapping it with a HashablePartial (< Python 3.10) i.e.
HashablePartial(partial(f, x)) == HashablePartial(f, x)