HEX
Server: nginx/1.30.4
System: Linux d-twindigital-web-1.host-ed.eu 4.18.0-553.141.2.el8_10.x86_64 #1 SMP Wed Jul 8 10:28:18 EDT 2026 x86_64
User: u_twindigital_html (1009)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/S3/__pycache__/Config.cpython-36.pyc
3

@tJ[R�@s`ddlmZddlZddlmZmZmZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
m
Z
yddlZWnek
r�ddljZYnXddlZyddlmZmZmZmZWn,ek
r�ddlmZmZmZmZYnXyeWnek
�reZYnXdd
d�Zdd
�Zdd�Zdd�ZGdd�de �Z!Gdd�de �ZGdd�de �Z"dS)�)�absolute_importN)�debug�warning�error�)�Progress)�
SortedDict)�
NoOptionError�NoSectionError�MissingSectionHeaderError�ConfigParser�utf-8�replacecCsBt|�tkr|Syt|||�Stk
r<td|��YnXdS)z�
    Convert 'string' to Unicode or raise an exception.
    Config can't use toolbox from Utils that is itself using Config
    z Conversion to unicode failed: %rN)�type�unicode�UnicodeDecodeError)�string�encoding�errors�r�/usr/lib/python3.6/Config.py�config_unicodise(srcCs8t|�tkr|j�dkSt|�tkr0|dkr0dSdSdS)	zsCheck to see if a string is true, yes, on, or 1

    value may be a str, or unicode.

    Return True if it is
    �true�yes�on�1TFN)rrrr)rr�lower�bool)�valuerrr�is_bool_true5s
rcCs8t|�tkr|j�dkSt|�tkr0|dkr0dSdSdS)	ztCheck to see if a string is false, no, off, or 0

    value may be a str, or unicode.

    Return True if it is
    �false�no�off�0FTN)r r!r"r#)rrrr)rrrr�
is_bool_falseCs
r$cCst|�pt|�S)z)Check a string value to see if it is bool)rr$)rrrr�is_boolQsr%c	@seZdZdZgZiZdZdZdZdZ	dZ
dZdZdZ
dZejZejj�ZejZd:Zd;Zd
Zd
Zd
Zedd�Zd
Z d
Z!dZ"d
Z#d
Z$dZ%d
Z&d
Z'dZ(d
Z)dZ*gZ+gZ,dZ-dZ.d
Z/d
Z0dZ1dZ2dddddddddg	Z3d
Z4d
Z5d
Z6d<Z7d=Z8ded<d
Z9dZ:dZ;dZ<dZ=dZ>dZ?dZ@dZAdZBdZCdZDdZEdZFdZGdZHdZId dgZJgZKgZLiZMiZNeOjP��pRd!ZQd"ZRdZSd
ZTdZUd
ZVd#ZWd
ZXd
ZYdZZd$Z[dZ\d%Z]gZ^gZ_dZ`dZagZbdZcdZddZed
Zfd&Zgd
Zhd
ZidZjdZkd
Zld
Zmd
Znd'Zod>d(d)�Zpd?d*d+�Zqd,d-�Zrd.d/�Zsd0d1�Ztd2d3�Zud4d5�Zvd6d7�Zwd8d9�ZxdS)@�ConfigN�Tzs3.amazonaws.comz%(bucket)s.s3.amazonaws.comzsdb.amazonaws.comzcloudfront.amazonaws.com�@iF)Zignore_caserZStandardi8�uname�uid�gname�gidZatime�mtime�ctime�mode�md5z@[sync] Remove remote S3 objects when local file has been deleted�delete_removedz}%(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)sz}%(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)sZUSzbinary/octet-stream�i'�sizezUTF-8Znormali,z
index.htmlz8http://%(bucket)s.s3-website-%(location)s.amazonaws.com/r�dcCs|jdkrtj|�|_|jS)N)�	_instance�object�__new__)�self�
configfile�
access_key�
secret_key�access_tokenrrrr7�s
zConfig.__new__cCs$|�r y|j|�Wn0tk
rDdtjks8dtjkr@|j�YnX|rZ|rZ||_||_|rj||_d|_t	|j�dkr�tj
d�p�tj
d�}tj
d�p�tj
d�}tj
d	�p�tj
d
�}|r�t|�|_t|�|_|r�d|_t|�|_n|j�|j
o�|jdk�rtd�|j
�r |jdk�r td
��dS)N�AWS_CREDENTIAL_FILE�AWS_PROFILEFrZAWS_ACCESS_KEYZAWS_ACCESS_KEY_IDZAWS_SECRET_KEYZAWS_SECRET_ACCESS_KEYZAWS_SESSION_TOKENZAWS_SECURITY_TOKENTz�Cannot have server_side_encryption (S3 SSE) and KMS_key set (S3 KMS). KMS encryption will be used. Please set server_side_encryption to FalsezFKMS encryption requires signature v4. Please set signature_v2 to False)�read_config_file�IOError�os�environ�aws_credential_filer:r;r<�_access_token_refresh�len�getenvr�role_config�kms_key�server_side_encryptionr�signature_v2�	Exception)r8r9r:r;r<Zenv_access_keyZenv_secret_keyZenv_access_tokenrrr�__init__�s6

