def handle(self, *args, **options):
<EOL>self.uploaded_files = <NUM_LIT:0><EOL>self.uploaded_file_list = []<EOL>self.deleted_files = <NUM_LIT:0><EOL>self.deleted_file_list = []<EOL>self.start_time = time.time()<EOL>self.set_options(options)<EOL>logger.debug("<STR_LIT>")<EOL>if self.verbosity > <NUM_LIT:2>:<EOL><INDENT>self.stdout.write("<STR_LIT>")<EOL><DEDENT>self.s3_client, self.s3_resource = get_s3_client()<EOL>logger.debug("<STR_LIT>".format(self.aws_bucket_name))<EOL>if self.verbosity > <NUM_LIT:2>:<EOL><INDENT>self.stdout.write("<STR_LIT>".format(self.aws_bucket_name))<EOL><DEDENT>self.bucket = self.s3_resource.Bucket(self.aws_bucket_name)<EOL>if self.force_publish and self.no_delete:<EOL><INDENT>self.blind_upload = True<EOL>logger.debug("<STR_LIT>")<EOL>self.s3_obj_dict = {}<EOL><DEDENT>else:<EOL><INDENT>self.blind_upload = False<EOL>logger.debug("<STR_LIT>")<EOL>if self.verbosity > <NUM_LIT:2>:<EOL><INDENT>self.stdout.write("<STR_LIT>")<EOL><DEDENT>self.s3_obj_dict = {}<EOL>self.s3_obj_dict = self.get_bucket_file_list()<EOL><DEDENT>logger.debug("<STR_LIT>")<EOL>if self.verbosity > <NUM_LIT:2>:<EOL><INDENT>self.stdout.write("<STR_LIT>")<EOL><DEDENT>self.local_file_list = self.get_local_file_list()<EOL>logger.debug("<STR_LIT>")<EOL>if self.verbosity > <NUM_LIT:2>:<EOL><INDENT>self.stdout.write("<STR_LIT>")<EOL><DEDENT>self.sync_with_s3()<EOL>if not self.dry_run and not self.no_delete:<EOL><INDENT>self.deleted_file_list = list(self.s3_obj_dict.keys())<EOL>self.deleted_files = len(self.deleted_file_list)<EOL>if self.deleted_files:<EOL><INDENT>logger.debug("<STR_LIT>" % self.deleted_files)<EOL>if self.verbosity > <NUM_LIT:0>:<EOL><INDENT>self.stdout.write("<STR_LIT>" % self.deleted_files)<EOL><DEDENT>self.batch_delete_s3_objects(<EOL>self.deleted_file_list,<EOL>self.aws_bucket_name<EOL>)<EOL><DEDENT><DEDENT>if not hasattr(settings, '<STR_LIT>'):<EOL><INDENT>raise CommandError(self.views_unconfig_msg)<EOL><DEDENT>for view_str in settings.BAKERY_VIEWS:<EOL><INDENT>view = get_callable(view_str)()<EOL>if hasattr(view, '<STR_LIT>'):<EOL><INDENT>getattr(view, '<STR_LIT>')(self.bucket)<EOL><DEDENT><DEDENT>elapsed_time = time.time() - self.start_time<EOL>msg = "<STR_LIT>" % (<EOL>self.uploaded_files,<EOL>self.deleted_files,<EOL>elapsed_time<EOL>)<EOL>logger.info(msg)<EOL>if self.verbosity > <NUM_LIT:0>:<EOL><INDENT>self.stdout.write(msg)<EOL><DEDENT>if self.dry_run:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>if self.verbosity > <NUM_LIT:0>:<EOL><INDENT>self.stdout.write("<STR_LIT>")<EOL><DEDENT><DEDENT>
Sync files in the build directory to a specified S3 bucket