o .&ßa²ã@s`ddlmZddlmZddlmZddddddœZGd d „d eƒZGd d „d e ƒZ d d„Z dS)é)ÚTransferConfig)Úhuman_readable_to_bytes)Úsixi€é ièN)Úmultipart_thresholdÚmultipart_chunksizeÚmax_concurrent_requestsÚmax_queue_sizeÚ max_bandwidthc@s eZdZdS)ÚInvalidConfigErrorN)Ú__name__Ú __module__Ú __qualname__©rrúI/usr/lib/python3/dist-packages/awscli/customizations/s3/transferconfig.pyr sr c@sVeZdZgd¢ZddgZdgZedd„ƒZdd„Zd d „Z d d „Z d d„Z dd„Z dS)Ú RuntimeConfig)rrrr r rrr cCst ¡S©N)ÚDEFAULTSÚcopyrrrrÚdefaults)szRuntimeConfig.defaultscKs8t ¡}|r | |¡| |¡| |¡| |¡|S)ajCreate and convert a runtime config dictionary. This method will merge and convert S3 runtime configuration data into a single dictionary that can then be passed to classes that use this runtime config. :param kwargs: Any key in the ``DEFAULTS`` dict. :return: A dictionary of the merged and converted values. )rrÚupdateÚ_convert_human_readable_sizesÚ_convert_human_readable_ratesÚ_validate_config)ÚselfÚkwargsÚruntime_configrrrÚ build_config-s     zRuntimeConfig.build_configcCs:|jD]}| |¡}|durt|tjƒst|ƒ||<qdSr)ÚHUMAN_READABLE_SIZESÚgetÚ isinstancerÚ integer_typesr©rrÚattrÚvaluerrrr@s   €ýz+RuntimeConfig._convert_human_readable_sizescCsX|jD]&}| |¡}|dur)t|tjƒs)| d¡std|ƒ‚t|dd…ƒ||<qdS)NzB/sznInvalid rate: %s. The value must be expressed as a rate in terms of bytes per seconds (e.g. 10MB/s or 800KB/s)éþÿÿÿ)ÚHUMAN_READABLE_RATESrr rr!Úendswithr rr"rrrrFs   þÿ€øz+RuntimeConfig._convert_human_readable_ratesc Csj|jD]/}| |¡}|dur2zt|ƒ||<||dks!| ||¡Wqty1| ||¡YqwqdS)Nr)ÚPOSITIVE_INTEGERSrÚintÚ_error_positive_valueÚ ValueErrorr"rrrrQs     € ÿûþzRuntimeConfig._validate_configcCstd||fƒ‚)Nz+Value for %s must be a positive integer: %s)r )rÚnamer$rrrr*\s ÿz#RuntimeConfig._error_positive_valueN) r r rr(rr&Ú staticmethodrrrrrr*rrrrr!s  rcCsJddddddœ}i}| ¡D]\}}||vrq||||<qtdi|¤ŽS) zø Creates an equivalent s3transfer TransferConfig :type runtime_config: dict :argument runtime_config: A valid RuntimeConfig-generated dict. :returns: A TransferConfig with the same configuration as the runtime config. Úmax_request_concurrencyÚmax_request_queue_sizerrr )rr rrr Nr)Úitemsr)rÚtranslation_maprÚkeyr$rrrÚ*create_transfer_config_from_runtime_configas ûr3) Ús3transfer.managerrÚawscli.customizations.s3.utilsrÚ awscli.compatrrÚ Exceptionr Úobjectrr3rrrrÚs  û  @