Skip to content

Commit fe4d98f

Browse files
committed
removed todos and commnets per request
1 parent 1b6761b commit fe4d98f

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

fastcore/docscrape.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,48 +94,31 @@ def __str__(self):
9494

9595

9696
SECTIONS = 'Summary Extended Yields Receives Other Raises Warns Warnings See Also Notes References Examples Attributes Methods'.split()
97-
'''Named `numpydoc` sections see: https://numpydoc.readthedocs.io/en/latest/format.html#sections'''
9897

9998
PARAM_SECTIONS = {
100-
"Parameters",
101-
"Other Parameters",
102-
"Attributes",
103-
"Methods",
104-
"Raises",
105-
"Warns",
106-
"Yields",
107-
"Receives"
99+
"Parameters", "Other Parameters", "Attributes", "Methods",
100+
"Raises", "Warns", "Yields", "Receives"
108101
}
109-
'''Set of `numpydoc` sections which should support parameters via `Parameter`.'''
110-
111102

112103
class NumpyDocString(Mapping):
113104
"Parses a numpydoc string to an abstract representation"
114105
# See the NumPy Doc Manual https://numpydoc.readthedocs.io/en/latest/format.html>
115-
# TODO: flushout docstring
116106

117-
# NOTE: unclear why these are class variables
118107
sections = {o:[] for o in SECTIONS}
119108
sections['Summary'] = ['']
120-
121-
# NOTE: unclear why these are not included in `SECTIONS` given initialization above creates lists
122109
sections['Parameters'] = []
123110
sections['Returns'] = []
124-
125-
# NOTE: following above style, adding `param_sections` as class variable
126111
param_sections: set[str] = set(PARAM_SECTIONS)
127112

128113
def __init__(
129114
self, docstring,
130-
config=None, # TODO: figure this out
115+
config=None,
131116
supported_sections: list[str] | None = SECTIONS,
132117
supports_params: set[str] | None = PARAM_SECTIONS
133118
):
134119

135-
# If None, set to default supported set
136120
if supports_params is None: supports_params = set(PARAM_SECTIONS)
137121
else:
138-
# add missing to class variable
139122
missing = set(supports_params) - set(self.param_sections)
140123
for sec in missing: self.param_sections.add(sec)
141124

@@ -157,7 +140,7 @@ def __init__(
157140
self['Parameters'] = {o.name:o for o in self['Parameters']}
158141
if self['Returns']: self['Returns'] = self['Returns'][0]
159142

160-
# --- our patch: normalize ALL parameter-like sections ---
143+
# --- normalize ALL parameter-like sections ---
161144
for sec in supports_params:
162145
if sec in self._parsed_data:
163146
self._parsed_data[sec] = self._normalize_param_section(self._parsed_data[sec])

0 commit comments

Comments
 (0)