Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/botocore/__pycache__/loaders.cpython-39.pyc
Ðазад
a p�h�C � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z m Z ddlmZ e� e�Zdd � ZG d d� de�Zddd �ZG dd� de�ZG dd� de�ZdS )a� Module for loading various model files. This module provides the classes that are used to load models used by botocore. This can include: * Service models (e.g. the model for EC2, S3, DynamoDB, etc.) * Service model extras which customize the service models * Other models associated with a service (pagination, waiters) * Non service-specific config (Endpoint data, retry config) Loading a module is broken down into several steps: * Determining the path to load * Search the data_path for files to load * The mechanics of loading the file * Searching for extras and applying them to the loaded file The last item is used so that other faster loading mechanism besides the default JSON loader can be used. The Search Path =============== Similar to how the PATH environment variable is to finding executables and the PYTHONPATH environment variable is to finding python modules to import, the botocore loaders have the concept of a data path exposed through AWS_DATA_PATH. This enables end users to provide additional search paths where we will attempt to load models outside of the models we ship with botocore. When you create a ``Loader``, there are two paths automatically added to the model search path: * <botocore root>/data/ * ~/.aws/models The first value is the path where all the model files shipped with botocore are located. The second path is so that users can just drop new model files in ``~/.aws/models`` without having to mess around with the AWS_DATA_PATH. The AWS_DATA_PATH using the platform specific path separator to separate entries (typically ``:`` on linux and ``;`` on windows). Directory Layout ================ The Loader expects a particular directory layout. In order for any directory specified in AWS_DATA_PATH to be considered, it must have this structure for service models:: <root> | |-- servicename1 | |-- 2012-10-25 | |-- service-2.json |-- ec2 | |-- 2014-01-01 | | |-- paginators-1.json | | |-- service-2.json | | |-- waiters-2.json | |-- 2015-03-01 | |-- paginators-1.json | |-- service-2.json | |-- waiters-2.json | |-- service-2.sdk-extras.json That is: * The root directory contains sub directories that are the name of the services. * Within each service directory, there's a sub directory for each available API version. * Within each API version, there are model specific files, including (but not limited to): service-2.json, waiters-2.json, paginators-1.json The ``-1`` and ``-2`` suffix at the end of the model files denote which version schema is used within the model. Even though this information is available in the ``version`` key within the model, this version is also part of the filename so that code does not need to load the JSON model in order to determine which version to use. The ``sdk-extras`` and similar files represent extra data that needs to be applied to the model after it is loaded. Data in these files might represent information that doesn't quite fit in the original models, but is still needed for the sdk. For instance, additional operation parameters might be added here which don't represent the actual service api. � N)� BOTOCORE_ROOT)�json)�OrderedDict)�DataNotFoundError�UnknownServiceError�� deep_mergec s � fdd�}|S )a Cache the result of a method on a per instance basis. This is not a general purpose caching decorator. In order for this to be used, it must be used on methods on an instance, and that instance *must* provide a ``self._cache`` dictionary. c s^ � j f| }t|�� �D ]}||7 }q|| jv r:| j| S � | g|�R i |��}|| j|<