diff options
author | Yaroslav Halchenko <debian@onerussian.com> | 2016-10-02 11:17:36 -0400 |
---|---|---|
committer | Yaroslav Halchenko <debian@onerussian.com> | 2016-10-02 11:17:36 -0400 |
commit | 51f4a1407ef12405e16f643f5f9d2002b4b52ab9 (patch) | |
tree | 056a89bcfc54ba16a835ad5fcd3c73650bac170c /git/util.py | |
parent | b3b9c0242ba2893231e0ab1c13fa2a0c8a9cfc59 (diff) | |
download | gitpython-51f4a1407ef12405e16f643f5f9d2002b4b52ab9.tar.gz |
RF: use @functools.wraps within decorators instead of manual __name__ reassignment
@wraps does more and does it right ;)
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/git/util.py b/git/util.py index 814cd7f4..9640a74f 100644 --- a/git/util.py +++ b/git/util.py @@ -14,6 +14,8 @@ import shutil import stat import time +from functools import wraps + from git.compat import is_win from gitdb.util import ( # NOQA make_sha, @@ -50,13 +52,13 @@ def unbare_repo(func): """Methods with this decorator raise InvalidGitRepositoryError if they encounter a bare repository""" + @wraps(func) def wrapper(self, *args, **kwargs): if self.repo.bare: raise InvalidGitRepositoryError("Method '%s' cannot operate on bare repositories" % func.__name__) # END bare method return func(self, *args, **kwargs) # END wrapper - wrapper.__name__ = func.__name__ return wrapper |