Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b7174e

Browse files
committed
fix: python-openxml#375 import docx failure on --OO optimization
1 parent bdf4c36 commit 7b7174e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

docx/enum/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ def decorator(cls):
2828

2929

3030
class _DocsPageFormatter(object):
31-
"""
31+
"""Generate an .rst doc page for an enumeration.
32+
3233
Formats a RestructuredText documention page (string) for the enumeration
3334
class parts passed to the constructor. An immutable one-shot service
3435
object.
3536
"""
37+
3638
def __init__(self, clsname, clsdict):
3739
self._clsname = clsname
3840
self._clsdict = clsdict
@@ -52,14 +54,15 @@ def page_str(self):
5254

5355
@property
5456
def _intro_text(self):
55-
"""
56-
The docstring of the enumeration, formatted for use at the top of the
57-
documentation page
58-
"""
57+
"""Docstring of the enumeration, formatted for documentation page."""
5958
try:
6059
cls_docstring = self._clsdict['__doc__']
6160
except KeyError:
6261
cls_docstring = ''
62+
63+
if cls_docstring is None:
64+
return ''
65+
6366
return textwrap.dedent(cls_docstring).strip()
6467

6568
def _member_def(self, member):

0 commit comments

Comments
 (0)