https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/boto/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/boto/__pycache__/regioninfo.cpython-310.pyc
o

ckF[%�@s�ddlZddlZddlmZddlmZddlmZddlmZiZ	dd�Z
dd	�Zd
d�Zdd
�Z
e	fdd�Zddd�Z		ddd�Z		ddd�Z		ddd�Zdd�ZGdd�de�ZdS)�N)�json)�BotoClientError)�BotoEndpointResolver)�StaticEndpointBuildercCst|�S)��
    Loads a given JSON file & returns it.

    :param path: The path to the JSON file
    :type path: string

    :returns: The loaded data
    )�_load_json_file)�path�r	�1/usr/lib/python3/dist-packages/boto/regioninfo.py�load_endpoint_json#s	rcCs8t|d��
}t�|�Wd�S1swYdS)r�rN)�openr�load)r�endpoints_filer	r	r
r/s	$�rcCs0|��D]\}}|�|i�||�|�q|S)aW
    Given an existing set of endpoint data, this will deep-update it with
    any similarly structured data in the additions.

    :param defaults: The existing endpoints data
    :type defaults: dict

    :param defaults: The additional endpoints data
    :type defaults: dict

    :returns: The modified endpoints data
    :rtype: dict
    )�items�
setdefault�update)�defaults�	additions�service�region_infor	r	r
�merge_endpoints<srcCsXt�}d}tj�d�rtjd}ntj�dd�rtj�dd�}|r*t|�}t||�}|S)a�
    Actually load the region/endpoint information from the JSON files.

    By default, this loads from the default included ``boto/endpoints.json``
    file.

    Users can override/extend this by supplying either a ``BOTO_ENDPOINTS``
    environment variable or a ``endpoints_path`` config variable, either of
    which should be an absolute path to the user's JSON file.

    :returns: The endpoints data
    :rtype: dict
    N�BOTO_ENDPOINTS�Boto�endpoints_path)�_load_builtin_endpoints�os�environ�get�boto�configrr)�	endpoints�additional_path�
additionalr	r	r
�load_regionsUs
r$cCs8|r|Sttj�}t|�}t|�}|��}|�|�|S)z1Loads the builtin endpoints in the legacy format.)rr�ENDPOINTS_PATHrr�build_static_endpointsr)�_cacher!�resolver�builderr	r	r
rvs

rcCs\t�}||vr
td|��|durt}g}|�|i���D]\}}|�||||d��q|S)ae
    Given a service name (like ``ec2``), returns a list of ``RegionInfo``
    objects for that service.

    This leverages the ``endpoints.json`` file (+ optional user overrides) to
    configure/construct all the objects.

    :param service_name: The name of the service to construct the ``RegionInfo``
        objects for. Ex: ``ec2``, ``s3``, ``sns``, etc.
    :type service_name: string

    :param region_cls: (Optional) The class to use when constructing. By
        default, this is ``RegionInfo``.
    :type region_cls: class

    :param connection_cls: (Optional) The connection class for the
        ``RegionInfo`` object. Providing this allows the ``connect`` method on
        the ``RegionInfo`` to work. Default is ``None`` (no connection).
    :type connection_cls: class

    :returns: A list of configured ``RegionInfo`` objects
    :rtype: list
    z$Service '%s' not found in endpoints.N��name�endpoint�connection_cls)r$r�
RegionInforr�append)�service_name�
region_clsr-r!�region_objs�region_namer,r	r	r
�get_regions�s"���r4cKsR|durt}t||||�}|durt�rt||||�}|dur!dS|jdi|��S)a(Create a connection class for a given service in a given region.

    :param service_name: The name of the service to construct the
        ``RegionInfo`` object for, e.g. ``ec2``, ``s3``, etc.
    :type service_name: str

    :param region_name: The name of the region to connect to, e.g.
        ``us-west-2``, ``eu-central-1``, etc.
    :type region_name: str

    :param region_cls: (Optional) The class to use when constructing. By
        default, this is ``RegionInfo``.
    :type region_cls: class

    :param connection_cls: (Optional) The connection class for the
        ``RegionInfo`` object. Providing this allows the ``connect`` method on
        the ``RegionInfo`` to work. Default is ``None`` (no connection).
    :type connection_cls: class

    :returns: A configured connection class.
    Nr	)r.�_get_region�_use_endpoint_heuristics�_get_region_with_heuristics�connect)r0r3r1r-�	kw_params�regionr	r	r
r8�s�r8cCs(t|||�D]}|j|kr|SqdS)z8Finds the region by searching through the known regions.N)r4r+)r0r3r1r-r:r	r	r
r5�s

�r5cCs,ttj�}t|�}|�||�}||||d�S)z4Finds the region using known regions and heuristics.r*)rrr%r�resolve_hostname)r0r3r1r-r!r(�hostnamer	r	r
r7�s
�r7cCs.tj�dd���}tj�ddd�}|dkp|S)N�BOTO_USE_ENDPOINT_HEURISTICS�falser�use_endpoint_heuristicsF�true)rrr�lowerrr �getbool)�env_var�
config_varr	r	r
r6�sr6c@s>eZdZdZ		d
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)r.z"
    Represents an AWS Region
    NcCs||_||_||_||_dS�N)�
connectionr+r,r-)�selfrFr+r,r-r	r	r
�__init__s
zRegionInfo.__init__cCs
d|jS)Nz
RegionInfo:%s)r+)rGr	r	r
�__repr__s
zRegionInfo.__repr__cCsdSrEr	)rGr+�attrsrFr	r	r
�startElementszRegionInfo.startElementcCs4|dkr	||_dS|dkr||_dSt|||�dS)N�
regionName�regionEndpoint)r+r,�setattr)rGr+�valuerFr	r	r
�
endElements


zRegionInfo.endElementcKs|jr
|jdd|i|��SdS)a�
        Connect to this Region's endpoint. Returns an connection
        object pointing to the endpoint associated with this region.
        You may pass any of the arguments accepted by the connection
        class's constructor as keyword arguments and they will be
        passed along to the connection object.

        :rtype: Connection object
        :return: The connection to this regions endpoint
        r:Nr	)r-)rGr9r	r	r
r8s�zRegionInfo.connect)NNNN)	�__name__�
__module__�__qualname__�__doc__rHrIrKrPr8r	r	r	r
r.�s
�r.)NN)rr�boto.compatr�boto.exceptionr�boto.endpointsrr�_endpoints_cacherrrr$rr4r8r5r7r6�objectr.r	r	r	r
�<module>s0
!
0
�&
�	
�

https://t.me/RX1948 - 2025