Ë
    |`¢*  ã                   óf   — d Z ddlmZmZmZmZ ddlmZ ddlm	Z	m
Z
mZmZmZmZmZ  G d„ de	«      Zy)zX
This module provides the Person class, used to store information about
a given person.
é    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literals)Údeepcopy)Ú
_ContainerÚanalyze_nameÚ
build_nameÚ	cmpPeopleÚflattenÚnormalizeNameÚcanonicalNamec                   ó^  — e Zd ZdZdZi dd“dd“dd“dd“d	d
“dd
“dd
“dd
“dd“dd“dd“dd“dd“dd“dd“dd“dd“i dd“dd“dd“d d“d!d"“d#d$“d%d&“d'd(“d)d(“d*d+“d,d-“d.d/“d0d1“d1d1“d2d1“d3d1“d4d5“¥d6d6d7d7d8d/d9œ¥Zd:Zd;ZeZ	d<„ Z
d=„ Zd>„ Zd?„ Zd@„ ZdA„ ZdB„ ZdC„ ZdD„ ZdE„ ZeZdF„ ZdG„ ZdH„ ZdI„ ZyJ)KÚPersonaH  A Person.

    Every information about a person can be accessed as::

        personObject['information']

    to get a list of the kind of information stored in a
    Person object, use the keys() method; some useful aliases
    are defined (as "biography" for the "mini biography" key);
    see the keys_alias dictionary.
    )ÚmainÚfilmographyÚ	biographyr   úmini biographyÚbioÚakaÚakaszalso known asz	nick namez
nick namesÚnicksÚnicknameÚ	nicknamesÚmiscellaneouscrewzmiscellaneous crewÚcrewmembersÚmiscÚguestznotable tv guest appearancesÚguestsztv guestzguest appearancesÚspousesÚspouseÚsalaryúsalary historyÚsalariesÚ
otherworksúother workszmaltin's biographyú2biography from leonard maltin's movie encyclopediazleonard maltin's biographyz	real namez
birth namezwhere are they nowú	where nowzpersonal quotesÚquoteszmini-biography authorzimdb mini-biography byzbiography authorÚgenreÚgenresÚ	portrayedúportrayed inÚkeysÚkeywordsÚ
trademarksú
trade markztrade marksÚ	trademarkÚ
pictorialsÚ	pictorialzmagazine cover photoÚepisodesÚarticle)zmagazine coverszmagazine-coversztv series episodesztv-series episodesÚarticlesÚkeyword)r   r!   r)   r&   r#   Útriviar1   ÚnewsÚbookszbiographical moviesr-   r(   Ú
interviewsr6   r'   Úheadshotc                 óò   — |j                  d«      }|rd| j                  vr| j                  |«       |j                  dd«      | _        |j                  dd«      | _        |j                  dd«      | _        y)a—  Initialize a Person object.

        *personID* -- the unique identifier for the person.
        *name* -- the name of the Person, if not in the data dictionary.
        *myName* -- the nickname you use for this person.
        *myID* -- your personal id for this person.
        *data* -- a dictionary used to initialize the object.
        *currentRole* -- a Character instance representing the current role
                         or duty of a person in this movie, or a Person
                         object representing the actor/actress who played
                         a given character in a Movie.  If a string is
                         passed, an object is automatically build.
        *roleID* -- if available, the characterID/personID of the currentRole
                    object.
        *roleIsPerson* -- when False (default) the currentRole is assumed
                          to be a Character object, otherwise a Person.
        *notes* -- notes about the given person for a specific movie
                    or role (e.g.: the alias used in the movie credits).
        *accessSystem* -- a string representing the data access system used.
        *titlesRefs* -- a dictionary with references to movies.
        *namesRefs* -- a dictionary with references to persons.
        *modFunct* -- function called returning text fields.
        *billingPos* -- position of this person in the credits list.
        ÚnameÚpersonIDNÚmyNameÚ Ú
billingPos)ÚgetÚdataÚset_namer@   rA   rC   )ÚselfÚkwdsr?   s      ú-/usr/lib/python3/dist-packages/imdb/Person.pyÚ_initzPerson._inite   sb   € ð2 �x‰x˜ÓˆÙ�F $§)¡)Ñ+Ø�M‰M˜$ÔØŸ™ ¨TÓ2ˆŒØ—h‘h˜x¨Ó,ˆŒØŸ(™( <°Ó6ˆ�ó    c                 ó.   — d| _         d| _        d| _        y)zReset the Person object.NrB   )r@   rA   rC   ©rG   s    rI   Ú_resetzPerson._reset…   s   € àˆŒØˆŒØˆ�rK   c                 ó   — d| _         y)zReset the dictionary.N)rC   rM   s    rI   Ú_clearzPerson._clear‹   s	   € àˆ�rK   c                 óT   — t        |d¬«      }| j                  j                  |«       y)zSet the name of the person.F©Ú	canonicalN)r	   rE   Úupdate)rG   r?   Úds      rI   rF   zPerson.set_name�   s    € ä˜¨Ô/ˆØ�	‰	×Ñ˜ÕrK   c                 ó\   — g }d| j                   v r|g d¢z  }d| j                   v r|dgz  }|S )z-Valid keys to append to the data.keys() list.r?   )úcanonical nameúlong imdb nameúlong imdb canonical namer=   úfull-size headshot©rE   )rG   Úaddkeyss     rI   Ú_additional_keyszPerson._additional_keys”   sA   € àˆØ�T—Y‘YÑØò 4ñ 4ˆGà˜Ÿ™Ñ"ØÐ,Ð-Ñ-ˆGØˆrK   c                 óª  — d| j                   v rr|dk(  rt        | j                   d   «      S |dk(  rt        | j                   d   «      S |dk(  rt        | j                   d¬«      S |dk(  rt        | j                   d¬«      S |dk(  r| j	                  «       S || j                   vr0|| j                   j                  d	i «      v r| j                   d	   |   S y
)zHandle special keys.r?   rW   rX   FrR   rY   TrZ   r   N)rE   r   r   r
   Úget_fullsizeURLrD   )rG   Úkeys     rI   Ú_getitemzPerson._getitemž   sË   € à�T—Y‘YÑØ�fŠ}Ü$ T§Y¡Y¨vÑ%6Ó7Ð7ØÐ(Ò(Ü$ T§Y¡Y¨vÑ%6Ó7Ð7ØÐ(Ò(Ü! $§)¡)°uÔ=Ð=ØÐ2Ò2Ü! $§)¡)°tÔ<Ð<ØÐ&Ò&Ø×'Ñ'Ó)Ð)Ø˜Ÿ	™	Ñ! c¨T¯Y©Y¯]©]¸=È"Ó-MÑ&MØ—9‘9˜]Ñ+¨CÑ0Ð0ØrK   c                 ó   — | j                   S )zReturn the personID.)r@   rM   s    rI   ÚgetIDzPerson.getID¯   s   € à�}‰}ÐrK   c                 ó   — d| j                   v S )z?The Person is "false" if the self.data does not contain a name.r?   r[   rM   s    rI   Ú__bool__zPerson.__bool__³   s   € ð ˜Ÿ™Ð"Ð"rK   c                 ó`  — ddl m } ddlm} t        ||«      r1t        | j                  d|¬«      D ]  }|j                  |«      sŒ y yt        ||«      r;t        | j                  d|¬«      D ]  }|j                  |j                  «      sŒ y yt        |t        «      r|| j                  v S y)zvReturn true if this Person has worked in the given Movie,
        or if the fiven Character was played by this Person.é   )ÚMovie)Ú	CharacterT)ÚyieldDictKeysÚscalarF)rh   ri   Ú
