Файловый менеджер - Редактировать - /usr/lib/python3.9/site-packages/glances/plugins/__pycache__/glances_wifi.cpython-39.pyc
Назад
a ���c< � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ ddl Z zddl mZ ddlm Z W n8 ey� Z z dZe�d �e�� W Y dZ[ndZ[0 0 d Zer�dZe�d� G dd � d e�ZdS )zWifi plugin.� N)� nativestr�PY3)�logger)� GlancesPlugin)�Cell)�InterfaceErrorTz0Missing Python Lib ({}), Wifi plugin is disabledFz@Wifi lib is not compliant with Python 3, Wifi plugin is disabledc s\ e Zd ZdZd� fdd� Zdd� Zejejdd� ��Z d d � Z � fdd�Zdd d�Z� Z S )�PluginzFGlances Wifi plugin. Get stats of the current Wifi hotspots. Nc s t t| �j||g d� d| _dS )zInit the plugin.)�args�configZstats_init_valueTN)�superr �__init__Z display_curse)�selfr r �� __class__� �@/usr/lib/python3.9/site-packages/glances/plugins/glances_wifi.pyr + s zPlugin.__init__c C s dS )zVReturn the key of the list. :returns: string -- SSID is the dict key �ssidr )r r r r �get_key2 s zPlugin.get_keyc C s( | � � }tr|S | jdk�rztjdd�}W n tyB | Y S 0 |D ]�}| �|�sXqHzt�|�}W nf t y� } zt �d�|�� W Y d}~qHd}~0 t y� } zt �d�|�� W Y d}~qHd}~0 0 |D ]8}| �� |j|j|j|j|jr�|jndd�}|�|� q�qHn| jdk�r|| _| jS ) z�Update Wifi stats using the input method. Stats is a list of dict (one dict per hotspot) :returns: list -- Stats is a list of dict (hotspot) �localT)Zpernicz%WIFI plugin: Scan InterfaceError ({})Nz)WIFI plugin: Can not grab cell stats ({}))�keyr �signal�quality� encrypted�encryption_typeZsnmp)Zget_init_value�import_error_tagZinput_method�psutil�net_io_counters�UnicodeDecodeErrorZ is_displayr �allr r �debug�format� Exceptionr r r r r r �append�stats)r r# r ZnetZ wifi_cells�eZ wifi_cellZhotspotr r r �update9 s: $&� z Plugin.updatec C st d}zP|| j d| jd�kr d}n2|| j d| jd�kr:d}n|| j d| jd�krRd}W n ttfyn d }Y n0 |S ) z�Overwrite the default get_alert method. Alert is on signal quality where lower is better... :returns: string -- Signal alert ZOKZcritical)Z stat_nameZCRITICAL�warningZWARNINGZcarefulZCAREFULZDEFAULT)Z get_limitZplugin_name� TypeError�KeyError)r �value�retr r r � get_alertx s zPlugin.get_alertc sr t t| ��� | jD ]X}| �|d �| j|| �� d d<