Ë
    |`Þ  ã                   óf   — 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  G d„ de	«      Zy)	zZ
This module provides the company class, used to store information about
a given company.
é    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literals)Údeepcopy)Ú
_Container)Úanalyze_company_nameÚbuild_company_nameÚcmpCompaniesÚflattenc            	       ó„   — e Zd ZdZdZ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)ÚCompanyaF  A company.

    Every information about a company can be accessed as::

        companyObject['information']

    to get a list of the kind of information stored in a
    company object, use the keys() method; some useful aliases
    are defined (as "also known as" for the "akas" key);
    see the keys_alias dictionary.
    )ÚmainÚdistributorszspecial effects companieszmiscellaneous companieszproduction companies)Údistributorúspecial effects companyzother companyúmiscellaneous companyzother companieszmisc companieszmisc companyúproduction company© c                 óÄ   — |j                  d«      }|rd| j                  vr| j                  |«       |j                  dd«      | _        |j                  dd«      | _        y)aß  Initialize a company object.

        *companyID* -- the unique identifier for the company.
        *name* -- the name of the company, if not in the data dictionary.
        *myName* -- the nickname you use for this company.
        *myID* -- your personal id for this company.
        *data* -- a dictionary used to initialize the object.
        *notes* -- notes about the given company.
        *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 companies.
        *modFunct* -- function called returning text fields.
        ÚnameÚ	companyIDNÚmyNameÚ )ÚgetÚdataÚset_namer   r   )ÚselfÚkwdsr   s      ú./usr/lib/python3/dist-packages/imdb/Company.pyÚ_initzCompany._init=   sP   € ð �x‰x˜ÓˆÙ�F $§)¡)Ñ+Ø�M‰M˜$ÔØŸ™ +¨tÓ4ˆŒØ—h‘h˜x¨Ó,ˆ�ó    c                 ó    — d| _         d| _        y)zReset the company object.Nr   )r   r   ©r   s    r    Ú_resetzCompany._resetR   s   € àˆŒØˆ�r"   c                 ó@  — |j                  «       x}}d}|j                  d«      r.|j                  d«      }|dk7  r||d }|d| j                  «       }| j                  r|}t        |«      }| j                  j                  |«       |r| j                  s|| _        yyy)zSet the name of the company.r   ú)ú(éÿÿÿÿN)ÚstripÚendswithÚfindÚrstripÚnotesr	   r   Úupdate)r   r   Úonamer.   ÚfparidxÚds         r    r   zCompany.set_nameW   s—   € ð —z‘z“|Ð#ˆ�ØˆØ�=‰=˜ÔØ—i‘i “nˆGØ˜"Š}Ø˜W˜X˜�Ø˜H˜W�~×,Ñ,Ó.�Ø�:Š:ØˆDÜ  Ó&ˆØ�	‰	×Ñ˜ÔÙ˜ŸšØˆD�Jð $ˆ5r"   c                 ó(   — d| j                   v rdgS g S )z-Valid keys to append to the data.keys() list.r   úlong imdb name)r   r$   s    r    Ú_additional_keyszCompany._additional_keysi   s   € à�T—Y‘YÑØ$Ð%Ð%Øˆ	r"   c                 óT   — d| j                   v r|dk(  rt        | j                   «      S y)zHandle special keys.r   r4   N)r   r
   )r   Úkeys     r    Ú_getitemzCompany._getitemo   s+   € ð �T—Y‘YÑØÐ&Ò&Ü)¨$¯)©)Ó4Ð4Ør"   c                 ó   — | j                   S )zReturn the companyID.)r   r$   s    r    ÚgetIDzCompany.getIDw   s   € à�~‰~Ðr"   c                 óJ   — t        | j                  j                  d«      «      S )z@The company is "false" if the self.data does not contain a name.r   )Úboolr   r   r$   s    r    Ú__bool__zCompany.__bool__{   s   € ô �D—I‘I—M‘M &Ó)Ó*Ð*r"   c                 óÆ   — ddl m } t        ||«      r1t        | j                  d|¬«      D ]  }|j	                  |«      sŒ y yt        |t
        «      r|| j                  v S y)z<Return true if this company and the given Movie are related.é   )ÚMovieT)ÚyieldDictKeysÚscalarF)r@   Ú
isinstancer   r   ÚisSameÚstr)r   Úitemr@   Úms       r    Ú__contains__zCompany.__contains__€   s\   € å Ü�d˜EÔ"Ü˜TŸY™Y°dÀ5ÔIò  �Ø—;‘;˜q•>Ùð ð
 ô ˜œcÔ"Ø˜4Ÿ9™9Ð$Ð$Ør"   c                 ó@  — t        || j                  «      syd| j                  v r:d|j                  v r,t        | j                  «      t        |j                  «      k(  ry| j                  |j                  k(  r&| j
                  �| j
                  |j
                  k(  ryy)zGReturn true if two company have the same name
        and/or companyID.Fr   T)rC   Ú	__class__r   r
   ÚaccessSystemr   )r   Úothers     r    Ú
isSameNamezCompany.isSameName‹   s�   € ô ˜% §¡Ô0ØØ�T—Y‘YÑØ˜%Ÿ*™*Ñ$Ü" 4§9¡9Ó-Ü" 5§:¡:Ó.ò/àØ×Ñ × 2Ñ 2Ò2Ø—‘Ð*Ø—‘ %§/¡/Ò1ØØ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 company instance.r   )
r   r   r   ÚmyIDr   r.   rK   Ú
titlesRefsÚ	namesRefsÚcharactersRefs)r   r   r   rO   r   r   r.   rK   rP   rQ   rR   ÚlistÚcurrent_infoÚset_mod_functÚmodFunct)r   ÚmemoÚcs      r    Ú__deepcopy__zCompany.__deepcopy__œ   s”   € ä˜ t§~¡~ØŸ;™;¨T¯Y©YÜ! $§)¡)¨TÓ2ØŸ*™*°4×3DÑ3DÜ'¨¯©¸Ó>Ü& t§~¡~°tÓ<Ü#+¨D×,?Ñ,?ÀÓ#FôHˆô ˜d×/Ñ/Ó0ˆŒØ	�‰˜Ÿ™Ô&Øˆr"   c                 ó`   — d| j                   ›d| j                  ›d| j                  d«      ›d�S )z*String representation of a Company object.z<Company id:ú[z] name:_r4   z_>)r   rK   r   r$   s    r    Ú__repr__zCompany.__repr__©   s)   � ð �N‹N˜D×-Ó-¨t¯x©xÐ8HÕ/Ið
ð 	
r"   c                 ó&   — | j                  dd«      S )zSimply print the short name.r   r   )r   r$   s    r    Ú__str__zCompany.__str__¯   s   € à�x‰x˜ Ó#Ð#r"   c                 óð   — | syd| j                  dd«      z  }dD ]S  }| j                  |g «      dd }|sŒ|d|›dd	j                  |D �cg c]  }|j                  d
d«      ‘Œ c}«      ›d�z  }ŒU |S c c}w )z>Return a string with a pretty-printed summary for the company.r   zCompany
=======
Name: %s
r   )r   r   r   r   Né   zLast movies from this company (z): z; zlong imdb titlez.
)r   Újoin)r   ÚsÚkr2   Úxs        r    ÚsummaryzCompany.summary³   s‹   € áØØ*¨T¯X©X°f¸bÓ-AÑAˆð-ò 	ˆAà—‘˜˜B“  Ð#ˆAÙØÙÚ�4—9‘9ÀAÖF¸q˜aŸe™eÐ$5°rÕ:ÒFÕGðñ ‰Að	ð ˆùò Gs   Á
A3N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údefault_infoÚ
keys_aliasÚkeys_tomodify_listr   ÚcmpFunctr!   r%   r   r5   r8   r:   r=   rH   rM   ÚisSameCompanyrY   r\   r^   re   r   r"   r    r   r      s„   „ ñ
ð €Lð &Ø#>Ø2Ø!:Ø4Ø3Ø1Ø4ñ	€Jð Ðà€Hò-ò*ò
ò$òòò+ò
	òð €Mòò
ò$ór"   r   N)ri   Ú
__future__r   r   r   r   Úcopyr   Ú
imdb.utilsr   r	   r
   r   r   r   r   r"   r    ú<module>rr      s-   ðñ"÷
 SÓ Rå å !ß VÓ Vôbˆjõ br"   