isinstancer   rE   ÚisSameÚcurrentRoleÚstr)rG   Úitemrh   ri   Úms        rI   Ú__contains__zPerson.__contains__¸   s¡   € õ 	!Ý(Ü�d˜EÔ"Ü˜TŸY™Y°dÀ5ÔIò  �Ø—;‘;˜q•>Ùð ð ô ˜˜iÔ(Ü˜TŸY™Y°dÀ5ÔIò  �Ø—;‘;˜qŸ}™}Õ-Ùð ð
 ô ˜œcÔ"Ø˜4Ÿ9™9Ð$Ð$ØrK   c                 óH  — t        || j                  «      syd| j                  v r>d|j                  v r0t        | j                  d¬«      t        |j                  d¬«      k(  ry| j                  |j                  k(  r&| j
                  r| j
                  |j
                  k(  ryy)z]Return true if two persons have the same name and imdbIndex
        and/or personID.
        Fr?   TrR   )rl   Ú	__class__rE   r
   ÚaccessSystemr@   )rG   Úothers     rI   Ú
isSameNamezPerson.isSameNameÉ   s�   € ô ˜% §¡Ô0ØØ�T—Y‘YÑØ˜%Ÿ*™*Ñ$Ü˜4Ÿ9™9°Ô5Ü˜5Ÿ:™:°Ô6ò7àØ×Ñ × 2Ñ 2Ò2Ø—’ $§-¡-°5·>±>Ò"AØØrK   c                 ó   — t        d| j                  | j                  | j                  t	        | j
                  |«      t	        | j                  |«      | j                  | j                  | j                  t	        | j                  |«      t	        | j                  |«      t	        | j                  |«      ¬«      }t        | j                  «      |_        |j                  | j                   «       | j"                  |_        |S )z(Return a deep copy of a Person instance.rB   )r?   r@   rA   ÚmyIDrE   rn   ÚroleIsPersonÚnotesru   Ú
