99def deprecate (name , alternative , alt_name = None , klass = None ,
1010 stacklevel = 2 ):
1111 """
12-
13- Return a new function that emits a deprecation warning on use
12+ Return a new function that emits a deprecation warning on use.
1413
1514 Parameters
1615 ----------
@@ -22,8 +21,8 @@ def deprecate(name, alternative, alt_name=None, klass=None,
2221 Name to use in preference of alternative.__name__
2322 klass : Warning, default FutureWarning
2423 stacklevel : int, default 2
25-
2624 """
25+
2726 alt_name = alt_name or alternative .__name__
2827 klass = klass or FutureWarning
2928
@@ -35,7 +34,8 @@ def wrapper(*args, **kwargs):
3534
3635
3736def deprecate_kwarg (old_arg_name , new_arg_name , mapping = None , stacklevel = 2 ):
38- """Decorator to deprecate a keyword argument of a function
37+ """
38+ Decorator to deprecate a keyword argument of a function.
3939
4040 Parameters
4141 ----------
@@ -72,8 +72,8 @@ def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None, stacklevel=2):
7272 FutureWarning: old='yes' is deprecated, use new=True instead
7373 warnings.warn(msg, FutureWarning)
7474 yes!
75-
7675 """
76+
7777 if mapping is not None and not hasattr (mapping , 'get' ) and \
7878 not callable (mapping ):
7979 raise TypeError ("mapping from old to new argument values "
@@ -155,7 +155,12 @@ def __call__(self, func):
155155 return func
156156
157157 def update (self , * args , ** kwargs ):
158- "Assume self.params is a dict and update it with supplied args"
158+ """
159+ Update self.params with supplied args.
160+
161+ If called, we assume self.params is a dict.
162+ """
163+
159164 self .params .update (* args , ** kwargs )
160165
161166 @classmethod
@@ -215,16 +220,16 @@ def indent(text, indents=1):
215220
216221def make_signature (func ):
217222 """
218- Returns a string repr of the arg list of a func call, with any defaults
223+ Returns a string repr of the arg list of a func call, with any defaults.
219224
220225 Examples
221226 --------
222-
223227 >>> def f(a,b,c=2) :
224228 >>> return a*b*c
225229 >>> print(_make_signature(f))
226230 a,b,c=2
227231 """
232+
228233 spec = signature (func )
229234 if spec .defaults is None :
230235 n_wo_defaults = len (spec .args )
@@ -244,8 +249,8 @@ def make_signature(func):
244249
245250class docstring_wrapper (object ):
246251 """
247- decorator to wrap a function,
248- provide a dynamically evaluated doc-string
252+ Decorator to wrap a function and provide
253+ a dynamically evaluated doc-string.
249254
250255 Parameters
251256 ----------
0 commit comments