/usr/lib/python3.9/site-packages/glances/__pycache__
a ���c� � @ s0 d Z ddlmZ ddlmZ G dd� de�ZdS )z"Manage the Glances passwords list.� )�logger)�GlancesPasswordc s@ e Zd ZdZdZd� fdd� Zdd� Zd dd �Zd d� Z� Z S )�GlancesPasswordListz@Manage the Glances passwords list for the client|browser/server.Z passwordsNc s t t| ��� | �|�| _d S )N)�superr �__init__�load�_password_dict)�self�config�args�� __class__� �9/usr/lib/python3.9/site-packages/glances/password_list.pyr s zGlancesPasswordList.__init__c C sl i }|du rt �d� nP|�| j�s6t �d| j � n2t �d| j � t|�| j��}t �dt|� � |S )z.Load the password from the configuration file.Nz;No configuration file available. Cannot load password list.zENo [%s] section in the configuration file. Cannot load password list.z8Start reading the [%s] section in the configuration filez1%s password(s) loaded from the configuration file)r ZwarningZhas_section�_section�info�dict�items�len)r r Z password_dictr r r r s zGlancesPasswordList.loadc C sb |du r| j S z| j | W S ttfy\ z| j d W Y S ttfyV Y Y dS 0 Y n0 dS )z�Get the password from a Glances client or server. If host=None, return the current server list (dict). Else, return the host's password (or the default one if defined or None) N�default)r �KeyError� TypeError)r �hostr r r �get_password/ s z GlancesPasswordList.get_passwordc C s || j |<