titlesRefsÚ	namesRefsÚcharactersRefs)r   r@   rA   ry   r   rE   rn   Ú_roleIsPersonr{   ru   r|   r}   r~   ÚlistÚcurrent_infoÚset_mod_functÚmodFunctrC   )rG   ÚmemoÚps      rI   Ú__deepcopy__zPerson.__deepcopy__Û   s·   € ä˜ T§]¡]¸4¿;¹;ØŸ	™	¬°·±¸DÓ(AÜ'¨×(8Ñ(8¸$Ó?Ø $× 2Ñ 2ØŸ™°$×2CÑ2CÜ& t§¡¸Ó=Ü% d§n¡n°dÓ;Ü"*¨4×+>Ñ+>ÀÓ"EôGˆô ˜d×/Ñ/Ó0ˆŒØ	�‰˜Ÿ™Ô&Ø—‘ˆŒØˆrK   c                 ó`   — d| j                   ›d| j                  ›d| j                  d«      ›d�S )z)String representation of a Person object.z<Person id:ú[z] name:_rX   z_>)r@   ru   rD   rM   s    rI   Ú__repr__zPerson.__repr__ê   s)   � ð �M‹M˜4×,Ó,¨d¯h©hÐ7GÕ.Hð
ð 	
rK   c                 ó&   — | j                  dd«      S )zSimply print the short name.r?   rB   )rD   rM   s    rI   Ú__str__zPerson.__str__ñ   s   € à�x‰x˜ Ó#Ð#rK   c                 óÈ  — | syd| j                  dd«      z  }| j                  d«      }|r(|d|z  z  }| j                  d«      }|r|d|z  z  }|dz  }| j                  d	«      }|r(|d
|z  z  }| j                  d«      }|r|d|z  z  }|dz  }| j                  d«      }|r|d|d   z  z  }| j                  d«      }|r9|dd D �cg c]  }|j                  dd«      ‘Œ }	}|ddj                  |	«      z  z  }| j                  d«      xs | j                  d«      }
|
r9|
dd D �cg c]  }|j                  dd«      ‘Œ }}|ddj                  |«      z  z  }|S c c}w c c}w )z=Return a string with a pretty-printed summary for the person.rB   zPerson
=====
Name: %s
rY   z
birth datezBirth date: %szbirth notesz (%s)z.
z
death datezDeath date: %szdeath notesr   zBiography: %s
r   ÚdirectorNé   zlong imdb canonical titlezLast movies directed: %s.
z; ÚactorÚactressé   zLast movies acted: %s.
)rD   Újoin)rG   ÚsÚbdateÚbnotesÚddateÚdnotesr   r�   ÚxÚd_listÚactÚa_lists               rI   ÚsummaryzPerson.summaryõ   s–  € áØØ'¨$¯(©(Ð3MÈrÓ*RÑRˆØ—‘˜Ó&ˆÙØÐ! EÑ)Ñ)ˆAØ—X‘X˜mÓ,ˆFÙØ�W˜vÑ%Ñ%�Ø�‰JˆAØ—‘˜Ó&ˆÙØÐ! EÑ)Ñ)ˆAØ—X‘X˜mÓ,ˆFÙØ�W˜vÑ%Ñ%�Ø�‰JˆAØ�h‰hÐ'Ó(ˆÙØÐ" S¨¡VÑ+Ñ+ˆAØ—8‘8˜JÓ'ˆÙØFNÈrÐPQÀlÖSÀ�a—e‘eÐ7¸Õ<ÐSˆFÐSØÐ.°·±¸6Ó1BÑBÑBˆAØ�h‰h�wÓÒ6 4§8¡8¨IÓ#6ˆÙØFIÈ"È1ÀgÖNÀ�a—e‘eÐ7¸Õ<ÐNˆFÐNØÐ+¨d¯i©i¸Ó.?Ñ?Ñ?ˆAØˆùò Tùò Os   ÃEÄ&EN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údefault_infoÚ
keys_aliasÚkeys_tomodify_listÚ
_image_keyr   ÚcmpFunctrJ   rN   rP   rF   r]   ra   rc   re   rr   rw   ÚisSamePersonr†   r‰   r‹   rœ   © rK   rI   r   r      s<  „ ñ
ð 8€Lð)ØÐ%ð)àÐð)ð 	ˆvð)ð 	˜ð	)ð
 	�\ð)ð 	�ð)ð 	�Lð)ð 	�\ð)ð 	Ð1ð)ð 	Ð+ð)ð 	Ð$ð)ð 	Ð/ð)ð 	Ð0ð)ð 	Ð2ð)ð 	Ð;ð)ð  	�8ð!)ð" 	Ð"ñ#)ð$ 	Ð$ð%)ð& 	�mð')ð( 	ÐRð))ð* 	%Ð&Zð+)ð, 	�\ð-)ð. 	˜kð/)ð0 	˜8ð1)ð2 	 Ð!9ð3)ð4 	Ð4ð5)ð6 	�ð7)ð8 	�^ð9)ð: 	�
ð;)ð< 	�lð=)ð> 	�lð?)ð@ 	�|ðA)ðB 	�\ðC)ðD 	�kñE)ðF 2Ø1Ø(Ø(ØØòQ)€JðXÐð €Jà€Hò7ò@òòò
òò"ò#ò
ò"ð  €Lòò
ò$órK   r   N)r    Ú
__future__r   r   r   r   Úcopyr   Ú
imdb.utilsr   r	   r
   r   r   r   r   r   r§   rK   rI   ú<module>r«      s-   ðñ"÷
 SÓ Rå ç m× mÑ môvˆZõ vrK   