@@ -281,7 +281,13 @@ def test_deprecated_functions(module, prefix):
281281 ct .TransferFunction : ct .tf ,
282282}
283283
284+ #
284285# List of arguments described in class docstrings
286+ #
287+ # These are the minimal arguments needed to initialized the class. Optional
288+ # arguments should be documented in the factory functions and do not need
289+ # to be duplicated in the class documentation.
290+ #
285291class_args = {
286292 fs .FlatSystem : ['forward' , 'reverse' ],
287293 ct .FrequencyResponseData : ['response' , 'omega' , 'dt' ],
@@ -291,15 +297,27 @@ def test_deprecated_functions(module, prefix):
291297 ct .TransferFunction : ['num' , 'den' , 'dt' ],
292298}
293299
294- # List of attributes defined for all I/O systems
300+ #
301+ # List of attributes described in class docstrings
302+ #
303+ # This is the list of attributes for the class that are not already listed
304+ # as parameters used to inialize the class. These should all be defined
305+ # in the class docstring.
306+ #
307+ # Attributes that are part of all I/O system classes should be listed in
308+ # `std_class_attributes`. Attributes that are not commonly needed are
309+ # defined as part of a parent class can just be documented there, and
310+ # should be listed in `iosys_parent_attributes` (these will be searched
311+ # using the MRO).
312+
295313std_class_attributes = [
296314 'ninputs' , 'noutputs' , 'input_labels' , 'output_labels' , 'name' , 'shape' ]
297315
298316# List of attributes defined for specific I/O systems
299317class_attributes = {
300318 fs .FlatSystem : [],
301319 ct .FrequencyResponseData : [],
302- ct .NonlinearIOSystem : [],
320+ ct .NonlinearIOSystem : ['nstates' , 'state_labels' ],
303321 ct .StateSpace : ['nstates' , 'state_labels' ],
304322 ct .TransferFunction : [],
305323}
@@ -312,13 +330,22 @@ def test_deprecated_functions(module, prefix):
312330 'params' , 'outfcn' , 'updfcn' # NL I/O, SS overlap
313331]
314332
333+ #
315334# List of arguments described (only) in factory function docstrings
316- std_factory_args = ['inputs' , 'outputs' , 'name' ]
335+ #
336+ # These lists consist of the arguments that should be documented in the
337+ # factory functions and should not be duplicated in the class
338+ # documentation, even though in some cases they are actually processed in
339+ # the class __init__ function.
340+ #
341+ std_factory_args = [
342+ 'inputs' , 'outputs' , 'name' , 'input_prefix' , 'output_prefix' ]
343+
317344factory_args = {
318- fs .flatsys : [],
345+ fs .flatsys : ['states' , 'state_prefix' ],
319346 ct .frd : ['sys' ],
320- ct .nlsys : [],
321- ct .ss : ['sys' , 'states' ],
347+ ct .nlsys : ['state_prefix' ],
348+ ct .ss : ['sys' , 'states' , 'state_prefix' ],
322349 ct .tf : ['sys' ],
323350}
324351
@@ -343,7 +370,7 @@ def test_iosys_primary_classes(cls, fcn, args):
343370 f"{ cls .__name__ } does not reference factory function "
344371 f"{ fcn .__name__ } " )
345372
346- # Make sure we don't reference parameters in the factory function
373+ # Make sure we don't reference parameters from the factory function
347374 for argname in factory_args [fcn ]:
348375 if re .search (f"[\\ s]+{ argname } (, .*)*[\\ s]*:" , docstring ) is not None :
349376 pytest .fail (
@@ -448,7 +475,7 @@ def test_iosys_factory_functions(fcn):
448475 list (class_factory_function .values ()).index (fcn )]
449476
450477 # Make sure we reference parameters in class and factory function docstring
451- for argname in class_args [cls ] + factory_args [fcn ]:
478+ for argname in class_args [cls ] + std_factory_args + factory_args [fcn ]:
452479 _check_parameter_docs (fcn .__name__ , argname , docstring )
453480
454481 # Make sure we don't reference any class attributes
@@ -516,4 +543,3 @@ def _check_parameter_docs(
516543 pytest .fail (f"{ funcname } '{ argname } ' documented twice" )
517544
518545 return True
519-
0 commit comments