diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 605c1fbc6c6..d04a0bcf62d 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -7517,10 +7517,11 @@ def merge(left, right, *args, **kwargs): # a bit of fanciness to inject docstring with left parameter merge_doc = DataFrame.merge.__doc__ -idx = merge_doc.find("right") -merge.__doc__ = "".join( - [merge_doc[:idx], "\n\tleft : DataFrame\n\t", merge_doc[idx:]] -) +if merge_doc is not None: + idx = merge_doc.find("right") + merge.__doc__ = "".join( + [merge_doc[:idx], "\n\tleft : DataFrame\n\t", merge_doc[idx:]] + ) def _align_indices(lhs, rhs): diff --git a/python/cudf/cudf/utils/docutils.py b/python/cudf/cudf/utils/docutils.py index a4c35d0459a..57ad612846d 100644 --- a/python/cudf/cudf/utils/docutils.py +++ b/python/cudf/cudf/utils/docutils.py @@ -27,6 +27,8 @@ def docfmt(**kwargs): def outer(fn): buf = [] + if fn.__doc__ is None: + return fn formatsiter = string.Formatter().parse(fn.__doc__) for literal, field, fmtspec, conv in formatsiter: assert conv is None @@ -44,7 +46,6 @@ def outer(fn): buf.extend([indent + ln for ln in valuelines[1:]]) else: buf.append(kwargs[field]) - fn.__doc__ = "".join(buf) return fn