File: //opt/cppython/lib/python3.8/site-packages/botocore/__pycache__/useragent.cpython-38.pyc
U
KD�g�V � @ s( d Z ddlZddlZddlZddlmZ ddlmZmZ ddlm Z m
Z
ddlmZ
ddlmZ ddlmZ e�e�Zee d Zd
ZddiZd
Zdddddd�Zdd� Zdd� ZG dd� d�ZG dd� de �ZG dd� d�Zzddlm Z W n e!k
�r dd � Z Y nX G d!d"� d"�Z"d#d$� Z#dS )%a�
NOTE: All classes and functions in this module are considered private and are
subject to abrupt breaking changes. Please do not use them directly.
To modify the User-Agent header sent by botocore, use one of these
configuration options:
* The ``AWS_SDK_UA_APP_ID`` environment variable.
* The ``sdk_ua_app_id`` setting in the shared AWS config file.
* The ``user_agent_appid`` field in the :py:class:`botocore.config.Config`.
* The ``user_agent_extra`` field in the :py:class:`botocore.config.Config`.
� N)�copy)�
ascii_letters�digits)�
NamedTuple�Optional)�__version__)�HAS_CRT)�get_contextz!$%&'*+-.^_`|~,)�windows�linux�macosZandroid�iosZwatchosZtvos�other�darwinr ZBotocore�B�C�G�N�S)ZWAITERZ PAGINATORZS3_TRANSFERZENDPOINT_OVERRIDEZSIGV4A_SIGNINGc C s0 t � }|dkrdS t�| � }r,|j�|� dS )z�Adds metric value to the current context object's ``features`` set.
:type feature_id: str
:param feature_id: The name of the feature to register. Value must be a key
in the ``_USERAGENT_FEATURE_MAPPINGS`` dict.
N)r �_USERAGENT_FEATURE_MAPPINGS�get�features�add)Z
feature_id�ctx�val� r �?/opt/cppython/lib/python3.8/site-packages/botocore/useragent.py�register_feature_idB s
r c s d� � fdd�| D ��S )a~ Replaces all not allowed characters in the string with a dash ("-").
Allowed characters are ASCII alphanumerics and ``!$%&'*+-.^_`|~,``. If
``allow_hash`` is ``True``, "#"``" is also allowed.
:type raw_str: str
:param raw_str: The input string to be sanitized.
:type allow_hash: bool
:param allow_hash: Whether "#" is considered an allowed character.
� c 3 s* | ]"}|t ks� r|d kr|ndV qdS )�#�-N)�_USERAGENT_ALLOWED_CHARACTERS)�.0�c��
allow_hashr r � <genexpr>a s ����z7sanitize_user_agent_string_component.<locals>.<genexpr>)�join)Zraw_strr% r r$ r �$sanitize_user_agent_string_componentU s �r( c @ s( e Zd ZdZeed�dd�Zdd� ZdS )�UserAgentComponentSizeConfigz�
Configures the max size of a built user agent string component and the
delimiter used to truncate the string if the size is above the max.
)�max_size_in_bytes� delimiterc C s || _ || _| �� d S �N)r* r+ �_validate_input)�selfr* r+ r r r �__init__o s z%UserAgentComponentSizeConfig.__init__c C s | j dk rtd| j � d���d S )N� zInvalid `max_size_in_bytes`: z#. Value must be a positive integer.)r* �
ValueError�r. r r r r- t s
�z,UserAgentComponentSizeConfig._validate_inputN)�__name__�
__module__�__qualname__�__doc__�int�strr/ r- r r r r r) i s r) c @ sR e Zd ZU dZeed<