Skip to content
Snippets Groups Projects

Fix: sharedmethodcache didn't preserve docstrings

2 files
+ 6
2
Compare changes
  • Side-by-side
  • Inline

Files

+ 2
1
import os
import os
from collections.abc import Hashable
from collections.abc import Hashable
from functools import partial
from functools import partial, wraps
from itertools import chain
from itertools import chain
try:
try:
@@ -43,6 +43,7 @@ def sharedmethodcache(cache_id: str):
@@ -43,6 +43,7 @@ def sharedmethodcache(cache_id: str):
Of course, for this to be useful, said methods must have the same signature (up to additional kwargs)
Of course, for this to be useful, said methods must have the same signature (up to additional kwargs)
and must return the same result when called with the same arguments."""
and must return the same result when called with the same arguments."""
def _decorator(user_method):
def _decorator(user_method):
 
@wraps(user_method)
def _decorated_func(self, *args, **kwargs):
def _decorated_func(self, *args, **kwargs):
objdict = self.__dict__
objdict = self.__dict__
cache = objdict.setdefault(cache_id, dict())
cache = objdict.setdefault(cache_id, dict())
Loading