parameters: (self, target_path, source_data)
docstring: Adds the given file from a string.
docstring_summary: Adds the given file from a string.
docstring_tokens: Adds the given file from a string .
function: def write_file_data(self, target_path, source_data):
          """Adds the given file from a string."""
  
          sha = hashlib.sha256()
          sha.update(source_data.encode())
          digest = urlsafe_b64encode(sha.digest()).decode('ascii')
          digest = digest.rstrip('=')
          self.records.append("{0},sha256={1},{2}\n".format(target_path, digest, len(source_data)))
  
          if GetVerbose():
              print("Adding %s from data" % target_path)
  
          zinfo = zipfile.ZipInfo(filename=target_path,
                                  date_time=self.max_date_time)
          zinfo.compress_type = self.zip_file.compression
          zinfo.external_attr = 0o600 << 16
          self.zip_file.writestr(zinfo, source_data)
function_tokens: def write_file_data ( self , target_path , source_data ) : sha = hashlib . sha256 ( ) sha . update ( source_data . encode ( ) ) digest = urlsafe_b64encode ( sha . digest ( ) ) . decode ( 'ascii' ) digest = digest . rstrip ( '=' ) self . records . append ( "{0},sha256={1},{2}\n" . format ( target_path , digest , len ( source_data ) ) ) if GetVerbose ( ) : print ( "Adding %s from data" % target_path ) zinfo = zipfile . ZipInfo ( filename = target_path , date_time = self . max_date_time ) zinfo . compress_type = self . zip_file . compression zinfo . external_attr = 0o600 << 16 self . zip_file . writestr ( zinfo , source_data )