Create a blob with ``content``.

        :param str content: (required), content of the blob
        :param str encoding: (required), ('base64', 'utf-8')
        :returns: string of the SHA returned
354173
def create_blob(self, content, encoding):
        
        sha = ''
        if encoding in ('base64', 'utf-8'):
            url = self._build_url('git', 'blobs', base_url=self._api)
            data = {'content': content, 'encoding': encoding}
            json = self._json(self._post(url, data=data), 201)
            if json:
                sha = json.get('sha')
        return sha
452036
def parse(self, content):
    
    if self.format == 'json_map':
      try:
        return assert_list(json.loads(content.decode(self.encoding))[self.index])
      except (KeyError, UnicodeDecodeError, ValueError) as e:
        raise self.ResponseParserError("Error while parsing response content: {0}".format(str(e)))

    # Should never get here.
    raise ValueError('Unknown content format: "{}"'.format(self.format))
224335
def parse_content_type(content_type):
    
    if '; charset=' in content_type:
        return tuple(content_type.split('; charset='))
    else:
        if 'text' in content_type:
            encoding = 'ISO-8859-1'
        else:
            try:
                format = formats.find_by_content_type(content_type)
            except formats.UnknownFormat:
                encoding = 'ISO-8859-1'
            else:
                encoding = format.default_encoding or 'ISO-8859-1'

        return (content_type, encoding)
463673
def _compress_content(self, content):
        """"""
        zbuf = StringIO()
        zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
        zfile.write(content.read())
        zfile.close()
        content.file = zbuf
        return content
621235
def totext(self) ->str:
        
        sreturn = ''
        if self.properties.content_settings.content_encoding is None:
            raise AzureStorageWrapException(self, 'can not convert blob {!s} to text because content_encoding is not given'.format(self.name))
        else:
            sreturn = self.content.decode(self.properties.content_settings.content_encoding, 'ignore')

        return sreturn
420367
def put_content(self, content):
        

        self.blob.content_encoding = self.content_encoding
        self.blob.metadata = self.metadata
        return self.blob.upload_from_string(content, content_type=self.content_type)
708147
def determine_content(request):
        

        if not request.META.get('CONTENT_LENGTH', None) \
           and not request.META.get('TRANSFER_ENCODING', None):
            return None

        return request.META.get('CONTENT_TYPE', None)
421950
public static ByteArrayInputStream toStream(String content, Charset charset) {
		if (content == null) {
			return null;
		}
		return toStream(StrUtil.bytes(content, charset));
	}
729112
def blob(self, sha):
        
        url = self._build_url('git', 'blobs', sha, base_url=self._api)
        json = self._json(self._get(url), 200)
        return Blob(json) if json else None
408930
def get_content_type(
            self,
            bucket: str,
            key: str
    ) -> str:
        
        blob_obj = self._get_blob_obj(bucket, key)
        return blob_obj.content_type
809681
def parse_content_encoding(self, response_headers, response_data):
        
        if response_headers['content-encoding'] == 'gzip':
            buf = StringIO.StringIO(response_data)
            zipbuf = gzip.GzipFile(fileobj=buf)
            response_data = zipbuf.read()
        elif response_headers['content-encoding'] == 'deflate':
            data = StringIO.StringIO(zlib.decompress(response_data))
            response_data = data.read()
        else:
            raise errors.TestError(
                'Received unknown Content-Encoding',
                {
                    'content-encoding':
                        str(response_headers['content-encoding']),
                    'function': 'http.HttpResponse.parse_content_encoding'
                })
        return response_data
1225998
def content(self):
        
        content = self._get_content()

        if bool(content and '\0' in content):
            return content
        return safe_unicode(content)
1185983
def file_from_content(content):
    
    f = content
    if isinstance(content, cgi.FieldStorage):
        f = content.file
    elif isinstance(content, FileIntent):
        f = content._fileobj
    elif isinstance(content, byte_string):
        f = SpooledTemporaryFile(INMEMORY_FILESIZE)
        f.write(content)
    f.seek(0)
    return f
382050
def generate_content_encoding(self):
        
        if self._definition['contentEncoding'] == 'base64':
            with self.l('if isinstance({variable}, str):'):
                with self.l('try:'):
                    self.l('import base64')
                    self.l('{variable} = base64.b64decode({variable})')
                with self.l('except Exception:'):
                    self.l('raise JsonSchemaException("{name} must be encoded by base64")')
                with self.l('if {variable} == "":'):
                    self.l('raise JsonSchemaException("contentEncoding must be base64")')
1130457
def toBytes(text, encoding=DEFAULT_ENCODING):
    
    if not text:
        return text

    if not isinstance(text, bytes_type):
        text = text.encode(encoding)

    return text
704119
def iter_content(self, chunk_size=1024, decode_unicode=False):
        
        return self.response.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode)
882625
def _get_sha256_digest(self, content):
        
        content_sha256 = base64.b64encode(SHA256.new(content).digest())
        return 'SHA256=' + content_sha256