Dumps the content in standard metadata format or the pysaml2 metadata
        format

        :param format: Which format to dump in
        :return: a string
196181
def dumps(self, format="local"):
        
        if format == "local":
            res = EntitiesDescriptor()
            for _md in self.metadata.values():
                try:
                    res.entity_descriptor.extend(
                        _md.entities_descr.entity_descriptor)
                except AttributeError:
                    res.entity_descriptor.append(_md.entity_descr)

            return "%s" % res
        elif format == "md":
            return json.dumps(self.items(), indent=2)
781703
def serialize(self, content):
        
        content = super(JSONPTemplateEmitter, self).serialize(content)
        callback = self.request.GET.get('callback', 'callback')
        return '%s(%s)' % (callback, content)
296633
def ConvertToWireFormat(self, value):
    
    output = _SerializeEntries(
        (python_format, wire_format, value.type_descriptor)
        for (python_format, wire_format) in value.wrapped_list)
    return b"", b"", output
678812
def format_info(raw):
    
    logging.debug(_('raw[0]: %s'), raw[0])
    results, sense = raw
    # A scenario where ORM really stands out.
    new = '\n'.join(
        '{} {} {} {}'.format(
            i[0], sense.kind_id_to_name(i[1]),
            sense.file_id_to_name(i[2]).lower(),
            i[3] + ' ' if i[3] else '').strip()
        for i in results)
    return new
730122
def format_name_for_ext(metadata, ext, cm_default_formats=None, explicit_default=True):
    """"""
    # Is the format information available in the text representation?
    text_repr = metadata.get('jupytext', {}).get('text_representation', {})
    if text_repr.get('extension', '').endswith(ext) and text_repr.get('format_name'):
        return text_repr.get('format_name')

    # Format from jupytext.formats
    formats = metadata.get('jupytext', {}).get('formats', '') or cm_default_formats
    formats = long_form_multiple_formats(formats)
    for fmt in formats:
        if fmt['extension'] == ext:
            if (not explicit_default) or fmt.get('format_name'):
                return fmt.get('format_name')

    if (not explicit_default) or ext in ['.Rmd', '.md']:
        return None

    return get_format_implementation(ext).format_name
203501
def dumps(self):
        ''''''
        metadata = {'v': 'fc01'}
        if self.read_only:
            metadata['ro'] = 1
        rep = [metadata, self.to_dict()]
        return cbor.dumps(rep)
872514
def metadata_and_cell_to_header(notebook, metadata, text_format, ext):
    

    header = []

    lines_to_next_cell = None
    if notebook.cells:
        cell = notebook.cells[0]
        if cell.cell_type == 'raw':
            lines = cell.source.strip('\n\t ').splitlines()
            if len(lines) >= 2 \
                    and _HEADER_RE.match(lines[0]) \
                    and _HEADER_RE.match(lines[-1]):
                header = lines[1:-1]
                lines_to_next_cell = cell.metadata.get('lines_to_next_cell')
                notebook.cells = notebook.cells[1:]

    metadata = insert_jupytext_info_and_filter_metadata(metadata, ext, text_format)

    if metadata:
        header.extend(yaml.safe_dump({'jupyter': metadata}, default_flow_style=False).splitlines())

    if header:
        header = ['---'] + header + ['---']

    return comment_lines(header, text_format.header_prefix), lines_to_next_cell
946215
def _format(self, ans, q):
        
        if 'fmt' in q:
            fmt = q['fmt'][0]
        else:
            fmt = 'json'

        fmt = fmt.lower()

        if fmt in self._formatters:
            return (200, self._formatters[fmt](ans, q), 'application/json')
        else:
            return (415,
                'Invalid fmt request "%s", supported formats are: %s\n'%
                    (fmt, ' '.join(self._formatters.keys()),),
                'text/plain')
1071342
def serialize(self):
        
        import yaml
        output = {"metadata": self.metadata, "sources": {},
                  "name": self.name}
        for key, entry in self.items():
            output["sources"][key] = entry._captured_init_kwargs
        return yaml.dump(output)
700114
def setFormatMetadata(self, format):
    
    assert((self.needMetadataUpdate(CoverImageMetadata.FORMAT)) or
           (self.format is format))
    self.format = format
    self.check_metadata &= ~CoverImageMetadata.FORMAT
953708
def dump(self, filename=None, compressed=True, pretty=True):
        ''''''
        content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None)
        if filename:
            with open(filename, "wb") as f:
                f.write(content.encode("utf-8"))
        if pretty and "\n " not in content:
            xml_text = xml.dom.minidom.parseString(content.encode("utf-8"))
            content = U(xml_text.toprettyxml(indent='  '))
        return content
970848
def get_serialize_format(self, mimetype):
		
		format = self.formats.get(mimetype, None)
		if format is None:
			format = formats.get(mimetype, None)
		return format
1034717
def get_format(**kwargs):
    

    settings = foundations.data_structures.Structure(**{"format": QTextCharFormat(),
                                                        "background_color": None,
                                                        "color": None,
                                                        "font_weight": None,
                                                        "font_point_size": None,
                                                        "italic": False})
    settings.update(kwargs)

    format = QTextCharFormat(settings.format)

    settings.background_color and format.setBackground(settings.background_color)
    settings.color and format.setForeground(settings.color)
    settings.font_weight and format.setFontWeight(settings.font_weight)
    settings.font_point_size and format.setFontPointSize(settings.font_point_size)
    settings.italic and format.setFontItalic(True)

    return format
8667
def set_format(self, format):
        
        if self.options.format:
            self.format = self.options.format
        else:
            self.format = \
                self.config["default_format_" + format]
562640
def htmlSaveFileFormat(self, filename, encoding, format):
        
        ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
        return ret
1202677
def dump_yaml(data):
    
    return yaml.dump(data,
                     indent=2,
                     encoding=None,
                     allow_unicode=True,
                     default_flow_style=False,
                     Dumper=MyDumper)
232255
def encode_metadata(self):
        
        encoded_list = []
        for key, value in iteritems(self.metadata):
            key_str = str(key)  # dict keys may be of any object type.

            # confirm that the key does not contain unwanted characters.
            if re.search(r'^$|[\s,]+', key_str):
                msg = 'Upload-metadata key "{}" cannot be empty nor contain spaces or commas.'
                raise ValueError(msg.format(key_str))

            value_bytes = b(value)  # python 3 only encodes bytes
            encoded_list.append('{} {}'.format(key_str, b64encode(value_bytes).decode('ascii')))
        return encoded_list