Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _excavate_misanthropes(self):
"""Recognizes cases of characters who dislike many other characters."""
misanthropes = []
threshold_for_misanthropy = self.simulation.config.minimum_number_of_disliked_people_to_be_misanthrope
for person in self.simulation.town.residents:
number_of_disliked_people = len([p for p in person.relationships if person.dislikes(p)])
if number_of_disliked_people >= threshold_for_misanthropy:
misanthropes.append(Misanthropy(subjects=(person,)))
return misanthropes