Produce the final MIME message.
430015
def mime(self):
		""""""
		author = self.author
		sender = self.sender
		
		if not author:
			raise ValueError("You must specify an author.")

		if not self.subject:
			raise ValueError("You must specify a subject.")

		if len(self.recipients) == 0:
			raise ValueError("You must specify at least one recipient.")

		if not self.plain:
			raise ValueError("You must provide plain text content.")

		# DISCUSS: Take the first author, or raise this error?
		# if len(author) > 1 and len(sender) == 0:
		#	 raise ValueError('If there are multiple authors of message, you must specify a sender!')

		# if len(sender) > 1:
		#	 raise ValueError('You must not specify more than one sender!')

		if not self._dirty and self._processed:
			return self._mime

		self._processed = False

		plain = MIMEText(self._callable(self.plain), 'plain', self.encoding)

		rich = None
		if self.rich:
			rich = MIMEText(self._callable(self.rich), 'html', self.encoding)

		message = self._mime_document(plain, rich)
		headers = self._build_header_list(author, sender)
		self._add_headers_to_message(message, headers)

		self._mime = message
		self._processed = True
		self._dirty = False

		return message
56865
def mime(self):
        """"""

        mimes = []
        for Kind in type(self).__mro__:
            for mime in getattr(Kind, '_mimes', []):
                if mime not in mimes:
                    mimes.append(mime)
        return mimes
436028
def make_message(self, data):

        

        data = self.codec.loads(data)
        msg = Message(
            data.get("data"),
            *data.get("args",[]),
            **data.get("kwargs",{})
        )
        msg.meta.update(data.get("meta"))
        self.trigger("make_message", data, msg)
        return msg
206698
def finalize_content(self):
        
        self.write_closed = True
        body = self.raw_body.decode(self.encoding)
        self._init_xml(body)
        self._form_output()
989246
def build_message(self):
        '''
        '''
        if self._text is None:
            raise InvalidPayloadError('text is required')

        message = {
            'text': self._text,
            'markdown': self._markdown
        }

        if self._channel != Incoming.DEFAULT_CHANNEL:
            message['channel'] = self._channel

        if self._attachments:
            message['attachments'] = []
            for attachment in self._attachments:
                if 'title' not in attachment and 'text' not in attachment:
                    raise InvalidPayloadError('title or text is required')
                message['attachments'].append(attachment)

        return message
603299
def mime_to_bytes(msg, header_len):
    
    fp = BytesIO()
    g = BytesGenerator(fp, maxheaderlen=header_len)
    g.flatten(msg)
    return fp.getvalue()
537071
def buildMessage(headers, parts):
    
    message = multipart.MIMEMultipart('alternative')

    for name, value in headers.iteritems():
        name = name.title()
        if name == "From":
            multipart[name] = _encodeAddress(value)
        elif name in ["To", "Cc", "Bcc"]:
            multipart[name] = _encodeAddresses(value)
        else:
            multipart[name] = _encodeHeader(value)

    for partType, part in parts.iteritems():
        mimeText = text.MIMEText(part.encode("utf-8"), partType, "UTF-8")
        message.attach(mimeText.encode())

    return message
323409
def finish(self, message_id):
        """"""
        self.send(nsq.finish(message_id))
        self.finish_inflight()
        self.on_finish.send(self, message_id=message_id)
1064997
def finalize(self):
        """"""
        # Merge all the out_DDB files found in work.outdir.
        ddb_files = list(filter(None, [work.outdir.has_abiext("DDB") for work in self]))

        # Final DDB file will be produced in the outdir of the work.
        out_ddb = self.outdir.path_in("out_DDB")
        desc = "DDB file merged by %s on %s" % (self.__class__.__name__, time.asctime())

        mrgddb = wrappers.Mrgddb(manager=self.manager, verbose=0)
        mrgddb.merge(self.outdir.path, ddb_files, out_ddb=out_ddb, description=desc)
        print("Final DDB file available at %s" % out_ddb)

        # Call the method of the super class.
        retcode = super().finalize()
        return retcode
789149
function getText(msg) {
    return msg.parts.filter(function (part) {
      return part.mime_type === 'text/plain';
    }).map(function (part) {
      return part.body;
    }).join('; ');
  }
988807
def show_progress(self, message=None):
        """'"""
        if self.in_progress_hanging:
            if message is None:
                sys.stdout.write('.')
                sys.stdout.flush()
            else:
                if self.last_message:
                    padding = ' ' * max(0, len(self.last_message)-len(message))
                else:
                    padding = ''
                sys.stdout.write('\r%s%s%s%s' % (' '*self.indent, self.in_progress, message, padding))
                sys.stdout.flush()
                self.last_message = message
1070809
def make_message(message, binary=False):
    """"""
    if isinstance(message, str):
        message = message.encode('utf-8')

    if binary:
        return _make_frame(message, OPCODE_BINARY)
    else:
        return _make_frame(message, OPCODE_TEXT)
966218
def get_mime_message(subject, text):
    
    message = MIMEText(
        "<html>" +
        str(text).replace("\n", "<br>") +
        "</html>", "html"
    )
    message["subject"] = str(subject)
    return message
97387
private function finalise()
    {
        // Send output to email
        $this->emailOutput();

        // Call any callback defined
        if (is_callable($this->after)) {
            call_user_func($this->after, $this->output, $this->returnCode);
        }
    }
1012201
def finish(self):
        
        if self.cipher_finalized:
            raise CipherError("Cipher operation is already completed")
        outbuf = create_string_buffer(self.block_size)
        self.cipher_finalized = True
        outlen = c_int(0)
        result = libcrypto.EVP_CipherFinal_ex(self.ctx, outbuf, byref(outlen))
        if result == 0:
            self._clean_ctx()
            raise CipherError("Unable to finalize cipher")
        if outlen.value > 0:
            return outbuf.raw[:int(outlen.value)]
        else:
            return b""
572366
def build_message(self, stat, value):
        """"""
        return ' '.join((self.prefix + str(stat), str(value), str(round(time()))))
1052644
def gut_message(message: Message) -> Message:
    
    wrapper = Message()
    wrapper.add_header('Content-Type', 'message/external-body',
                       access_type='x-spam-deleted',
                       expiration=time.strftime("%a, %d %b %Y %H:%M:%S %z"),
                       size=str(len(message.get_payload())))

    message.set_payload('')
    wrapper.set_payload([message])

    return wrapper