Returns the recommended extension for a given format
7579
def get_format_extension(fmt):
    '''
    
    '''

    if fmt is None:
        return 'dict'

    fmt = fmt.lower()
    if fmt not in _converter_map:
        raise RuntimeError('Unknown basis set format "{}"'.format(fmt))

    return _converter_map[fmt]['extension']
363885
def _bsecurate_cli_get_reader_formats(args):
    ''''''

    all_formats = curate.get_reader_formats()

    if args.no_description:
        liststr = all_formats.keys()
    else:
        liststr = format_columns(all_formats.items())

    return '\n'.join(liststr)
806318
def extract_handler_and_format_and_variant(path)
        pieces = File.basename(path).split(".")
        pieces.shift

        extension = pieces.pop

        handler = Template.handler_for_extension(extension)
        format, variant = pieces.last.split(EXTENSIONS[:variants], 2) if pieces.last
        format = if format
          Template::Types[format]&.ref
        else
          if handler.respond_to?(:default_format) # default_format can return nil
            handler.default_format
          else
            nil
          end
        end

        # Template::Types[format] and handler.default_format can return nil
        [handler, format, variant]
      end
568797
def short_form_one_format(jupytext_format):
    """"""
    if not isinstance(jupytext_format, dict):
        return jupytext_format
    fmt = jupytext_format['extension']
    if 'suffix' in jupytext_format:
        fmt = jupytext_format['suffix'] + fmt
    elif fmt.startswith('.'):
        fmt = fmt[1:]

    if 'prefix' in jupytext_format:
        fmt = jupytext_format['prefix'] + '/' + fmt

    if jupytext_format.get('format_name'):
        if jupytext_format['extension'] not in ['.md', '.Rmd'] or jupytext_format['format_name'] == 'pandoc':
            fmt = fmt + ':' + jupytext_format['format_name']

    return fmt
966056
def preferred_format(incomplete_format, preferred_formats):
    """"""
    incomplete_format = long_form_one_format(incomplete_format)
    if 'format_name' in incomplete_format:
        return incomplete_format

    for fmt in long_form_multiple_formats(preferred_formats):
        if ((incomplete_format['extension'] == fmt['extension'] or (
                fmt['extension'] == '.auto' and
                incomplete_format['extension'] not in ['.md', '.Rmd', '.ipynb'])) and
                incomplete_format.get('suffix') == fmt.get('suffix', incomplete_format.get('suffix')) and
                incomplete_format.get('prefix') == fmt.get('prefix', incomplete_format.get('prefix'))):
            fmt.update(incomplete_format)
            return fmt

    return incomplete_format
489154
function selectFormat(format) {
  let method = "toTable";
  let extension = `.${format}`;

  switch (format) {
    case "json":
      method = "toJSON";
      break;
    case "csv":
      method = "toCSV";
      break;
    case "html":
      method = "toHTML";
      break;
    case "md":
      method = "toMarkdown";
      break;
    default:
      break;
  }

  return {
    extension: extension,
    method: method
  }
}
1048635
def GetFormatSpecification(cls):
    
    format_specification = specification.FormatSpecification(cls.NAME)
    format_specification.AddNewSignature(b'ElfFile\x00', offset=0)
    return format_specification
1025319
def format_extension
        extensions = CEF::EXTENSION_ATTRIBUTES.keys.map do |meth|
          value = self.send(meth)
          next if value.nil?
          shortname = CEF::EXTENSION_ATTRIBUTES[meth]
          [shortname, escape_extension_value(value)].join("=")
        end

        # make sure time comes out as milliseconds since epoch
        times = CEF::TIME_ATTRIBUTES.keys.map do |meth|
          value = self.send(meth)
          next if value.nil?
          shortname = CEF::TIME_ATTRIBUTES[meth]
          [shortname, escape_extension_value(value)].join("=")
        end
        (extensions + times).compact.join(" ")
      end
269704
def GetFormatSpecification(cls):
    
    format_specification = specification.FormatSpecification(cls.NAME)
    format_specification.AddNewSignature(b'BAAD', offset=0)
    format_specification.AddNewSignature(b'FILE', offset=0)
    return format_specification
395492
function format(extensions) {
  return Object.keys(extensions)
    .map((extension) => {
      let configurations = extensions[extension];
      if (!Array.isArray(configurations)) configurations = [configurations];
      return configurations
        .map((params) => {
          return [extension]
            .concat(
              Object.keys(params).map((k) => {
                let values = params[k];
                if (!Array.isArray(values)) values = [values];
                return values
                  .map((v) => (v === true ? k : `${k}=${v}`))
                  .join('; ');
              })
            )
            .join('; ');
        })
        .join(', ');
    })
    .join(', ');
}
336846
def expandf(m, format):  # noqa A002
    """"""

    _assert_expandable(format, True)
    return _apply_replace_backrefs(m, format, flags=FORMAT)
1200557
function normalizeFormat(format) {
  const clone = Object.assign({}, format);
  clone.prefix = normalizePrefixSuffix(format.prefix);
  clone.suffix = normalizePrefixSuffix(format.suffix);
  return clone;
}
1337104
def allowed_extension(*allowed):
    '''
    
    '''
    def predicate(info, request):
        log.debug(request.path)
        ext = os.path.splitext(request.path)[1]
        request.environ['path_extenstion'] = ext
        log.debug(ext)
        return ext in allowed

    return predicate
481928
function getCharacteristicFormatsKey(format) {
  // coerce 'int32' to 'int'
  if (format == 'int32') format = 'int';

  // look up the key in our known-formats dict
  for (var key in Characteristic.Formats)
    if (Characteristic.Formats[key] == format)
      return key;

  throw new Error("Unknown characteristic format '" + format + "'");
}
1123901
function buildFormat(format) {
  return format.v.map(x=> typeof x === 'string' ? x :
               '{' + x.p + ('o' in x ? '>' + x.o : '') + '}').join('') +
        (format.o ? '>>' + Object.keys(format.o).map(x => OPTIONS[x]).join('') : '');
}
224541
def get_format(format_):
    
    format_path = os.getenv('FORMAT_PATH', 'format_files')
    try:
        spec = importlib.util.spec_from_file_location(
            "format_mod", f"{format_path}/{format_}.py")
        format_mod = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(format_mod)
    except FileNotFoundError:
        try:
            format_mod = import_module(f'nerium.schema.{format_}')
        except ModuleNotFoundError:
            format_mod = import_module('nerium.schema.default')
    schema = format_mod.ResultSchema()
    return schema
269718
def get_extensions(self, support=None):
        
        return [x for x in self.extensions.values() if support
                and support in x.supported or not support]