zConfig.__init__cCs�y�tjddd�}|jdd�|j�}|j�}|jdkr�t|�dkr�|jdd|jd	��|j�}|jdkr�tj	|�}t
�jd
|djd��t
�jd
|djd��t
�jd|djd��q�t
�nt
�Wn�YnXdS)z9
        Get credentials from IAM authentication
        z169.254.169.254�)�host�timeout�GETz+/latest/meta-data/iam/security-credentials/��rz-/latest/meta-data/iam/security-credentials/%szUTF-8r:ZAccessKeyId�asciir;ZSecretAccessKeyr<�TokenN)�httplibZHTTPConnectionZrequestZgetresponse�read�statusrE�decode�json�loadr&�
update_option�encoder@)r8�connZresp�filesZcredsrrrrG�s"

zConfig.role_configc	Cs,|jr(y|j�Wntd�YnXdS)NzCould not refresh role)rDrGr)r8rrr�role_refreshs
zConfig.role_refreshc	s��y@tjjd��dtjkr:tjjtjd�r:ttjd��t��td��y�j��WnJt	k
r�d}t
�d��}d|j�}WdQRX�j|jd��YnXttjj
dd��}td	|�d��fdd�	}||d
d�}|r�t�jdt|��||dd�}|�rt�jdt|��||ddd�}|�r@t�jdt|��Wnhtk
�rx}ztd|j�f�WYdd}~Xn4tk
�r�}ztd|�f�WYdd}~XnXdS)Nz~/.aws/credentialsr=zReading AWS credentials from %s�rz
[default]
zutf-8r>�defaultzUsing AWS profile '%s'Tcs�d}y�j||�}Wn�tk
r�}zt|r@td|j|j�f�|r�y,|}d}�j||�}td|dd�Wn"tk
r�}zWYdd}~XnXWYdd}~XnX|r�td||�f�|S)NzLCouldn't find key '%s' for the AWS Profile '%s' in the credentials file '%s'r`z#Legacy configuratin key '%s' used, z=please use the standardized config format as described here: zghttps://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/zWFound the configuration option '%s' for the AWS Profile '%s' in the credentials file %s)�getr	r�option�sectionr)�profile�keyZ
legacy_keyZ
print_warning�result�e)rC�configrr�get_key7s&
$z+Config.aws_credential_file.<locals>.get_keyZaws_access_key_idZAWSAccessKeyIdr:Zaws_secret_access_keyZAWSSecretKeyr;Zaws_session_tokenFr<z %d accessing credentials file %sz;Couldn't find AWS Profile '%s' in the credentials file '%s')T)rA�path�
expanduserrB�isfiler�PyConfigParserrrUr�openZread_stringrWrar&rZr@r�errnor
)	r8Z
config_string�frdriZprofile_access_keyZprofile_secret_keyZprofile_access_tokenrgr)rCrhrrCs:"zConfig.aws_credential_filecCsXg}xNt|�D]B}ttt|��}|jd�s|td�td�td�fkrFq|j|�qW|S)N�_r�*T)�dirr�getattrr&�
startswith�append)r8ZretvalrbZoption_typerrr�option_listas
zConfig.option_listcCs�t|�}x6|j�D]*}|j|�}|dk	r0|j�}|j||�qW|jd�r\|jd|jd��|jd�r�x@|jd�jd�D],}|jd�\}}|j�|j|jdd�j�<qxW|jj	|�dS)N�
acl_public�add_headers�,�:rq�-)
rrwra�striprZ�split�
extra_headersr�
_parsed_filesrv)r8r9ZcprbZ_optionrerrrrr?os


