@@ -122,24 +122,32 @@ def __rename_nic(nic, name, transactions, cur_state):
122122 transactions .append ((nic .kname , name ))
123123
124124
125- def rename_logic ( static_rules ,
126- cur_state ,
127- last_state ,
128- old_state ):
125+ def rename_logic (static_rules , cur_state , last_state , old_state ):
129126 """
130127 Core logic of renaming the current state based on the rules and past state.
128+
131129 This function assumes all inputs have been suitably sanitised.
132- @param static_rules
130+
131+ Parameters
132+ ----------
133+ static_rules : list
133134 List of MACPCI objects representing rules
134- @param cur_state
135+ cur_state : list
135136 List of MACPCI objects representing the current state
136- @param last_state
137+ last_state : list
137138 List of MACPCI objects representing the last boot state
138- @param old_state
139+ old_state : list
139140 List of MACPCI objects representing the old state
140- @returns List of tuples...
141- @throws AssertionError (Should not be thrown, but better to know about logic
142- errors if they occur)
141+
142+ Returns
143+ -------
144+ list
145+ List of tuples representing name transactions.
146+
147+ Raises
148+ ------
149+ AssertionError
150+ Should not be thrown, but better to know about logic errors if they occur.
143151 """
144152
145153 transactions = []
@@ -365,26 +373,36 @@ def rename_logic( static_rules,
365373 util .niceformat (cur_state )))
366374 return transactions
367375
368- def rename ( static_rules ,
369- cur_state ,
370- last_state ,
371- old_state ):
376+ def rename (static_rules , cur_state , last_state , old_state ):
372377 """
373378 Rename current state based on the rules and past state.
374- This function sanitises the input and delegates the renaming logic to
375- __rename.
376- @param static_rules
379+
380+ This function sanitises the input and delegates the renaming logic to __rename.
381+
382+ Parameters
383+ ----------
384+ static_rules : list
377385 List of MACPCI objects representing rules
378- @param cur_state
386+ cur_state : list
379387 List of MACPCI objects representing the current state
380- @param last_state
388+ last_state : list
381389 List of MACPCI objects representing the last boot state
382- @param old_state
390+ old_state : list
383391 List of MACPCI objects representing the old state
384392
385- @throws StaticRuleError, CurrentStateError, LastStateError, TypeError
386-
387- @returns list of tuples of name changes required
393+ Returns
394+ -------
395+ list
396+ List of tuples of name changes required
397+
398+ Raises
399+ ------
400+ - StaticRuleError: If a static rule's kname is not None, tname does not start
401+ with 'eth', or if there are duplicate eth names or
402+ MAC addresses in static rules.
403+ - CurrentStateError: If the current state contains invalid entries.
404+ - LastStateError: If the last state contains invalid entries.
405+ - TypeError: If any of the input lists contain objects that are not MACPCI instances.
388406 """
389407
390408 if len (static_rules ):
0 commit comments