From a8a61d61db0b00e0b397c807ac8ca89e39a26c5b Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Fri, 5 Nov 2010 19:52:12 -0400 Subject: Fix docstrings for wsigfied methods. --- nova/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index e7892a212..d7ebe5b4c 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -21,6 +21,7 @@ System-level utilities and helper functions. """ import datetime +import functools import inspect import logging import os @@ -232,3 +233,10 @@ def utf8(value): return value.encode("utf-8") assert isinstance(value, str) return value + +def fix_wsgify_docstr(wsgified_func): + """A decorator to re-assign docstrings that webob.dec.wsgify clobbers.""" + @functools.wraps(wsgified_func.func) + def _f(*args, **kwargs): + wsgified_func(*args, **kwargs) + return _f -- cgit From 3b695e11da34247123ea919e71096e53393f227b Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 11 Nov 2010 19:52:36 -0600 Subject: Added a .mailmap that maps addresses in bzr to people's real, preferred e-mail addresses. (I made a few guesses along the way, feel free to adjust according to what is actually the preferred e-mail) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a couple of methods to nova.utils to parse said .mailmap and do the appropriate (though highly naïve) replacement. Apply mailmap replacement in changelog generation in setup.py. Add a unit test that checks everyone is properly listed in Authors. Add sleepsonthefloor to Authors. If anyone knows the real name, please add it. --- nova/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index e7892a212..b63237c10 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -173,6 +173,22 @@ def isotime(at=None): def parse_isotime(timestr): return datetime.datetime.strptime(timestr, TIME_FORMAT) +def parse_mailmap(mailmap='.mailmap'): + mapping = {} + if os.path.exists(mailmap): + fp = open(mailmap, 'r') + for l in fp: + l = l.strip() + if not l.startswith('#') and ' ' in l: + canonical_email, alias = l.split(' ') + mapping[alias] = canonical_email + return mapping + +def str_dict_replace(s, mapping): + for s1, s2 in mapping.iteritems(): + s = s.replace(s1, s2) + return s + class LazyPluggable(object): """A pluggable backend loaded lazily based on some value.""" -- cgit From f2c84807600dd49458e7b342b70a4bb8f1bb2232 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Mon, 15 Nov 2010 14:43:50 -0500 Subject: pep8 --- nova/utils.py | 1 + 1 file changed, 1 insertion(+) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index d7ebe5b4c..1207f52a4 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -234,6 +234,7 @@ def utf8(value): assert isinstance(value, str) return value + def fix_wsgify_docstr(wsgified_func): """A decorator to re-assign docstrings that webob.dec.wsgify clobbers.""" @functools.wraps(wsgified_func.func) -- cgit From f3744b0de85a1bc5be77f37a770144d3244bca86 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Mon, 15 Nov 2010 19:13:45 -0500 Subject: Change how wsgified doc wrapping happens to fix test. --- nova/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 1207f52a4..d074cab75 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -237,7 +237,6 @@ def utf8(value): def fix_wsgify_docstr(wsgified_func): """A decorator to re-assign docstrings that webob.dec.wsgify clobbers.""" - @functools.wraps(wsgified_func.func) - def _f(*args, **kwargs): - wsgified_func(*args, **kwargs) - return _f + wsgified_func.__doc__ = wsgified_func.func.__doc__ + wsgified_func.func_name = wsgified_func.func.func_name + return wsgified_func -- cgit From ff3ec33010ce8ece87523f7cf3ef2e4a0a23006e Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Mon, 15 Nov 2010 21:08:08 -0500 Subject: The docs are just going to be wrong for now. I'll file a bug upstream. --- nova/utils.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index d074cab75..2970b93bb 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -233,10 +233,3 @@ def utf8(value): return value.encode("utf-8") assert isinstance(value, str) return value - - -def fix_wsgify_docstr(wsgified_func): - """A decorator to re-assign docstrings that webob.dec.wsgify clobbers.""" - wsgified_func.__doc__ = wsgified_func.func.__doc__ - wsgified_func.func_name = wsgified_func.func.func_name - return wsgified_func -- cgit From 3df7b85265b123080387f1a844e067026410a9bc Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Tue, 23 Nov 2010 21:58:46 +0100 Subject: Address pep8 complaints. --- nova/utils.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nova/utils.py') diff --git a/nova/utils.py b/nova/utils.py index 820d5bb8a..142584df8 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -174,6 +174,7 @@ def isotime(at=None): def parse_isotime(timestr): return datetime.datetime.strptime(timestr, TIME_FORMAT) + def parse_mailmap(mailmap='.mailmap'): mapping = {} if os.path.exists(mailmap): @@ -185,6 +186,7 @@ def parse_mailmap(mailmap='.mailmap'): mapping[alias] = canonical_email return mapping + def str_dict_replace(s, mapping): for s1, s2 in mapping.iteritems(): s = s.replace(s1, s2) -- cgit