@@ -261,14 +261,26 @@ def extended_summary(self):
261
261
return " " .join (self .doc ["Summary" ])
262
262
return " " .join (self .doc ["Extended Summary" ])
263
263
264
- @property
265
- def doc_parameters (self ):
264
+ def _doc_parameters (self , sections ):
266
265
parameters = collections .OrderedDict ()
267
- for names , type_ , desc in self .doc ["Parameters" ]:
268
- for name in names .split (", " ):
269
- parameters [name ] = (type_ , desc )
266
+ for section in sections :
267
+ for names , type_ , desc in self .doc [section ]:
268
+ for name in names .split (", " ):
269
+ parameters [name ] = (type_ , desc )
270
270
return parameters
271
271
272
+ @property
273
+ def doc_parameters (self ):
274
+ return self ._doc_parameters (["Parameters" ])
275
+
276
+ @property
277
+ def doc_other_parameters (self ):
278
+ return self ._doc_parameters (["Other Parameters" ])
279
+
280
+ @property
281
+ def doc_all_parameters (self ):
282
+ return self ._doc_parameters (["Parameters" , "Other Parameters" ])
283
+
272
284
@property
273
285
def signature_parameters (self ):
274
286
def add_stars (param_name , info ):
@@ -307,22 +319,22 @@ def add_stars(param_name, info):
307
319
def parameter_mismatches (self ):
308
320
errs = []
309
321
signature_params = self .signature_parameters
310
- doc_params = tuple (self .doc_parameters )
311
- missing = set (signature_params ) - set (doc_params )
322
+ all_params = tuple (self .doc_all_parameters )
323
+ missing = set (signature_params ) - set (all_params )
312
324
if missing :
313
325
errs .append (error ("PR01" , missing_params = str (missing )))
314
- extra = set (doc_params ) - set (signature_params )
326
+ extra = set (all_params ) - set (signature_params )
315
327
if extra :
316
328
errs .append (error ("PR02" , unknown_params = str (extra )))
317
329
if (
318
330
not missing
319
331
and not extra
320
- and signature_params != doc_params
321
- and not (not signature_params and not doc_params )
332
+ and signature_params != all_params
333
+ and not (not signature_params and not all_params )
322
334
):
323
335
errs .append (
324
336
error (
325
- "PR03" , actual_params = signature_params , documented_params = doc_params
337
+ "PR03" , actual_params = signature_params , documented_params = all_params
326
338
)
327
339
)
328
340
@@ -333,7 +345,7 @@ def directives_without_two_colons(self):
333
345
return DIRECTIVE_PATTERN .findall (self .raw_doc )
334
346
335
347
def parameter_type (self , param ):
336
- return self .doc_parameters [param ][0 ]
348
+ return self .doc_all_parameters [param ][0 ]
337
349
338
350
@property
339
351
def see_also (self ):
@@ -542,7 +554,7 @@ def validate(obj_name):
542
554
# PR03: Wrong parameters order
543
555
errs += doc .parameter_mismatches
544
556
545
- for param , kind_desc in doc .doc_parameters .items ():
557
+ for param , kind_desc in doc .doc_all_parameters .items ():
546
558
if not param .startswith ("*" ): # Check can ignore var / kwargs
547
559
if not doc .parameter_type (param ):
548
560
if ":" in param :
0 commit comments