Ë
    |`æ  ã                   ój   — d Z ddlmZmZmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZmZmZ  G d„ de«      Zy)	z^
This module provides the Character class, used to store information about
a given character.
é    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literals)Údeepcopy)ÚIMDbParserError)Ú
_ContainerÚanalyze_nameÚ
build_nameÚ	cmpPeopleÚflattenc                   óŒ   — e Zd ZdZdZdddddddddddddœZdZeZd	„ Z	d
„ Z
d„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZeZd„ Zd„ Zd„ Zd„ Zy)Ú	CharacteraN  A Character.

    Every information about a character can be accessed as::

        characterObject['information']

    to get a list of the kind of information stored in a
    Character object, use the keys() method; some useful aliases
    are defined (as "also known as" for the "akas" key);
    see the keys_alias dictionary.
    )ÚmainÚfilmographyÚ	biographyr   ÚakasÚquotesÚkeywords)zmini biographyÚbiozcharacter biographyzcharacter biographiesÚbiographieszcharacter bioÚakazalso known aszalternate nameszpersonal quotesÚkeysÚkeyword)r   r   c                 óÄ   — |j                  d«      }|rd| j                  vr| j                  |«       |j                  dd«      | _        |j                  dd«      | _        y)aî  Initialize a Character object.

        *characterID* -- the unique identifier for the character.
        *name* -- the name of the Character, if not in the data dictionary.
        *myName* -- the nickname you use for this character.
        *myID* -- your personal id for this character.
        *data* -- a dictionary used to initialize the object.
        *notes* -- notes about the given character.
        *accessSystem* -- a string representing the data access system used.
        *titlesRefs* -- a dictionary with references to movies.
        *namesRefs* -- a dictionary with references to persons.
        *charactersRefs* -- a dictionary with references to characters.
        *modFunct* -- function called returning text fields.
        ÚnameÚcharacterIDNÚmyNameÚ )ÚgetÚdataÚset_namer   r   )ÚselfÚkwdsr   s      ú0/usr/lib/python3/dist-packages/imdb/Character.pyÚ_initzCharacter._initA   sQ   € ð �x‰x˜ÓˆÙ�F $§)¡)Ñ+Ø�M‰M˜$ÔØŸ8™8 M°4Ó8ˆÔØ—h‘h˜x¨Ó,ˆ�ó    c                 ó    — d| _         d| _        y)zReset the Character object.Nr   )r   r   ©r#   s    r%   Ú_resetzCharacter._resetV   s   € àˆÔØˆ�r'   c                 óp   — 	 t        |«      }| j                  j                  |«       y# t        $ r Y yw xY w)zSet the name of the character.N)r
   r!   Úupdater   )r#   r   Úds      r%   r"   zCharacter.set_name[   s5   € ð	Ü˜TÓ"ˆAØ�I‰I×Ñ˜QÕøÜò 	Ùð	ús   ‚&) ©	5´5c                 óZ   — g }d| j                   v r|dgz  }d| j                   v r|dgz  }|S )z-Valid keys to append to the data.keys() list.r   úlong imdb nameÚheadshotzfull-size headshot)r!   )r#   Úaddkeyss     r%   Ú_additional_keyszCharacter._additional_keysc   s@   € àˆØ�T—Y‘YÑØÐ(Ð)Ñ)ˆGØ˜Ÿ™Ñ"ØÐ,Ð-Ñ-ˆGØˆr'   c                 óT   — d| j                   v r|dk(  rt        | j                   «      S y)zHandle special keys.r   r/   N)r!   r   )r#   Úkeys     r%   Ú_getitemzCharacter._getiteml   s+   € ð �T—Y‘YÑØÐ&Ò&Ü! $§)¡)Ó,Ð,Ør'   c                 ó   — | j                   S )zReturn the characterID.)r   r)   s    r%   ÚgetIDzCharacter.getIDt   s   € à×ÑÐr'   c                 óJ   — t        | j                  j                  d«      «      S )zBThe Character is "false" if the self.data does not contain a name.r   )Úboolr!   r    r)   s    r%   Ú__bool__zCharacter.__bool__x   s   € ô �D—I‘I—M‘M &Ó)Ó*Ð*r'   c                 ó`  — ddl m } ddlm} t        ||«      r;t        | j                  d|¬«      D ]  }|j                  |j                  «      sŒ y yt        ||«      r1t        | j                  d|¬«      D ]  }|j                  |«      sŒ y yt        |t        «      r|| j                  v S y)zrReturn true if this Character was portrayed in the given Movie
        or it was impersonated by the given Person.é   )ÚMovie)ÚPersonT)ÚyieldDictKeysÚscalarF)r=   r>   Ú
