validate_page_name

pyrcs.utils.validate_page_name(cls_instance, page_no, valid_page_no)[source]

Retrieves the valid page name corresponding to a given page number.

This method checks if the provided page_no is within the set of valid page numbers. If valid, it returns the name of the page associated with the specified page_no from the catalogue of the given cls_instance.

Parameters:
  • cls_instance (object) – An instance of the class that contains the page catalogue.

  • page_no (int | str) – The page number to validate, which can be an integer or a string representation of a number.

  • valid_page_no (set | list | tuple) – A collection of valid page numbers, which can be a set, list, or tuple containing the allowable page numbers.

Returns:

The validated page name associated with the given page_no in the class’s catalogue.

Return type:

str

See also

Examples for the methods:

  • Tunnels.collect_codes_by_page()

  • Tunnels.collect_codes_by_page()