You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The part of the library the computes the cache key fails: /home/rruel/.pyenv/versions/3.10.8/envs/test/lib/python3.10/site-packages/nemoize/memoize.py:87: TypeError =========================================================================================================================================================== short test summary info =========================================================================================================================================================== FAILED test_connection.py::test_connmanager_memoization - TypeError: unsupported operand type(s) for +=: 'int' and 'object'
If I do not use named parameters, everything works fine.
Ideally I would like the keys to be computed such that if a user requests a new instance, it shouldn't matter the ordering of kwargs, or a mix of named vs. unamed parameters,
The text was updated successfully, but these errors were encountered:
This solution for key generation seems to be working well:
# Bind args and kwargs to the memoized signature to get the actual arg names values that will be passed.
bound_args = inspect.signature(self._f).bind(*args, **kwargs)
# Build the cache key using the bound arguments.
key = ""
for k, v in bound_args.arguments.items():
key += str((self._arg_hash_func(k)))
key += str((self._arg_hash_func(v)))
key = hash(key)
If I memoize a class:
@memoize class TestManager:
And then use named parameters in the object construction:
test1 = TestManager("10.1.1.1", test_param="1.1.1.1")
The part of the library the computes the cache key fails:
/home/rruel/.pyenv/versions/3.10.8/envs/test/lib/python3.10/site-packages/nemoize/memoize.py:87: TypeError =========================================================================================================================================================== short test summary info =========================================================================================================================================================== FAILED test_connection.py::test_connmanager_memoization - TypeError: unsupported operand type(s) for +=: 'int' and 'object'
If I do not use named parameters, everything works fine.
Ideally I would like the keys to be computed such that if a user requests a new instance, it shouldn't matter the ordering of kwargs, or a mix of named vs. unamed parameters,
The text was updated successfully, but these errors were encountered: