Skip to content

Commit 24e915e

Browse files
authored
Merge pull request #53 from haobibo/master
Allow extending NumpyDocString sections
2 parents c9b9634 + a3e6d6a commit 24e915e

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

numpydoc/docscrape.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pydoc
1010
from warnings import warn
1111
import collections
12+
import copy
1213
import sys
1314

1415

@@ -97,30 +98,32 @@ def __str__(self):
9798

9899

99100
class NumpyDocString(collections.Mapping):
101+
sections = {
102+
'Signature': '',
103+
'Summary': [''],
104+
'Extended Summary': [],
105+
'Parameters': [],
106+
'Returns': [],
107+
'Yields': [],
108+
'Raises': [],
109+
'Warns': [],
110+
'Other Parameters': [],
111+
'Attributes': [],
112+
'Methods': [],
113+
'See Also': [],
114+
'Notes': [],
115+
'Warnings': [],
116+
'References': '',
117+
'Examples': '',
118+
'index': {}
119+
}
120+
100121
def __init__(self, docstring, config={}):
101122
orig_docstring = docstring
102123
docstring = textwrap.dedent(docstring).split('\n')
103124

104125
self._doc = Reader(docstring)
105-
self._parsed_data = {
106-
'Signature': '',
107-
'Summary': [''],
108-
'Extended Summary': [],
109-
'Parameters': [],
110-
'Returns': [],
111-
'Yields': [],
112-
'Raises': [],
113-
'Warns': [],
114-
'Other Parameters': [],
115-
'Attributes': [],
116-
'Methods': [],
117-
'See Also': [],
118-
'Notes': [],
119-
'Warnings': [],
120-
'References': '',
121-
'Examples': '',
122-
'index': {}
123-
}
126+
self._parsed_data = copy.deepcopy(self.sections)
124127

125128
try:
126129
self._parse()

0 commit comments

Comments
 (0)