
    KJi                     N    d Z ddlmZ ddlmZmZmZmZmZ  G d de          Z	dS )zZ
This module provides the company class, used to store information about
a given company.
    )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dS )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                     |                     d          }|rd| j        vr|                     |           |                     dd          | _        |                     dd          | _        dS )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      L/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/imdb/Company.py_initzCompany._init@   si     xx 	 F$)++MM$+t44hhx,,    c                 "    d| _         d| _        dS )zReset the company object.Nr   )r   r   r   s    r   _resetzCompany._resetU   s    r   c                 n   |                                 x}}d}|                    d          rA|                    d          }|dk    r&||d         }|d|                                         }| j        r|}t          |          }| j                            |           |r| j        s|| _        dS dS dS )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_nameZ   s     zz||#== 	/iinnG"}}WXXHWH~,,..: 	D &&	 	 	DJJJ	 	 	 	r   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_keysl   s    TY$%%	r   c                 L    d| j         v r|dk    rt          | j                   S dS )zHandle special keys.r   r0   N)r   r   )r   keys     r   _getitemzCompany._getitemr   s2     TY&&&)$)444tr   c                     | j         S )zReturn the companyID.)r   r    s    r   getIDzCompany.getIDz   s
    ~r   c                 P    t          | 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      DIMM&))***r   c                     ddl m } t          ||          r3t          | j        d|          D ]}|                    |          r dS nt          |t
                    r	|| j        v S dS )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          dE"" 	%TYd5III    ;;q>>  44   c"" 	%49$$ur   c                    t          || j                  sdS d| j        v r5d|j        v r,t          | j                  t          |j                  k    rdS | j        |j        k    r| j        | j        |j        k    rdS dS )zGReturn true if two company have the same name
        and/or companyID.Fr   T)r?   	__class__r   r   accessSystemr   )r   others     r   
isSameNamezCompany.isSameName   s     %00 	5TY%*$$"49--"5:../ /4 222*%/114ur   c                 h   t          d| j        | j        | j        t	          | j        |          | j        | j        t	          | j        |          t	          | j	        |          t	          | j
        |          
  
        }t          | j                  |_        |                    | j                   |S )z)Return a deep copy of a company instance.r   )
r   r   r   myIDr   r*   rG   
titlesRefs	namesRefscharactersRefs)r
   r   r   rK   r   r   r*   rG   rL   rM   rN   listcurrent_infoset_mod_functmodFunct)r   memocs      r   __deepcopy__zCompany.__deepcopy__   s    t~;TY!$)T22*43D'>>&t~t<<#+D,?#F#FH H H d/00	&&&r   c                 T    d| j         d| j        d|                     d          dS )z*String representation of a Company object.z<Company id:[z] name:_r0   z_>)r   rG   r   r    s    r   __repr__zCompany.__repr__   s9      NNND---txx8H/I/I/I/I
 	
r   c                 .    |                      dd          S )zSimply print the short name.r   r   r   r    s    r   __str__zCompany.__str__   s    xx###r   c           	          | sdS d|                      dd          z  }dD ]L}|                      |g           dd         }|s#|d|dd	                    d
 |D                       dz  }M|S )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; c                 :    g | ]}|                     d d          S )zlong imdb titler   rZ   ).0xs     r   
<listcomp>z#Company.summary.<locals>.<listcomp>   s'    FFFqaee$5r::FFFr   z.
)r   join)r   skr.   s       r   summaryzCompany.summary   s     	2*TXXfb-A-AA- 	 	AB#A A499FFAFFFGGGG AA r   N)__name__
__module____qualname____doc__default_info
keys_aliaskeys_tomodify_listr   cmpFunctr   r!   r   r1   r4   r6   r9   rD   rI   isSameCompanyrU   rX   r[   re   r   r   r   r
   r
   !   s"       
 
 L &#>2!:4314	 	J H- - -*  
  $      + + +
	 	 	   M  
 
 
$ $ $    r   r
   N)
ri   copyr   
imdb.utilsr   r   r   r   r   r
   r   r   r   <module>rq      s   " 
                   b b b b bj b b b b br   