#NEWLINE# def create_filter( parameters ) : #NEWLINE# #INDENT# 'Given the CLI parameters dict, create a Filter object.' #NEWLINE# if parameters [ 'filters' ] : #NEWLINE# #INDENT# cli_filters = parameters [ 'filters' ] #NEWLINE# real_filters = [ ] #NEWLINE# for ( filter_type , filter_pattern ) in cli_filters : #NEWLINE# #INDENT# real_filters . append ( ( filter_type . lstrip ( '-' ) , filter_pattern ) ) #NEWLINE# #UNINDENT# source_location = parameters [ 'src' ] #NEWLINE# if source_location . startswith ( 's3://' ) : #NEWLINE# #INDENT# src_rootdir = _get_s3_root ( source_location , parameters [ 'dir_op' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# src_rootdir = _get_local_root ( parameters [ 'src' ] , parameters [ 'dir_op' ] ) #NEWLINE# #UNINDENT# destination_location = parameters [ 'dest' ] #NEWLINE# if destination_location . startswith ( 's3://' ) : #NEWLINE# #INDENT# dst_rootdir = _get_s3_root ( parameters [ 'dest' ] , parameters [ 'dir_op' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dst_rootdir = _get_local_root ( parameters [ 'dest' ] , parameters [ 'dir_op' ] ) #NEWLINE# #UNINDENT# return Filter ( real_filters , src_rootdir , dst_rootdir ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return Filter ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , None , None )