@@ -36,21 +36,22 @@ def fill_doc(f):
3636 try :
3737 indented = docdict_indented [indent_count ]
3838 except KeyError :
39- indent = ' ' * indent_count
39+ indent = " " * indent_count
4040 docdict_indented [indent_count ] = indented = dict ()
4141
4242 for name , docstr in docdict .items ():
43- lines = [indent + line if k != 0 else line
44- for k , line in enumerate (docstr .strip ().splitlines ())]
45- indented [name ] = '\n ' .join (lines )
43+ lines = [
44+ indent + line if k != 0 else line
45+ for k , line in enumerate (docstr .strip ().splitlines ())
46+ ]
47+ indented [name ] = "\n " .join (lines )
4648
4749 try :
4850 f .__doc__ = docstring % indented
4951 except (TypeError , ValueError , KeyError ) as exp :
5052 funcname = f .__name__
51- funcname = docstring .split ('\n ' )[0 ] if funcname is None else funcname
52- raise RuntimeError ('Error documenting %s:\n %s'
53- % (funcname , str (exp )))
53+ funcname = docstring .split ("\n " )[0 ] if funcname is None else funcname
54+ raise RuntimeError ("Error documenting %s:\n %s" % (funcname , str (exp )))
5455
5556 return f
5657
@@ -115,12 +116,14 @@ def copy_doc(source):
115116 >>> print(B.m1.__doc__)
116117 Docstring for m1 this gets appended
117118 """
119+
118120 def wrapper (func ):
119121 if source .__doc__ is None or len (source .__doc__ ) == 0 :
120- raise ValueError (' Cannot copy docstring: docstring was empty.' )
122+ raise ValueError (" Cannot copy docstring: docstring was empty." )
121123 doc = source .__doc__
122124 if func .__doc__ is not None :
123125 doc += func .__doc__
124126 func .__doc__ = doc
125127 return func
128+
126129 return wrapper
0 commit comments