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_rivalries(self):
"""Recognize cases where mutual animosity exists between a pair of characters."""
rivalries = []
for person in self.simulation.town.residents:
for other_person in person.relationships:
if person.dislikes(other_person) and other_person.dislikes(person):
subjects = (person, other_person)
if not any(r for r in self.rivalries if set(r.subjects) == set(subjects)):
rivalries.append(Rivalry(subjects=subjects))
return rivalries