:mod:`humphrey.core.person` =========================== .. currentmodule:: humphrey.core.person .. automodule:: humphrey.core.person Every person has a name which must be specified on initialization. The name may not be empty and may not consist only of whitespace. It is possible -and recommended- to store the IMDb ids of persons. The IMDb id is a 7-digit string and it will be used as the primary value to identify a person. Two persons are considered the same if they have the same IMDb id, regardless of their names:: >>> p1 = Person(u"Farrah Fawcett", imdb_id=u'0000396') >>> p2 = Person(u"Farrah Fawcett-Majors", imdb_id=u'0000396') >>> p1 == p2 True If they have no IMDb ids, their names will be checked. A comparison between a person and a name is also valid:: >>> p = Person(u"Marlon Brando") >>> p == u"Marlon Brando" True Roles ----- Persons can take on directing and acting roles in movies. These roles are represented by classes which wrap person objects. The :class:`Director` class is for directing roles and the :class:`CastMember` class is for acting roles. A role object contains :attr:`Role.movie` and :attr:`Role.person` attributes to provide the connection between the movie and the person. There is also a :attr:`Role.position` attribute which is used for ordering the list of persons having that role. Role objects must be initialized with the person object they will wrap and can be checked for equality against the person they wrap:: >>> p = Person(u"Marlon Brando") >>> c = CastMember(p) >>> c == p True The movies in which a person is a director or a cast member can be accessed via the :attr:`Person.directed` and :attr:`Person.acted` attributes, respectively. Both these attributes are lists of :class:`CastMember` objects:: for role in person.acted: print role.movie.title print role.position API --- .. autoclass:: Person :members: .. autoclass:: Role :members: .. autoclass:: Director :show-inheritance: :members: .. autoclass:: CastMember :show-inheritance: :members: