o
    UÀ7eÒ  ã                   @   s0   d dl Z d dlZd dlmZ G dd„ deƒZdS )é    N)ÚElementTreec                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚCountryInformationc           
      C   sè   i | _ d}tj |¡rCt|d�}| d¡}|D ]+}d|jv r$|jd }n|jd }d|jv r4|jd }n|jd }t d|¡| j |< qd | _	d | _
tjd	d
d�}| d¡}| d¡}	|	dkrbt|ƒ}	||d |	… | _
|  | j
¡| _	d S )Nz%/usr/share/xml/iso-codes/iso_3166.xml)ÚfileÚiso_3166_entryÚcommon_nameÚnameÚalpha_2_codeÚalpha_3_codeÚiso_3166ÚLANGzen.UK)ÚdefaultÚ_Ú.éÿÿÿÿé   )Ú	countriesÚosÚpathÚexistsr   ÚiterÚattribÚgettextÚdgettextÚcountryÚcodeÚgetenvÚfindÚlenÚget_country_name)
ÚselfÚfnameÚetÚitÚelmÚdescrr   ÚlocaleÚaÚz© r(   úG/usr/lib/python3/dist-packages/softwareproperties/CountryInformation.pyÚ__init__   s,   







zCountryInformation.__init__c                 C   s   || j v r| j | }|S |S )N)r   )r   r   r   r(   r(   r)   r   7   s   

z#CountryInformation.get_country_nameN)Ú__name__Ú
__module__Ú__qualname__r*   r   r(   r(   r(   r)   r      s    r   )r   r   Úxml.etree.ElementTreer   Úobjectr   r(   r(   r(   r)   Ú<module>   s   