zConfig.read_config_filecCst|�jd|�dS)Nr`)�ConfigDumper�dump)r8�streamrrr�dump_config�szConfig.dump_configcCs>|dkrdSt|�jd�r4|j|tj|dd���S|dkr�yt|�}Wnhtk
r�y2ytj|}Wnt	k
r�tj
|}YnXWn tk
r�td|��YnXYnX�nx|dk�r@|jd�s�|jd�r�d}n|jd	�s�|jd
�r�d}nd}y(|�rt|dd��|>�pt|�}Wntd
||f��YnXn�t
tt|��t
d�k�srtt|�dk�r�t|��r�t|��r�d}n t|��r�d}ntd||f��n�t
tt|��t
d�k�r�yt|�}Wn&tk
�r�td||f��YnXn<|dk�r.|jd��r|dd�}n|jd��r.|dd�}tt||�dS)N�$r�	verbosityz)Config: verbosity level '%s' is not valid�	limitrate�k�K�
�m�M�rzFConfig: value of option %s must have suffix m, k, or nothing, not '%s'TFz8Config: value of option '%s' must be Yes or No, not '%s'rrz9Config: value of option '%s' must be an integer, not '%s'�	host_base�host_bucket�cloudfront_hostzhttp://�zhttps://����)r�r�r�)rrurZrArF�int�
ValueError�logging�_levelNames�AttributeError�_nameToLevel�KeyError�endswithrrtr&r%rr$�setattr)r8rbrZshiftrrrrZ�sV
(


zConfig.update_optioniir�r�)NNNN)NNNN)y�__name__�
__module__�__qualname__r5r�Z_docr:r;r<rDr�r�rHZ
simpledb_hostr�r��WARNINGr��sys�stdout�isattyZprogress_meterrZ
ProgressCRZprogress_classZ
send_chunkZ
recv_chunkZlist_md5Zlong_listingZhuman_readable_sizesrr�forcerI�enableZget_continueZput_continueZ	upload_idZ
skip_existing�	recursiveZrestore_daysZrestore_priorityrxZ
acl_grantsZacl_revokesZ
proxy_hostZ
proxy_portZencrypt�dry_runZadd_encoding_extsZpreserve_attrsZpreserve_attrs_listr1Zdelete_afterZdelete_after_fetchZ
max_delete�limitZ
delay_updates�gpg_passphraseZgpg_commandZgpg_encryptZgpg_decryptZ	use_httpsZ
ca_certs_fileZcheck_ssl_certificateZcheck_ssl_hostnameZbucket_locationZdefault_mime_typeZguess_mime_typeZuse_mime_magicZ	mime_typeZenable_multipartZmultipart_chunk_size_mbZmultipart_max_chunksZsync_checks�exclude�includeZ
debug_excludeZ
debug_include�locale�getpreferredencodingrZurlencoding_modeZlog_target_prefixZreduced_redundancyZ
storage_class�follow_symlinksZsocket_timeoutZinvalidate_on_cfZinvalidate_default_index_on_cfZ#invalidate_default_index_root_on_cfZ
website_indexZ
website_errorZwebsite_endpointZadditional_destinationsZ
files_fromZ
cache_fileryZremove_headersZexpiry_daysZexpiry_dateZ
expiry_prefixrJr�Zrequester_paysZ
stop_on_errorZcontent_dispositionZcontent_typeZstatsZuse_http_expectZsignurl_use_httpsZthrottle_maxr7rLrGr^rCrwr?r�rZrrrrr&Us�



&Er&c@s>eZdZgfdd�Zgfdd�Zdd�Zdd�Zdd
d�Zd	S)
rcCsi|_|j||�dS)N)�cfg�
parse_file)r8�file�sectionsrrrrL�szConfigParser.__init__cCs�td|�t|�tg�kr"|g}d}tjd�}tjd�}tjd�}tjd�}tjd�}tj|d|jd	d
�d���"}	�x|	D�]}
|j|
�s||j|
�r�q||j|
�}|r�|j�d}||kp�t	|�dk}q||j|
�}
|
o�|�r||
j
�}|j|d
��r|d
dd�|d
<|j|d|d
�|ddk�r^d|d
dd�t	|d
�d|d
dd�f}n|d
}td|d|f�q|td||
f�q|WWdQRXdS)NzConfigParser: Reading file '%s'Tz^\s*#.*z^\s*$z
^\[([^\]]+)\]z$^\s*(?P<key>\w+)\s*=\s*(?P<value>.*)z^"(.*)"\s*$r_rzUTF-8)rrrrrer:r;r�z%s...%d_chars...%srM�zConfigParser: %s->%sz!Ignoring invalid line in '%s': %sr�)r:r;r�r�)
rr�re�compile�iornra�match�groupsrE�	groupdict�__setitem__r)r8r�r�Zin_our_sectionZ	r_commentZr_emptyZ	r_sectionZr_dataZr_quotes�fp�lineZ
is_sectionrcZis_data�dataZprint_valuerrrr��s<







4zConfigParser.parse_filecCs
|j|S)N)r�)r8�namerrr�__getitem__�szConfigParser.__getitem__cCs||j|<dS)N)r�)r8r�rrrrr��szConfigParser.__setitem__NcCs||jkr|j|S|S)N)r�)r8r�r`rrrra�s

zConfigParser.get)N)r�r�r�rLr�r�r�rarrrrr�s
!rc@seZdZdd�Zdd�ZdS)r�cCs
||_dS)N)r�)r8r�rrrrL�szConfigDumper.__init__cCs�|jjd|�x�|j�D]|}t||�}|dkr�t|t�r�y2ytj|}Wntk
rhtj	|}YnXWnt
k
r�YnX|jjd||f�qWdS)Nz[%s]
r�z%s = %s
)r��writerwrt�
isinstancer�r�r�r��_levelToNamer�)r8rcrhrbrrrrr��s

zConfigDumper.dumpN)r�r�r�rLr�rrrrr��sr�)r
r)#Z
__future__rr�rrrr�rAr�r�rXr'rrrT�ImportErrorZhttp.client�clientr��configparserr	r
rrrmr�	NameError�strrrr$r%r6r&r�rrrr�<module>	s>


s1