509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
UˆŠZ“  ã               @   s²   d dl mZ d dl mZ d dl mZ d dl mZ d dlZejddd�Zeed	ƒsXeje_	ej	Z
G d
d„ dƒZG dd„ dƒZddd„Zg Zdaddd„Zdd„ Zdd„ Zdd„ ZdS )é    )Úup2dateAuth)Úup2dateErrors)Úconfig)Ú	rhnserverNzrhn-client-toolsT)ZfallbackÚugettextc               @   sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )Ú
rhnChannelc             K   s*   i | _ x|jƒ D ]}|| | j |< qW d S )N)ÚdictÚkeys)ÚselfÚkwargsÚkw© r   ú /usr/lib/python3.6/rhnChannel.pyÚ__init__   s    zrhnChannel.__init__c             C   s
   | j | S )N)r   )r
   Úitemr   r   r   Ú__getitem__   s    zrhnChannel.__getitem__c             C   s   || j |< d S )N)r   )r
   r   Úvaluer   r   r   Ú__setitem__   s    zrhnChannel.__setitem__c             C   s   | j d |j d kS )NÚname)r   )r
   Úotherr   r   r   Ú__lt__    s    zrhnChannel.__lt__c             C   s
   | j jƒ S )N)r   r	   )r
   r   r   r   r	   #   s    zrhnChannel.keysc             C   s
   | j jƒ S )N)r   Úvalues)r
   r   r   r   r   &   s    zrhnChannel.valuesc             C   s
   | j jƒ S )N)r   Úitems)r
   r   r   r   r   )   s    zrhnChannel.itemsN)
Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r	   r   r   r   r   r   r   r      s   r   c               @   s<   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ ZdS )ÚrhnChannelListc             C   s
   g | _ d S )N)Úlist)r
   r   r   r   r   -   s    zrhnChannelList.__init__c             C   s   | j j|ƒ d S )N)r   Úappend)r
   Úchannelr   r   r   Ú
addChannel2   s    zrhnChannelList.addChannelc             C   s   | j S )N)r   )r
   r   r   r   Úchannels6   s    zrhnChannelList.channelsc             C   s$   x| j D ]}|d |kr|S qW d S )NÚlabel)r   )r
   Úchannelnamer   r   r   r   Ú
getByLabel9   s    zrhnChannelList.getByLabelc             C   s
   | j |ƒS )N)r$   )r
   r#   r   r   r   Ú	getByName=   s    zrhnChannelList.getByNamec             C   s.   g }x$| j D ]}|d |kr|j|ƒ qW |S )NÚtype)r   r   )r
   r&   r!   r   r   r   r   Ú	getByType@   s
    zrhnChannelList.getByTypeN)	r   r   r   r   r    r!   r$   r%   r'   r   r   r   r   r   ,   s   r   c             C   sd   g }t | d�}xP|jƒ D ]D}|d dkrR|d |d< d|d |d |d f |d< |j|ƒ qW |S )	N)Útimeoutr&   Úup2dater"   r   z%s channel %s from  %sÚurlÚdescription)ÚgetChannelsr!   r   )r(   r!   ZsourceChannelsZsourceChannelr   r   r   ÚgetChannelDetailsJ   s    
r-   c       	      C   sÚ   t jƒ }t rº|  rºtƒ atj|d�}tjƒ s<tj	t
dƒƒ‚|jjtjƒ ƒ}xl|D ]d}|rh|d |krhqRtdt jƒ d�}x2|jƒ D ]&}|dkrœ|d |d< q‚|| ||< q‚W tj|ƒ qRW ttjƒdkrÖtjt
d	ƒƒ‚tS )
zG return rhnChannelList containing list of channel we are subscribed to )r(   zUnable to Locate SystemIdr"   r)   )r&   r*   Zlast_modifiedÚversionr   zEThis system may not be updated until it is associated with a channel.)r   ZinitUp2dateConfigÚselected_channelsr   r   Ú	RhnServerr   ÚgetSystemIdr   ZNoSystemIdErrorÚ_r)   ZlistChannelsr   ZgetServerlURLr	   r    Úlenr   ZNoChannelsError)	ÚforceÚlabel_whitelistr(   ZcfgÚsZup2dateChannelsZchanr   Úkeyr   r   r   r,   ]   s&    
r,   c             C   s    d a ttdd„ | ƒƒ}t|d�S )Nc             S   s   | dfS )Né   r   )Úxr   r   r   Ú<lambda>   s    zsetChannels.<locals>.<lambda>)r5   )r/   r   Úmapr,   )ZtempchannelsZ	whitelistr   r   r   ÚsetChannels|   s    r<   c             C   s   t jƒ }|jjtjƒ | ||ƒS )N)r   r0   r)   ÚsubscribeChannelsr   r1   )r!   ÚusernameÚpasswdr6   r   r   r   r=   „   s    r=   c             C   s   t jƒ }|jjtjƒ | ||ƒS )N)r   r0   r)   ÚunsubscribeChannelsr   r1   )r!   r>   r?   r6   r   r   r   r@   ‰   s    r@   )N)NNN)Zup2date_clientr   r   r   r   ÚgettextZtranslationÚtÚhasattrr   r2   r   r   r-   Zcmdline_pkgsr/   r,   r<   r=   r@   r   r   r   r   Ú<module>   s"   


