def upload_file(self, abspath, cloud_filename):
if not self.test_run:<EOL><INDENT>content = open(abspath, "<STR_LIT:rb>")<EOL>content_type = get_content_type(cloud_filename, content)<EOL>headers = get_headers(cloud_filename, content_type)<EOL>if headers.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>content = get_gzipped_contents(content)<EOL>size = content.size<EOL><DEDENT>else:<EOL><INDENT>size = os.stat(abspath).st_size<EOL><DEDENT>self.container.create(<EOL>obj_name=cloud_filename,<EOL>data=content,<EOL>content_type=content_type,<EOL>content_length=size,<EOL>content_encoding=headers.get("<STR_LIT>", None),<EOL>headers=headers,<EOL>ttl=CUMULUS["<STR_LIT>"],<EOL>etag=None,<EOL>)<EOL><DEDENT>self.upload_count += <NUM_LIT:1><EOL>if not self.quiet or self.verbosity > <NUM_LIT:1>:<EOL><INDENT>print("<STR_LIT>".format(cloud_filename))<EOL><DEDENT>
Uploads a file to the container.