diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-02 22:39:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-02 22:39:27 +0200 |
commit | fd8537b23ce85be6f9dacb7806e791b7f902a206 (patch) | |
tree | ec46b9f3844cc71c9e47546bf991640e0226c33d /git/util.py | |
parent | df5c1cb715664fd7a98160844572cc473cb6b87c (diff) | |
parent | 51f4a1407ef12405e16f643f5f9d2002b4b52ab9 (diff) | |
download | gitpython-fd8537b23ce85be6f9dacb7806e791b7f902a206.tar.gz |
Merge pull request #523 from yarikoptic/enh-wraps
RF: use @functools.wraps within decorators instead of manual __name__ reassignment
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 |