
    KJiW+                     V    d 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dS )zX
This module provides the Person class, used to store information about
a given person.
    )deepcopy)
_Containeranalyze_name
build_namecanonicalName	cmpPeopleflattennormalizeNamec                   `   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dJS )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 biography2biography 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   triviar-   newsbookszbiographical moviesr)   r$   
interviewsr2   r#   headshotc                    |                     d          }|rd| j        vr|                     |           |                     dd          | _        |                     dd          | _        |                     dd          | _        dS )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<   r=   r?   )selfkwdsr;   s      K/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/imdb/Person.py_initzPerson._initk   s~    2 xx 	 F$)++MM$T22hhx,,((<66    c                 0    d| _         d| _        d| _        dS )zReset the Person object.Nr>   )r<   r=   r?   rC   s    rE   _resetzPerson._reset   s    rG   c                     d| _         dS )zReset the dictionary.N)r?   rI   s    rE   _clearzPerson._clear   s    rG   c                 \    t          |d          }| j                            |           dS )zSet the name of the person.F	canonicalN)r   rA   update)rC   r;   ds      rE   rB   zPerson.set_name   s0    ///	rG   c                 H    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 namer9   full-size headshotrA   )rC   addkeyss     rE   _additional_keyszPerson._additional_keys   sM    TY 4 4 4 4G"",--GrG   c                    d| j         v rx|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|                                 S || j         vrD| j                             d	i           }||v r| j         d	         |         S |d
k    rd|v r|d         S dS )zHandle special keys.r;   rS   rT   FrN   rU   TrV   r   actoractressN)rA   r
   r   r   get_fullsizeURLr@   )rC   keyr   s      rE   _getitemzPerson._getitem   s   TYf}}$TYv%6777((($TYv%6777(((!$)u====222!$)t<<<<&&&'')))	!!)--r::Kk!!y/44I$<$<"9--trG   c                     | j         S )zReturn the personID.)r<   rI   s    rE   getIDzPerson.getID   s
    }rG   c                     d| j         v S )z?The Person is "false" if the self.data does not contain a name.r;   rW   rI   s    rE   __bool__zPerson.__bool__   s     ""rG   c                 p   ddl m } ddlm} t          ||          r3t          | j        d|          D ]}|                    |          r dS nft          ||          r8t          | j        d|          D ]}|                    |j                  r dS  nt          |t                    r	|| j        v S dS )zvReturn true if this Person has worked in the given Movie,
        or if the fiven Character was played by this Person.   )	Character)MovieT)yieldDictKeysscalarF)rf   rg   
isinstancer	   rA   isSamecurrentRolestr)rC   itemrf   rg   ms        rE   __contains__zPerson.__contains__   s     	)(((((      dE"" 		%TYd5III    ;;q>>  44   i(( 	%TYd5III    ;;q}--  44   c"" 	%49$$urG   c                 
   t          || j                  sdS d| j        v r9d|j        v r0t          | j        d          t          |j        d          k    rdS | j        |j        k    r| j        r| j        |j        k    rdS dS )z]Return true if two persons have the same name and imdbIndex
        and/or personID.
        Fr;   TrN   )rj   	__class__rA   r   accessSystemr<   )rC   others     rE   
isSameNamezPerson.isSameName   s     %00 	5TY%*$$495555:6667 74 222 3"&-5>"A"A4urG   c                    t          d| j        | j        | j        t	          | j        |          t	          | j        |          | j        | j        | j	        t	          | j
        |          t	          | j        |          t	          | j        |                    }t          | j                  |_        |                    | j                   | j        |_        |S )z(Return a deep copy of a Person instance.r>   )r;   r<   r=   myIDrA   rl   roleIsPersonnotesrs   
titlesRefs	namesRefscharactersRefs)r   r<   r=   rw   r   rA   rl   _roleIsPersonry   rs   rz   r{   r|   listcurrent_infoset_mod_functmodFunctr?   )rC   memops      rE   __deepcopy__zPerson.__deepcopy__   s    T]4;	D(A(A'(8$?? $ 2$2C&t==%dnd;;"*4+>"E"EG G G d/00	&&&rG   c                 T    d| j         d| j        d|                     d          dS )z)String representation of a Person object.z<Person id:[z] name:_rT   z_>)r<   rs   r@   rI   s    rE   __repr__zPerson.__repr__   s9      MMM4,,,dhh7G.H.H.H.H
 	
rG   c                 .    |                      dd          S )zSimply print the short name.r;   r>   r@   rI   s    rE   __str__zPerson.__str__   s    xx###rG   c                    | sdS d|                      dd          z  }|                      d          }|r,|d|z  z  }|                      d          }|r|d|z  z  }|dz  }|                      d	          }|r,|d
|z  z  }|                      d          }|r|d|z  z  }|dz  }|                      d          }|r|d|d         z  z  }|                      d          }|r/d |dd         D             }|dd                    |          z  z  }|                      d          p|                      d          }	|	r/d |	dd         D             }
|dd                    |
          z  z  }|S )z=Return a string with a pretty-printed summary for the person.r>   zPerson
=====
Name: %s
rU   z
birth datezBirth date: %szbirth notesz (%s)z.
z
death datezDeath date: %szdeath notesr   zBiography: %s
r   directorc                 :    g | ]}|                     d d          S zlong imdb canonical titler>   r   .0xs     rE   
<listcomp>z"Person.summary.<locals>.<listcomp>  s'    SSSaee7<<SSSrG   N   zLast movies directed: %s.
z; r[   r\   c                 :    g | ]}|                     d d          S r   r   r   s     rE   r   z"Person.summary.<locals>.<listcomp>  s'    NNNaee7<<NNNrG      zLast movies acted: %s.
)r@   join)rC   sbdatebnotesddatednotesr   r   d_listacta_lists              rE   summaryzPerson.summary  s    	2'$((3Mr*R*RR&& 	!E))AXXm,,F &Wv%%JA&& 	!E))AXXm,,F &Wv%%JAhh'(( 	,"SV++A88J'' 	CSShrPQrlSSSF.61B1BBBAhhw6488I#6#6 	@NNc"1"gNNNF+dii.?.???ArG   N)__name__
__module____qualname____doc__default_info
keys_aliaskeys_tomodify_list
_image_keyr   cmpFunctrF   rJ   rL   rB   rY   r_   ra   rc   rp   ru   isSamePersonr   r   r   r    rG   rE   r   r   #   s       
 
 8L)%)) 	v) 		)
 	\) 	) 	L) 	\) 	1) 	+) 	$) 	/) 	0) 	2) 	;)  	8!)" 	"#) )$ 	$%)& 	m')( 	R))* 	%&Z+), 	\-). 	k/)0 	81)2 	 !93)4 	45)6 	7)8 	^9): 	
;)< 	l=)> 	l?)@ 	|A)B 	\C)D 	kE) )F 21((Q) ) )JX JH7 7 7@      
    ,  # # #
  $    L  
 
 
$ $ $    rG   r   N)r   copyr   
imdb.utilsr   r   r   r   r   r	   r
   r   r   rG   rE   <module>r      s   " 
                       | | | | |Z | | | | |rG   