Skip to content

Commit 94cb58c

Browse files
authored
mark decorator with functools.wraps to copy attributes (brain-score#9)
following https://stackoverflow.com/a/1782888/2225200
1 parent 273052c commit 94cb58c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

result_caching/__init__.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
from collections import defaultdict, OrderedDict
2+
13
import inspect
24
import itertools
35
import logging
6+
import numpy as np
47
import os
58
import pickle
6-
from collections import defaultdict, OrderedDict
7-
from typing import Union
8-
9-
import numpy as np
109
import xarray as xr
10+
from functools import wraps
11+
from typing import Union
1112

1213

1314
def get_function_identifier(function, call_args):
@@ -65,6 +66,7 @@ def __init__(self, identifier_ignore=()):
6566
self._logger = logging.getLogger(_fullname(self))
6667

6768
def __call__(self, function):
69+
@wraps(function)
6870
def wrapper(*args, **kwargs):
6971
call_args = self.getcallargs(function, *args, **kwargs)
7072
function_identifier = self.get_function_identifier(function, call_args)

0 commit comments

Comments
 (0)