isinstancer   r!   ÚisSameÚcurrentRoleÚstr)r#   Úitemr=   r>   Úms        r%   Ú__contains__zCharacter.__contains__}   s¡   € õ 	!Ý"Ü�d˜FÔ#Ü˜TŸY™Y°dÀ5ÔIò  �Ø—;‘;˜qŸ}™}Õ-Ùð ð ô ˜˜eÔ$Ü˜TŸY™Y°dÀ5ÔIò  �Ø—;‘;˜q•>Ùð ð
 ô ˜œcÔ"Ø˜4Ÿ9™9Ð$Ð$Ør'   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
                  �| j
                  |j
                  k(  ryy)zKReturn true if two character have the same name
        and/or characterID.Fr   )Ú	canonicalT)rA   Ú	__class__r!   r   ÚaccessSystemr   )r#   Úothers     r%   Ú
isSameNamezCharacter.isSameNameŽ   sˆ   € ô ˜% §¡Ô0ØØ�T—Y‘YÑ 6¨U¯Z©ZÑ#7Ü˜4Ÿ9™9°Ô6¼*ÀUÇZÁZÐ[`Ô:aÒaØØ×Ñ × 2Ñ 2Ò2Ø× Ñ Ð,Ø× Ñ  E×$5Ñ$5Ò5ØØr'   c                 óž  — t        d| j                  | j                  | j                  t	        | j
                  |«      | j                  | j                  t	        | j                  |«      t	        | j                  |«      t	        | j                  |«      ¬«
      }t        | j                  «      |_        |j                  | j                  «       |S )z+Return a deep copy of a Character instance.r   )
r   r   r   ÚmyIDr!   ÚnotesrK   Ú
titlesRefsÚ	namesRefsÚcharactersRefs)r   r   r   rO   r   r!   rP   rK   rQ   rR   rS   ÚlistÚcurrent_infoÚset_mod_functÚmodFunct)r#   ÚmemoÚcs      r%   Ú__deepcopy__zCharacter.__deepcopy__�   s–   € ä˜2¨4×+;Ñ+;Ø!Ÿ[™[¨t¯y©yÜ# D§I¡I¨tÓ4Ø ŸJ™J°T×5FÑ5FÜ!)¨$¯/©/¸4Ó!@Ü (¨¯©¸Ó >Ü%-¨d×.AÑ.AÀ4Ó%HôJˆô ˜d×/Ñ/Ó0ˆŒØ	�‰˜Ÿ™Ô&Øˆr'   c                 ó`   — d| j                   ›d| j                  ›d| j                  d«      ›d�S )z,String representation of a Character object.z<Character id:ú[z] name:_r   z_>)r   rK   r    r)   s    r%   Ú__repr__zCharacter.__repr__ª   s*   � ð ×Ó˜d×/Ó/°·±¸&Õ1Að
ð 	
r'   c                 ó&   — | j                  dd«      S )zSimply print the short name.r   r   )r    r)   s    r%   Ú__str__zCharacter.__str__°   s   € à�x‰x˜ Ó#Ð#r'   c                 ó  — | syd| j                  d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  }|S c c}w )z@Return a string with a pretty-printed summary for the character.r   zCharacter
=====
Name: %s
r   r   zBiography: %s
r   r   Né   zlong imdb canonical titlez%Last movies with this character: %s.
z; )r    Újoin)r#   Úsr   ÚfilmoÚxÚa_lists         r%   ÚsummaryzCharacter.summary´   sœ   € áØØ*¨T¯X©X°f¸bÓ-AÑAˆØ�h‰h�{Ó#ˆÙØÐ" S¨¡VÑ+Ñ+ˆAØ—‘˜Ó'ˆÙØFKÈBÈQÀiÖPÀ�a—e‘eÐ7¸Õ<ÐPˆFÐPØÐ9¸D¿I¹IÀfÓ<MÑMÑMˆAØˆùò Qs   ÁBN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údefault_infoÚ
keys_aliasÚkeys_tomodify_listr   ÚcmpFunctr&   r*   r"   r2   r5   r7   r:   rG   rM   ÚisSameCharacterrZ   r]   r_   rg   © r'   r%   r   r      s�   „ ñ
ð 8€Lð &ØØ*Ø!,Ø"Ø$ØØØ!Ø#ØØñ€Jð 1Ðà€Hò-ò*ò
òòò ò+ò
ò"ð !€Oòò
ò$ór'   r   N)rk   Ú
__future__r   r   r   r   Úcopyr   Úimdb._exceptionsr   Ú
imdb.utilsr	   r
   r   r   r   r   rq   r'   r%   ú<module>rv      s-   ðñ"÷
 SÓ Rå å ,ß OÕ Oôb�
õ br'   