File: //opt/saltstack/salt/lib/python3.10/site-packages/psutil/__pycache__/_compat.cpython-310.pyc
o
�N�g�8 � @ s� d Z ddlZddlZddlZddlZddlZddlZg d�Zejd dkZ e
� Ze r=eZ
eZeZeZeZdd� Zdd� Zne
Z
eZeZeZd d� Zd
d� Ze rReZn
eZeedfdd
�Ze rkeZeZeZeZeZeZnZddlZefdd�Zee �dd� �Zee �dd� �Zee �dd� �Zee �dd� �Zee �dd� �Zee �dd� �Ze�!� dkr�ze"ej#d�� ey� Y n e"y� e$d��w zddlm%Z% W nL e&�y zdd l'm(Z( W n e&y� dd l)m(Z( Y nw e�*d!g d"��Z+G d#d$� d$e,�Z-e
� fe.eee/e0d�f�e1e2e0e3fd%d&�Z4d2d)d*�Z%Y nw zdd+l5m6Z6 W n e&�y7 ej7ej8B dfd,d-�Z6Y nw z dd.l5m9Z9 W dS e&�yQ d3d0d1�Z9Y dS w )4z�Module which provides compatibility with older Python versions.
This is more future-compatible rather than the opposite (prefer latest
Python 3 way of doing things).
� N)�PY3�long�range�super�unicode�
basestring�u�b� lru_cache�which�get_terminal_size�FileNotFoundError�PermissionError�ProcessLookupError�InterruptedError�ChildProcessError�FileExistsError� c C � | S �N� ��sr r �B/opt/saltstack/salt/lib/python3.10/site-packages/psutil/_compat.pyr + � r c C s
| � d�S )Nzlatin-1)�encoder r r r r . �
r c C s
t | d�S )NZunicode_escape)r r r r r r 6 r c C r r r r r r r r 9 r � c C sJ | t u r�t�|�}z|j|jjd }W n
ttfy! td��w z|j }W n t
tfyD z|jj }W n t
yA td��w Y nw |D ]L} | j�
� D ]B}z,t|tj�s{t|t�r`|j}nz|j}W n t
yt |�|| �}Y nw t|tj�rWW n t
tfy� Y qNw |j|ju r� nqNqG ntd��|t ur�t| |�S t| �S )zuLike Python 3 builtin super(). If called without any arguments
it attempts to infer them at runtime.
r z'super() used in a function with no argsz$super() used in a non-newstyle classzsuper() called outside a method)� _SENTINEL�sys� _getframe�f_locals�f_code�co_varnames�
IndexError�KeyError�RuntimeError�__mro__�AttributeError� __class__�__dict__�values�
isinstance�types�FunctionType�property�fget�__func__�__get__� TypeErrorZ func_code�_builtin_super)Ztype_Ztype_or_objZ
framedepth�f�mro�methr r r r H sT
�
���
�����
r c s � fdd�}|S )Nc s* G � �fdd�d��� �j � _ �j� _� S )Nc s2 e Zd Z�� fdd�ZG �fdd�de�Z� ZS )zE_instance_checking_exception.<locals>.wrapped.<locals>.TemporaryClassc sj t |�dkr(t|d � �r(|d }t|�D ]}|�d�s%t| |t||�� qd S t� | �j|i |�� d S )Nr r �__)�lenr, �dir�
startswith�setattr�getattrr �__init__)�self�args�kwargsZ unwrap_me�attr)�TemporaryClassr) r r r>