Collapse a private message or modmail.
480791
def collapse(self):
        """"""
        url = self.reddit_session.config['collapse_message']
        self.reddit_session.request_json(url, data={'id': self.name})
1294325
def split_message(message, max_length):
    """"""
    if len(message) > max_length:
        for message in textwrap.wrap(message, max_length):
            yield message
    else:
        yield message.rstrip(STRIPPED_CHARS)
395254
def make_close_message(code=1000, message=b''):
    """"""
    return _make_frame(struct.pack('!H%ds' % len(message), code, message),
                       opcode=OPCODE_CLOSE)
632877
def fold(self):
        """"""
        start, end = self.get_range()
        TextBlockHelper.set_collapsed(self._trigger, True)
        block = self._trigger.next()
        while block.blockNumber() <= end and block.isValid():
            block.setVisible(False)
            block = block.next()
539813
def message(self, message, source, point, ln):
        """"""
        message += " (disable --strict to dismiss)"
        return super(CoconutStyleError, self).message(message, source, point, ln)
745663
def message_callback_remove(self, sub):
        """"""
        if sub is None:
            raise ValueError("sub must defined.")

        self._callback_mutex.acquire()
        for i in range(0, len(self.on_message_filtered)):
            if self.on_message_filtered[i][0] == sub:
                self.on_message_filtered.pop(i)
                self._callback_mutex.release()
                return
        self._callback_mutex.release()
1016690
def shrink_wrap(self):
        """"""

        self.frame.size = (self.text_size[0] + self.padding[0] * 2,
                           self.text_size[1] + self.padding[1] * 2)
717956
@Trivial
    private static String collapseWhitespace(String value) {
        final int length = value.length();
        for (int i = 0; i < length; ++i) {
            if (isSpace(value.charAt(i))) {
                return collapse0(value, i, length);
            }
        }
        return value;
    }
1085569
def away(self, message=None):
        """"""
        cmd = 'AWAY'
        if message:
            cmd += ' :' + message
        self.send_line(cmd)
152416
def collapse_spaces(text):
    """"""
    if not isinstance(text, six.string_types):
        return text
    return COLLAPSE_RE.sub(WS, text).strip(WS)
673127
function( m ){
      var _p = this._private;

      if( _p.webworker ){
        _p.webworker.postMessage( m );
      }

      if( _p.child ){
        _p.child.send( m );
      } 

      return this; // chaining
    }
