403Webshell
Server IP : 157.22.201.140  /  Your IP : 216.73.216.74
Web Server : nginx/1.30.1
System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/libcloud/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/libcloud/__pycache__/pricing.cpython-312.pyc
�

�q�a�!����dZddlmZddlmZddlmZddlmZddlZddlm	Z
	ddlZ	ejZ
gd�Zd	Zd
Zej(j+ej(j-e��Ze
ed�Zej(j5d�Ziid
�ZddgZdZdd�Z		dd�Z d�Z!dd�Z"d�Z#d�Z$d�Z%eefd�Z&y#e$reZ
Y��wxYw#e$r	ddlZeZ
Y��wxYw)z2
A class which handles loading the pricing files.
�)�with_statement)�Dict)�Optional)�UnionN)�join)�get_pricing�get_size_price�set_pricing�clear_pricing_data�download_pricing_filez`https://git-wip-us.apache.org/repos/asf?p=libcloud.git;a=blob_plain;f=libcloud/data/pricing.jsonz;https://libcloud-pricing-data.s3.amazonaws.com/pricing.jsonzdata/pricing.jsonz~/.libcloud/pricing.json)�compute�storager
rFc��tjjt�r)tjj	t�rtSt
S�N)�os�path�exists�CUSTOM_PRICING_FILE_PATH�isfile�DEFAULT_PRICING_FILE_PATH��	file_paths �2/usr/lib/python3/dist-packages/libcloud/pricing.py�get_pricing_file_pathrFs0��	�w�w�~�~�.�/�	�w�w�~�~�.�/�'�'�$�$�c��|xst}|tvrtd|��|t|vrt||S|st	|��}t|d�5}|j
�}ddd�tj�}|||}|r+tD] }|j|d�}|s�|t|<�"|St|||��|S#1swY�cxYw)a�
    Return pricing for the provided driver.

    NOTE: This method will also cache data for the requested driver
    memory.

    We intentionally only cache data for the requested driver and not all the
    pricing data since the whole pricing data is quite large (~2 MB). This
    way we avoid unncessary memory overhead.

    :type driver_type: ``str``
    :param driver_type: Driver type ('compute' or 'storage')

    :type driver_name: ``str``
    :param driver_name: Driver name

    :type pricing_file_path: ``str``
    :param pricing_file_path: Custom path to a price file. If not provided
                              it uses a default path.

    :type cache_all: ``bool``
    :param cache_all: True to cache pricing data in memory for all the drivers
                      and not just for the requested one.

    :rtype: ``dict``
    :return: Dictionary with pricing where a key name is size ID and
             the value is a price.
    zInvalid driver type: %sr�rN��driver_type�driver_name�pricing)�CACHE_ALL_PRICING_DATA�VALID_PRICING_DRIVER_TYPES�AttributeError�PRICING_DATAr�open�read�json�loads�getr
)	rr �pricing_file_path�	cache_all�fp�content�pricing_data�driver_pricingr!s	         rrrPs���>�3�3�I��4�4��6��D�D��l�;�/�/��K�(��5�5��1�<M�N��	
���	%����'�'�)����:�:�g�&�L�!�+�.�{�;�N��5�	0�K�"�&�&�{�D�9�G���(/�L��%�	0���	���*�	,���/��s�C�Cc��|t||<y)a?
    Populate the driver pricing dictionary.

    :type driver_type: ``str``
    :param driver_type: Driver type ('compute' or 'storage')

    :type driver_name: ``str``
    :param driver_name: Driver name

    :type pricing: ``dict``
    :param pricing: Dictionary where a key is a size ID and a value is a price.
    N�r%rs   rr
r
�s��.5�L���k�*rc��t||��}|�J�d}	|�t||�}|St|||�}	|S#t$rd}Y|SwxYw)a�
    Return price for the provided size.

    :type driver_type: ``str``
    :param driver_type: Driver type ('compute' or 'storage')

    :type driver_name: ``str``
    :param driver_name: Driver name

    :type size_id: ``str`` or ``int``
    :param size_id: Unique size ID (can be an integer or a string - depends on
                    the driver)

    :rtype: ``float``
    :return: Size price.
    �rr N)r�float�KeyError)rr �size_id�regionr!�prices      rr	r	�sy��$�k�{�K�G������E���>��'�'�*�+�E��L��'�'�*�6�2�3�E�
�L��	�����L�	�s�;�;�A
�	A
c�(�itd<itd<y)z7
    Invalidate pricing cache for all the drivers.
    r
rNr2�rr�invalidate_pricing_cacher<�s��
!�L��� �L��rc��t�y)z�
    Invalidate pricing cache for all the drivers.

    Note: This method does the same thing as invalidate_pricing_cache and is
    here for backward compatibility reasons.
    N)r<r;rrrr�s
���rc�0�|t|vrt||=yy)z�
    Invalidate the cache for the specified driver.

    :type driver_type: ``str``
    :param driver_type: Driver type ('compute' or 'storage')

    :type driver_name: ``str``
    :param driver_name: Driver name
    Nr2r4s  r�invalidate_module_pricing_cacher?�s#���l�;�/�/���%�k�2�0rc�z�ddlm}tjj	|�}tjj|�sd|�d|�d�}t
|��tjj|�r/tjj|�rd|z}t
|��||�}|j}	tj|�}|jdd	�s
d}t|��t|d
�5}|j|�d	d	d	�y	#t$rd}t|��wxYw#1swYy	xYw)a
    Download pricing file from the file_url and save it to file_path.

    :type file_url: ``str``
    :param file_url: URL pointing to the pricing file.

    :type file_path: ``str``
    :param file_path: Path where a download pricing file will be saved.
    r)�get_response_objectzCan't write to z, directory z, doesn't existz4Can't write to %s file path because it's a directoryz/Provided URL doesn't contain valid pricing data�updatedN�w)�libcloud.utils.connectionrArr�dirnamer�
ValueError�isdir�bodyr(r)�JSONDecodeError�	Exceptionr*r&�write)	�file_urlrrA�dir_name�msg�responserH�data�file_handles	         rrr�s��>��w�w���y�)�H�
�7�7�>�>�(�#��8�%����o��	�w�w�~�~�i� �R�W�W�]�]�9�%=��(�*����o��"�8�,�H��=�=�D���z�z�$����8�8�I�t�$�@����n��
�i��	� �����$�� � ����@����n���� � �s�<D�<D1�D.�1D:r)NF)'�__doc__�
__future__r�typingrrr�os.pathrr�pjoin�
simplejsonr(rIr$rF�ImportError�__all__�DEFAULT_FILE_URL_GIT�DEFAULT_FILE_URL_S3_BUCKETrrE�abspath�__file__�CURRENT_DIRECTORYr�
expanduserrr%r#r"rrr
r	r<rr?rr;rr�<module>r`s �� �&�����!�	!��%��.�.����z��Z���G�G�O�O�B�G�G�O�O�H�$=�>��!�"3�5H�I���7�7�-�-�.H�I������
(��3����%�=A��A�H5�$ �F!��3�$>�$<�, ��W�%�$��%���!�� �O�!�s.�C�C�C
�
C�C
�
C�C�C

Youez - 2016 - github.com/yon3zu
LinuXploit