Checkers package#
Submodules#
Base Check module#
Base Checker Class
This module defines the base checker class that each deparmtnet’s checker class will inherit from. Aditionally, using python’s builtin ‘getattr’ function, it allows for dynamic method calling. Avoiding the need to call each department’s method individually.
Example
To create a new checker class, you can inherit from BaseCheck and add your own ‘check’ and ‘fix’ methods to it.
- class MyDepartmentChecker(BaseCheck):
- def __init__(self):
super().__init__() # Add your check methods and condition managers to the data’s department dictionary pass
- def check_my_check(self):
# Your check logic here pass
- def fix_my_check(self, error_list):
# Your fix logic here pass
- class master_checker.checkers.basecheck.BaseCheck#
Bases:
object
Base Checker Class
This class is the base class for all department checker classes. It contains the basic structure and methods that each department’s checker class will inherit from.
- data#
Dictionary that holds each department checker and their respective methods
- Type:
dict
- objects_list#
List of objects to run the checks on
- Type:
list
- __init__()#
Base Checker Class Constructor
Initializes the data dictionary and the objects_list list
- check_all(public_nodes)#
Abstract method to run all checks defined in the data dictionary
Using python’s builtin ‘getattr’ function, this method allows for dynamic method calling. Formating the method name to call using the ‘check_’ prefix and the function name as the suffix. If the method is not implemented, it will print a message and skip it.
- Parameters:
public_nodes (list) – List of public nodes to run the checks on
- check_func(public_nodes, _func)#
Run specific department’s check method
Using python’s builtin ‘getattr’ function, this method allows for dynamic method calling. Formating the method name to call using the ‘check_’ prefix and the function name as the suffix. If the method is not implemented, it will print a message and skip it.
- Parameters:
public_nodes (list) – List of public nodes to run the check on
_func (string) – basname of the function to run
- fix_func(error_list, _func)#
Run specific department’s fix method
Using python’s builtin ‘getattr’ function, this method allows for dynamic method calling. Formating the method name to call using the ‘fix_’ prefix and the function name as the suffix. If the method is not implemented, it will print a message and skip it.
- Parameters:
error_list (list) – List of public nodes that fail the check
_func (string) – basname of the function to run
- update_object_list(scene_objects)#
Update the list of objects to run the checks on
- Parameters:
scene_objects (list) – List of objects to run the checks on