Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/openstack/cloud/__pycache__/_utils.cpython-39.pyc
Ðазад
a t�h!^ � @ s` d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlmZ d dlm Z d dlmZ d dlmZ g Zdd� Zdd � Zd d� Zdd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Ze j d8d"d#��Z!d$d%� Z"d&d'� Z#d9d*d+�Z$d,d-� Z%d.d/� Z&d0d1� Z'G d2d3� d3�Z(d4d5� Z)d6d7� Z*dS ):� N�� decorator)�_log)�exc)�metac C sT z4t | t�r| W S t | t�r(| �d�W S t| �W S W n tyN t| � Y S 0 dS )zkTurn an input into unicode unconditionally :param input: A unicode, string or other object zutf-8N)� isinstance�unicode�str�decode� NameError)�input� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/openstack/cloud/_utils.py� _make_unicode$ s r c C s2 t | t�rdd� | D �S t| d�r*| �� S | S d S )Nc S s g | ]}t |��qS r )�_dictify_resource)�.0�rr r r � <listcomp>9 � z%_dictify_resource.<locals>.<listcomp>�toDict)r �list�hasattrr )�resourcer r r r 7 s r c s� t �d�}|r�t|�}g }d}zt�t�|��}W n tjyJ d}Y n0 | D ]x}t|� dd��}t|� dd��} |r�||ks�| r�| |kr�|� |� qP|s�d}qP|r�|�|�s�| rP|�| �rP|� |� qP|s�|r�|jddd� |} |s�| S t |t��rt�|| �S � fd d �� g } | D ]|}| � |� |�� D ]b}t || t��rj� || |� |d���s�| �� �qn$|� |d�|| k�r.| �� �q�q.�q| S )a� Filter a list by name/ID and arbitrary meta data. :param list data: The list of dictionary data to filter. It is expected that each dictionary contains an 'id' and 'name' key if a value for name_or_id is given. :param string name_or_id: The name or ID of the entity being filtered. Can be a glob pattern, such as 'nb01*'. :param filters: A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:: { 'last_name': 'Smith', 'other': { 'gender': 'Female' } } OR A string containing a jmespath expression for further filtering. zopenstack.fnmatchFN�id�nameTzBad pattern passed to fnmatch)�exc_infoc s` |sdS | � � D ]J}t| | t�r@� | | |�|d ��sZ dS q|�|d �| | kr dS qdS )NFT)�keysr �dict�get)�f�d�key��_dict_filterr r r# � s z"_filter_list.<locals>._dict_filter)r � setup_loggingr �re�compile�fnmatch� translate� sre_constants�errorr �append�match�debugr r �jmespath�searchr r �pop)�data� name_or_id�filters�logZidentifier_matchesZbad_patternZfn_reg�eZe_idZe_name�filteredr! r r"