<s> import os <EOL> import sys <EOL> from botocore . client import Config <EOL> from dateutil . parser import parse <EOL> from dateutil . tz import tzlocal <EOL> from awscli . compat import six <EOL> from awscli . compat import queue <EOL> from awscli . customizations . commands import BasicCommand <EOL> from awscli . customizations . s3 . comparator import Comparator <EOL> from awscli . customizations . s3 . fileinfobuilder import FileInfoBuilder <EOL> from awscli . customizations . s3 . fileformat import FileFormat <EOL> from awscli . customizations . s3 . filegenerator import FileGenerator <EOL> from awscli . customizations . s3 . fileinfo import TaskInfo , FileInfo <EOL> from awscli . customizations . s3 . filters import create_filter <EOL> from awscli . customizations . s3 . s3handler import S3Handler , S3StreamHandler <EOL> from awscli . customizations . s3 . utils import find_bucket_key , uni_print , AppendFilter , find_dest_path_comp_key , human_readable_size , RequestParamsMapper <EOL> from awscli . customizations . s3 . syncstrategy . base import MissingFileSync , SizeAndLastModifiedSync , NeverSync <EOL> from awscli . customizations . s3 import transferconfig <EOL> RECURSIVE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> HUMAN_READABLE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : "<STR_LIT>" } <EOL> SUMMARIZE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> DRYRUN = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> QUIET = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> FORCE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> FOLLOW_SYMLINKS = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT:default>' : True , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> NO_FOLLOW_SYMLINKS = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:default>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> NO_GUESS_MIME_TYPE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:default>' : True , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> CONTENT_TYPE = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> EXCLUDE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : AppendFilter , '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> INCLUDE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : AppendFilter , '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> ACL = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> GRANTS = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:+>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> SSE = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:?>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> SSE_C = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:?>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> SSE_C_KEY = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> SSE_KMS_KEY_ID = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> SSE_C_COPY_SOURCE = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:?>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> SSE_C_COPY_SOURCE_KEY = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> STORAGE_CLASS = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> WEBSITE_REDIRECT = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> CACHE_CONTROL = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> CONTENT_DISPOSITION = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> CONTENT_ENCODING = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> CONTENT_LANGUAGE = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( "<STR_LIT>" ) } <EOL> SOURCE_REGION = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) } <EOL> EXPIRES = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" ) <EOL> } <EOL> METADATA = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT:key>' : { '<STR_LIT:type>' : '<STR_LIT:string>' } , <EOL> '<STR_LIT:value>' : { '<STR_LIT:type>' : '<STR_LIT:string>' } <EOL> } , <EOL> '<STR_LIT>' : ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> } <EOL> METADATA_DIRECTIVE = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> } <EOL> INDEX_DOCUMENT = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> ERROR_DOCUMENT = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> ONLY_SHOW_ERRORS = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> EXPECTED_SIZE = { '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> PAGE_SIZE = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) } <EOL> IGNORE_GLACIER_WARNINGS = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> FORCE_GLACIER_TRANSFER = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:action>' : '<STR_LIT:store_true>' , <EOL> '<STR_LIT>' : ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> } <EOL> TRANSFER_ARGS = [ DRYRUN , QUIET , INCLUDE , EXCLUDE , ACL , <EOL> FOLLOW_SYMLINKS , NO_FOLLOW_SYMLINKS , NO_GUESS_MIME_TYPE , <EOL> SSE , SSE_C , SSE_C_KEY , SSE_KMS_KEY_ID , SSE_C_COPY_SOURCE , <EOL> SSE_C_COPY_SOURCE_KEY , STORAGE_CLASS , GRANTS , <EOL> WEBSITE_REDIRECT , CONTENT_TYPE , CACHE_CONTROL , <EOL> CONTENT_DISPOSITION , CONTENT_ENCODING , CONTENT_LANGUAGE , <EOL> EXPIRES , SOURCE_REGION , ONLY_SHOW_ERRORS , <EOL> PAGE_SIZE , IGNORE_GLACIER_WARNINGS , FORCE_GLACIER_TRANSFER ] <EOL> def get_client ( session , region , endpoint_url , verify , config = None ) : <EOL> return session . create_client ( '<STR_LIT>' , region_name = region , <EOL> endpoint_url = endpoint_url , verify = verify , <EOL> config = config ) <EOL> class S3Command ( BasicCommand ) : <EOL> def _run_main ( self , parsed_args , parsed_globals ) : <EOL> self . client = get_client ( self . _session , parsed_globals . region , <EOL> parsed_globals . endpoint_url , <EOL> parsed_globals . verify_ssl ) <EOL> class ListCommand ( S3Command ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> USAGE = "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT:?>' , '<STR_LIT:default>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , '<STR_LIT>' : USAGE } , RECURSIVE , <EOL> PAGE_SIZE , HUMAN_READABLE , SUMMARIZE ] <EOL> def _run_main ( self , parsed_args , parsed_globals ) : <EOL> super ( ListCommand , self ) . _run_main ( parsed_args , parsed_globals ) <EOL> self . _empty_result = False <EOL> self . _at_first_page = True <EOL> self . _size_accumulator = <NUM_LIT:0> <EOL> self . _total_objects = <NUM_LIT:0> <EOL> self . _human_readable = parsed_args . human_readable <EOL> path = parsed_args . paths <EOL> if path . startswith ( '<STR_LIT>' ) : <EOL> path = path [ <NUM_LIT:5> : ] <EOL> bucket , key = find_bucket_key ( path ) <EOL> if not bucket : <EOL> self . _list_all_buckets ( ) <EOL> elif parsed_args . dir_op : <EOL> self . _list_all_objects_recursive ( bucket , key , <EOL> parsed_args . page_size ) <EOL> else : <EOL> self . _list_all_objects ( bucket , key , parsed_args . page_size ) <EOL> if parsed_args . summarize : <EOL> self . _print_summary ( ) <EOL> if key : <EOL> return self . _check_no_objects ( ) <EOL> else : <EOL> return <NUM_LIT:0> <EOL> def _list_all_objects ( self , bucket , key , page_size = None ) : <EOL> paginator = self . client . get_paginator ( '<STR_LIT>' ) <EOL> iterator = paginator . paginate ( Bucket = bucket , <EOL> Prefix = key , Delimiter = '<STR_LIT:/>' , <EOL> PaginationConfig = { '<STR_LIT>' : page_size } ) <EOL> for response_data in iterator : <EOL> self . _display_page ( response_data ) <EOL> def _display_page ( self , response_data , use_basename = True ) : <EOL> common_prefixes = response_data . get ( '<STR_LIT>' , [ ] ) <EOL> contents = response_data . get ( '<STR_LIT>' , [ ] ) <EOL> if not contents and not common_prefixes : <EOL> self . _empty_result = True <EOL> return <EOL> for common_prefix in common_prefixes : <EOL> prefix_components = common_prefix [ '<STR_LIT>' ] . split ( '<STR_LIT:/>' ) <EOL> prefix = prefix_components [ - <NUM_LIT:2> ] <EOL> pre_string = "<STR_LIT>" . rjust ( <NUM_LIT:30> , "<STR_LIT:U+0020>" ) <EOL> print_str = pre_string + '<STR_LIT:U+0020>' + prefix + '<STR_LIT>' <EOL> uni_print ( print_str ) <EOL> for content in contents : <EOL> last_mod_str = self . _make_last_mod_str ( content [ '<STR_LIT>' ] ) <EOL> self . _size_accumulator += int ( content [ '<STR_LIT>' ] ) <EOL> self . _total_objects += <NUM_LIT:1> <EOL> size_str = self . _make_size_str ( content [ '<STR_LIT>' ] ) <EOL> if use_basename : <EOL> filename_components = content [ '<STR_LIT>' ] . split ( '<STR_LIT:/>' ) <EOL> filename = filename_components [ - <NUM_LIT:1> ] <EOL> else : <EOL> filename = content [ '<STR_LIT>' ] <EOL> print_str = last_mod_str + '<STR_LIT:U+0020>' + size_str + '<STR_LIT:U+0020>' + filename + '<STR_LIT:\n>' <EOL> uni_print ( print_str ) <EOL> self . _at_first_page = False <EOL> def _list_all_buckets ( self ) : <EOL> response_data = self . client . list_buckets ( ) <EOL> buckets = response_data [ '<STR_LIT>' ] <EOL> for bucket in buckets : <EOL> last_mod_str = self . _make_last_mod_str ( bucket [ '<STR_LIT>' ] ) <EOL> print_str = last_mod_str + '<STR_LIT:U+0020>' + bucket [ '<STR_LIT:Name>' ] + '<STR_LIT:\n>' <EOL> uni_print ( print_str ) <EOL> def _list_all_objects_recursive ( self , bucket , key , page_size = None ) : <EOL> paginator = self . client . get_paginator ( '<STR_LIT>' ) <EOL> iterator = paginator . paginate ( Bucket = bucket , <EOL> Prefix = key , <EOL> PaginationConfig = { '<STR_LIT>' : page_size } ) <EOL> for response_data in iterator : <EOL> self . _display_page ( response_data , use_basename = False ) <EOL> def _check_no_objects ( self ) : <EOL> if self . _empty_result and self . _at_first_page : <EOL> return <NUM_LIT:1> <EOL> return <NUM_LIT:0> <EOL> def _make_last_mod_str ( self , last_mod ) : <EOL> """<STR_LIT>""" <EOL> last_mod = parse ( last_mod ) <EOL> last_mod = last_mod . astimezone ( tzlocal ( ) ) <EOL> last_mod_tup = ( str ( last_mod . year ) , str ( last_mod . month ) . zfill ( <NUM_LIT:2> ) , <EOL> str ( last_mod . day ) . zfill ( <NUM_LIT:2> ) , <EOL> str ( last_mod . hour ) . zfill ( <NUM_LIT:2> ) , <EOL> str ( last_mod . minute ) . zfill ( <NUM_LIT:2> ) , <EOL> str ( last_mod . second ) . zfill ( <NUM_LIT:2> ) ) <EOL> last_mod_str = "<STR_LIT>" % last_mod_tup <EOL> return last_mod_str . ljust ( <NUM_LIT> , '<STR_LIT:U+0020>' ) <EOL> def _make_size_str ( self , size ) : <EOL> """<STR_LIT>""" <EOL> if self . _human_readable : <EOL> size_str = human_readable_size ( size ) <EOL> else : <EOL> size_str = str ( size ) <EOL> return size_str . rjust ( <NUM_LIT:10> , '<STR_LIT:U+0020>' ) <EOL> def _print_summary ( self ) : <EOL> """<STR_LIT>""" <EOL> print_str = str ( self . _total_objects ) <EOL> uni_print ( "<STR_LIT>" . rjust ( <NUM_LIT:15> , '<STR_LIT:U+0020>' ) + print_str + "<STR_LIT:\n>" ) <EOL> if self . _human_readable : <EOL> print_str = human_readable_size ( self . _size_accumulator ) <EOL> else : <EOL> print_str = str ( self . _size_accumulator ) <EOL> uni_print ( "<STR_LIT>" . rjust ( <NUM_LIT:15> , '<STR_LIT:U+0020>' ) + print_str + "<STR_LIT:\n>" ) <EOL> class WebsiteCommand ( S3Command ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = '<STR_LIT>' <EOL> USAGE = '<STR_LIT>' <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } , INDEX_DOCUMENT , ERROR_DOCUMENT ] <EOL> def _run_main ( self , parsed_args , parsed_globals ) : <EOL> super ( WebsiteCommand , self ) . _run_main ( parsed_args , parsed_globals ) <EOL> bucket = self . _get_bucket_name ( parsed_args . paths [ <NUM_LIT:0> ] ) <EOL> website_configuration = self . _build_website_configuration ( parsed_args ) <EOL> self . client . put_bucket_website ( <EOL> Bucket = bucket , WebsiteConfiguration = website_configuration ) <EOL> return <NUM_LIT:0> <EOL> def _build_website_configuration ( self , parsed_args ) : <EOL> website_config = { } <EOL> if parsed_args . index_document is not None : <EOL> website_config [ '<STR_LIT>' ] = { '<STR_LIT>' : parsed_args . index_document } <EOL> if parsed_args . error_document is not None : <EOL> website_config [ '<STR_LIT>' ] = { '<STR_LIT>' : parsed_args . error_document } <EOL> return website_config <EOL> def _get_bucket_name ( self , path ) : <EOL> if path . startswith ( '<STR_LIT>' ) : <EOL> path = path [ <NUM_LIT:5> : ] <EOL> if path . endswith ( '<STR_LIT:/>' ) : <EOL> path = path [ : - <NUM_LIT:1> ] <EOL> return path <EOL> class S3TransferCommand ( S3Command ) : <EOL> def _run_main ( self , parsed_args , parsed_globals ) : <EOL> super ( S3TransferCommand , self ) . _run_main ( parsed_args , parsed_globals ) <EOL> self . _convert_path_args ( parsed_args ) <EOL> params = self . _build_call_parameters ( parsed_args , { } ) <EOL> cmd_params = CommandParameters ( self . NAME , params , <EOL> self . USAGE ) <EOL> cmd_params . add_region ( parsed_globals ) <EOL> cmd_params . add_endpoint_url ( parsed_globals ) <EOL> cmd_params . add_verify_ssl ( parsed_globals ) <EOL> cmd_params . add_page_size ( parsed_args ) <EOL> cmd_params . add_paths ( parsed_args . paths ) <EOL> self . _handle_rm_force ( parsed_globals , cmd_params . parameters ) <EOL> runtime_config = transferconfig . RuntimeConfig ( ) . build_config ( <EOL> ** self . _session . get_scoped_config ( ) . get ( '<STR_LIT>' , { } ) ) <EOL> cmd = CommandArchitecture ( self . _session , self . NAME , <EOL> cmd_params . parameters , <EOL> runtime_config ) <EOL> cmd . set_clients ( ) <EOL> cmd . create_instructions ( ) <EOL> return cmd . run ( ) <EOL> def _build_call_parameters ( self , args , command_params ) : <EOL> """<STR_LIT>""" <EOL> for name , value in vars ( args ) . items ( ) : <EOL> command_params [ name ] = value <EOL> return command_params <EOL> def _convert_path_args ( self , parsed_args ) : <EOL> if not isinstance ( parsed_args . paths , list ) : <EOL> parsed_args . paths = [ parsed_args . paths ] <EOL> for i in range ( len ( parsed_args . paths ) ) : <EOL> path = parsed_args . paths [ i ] <EOL> if isinstance ( path , six . binary_type ) : <EOL> dec_path = path . decode ( sys . getfilesystemencoding ( ) ) <EOL> enc_path = dec_path . encode ( '<STR_LIT:utf-8>' ) <EOL> new_path = enc_path . decode ( '<STR_LIT:utf-8>' ) <EOL> parsed_args . paths [ i ] = new_path <EOL> def _handle_rm_force ( self , parsed_globals , parameters ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in parameters : <EOL> if parameters [ '<STR_LIT>' ] : <EOL> bucket , key = find_bucket_key ( parameters [ '<STR_LIT:src>' ] [ <NUM_LIT:5> : ] ) <EOL> if key : <EOL> raise ValueError ( '<STR_LIT>' <EOL> '<STR_LIT>' % bucket ) <EOL> path = '<STR_LIT>' + bucket <EOL> del_objects = RmCommand ( self . _session ) <EOL> rc = del_objects ( [ path , '<STR_LIT>' ] , parsed_globals ) <EOL> if rc != <NUM_LIT:0> : <EOL> raise RuntimeError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class CpCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = "<STR_LIT>" "<STR_LIT>" <EOL> USAGE = "<STR_LIT>" "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } ] + TRANSFER_ARGS + [ METADATA , METADATA_DIRECTIVE , EXPECTED_SIZE , RECURSIVE ] <EOL> class MvCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = "<STR_LIT>" "<STR_LIT>" <EOL> USAGE = "<STR_LIT>" "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } ] + TRANSFER_ARGS + [ METADATA , METADATA_DIRECTIVE , RECURSIVE ] <EOL> class RmCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = "<STR_LIT>" <EOL> USAGE = "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } , DRYRUN , QUIET , RECURSIVE , INCLUDE , <EOL> EXCLUDE , ONLY_SHOW_ERRORS , PAGE_SIZE ] <EOL> class SyncCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" <EOL> USAGE = "<STR_LIT>" "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } ] + TRANSFER_ARGS + [ METADATA , METADATA_DIRECTIVE ] <EOL> class MbCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT>' <EOL> DESCRIPTION = "<STR_LIT>" <EOL> USAGE = "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } ] <EOL> class RbCommand ( S3TransferCommand ) : <EOL> NAME = '<STR_LIT:rb>' <EOL> DESCRIPTION = ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> USAGE = "<STR_LIT>" <EOL> ARG_TABLE = [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : USAGE } , FORCE ] <EOL> class CommandArchitecture ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , session , cmd , parameters , runtime_config = None ) : <EOL> self . session = session <EOL> self . cmd = cmd <EOL> self . parameters = parameters <EOL> self . instructions = [ ] <EOL> self . _runtime_config = runtime_config <EOL> self . _endpoint = None <EOL> self . _source_endpoint = None <EOL> self . _client = None <EOL> self . _source_client = None <EOL> def set_clients ( self ) : <EOL> client_config = None <EOL> if self . parameters . get ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> client_config = Config ( signature_version = '<STR_LIT>' ) <EOL> self . _client = get_client ( <EOL> self . session , <EOL> region = self . parameters [ '<STR_LIT>' ] , <EOL> endpoint_url = self . parameters [ '<STR_LIT>' ] , <EOL> verify = self . parameters [ '<STR_LIT>' ] , <EOL> config = client_config <EOL> ) <EOL> self . _source_client = get_client ( <EOL> self . session , <EOL> region = self . parameters [ '<STR_LIT>' ] , <EOL> endpoint_url = self . parameters [ '<STR_LIT>' ] , <EOL> verify = self . parameters [ '<STR_LIT>' ] , <EOL> config = client_config <EOL> ) <EOL> if self . parameters [ '<STR_LIT>' ] : <EOL> if self . parameters [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> self . _source_client = get_client ( <EOL> self . session , <EOL> region = self . parameters [ '<STR_LIT>' ] , <EOL> endpoint_url = None , <EOL> verify = self . parameters [ '<STR_LIT>' ] , <EOL> config = client_config <EOL> ) <EOL> def create_instructions ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . needs_filegenerator ( ) : <EOL> self . instructions . append ( '<STR_LIT>' ) <EOL> if self . parameters . get ( '<STR_LIT>' ) : <EOL> self . instructions . append ( '<STR_LIT>' ) <EOL> if self . cmd == '<STR_LIT>' : <EOL> self . instructions . append ( '<STR_LIT>' ) <EOL> self . instructions . append ( '<STR_LIT>' ) <EOL> self . instructions . append ( '<STR_LIT>' ) <EOL> def needs_filegenerator ( self ) : <EOL> if self . cmd in [ '<STR_LIT>' , '<STR_LIT:rb>' ] or self . parameters [ '<STR_LIT>' ] : <EOL> return False <EOL> else : <EOL> return True <EOL> def choose_sync_strategies ( self ) : <EOL> """<STR_LIT>""" <EOL> sync_strategies = { } <EOL> sync_strategies [ '<STR_LIT>' ] = SizeAndLastModifiedSync ( ) <EOL> sync_strategies [ '<STR_LIT>' ] = MissingFileSync ( ) <EOL> sync_strategies [ '<STR_LIT>' ] = NeverSync ( ) <EOL> responses = self . session . emit ( <EOL> '<STR_LIT>' , params = self . parameters ) <EOL> if responses is not None : <EOL> for response in responses : <EOL> override_sync_strategy = response [ <NUM_LIT:1> ] <EOL> if override_sync_strategy is not None : <EOL> sync_type = override_sync_strategy . sync_type <EOL> sync_type += '<STR_LIT>' <EOL> sync_strategies [ sync_type ] = override_sync_strategy <EOL> return sync_strategies <EOL> def run ( self ) : <EOL> """<STR_LIT>""" <EOL> src = self . parameters [ '<STR_LIT:src>' ] <EOL> dest = self . parameters [ '<STR_LIT>' ] <EOL> paths_type = self . parameters [ '<STR_LIT>' ] <EOL> files = FileFormat ( ) . format ( src , dest , self . parameters ) <EOL> rev_files = FileFormat ( ) . format ( dest , src , self . parameters ) <EOL> cmd_translation = { } <EOL> cmd_translation [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> cmd_translation [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> cmd_translation [ '<STR_LIT>' ] = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> cmd_translation [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:rb>' : '<STR_LIT>' <EOL> } <EOL> result_queue = queue . Queue ( ) <EOL> operation_name = cmd_translation [ paths_type ] [ self . cmd ] <EOL> fgen_kwargs = { <EOL> '<STR_LIT>' : self . _source_client , '<STR_LIT>' : operation_name , <EOL> '<STR_LIT>' : self . parameters [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : self . parameters [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : result_queue <EOL> } <EOL> rgen_kwargs = { <EOL> '<STR_LIT>' : self . _client , '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : self . parameters [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : self . parameters [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : result_queue <EOL> } <EOL> fgen_request_parameters = { } <EOL> fgen_head_object_params = { } <EOL> fgen_request_parameters [ '<STR_LIT>' ] = fgen_head_object_params <EOL> fgen_kwargs [ '<STR_LIT>' ] = fgen_request_parameters <EOL> RequestParamsMapper . map_head_object_params ( <EOL> fgen_head_object_params , self . parameters ) <EOL> if paths_type == '<STR_LIT>' : <EOL> RequestParamsMapper . map_head_object_params ( <EOL> fgen_head_object_params , { <EOL> '<STR_LIT>' : self . parameters . get ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : self . parameters . get ( '<STR_LIT>' ) <EOL> } <EOL> ) <EOL> file_generator = FileGenerator ( ** fgen_kwargs ) <EOL> rev_generator = FileGenerator ( ** rgen_kwargs ) <EOL> taskinfo = [ TaskInfo ( src = files [ '<STR_LIT:src>' ] [ '<STR_LIT:path>' ] , <EOL> src_type = '<STR_LIT>' , <EOL> operation_name = operation_name , <EOL> client = self . _client ) ] <EOL> stream_dest_path , stream_compare_key = find_dest_path_comp_key ( files ) <EOL> stream_file_info = [ FileInfo ( src = files [ '<STR_LIT:src>' ] [ '<STR_LIT:path>' ] , <EOL> dest = stream_dest_path , <EOL> compare_key = stream_compare_key , <EOL> src_type = files [ '<STR_LIT:src>' ] [ '<STR_LIT:type>' ] , <EOL> dest_type = files [ '<STR_LIT>' ] [ '<STR_LIT:type>' ] , <EOL> operation_name = operation_name , <EOL> client = self . _client , <EOL> is_stream = True ) ] <EOL> file_info_builder = FileInfoBuilder ( <EOL> self . _client , self . _source_client , self . parameters ) <EOL> s3handler = S3Handler ( self . session , self . parameters , <EOL> runtime_config = self . _runtime_config , <EOL> result_queue = result_queue ) <EOL> s3_stream_handler = S3StreamHandler ( self . session , self . parameters , <EOL> result_queue = result_queue ) <EOL> sync_strategies = self . choose_sync_strategies ( ) <EOL> command_dict = { } <EOL> if self . cmd == '<STR_LIT>' : <EOL> command_dict = { '<STR_LIT>' : [ files , rev_files ] , <EOL> '<STR_LIT>' : [ file_generator , <EOL> rev_generator ] , <EOL> '<STR_LIT>' : [ create_filter ( self . parameters ) , <EOL> create_filter ( self . parameters ) ] , <EOL> '<STR_LIT>' : [ Comparator ( ** sync_strategies ) ] , <EOL> '<STR_LIT>' : [ file_info_builder ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> elif self . cmd == '<STR_LIT>' and self . parameters [ '<STR_LIT>' ] : <EOL> command_dict = { '<STR_LIT>' : [ stream_file_info ] , <EOL> '<STR_LIT>' : [ s3_stream_handler ] } <EOL> elif self . cmd == '<STR_LIT>' : <EOL> command_dict = { '<STR_LIT>' : [ files ] , <EOL> '<STR_LIT>' : [ file_generator ] , <EOL> '<STR_LIT>' : [ create_filter ( self . parameters ) ] , <EOL> '<STR_LIT>' : [ file_info_builder ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> elif self . cmd == '<STR_LIT>' : <EOL> command_dict = { '<STR_LIT>' : [ files ] , <EOL> '<STR_LIT>' : [ file_generator ] , <EOL> '<STR_LIT>' : [ create_filter ( self . parameters ) ] , <EOL> '<STR_LIT>' : [ file_info_builder ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> elif self . cmd == '<STR_LIT>' : <EOL> command_dict = { '<STR_LIT>' : [ files ] , <EOL> '<STR_LIT>' : [ file_generator ] , <EOL> '<STR_LIT>' : [ create_filter ( self . parameters ) ] , <EOL> '<STR_LIT>' : [ file_info_builder ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> elif self . cmd == '<STR_LIT>' : <EOL> command_dict = { '<STR_LIT>' : [ taskinfo ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> elif self . cmd == '<STR_LIT:rb>' : <EOL> command_dict = { '<STR_LIT>' : [ taskinfo ] , <EOL> '<STR_LIT>' : [ s3handler ] } <EOL> files = command_dict [ '<STR_LIT>' ] <EOL> while self . instructions : <EOL> instruction = self . instructions . pop ( <NUM_LIT:0> ) <EOL> file_list = [ ] <EOL> components = command_dict [ instruction ] <EOL> for i in range ( len ( components ) ) : <EOL> if len ( files ) > len ( components ) : <EOL> file_list . append ( components [ i ] . call ( * files ) ) <EOL> else : <EOL> file_list . append ( components [ i ] . call ( files [ i ] ) ) <EOL> files = file_list <EOL> rc = <NUM_LIT:0> <EOL> if files [ <NUM_LIT:0> ] . num_tasks_failed > <NUM_LIT:0> : <EOL> rc = <NUM_LIT:1> <EOL> if files [ <NUM_LIT:0> ] . num_tasks_warned > <NUM_LIT:0> : <EOL> rc = <NUM_LIT:2> <EOL> return rc <EOL> class CommandParameters ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , cmd , parameters , usage ) : <EOL> """<STR_LIT>""" <EOL> self . cmd = cmd <EOL> self . parameters = parameters <EOL> self . usage = usage <EOL> if '<STR_LIT>' not in parameters : <EOL> self . parameters [ '<STR_LIT>' ] = False <EOL> if '<STR_LIT>' not in parameters : <EOL> self . parameters [ '<STR_LIT>' ] = True <EOL> if '<STR_LIT>' not in parameters : <EOL> self . parameters [ '<STR_LIT>' ] = None <EOL> if self . cmd in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:rb>' ] : <EOL> self . parameters [ '<STR_LIT>' ] = True <EOL> def add_paths ( self , paths ) : <EOL> """<STR_LIT>""" <EOL> self . check_path_type ( paths ) <EOL> self . _normalize_s3_trailing_slash ( paths ) <EOL> src_path = paths [ <NUM_LIT:0> ] <EOL> self . parameters [ '<STR_LIT:src>' ] = src_path <EOL> if len ( paths ) == <NUM_LIT:2> : <EOL> self . parameters [ '<STR_LIT>' ] = paths [ <NUM_LIT:1> ] <EOL> elif len ( paths ) == <NUM_LIT:1> : <EOL> self . parameters [ '<STR_LIT>' ] = paths [ <NUM_LIT:0> ] <EOL> self . _validate_streaming_paths ( ) <EOL> self . _validate_path_args ( ) <EOL> self . _validate_sse_c_args ( ) <EOL> def _validate_streaming_paths ( self ) : <EOL> self . parameters [ '<STR_LIT>' ] = False <EOL> if self . parameters [ '<STR_LIT:src>' ] == '<STR_LIT:->' or self . parameters [ '<STR_LIT>' ] == '<STR_LIT:->' : <EOL> if self . cmd != '<STR_LIT>' or self . parameters . get ( '<STR_LIT>' ) : <EOL> raise ValueError ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) <EOL> self . parameters [ '<STR_LIT>' ] = True <EOL> self . parameters [ '<STR_LIT>' ] = False <EOL> self . parameters [ '<STR_LIT>' ] = True <EOL> def _validate_path_args ( self ) : <EOL> params = self . parameters <EOL> if self . cmd == '<STR_LIT>' and self . _same_path ( params [ '<STR_LIT:src>' ] , params [ '<STR_LIT>' ] ) : <EOL> raise ValueError ( "<STR_LIT>" % ( <EOL> params [ '<STR_LIT:src>' ] , params [ '<STR_LIT>' ] ) ) <EOL> if '<STR_LIT>' == params [ '<STR_LIT>' ] and not params [ '<STR_LIT>' ] : <EOL> if not os . path . exists ( params [ '<STR_LIT:src>' ] ) : <EOL> raise RuntimeError ( <EOL> '<STR_LIT>' % <EOL> params [ '<STR_LIT:src>' ] ) <EOL> elif '<STR_LIT>' == params [ '<STR_LIT>' ] and params [ '<STR_LIT>' ] : <EOL> if not os . path . exists ( params [ '<STR_LIT>' ] ) : <EOL> os . makedirs ( params [ '<STR_LIT>' ] ) <EOL> def _same_path ( self , src , dest ) : <EOL> if not self . parameters [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> return False <EOL> elif src == dest : <EOL> return True <EOL> elif dest . endswith ( '<STR_LIT:/>' ) : <EOL> src_base = os . path . basename ( src ) <EOL> return src == os . path . join ( dest , src_base ) <EOL> def _normalize_s3_trailing_slash ( self , paths ) : <EOL> for i , path in enumerate ( paths ) : <EOL> if path . startswith ( '<STR_LIT>' ) : <EOL> bucket , key = find_bucket_key ( path [ <NUM_LIT:5> : ] ) <EOL> if not key and not path . endswith ( '<STR_LIT:/>' ) : <EOL> path += '<STR_LIT:/>' <EOL> paths [ i ] = path <EOL> def check_path_type ( self , paths ) : <EOL> """<STR_LIT>""" <EOL> template_type = { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT:rb>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ ] , '<STR_LIT>' : [ ] } <EOL> paths_type = '<STR_LIT>' <EOL> usage = "<STR_LIT>" % ( self . cmd , <EOL> self . usage ) <EOL> for i in range ( len ( paths ) ) : <EOL> if paths [ i ] . startswith ( '<STR_LIT>' ) : <EOL> paths_type = paths_type + '<STR_LIT>' <EOL> else : <EOL> paths_type = paths_type + '<STR_LIT>' <EOL> if self . cmd in template_type [ paths_type ] : <EOL> self . parameters [ '<STR_LIT>' ] = paths_type <EOL> else : <EOL> raise TypeError ( "<STR_LIT>" % usage ) <EOL> def add_region ( self , parsed_globals ) : <EOL> self . parameters [ '<STR_LIT>' ] = parsed_globals . region <EOL> def add_endpoint_url ( self , parsed_globals ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in parsed_globals : <EOL> self . parameters [ '<STR_LIT>' ] = getattr ( parsed_globals , <EOL> '<STR_LIT>' ) <EOL> else : <EOL> self . parameters [ '<STR_LIT>' ] = None <EOL> def add_verify_ssl ( self , parsed_globals ) : <EOL> self . parameters [ '<STR_LIT>' ] = parsed_globals . verify_ssl <EOL> def add_page_size ( self , parsed_args ) : <EOL> self . parameters [ '<STR_LIT>' ] = getattr ( parsed_args , '<STR_LIT>' , None ) <EOL> def _validate_sse_c_args ( self ) : <EOL> self . _validate_sse_c_arg ( ) <EOL> self . _validate_sse_c_arg ( '<STR_LIT>' ) <EOL> self . _validate_sse_c_copy_source_for_paths ( ) <EOL> def _validate_sse_c_arg ( self , sse_c_type = '<STR_LIT>' ) : <EOL> sse_c_key_type = sse_c_type + '<STR_LIT>' <EOL> sse_c_type_param = '<STR_LIT>' + sse_c_type . replace ( '<STR_LIT:_>' , '<STR_LIT:->' ) <EOL> sse_c_key_type_param = '<STR_LIT>' + sse_c_key_type . replace ( '<STR_LIT:_>' , '<STR_LIT:->' ) <EOL> if self . parameters . get ( sse_c_type ) : <EOL> if not self . parameters . get ( sse_c_key_type ) : <EOL> raise ValueError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( sse_c_type_param , sse_c_key_type_param ) <EOL> ) <EOL> if self . parameters . get ( sse_c_key_type ) : <EOL> if not self . parameters . get ( sse_c_type ) : <EOL> raise ValueError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( sse_c_key_type_param , sse_c_type_param ) <EOL> ) <EOL> def _validate_sse_c_copy_source_for_paths ( self ) : <EOL> if self . parameters . get ( '<STR_LIT>' ) : <EOL> if self . parameters [ '<STR_LIT>' ] != '<STR_LIT>' : <EOL> raise ValueError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) </s>
