Build the caching info message with correct formatting.
962344
def build_caching_info_message(job_spec,
                               job_id,
                               workflow_workspace,
                               workflow_json,
                               result_path):
    """"""
    caching_info_message = {
        "job_spec": job_spec,
        "job_id": job_id,
        "workflow_workspace": workflow_workspace,
        "workflow_json": workflow_json,
        "result_path": result_path
    }
    return caching_info_message
697995
def add_info(self, header, message):
        ''''''
        current_message = self.args[0]
        message = current_message + self._format_info(header, message)
        self.args = (message,) + self.args[1:]
453329
function(content, info) {
    var infos = {
      version: this.version,
      timestamp: this.timestamp,
      deps: this.deps,
      mDeps: this.mDeps,
      info: info
    };
    fis.util.write(this.cacheInfo, JSON.stringify(infos));
    fis.util.write(this.cacheFile, content);
  }
155697
def info(request, message, extra_tags='', fail_silently=False):
    """"""
    add_message(request, constants.INFO, message, extra_tags=extra_tags,
                fail_silently=fail_silently)
145536
def _format_info(self):
		
		info = 'GNTP/%s %s' % (
			self.info.get('version'),
			self.info.get('messagetype'),
		)
		if self.info.get('encryptionAlgorithmID', None):
			info += ' %s:%s' % (
				self.info.get('encryptionAlgorithmID'),
				self.info.get('ivValue'),
			)
		else:
			info += ' NONE'

		if self.info.get('keyHashAlgorithmID', None):
			info += ' %s:%s.%s' % (
				self.info.get('keyHashAlgorithmID'),
				self.info.get('keyHash'),
				self.info.get('salt')
			)

		return info
1049328
def build_message(self):
        
        if self.params is None:
            inline_params = ""
        else:
            # Put all params in one string
            inline_params = ""
            if type(self.params) is list:
                for x in self.params:
                    if x != self.params[0]:
                        inline_params += ", "
                    if type(x) is int:
                        inline_params += str(x)
                    else:
                        inline_params += '"{}"'.format(x)
            else:
                inline_params += '"{}"'.format(self.params)

        # Build message with that string
        self.message = self.COMMAND_BODY.format(str(self.command_id), self.method, inline_params)
887441
def _build_message(self, to, text, subject=None, mtype=None, unsubscribe_url=None):
        """"""
        # TODO Maybe file attachments handling through `files` message_model context var.

        if subject is None:
            subject = u'%s' % _('No Subject')

        if mtype == 'html':
            msg = self.mime_multipart()
            text_part = self.mime_multipart('alternative')
            text_part.attach(self.mime_text(strip_tags(text), _charset='utf-8'))
            text_part.attach(self.mime_text(text, 'html', _charset='utf-8'))
            msg.attach(text_part)

        else:
            msg = self.mime_text(text, _charset='utf-8')

        msg['From'] = self.from_email
        msg['To'] = to
        msg['Subject'] = subject

        if unsubscribe_url:
            msg['List-Unsubscribe'] = '<%s>' % unsubscribe_url

        return msg
424486
def format(file_metrics, build_metrics):
    """"""
    metrics = {'files': file_metrics}
    if build_metrics:
        metrics['build'] = build_metrics
    body = json.dumps(metrics, sort_keys=True, indent=4) + '\n'
    return body
896503
def _set_cache_(self, attr):
        """"""
        if attr == "size":
            oinfo = self.repo.odb.info(self.binsha)
            self.size = oinfo.size
            # assert oinfo.type == self.type, _assertion_msg_format % (self.binsha, oinfo.type, self.type)
        else:
            super(Object, self)._set_cache_(attr)
173179
def cache_page(page_cache, page_hash, cache_size):
    """"""
    page_cache.append(page_hash)
    if len(page_cache) > cache_size:
        page_cache.pop(0)
372241
def info(self, message, *args, **kwargs):
        """"""
        self.log("info", message, *args, **kwargs)
381755
private static synchronized CacheInfo getCacheInfo() {
		AppContext context = AppContext.getAppContext();
		CacheInfo info = (CacheInfo) context.get(CacheInfo.class);
		if (info == null) {
			info = new CacheInfo();
			context.put(CacheInfo.class, info);
		}
		return info;
	}
401468
def prepare(data):
    """"""
    message = data.get("message")
    sha = data.get("sha")
    tree = data.get("tree")
    tree_sha = tree.get("sha")
    return {"message": message, "sha": sha, "tree": {"sha": tree_sha}}
295948
private static String buildCacheID(ApiRequest request) {
        StringBuilder req = new StringBuilder();
        if (request.getContract() != null) {
            req.append(request.getApiKey());
        } else {
            req.append(request.getApiOrgId()).append(KEY_SEPARATOR).append(request.getApiId())
                    .append(KEY_SEPARATOR).append(request.getApiVersion());
        }
        req.append(KEY_SEPARATOR).append(request.getType()).append(KEY_SEPARATOR)
                .append(request.getDestination());
        return req.toString();
    }
706885
def _format_msg(text, width, indent=0, prefix=""):
    
    """
    text = repr(text).replace("`", "\\`").replace("\\n", " ``\\n`` ")
    sindent = " " * indent if not prefix else prefix
    wrapped_text = textwrap.wrap(text, width, subsequent_indent=sindent)
    # [1:-1] eliminates quotes generated by repr in first line
    return ("\n".join(wrapped_text))[1:-1].rstrip()
284849
def prepare_message(self, message_data, delivery_mode, priority=None,
                content_type=None, content_encoding=None):
        """"""
        return amqp.Message(message_data, properties={
                "delivery_mode": delivery_mode,
                "priority": priority,
                "content_type": content_type,
                "content_encoding": content_encoding})
1339043
def generate_messages_info(msgs):
    """"""

    for msg in msgs:
        msg.swift_name = camel_case_from_underscores(msg.name)

        msg.formatted_description = ""
        if msg.description:
            msg.description = " ".join(msg.description.split())
            msg.formatted_description = "\n/**\n    %s\n*/\n" % " ".join(msg.description.split())
        msg.message_description = msg.description.replace('"','\\"')

        for field in msg.ordered_fields:
            field.swift_name = lower_camel_case_from_underscores(field.name)
            field.return_type = swift_types[field.type][0]
            
            # configure fields initializers
            if field.enum:
                # handle enums
                field.return_type = camel_case_from_underscores(field.enum)
                field.initial_value = "try data.mavEnumeration(offset: %u)" % field.wire_offset
            elif field.array_length > 0:
                if field.return_type == "String":
                    # handle strings
                    field.initial_value = "data." + swift_types[field.type][2] % (field.wire_offset, field.array_length)
                else:
                    # other array types
                    field.return_type = "[%s]" % field.return_type
                    field.initial_value = "try data.mavArray(offset: %u, count: %u)" % (field.wire_offset, field.array_length)
            else:
                # simple type field
                field.initial_value = "try data." + swift_types[field.type][2] % field.wire_offset
            
            field.formatted_description = ""
            if field.description:
                field.description = " ".join(field.description.split())
                field.formatted_description = "\n\t/// " + field.description + "\n"
         
        fields_info = map(lambda field: '("%s", %u, "%s", "%s")' % (field.swift_name, field.wire_offset, field.return_type, field.description.replace('"','\\"')), msg.fields)
        msg.fields_info = ", ".join(fields_info)

    msgs.sort(key = lambda msg : msg.id)