In our case, self.target_units is a dictionary that contains the required number of units for each building type. The selection itself is handled by our own custom_selection_func. Because the self.target_units is not a number, the warning about insufficient units is always printed, regardless of the actual numbers.
Here I added a condition that the warning should be printed only if self.target_units is a number. Other possibility is to print the warning only if custom_selection_func is not set.
In our case, self.target_units is a dictionary that contains the required number of units for each building type. The selection itself is handled by our own custom_selection_func. Because the self.target_units is not a number, the warning about insufficient units is always printed, regardless of the actual numbers.
Here I added a condition that the warning should be printed only if self.target_units is a number. Other possibility is to print the warning only if custom_selection_func is not set.