def get_file_attachment(self, path):
        """
        Return a MIMEBase email part with the file under path as payload.
        If the file is not textual, it is encoded as base64
        :param path: Absolute path to the file being attached
        :return: MIMEBase object
        """
        # todo test graceful failure of this
        email_part = self.assert_file_mime_type(path)
        with open(path, 'r') as attached_file:
            email_part.set_payload( attached_file.read() )
        # no need to base64 plain text
        if email_part.get_content_maintype() != "text":
            encode_base64(email_part)
        email_part.add_header('Content-Disposition', os.path.basename(path) % 'attachment; filename="%s"')
        return email_part
dataset/ETHPy150Open harel/strudelpy/strudelpy/__init__.py/Email.get_file_attachment/swapped operands of `%`