def all_names(self) -> Set[str]:
retval = self.aliases.copy()
retval.add(self.identifier)
+ if self.email is not None:
+ retval.add(self.email)
return retval
def __eq__(self, other):
retval = self.people.copy()
for person in self.people.values():
- for alias in person.aliases:
- other_person = retval.get(alias)
- if other_person is not None:
- if alias in self.people:
+ for name in person.all_names:
+ other_person = retval.get(name)
+ if other_person is not None and other_person is not person:
+ alias_or_email = "alias"
+ if name == person.email:
+ alias_or_email = "email"
+ if name in self.people:
raise ConfigParseError(
- f"alias is not allowed to be the same as any"
- f" person's identifier: in person entry for "
- f"{person.identifier!r}: {alias!r} is also the "
+ f"{alias_or_email} is not allowed to be the same "
+ f"as any person's identifier: in person entry for "
+ f"{person.identifier!r}: {name!r} is also the "
f"identifier for person"
f" {other_person.identifier!r}")
raise ConfigParseError(
- f"alias is not allowed to be the same as another"
- f" person's alias: in person entry for "
- f"{person.identifier!r}: {alias!r} is also an alias "
- f"for person {other_person.identifier!r}")
- retval[alias] = person
+ f"{alias_or_email} is not allowed to be the same as "
+ f"another person's alias or email: in person entry "
+ f"for {person.identifier!r}: {name!r} is also an alias"
+ f" or email for person {other_person.identifier!r}")
+ retval[name] = person
return retval
@cached_property