374011
def prepare_message(user, useralias, addresses, subject, contents, attachments, headers, encoding, newline_to_break=True):
    # check if closed!!!!!! XXX
    
    if isinstance(contents, text_type):
        contents = [contents]
    if isinstance(attachments, text_type):
        attachments = [attachments]

    # merge contents and attachments for now.
    if attachments is not None:
        for a in attachments:
            if not os.path.isfile(a):
                raise TypeError("'{0}' is not a valid filepath".format(a))
        contents = attachments if contents is None else contents + attachments

    has_included_images, content_objects = prepare_contents(contents, encoding)
    msg = MIMEMultipart()
    if headers is not None:
        # Strangely, msg does not have an update method, so then manually.
        for k, v in headers.items():
            msg[k] = v
    if headers is None or "Date" not in headers:
        msg["Date"] = formatdate()

    msg_alternative = MIMEMultipart("alternative")
    msg_related = MIMEMultipart("related")
    msg_related.attach("-- HTML goes here --")
    msg.attach(msg_alternative)
    add_subject(msg, subject)
    add_recipients_headers(user, useralias, msg, addresses)
    htmlstr = ""
    altstr = []
    if has_included_images:
        msg.preamble = "This message is best displayed using a MIME capable email reader."

    if contents is not None:
        for content_object, content_string in zip(content_objects, contents):
            if content_object["main_type"] == "image":
                # all image objects need base64 encoding, so do it now
                email.encoders.encode_base64(content_object["mime_object"])
                # aliased image {'path' : 'alias'}
                if isinstance(content_string, dict) and len(content_string) == 1:
                    for key in content_string:
                        hashed_ref = str(abs(hash(key)))
                        alias = content_string[key]
                    # pylint: disable=undefined-loop-variable
                    content_string = key
                else:
                    alias = os.path.basename(str(content_string))
                    hashed_ref = str(abs(hash(alias)))

                # TODO: I should probably remove inline now that there is "attachments"
                # if string is `inline`, inline, else, attach
                # pylint: disable=unidiomatic-typecheck
                if type(content_string) == inline:
                    htmlstr += '<img src="cid:{0}" title="{1}"/>'.format(hashed_ref, alias)
                    content_object["mime_object"].add_header(
                        "Content-ID", "<{0}>".format(hashed_ref)
                    )
                    altstr.append("-- img {0} should be here -- ".format(alias))
                    # inline images should be in related MIME block
                    msg_related.attach(content_object["mime_object"])
                else:
                    # non-inline images get attached like any other attachment
                    msg.attach(content_object["mime_object"])

            else:
                if content_object["encoding"] == "base64":
                    email.encoders.encode_base64(content_object["mime_object"])
                    msg.attach(content_object["mime_object"])
                elif content_object["sub_type"] not in ["html", "plain"]:
                    msg.attach(content_object["mime_object"])
                else:
                    if newline_to_break:
                        content_string = content_string.replace("\n", "<br>")
                    try:
                        htmlstr += "<div>{0}</div>".format(content_string)
                    except UnicodeEncodeError:
                        htmlstr += u"<div>{0}</div>".format(content_string)
                    altstr.append(content_string)

    msg_related.get_payload()[0] = MIMEText(htmlstr, "html", _charset=encoding)
    msg_alternative.attach(MIMEText("\n".join(altstr), _charset=encoding))
    msg_alternative.attach(msg_related)
    return msg
1287885
private void collapseMap(HashMap<String, Object> objMap) {
    while (objMap.keySet().size() == 1 && objMap.keySet().contains("")) {
      HashMap<String, Object> innerMap = (HashMap<String, Object>) objMap.get("");
      objMap.clear();
      objMap.putAll(innerMap);
    }
  }
137364
function decomposeChatFlags(chat, chatFlags) {
	chat.private = !!(chatFlags & SteamUser.EChatFlags.Locked);
	chat.invisibleToFriends = !!(chatFlags & SteamUser.EChatFlags.InvisibleToFriends);
	chat.officersOnlyChat = !!(chatFlags & SteamUser.EChatFlags.Moderated);
	chat.unjoinable = !!(chatFlags & SteamUser.EChatFlags.Unjoinable);
}
637475
function customLog(message) {
  const trimmed = message.trim()
  const limit = trimmed.indexOf('\n')
  if (limit === -1) {
    fancyLog(trimmed)
  } else {
    const title = trimmed.slice(0, limit).trim()
    const details = trimmed.slice(limit).trim()
    fancyLog(`${title}${('\n' + details).replace(/\n/g, '\n  ')}`)
  }
}
1342377
def hide(input_image: Union[str, IO[bytes]], message: str):
    
    message_length = len(message)
    assert message_length != 0, "message message_length is zero"
    assert message_length < 255, "message is too long"
    img = tools.open_image(input_image)
    # Use a copy of image to hide the text in
    encoded = img.copy()
    width, height = img.size
    index = 0
    for row in range(height):
        for col in range(width):
            (r, g, b) = img.getpixel((col, row))
            # first value is message_length of message
            if row == 0 and col == 0 and index < message_length:
                asc = message_length
            elif index <= message_length:
                c = message[index - 1]
                asc = ord(c)
            else:
                asc = r
            encoded.putpixel((col, row), (asc, g, b))
            index += 1
    img.close()
    return encoded
1019681
def mail_admins(subject, message, fail_silently=False, connection=None,
                html_message=None):
    """"""
    if not settings.ADMINS:
        return
    mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject),
                                  message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
                                  connection=connection)
    if html_message:
        mail.attach_alternative(html_message, 'text/html')
    mail.send(fail_silently=fail_silently)