/*
2 formats are allowed:
[[x1,x2,...],[y1,y2,...]] or [[x1,y1],[x2,y2], ...]
969184
function setOptions(newOptions) {
    options = newOptions || {};
    if (typeof options.common === 'string') {
      if (options.common.toLowerCase() === 'first') {
        common = COMMON_FIRST;
      } else if (options.common.toLowerCase() === 'second') {
        common = COMMON_SECOND;
      } else if (options.common.toLowerCase() === 'both') {
        common = COMMON_BOTH;
      } else {
        common = COMMON_NO;
      }
    } else {
      if (options.common === true) {
        common = COMMON_BOTH;
      } else {
        common = COMMON_NO;
      }
    }
    commonFactor = options.commonFactor || commonFactor || 4;

    if (options.widthBottom === undefined) {
      options.widthBottom = widthBottom || 2;
    }
    if (options.widthTop === undefined) {
      options.widthTop = widthTop || 1;
    }
    setTrapezoid(options.widthBottom, options.widthTop);
    setFromTo(options.from || from, options.to || to);
  }
749333
def long_form_multiple_formats(jupytext_formats, metadata=None):
    """"""
    if not jupytext_formats:
        return []

    if not isinstance(jupytext_formats, list):
        jupytext_formats = [fmt for fmt in jupytext_formats.split(',') if fmt]

    jupytext_formats = [long_form_one_format(fmt, metadata) for fmt in jupytext_formats]

    return jupytext_formats
595371
function formatType(node) {
  let result;

  if (!node) {
    return [t('any')];
  }

  switch (node.type) {
    case Syntax.NullableLiteral:
      return [t('?')];
    case Syntax.AllLiteral:
      return [t('any')];
    case Syntax.NullLiteral:
      return [t('null')];
    case Syntax.VoidLiteral:
      return [t('void')];
    case Syntax.UndefinedLiteral:
      return [t('undefined')];
    case Syntax.NameExpression:
      return [t(node.name)];
    case Syntax.ParameterType:
      result = [];

      if (node.name) {
        result.push(c(node.name), t(': '));
      }

      return result.concat(formatType(node.expression));

    case Syntax.TypeApplication:
      return formatType(node.expression).concat(
        commaList(node.applications, '<', '>'),
      );
    case Syntax.UnionType:
      return commaList(node.elements, '(', ')', ' | ');

    case Syntax.ArrayType:
      return commaList(node.elements, '[', ']');
    case Syntax.RecordType:
      return commaList(node.fields, '{', '}');

    case Syntax.FieldType:
      if (node.value) {
        return [t(node.key + ': ')].concat(formatType(node.value));
      }
      return [t(node.key)];

    case Syntax.FunctionType:
      result = [t('function(')];

      if (node['this']) {
        if (node['new']) {
          result.push(t('new: '));
        } else {
          result.push(t('this: '));
        }

        result = result.concat(formatType(node['this']));

        if (node.params.length !== 0) {
          result.push(t(', '));
        }
      }

      result = result.concat(commaList(node.params, '', ')'));

      if (node.result) {
        result = result.concat([t(': ')].concat(formatType(node.result)));
      }
      return result;

    case Syntax.RestType:
      // note that here we diverge from doctrine itself, which
      // lets the expression be omitted.
      return [t('...'), ...formatType(node.expression)];
    case Syntax.OptionalType:
      if (node.default) {
        return [
          ...formatType(node.expression),
          t('?'),
          t('= ' + c(node.default)),
        ];
      }
      return [...formatType(node.expression), t('?')];
    case Syntax.NonNullableType:
      return node.prefix
        ? [t('?'), ...formatType(node.expression)]
        : [...formatType(node.expression), t('?')];
    case Syntax.NullableType:
      return [...formatType(node.expression), t('?')];
    case Syntax.StringLiteralType:
      return [c(JSON.stringify(node.value))];
    case Syntax.NumericLiteralType:
    case Syntax.BooleanLiteralType:
      return [c(String(node.value))];

    default:
      throw new Error('Unknown type ' + node.type);
  }
}
1097700
function wrapPartsIntoGroups(parts, indexes) {
  if (indexes.length === 0) {
    return parts;
  }

  let lastEnd = 0;

  return indexes.reduce((accumulator, index) => {
    const { start, end, alignment, before, after } = index;
    const printedPartsForGrouping = concat([
      before || "",
      concat(parts.slice(start, end)),
      after || ""
    ]);
    const newArray = accumulator.concat(
      parts.slice(lastEnd, start),
      alignment
        ? dedentToRoot(
            group(
              concat([
                align(new Array(alignment).join(" "), printedPartsForGrouping)
              ])
            )
          )
        : group(printedPartsForGrouping),
      end === parts.length - 1 ? parts.slice(end) : ""
    );

    lastEnd = end;

    return newArray;
  }, []);
}
424112
def complete_opt_format(self, text, *_):
        
        return [t + " " for t in FORMATTERS if t.startswith(text)]
379116
function Delimiters (delims, options) {
  this.options = options || {};
  this.delims = delims || [];

  this.defaults = merge({}, {
    beginning: '^',           // '^' Matches beginning of input.
    matter: '([\\s\\S]+?)',   // The "content" between the delims
    body: '([\\s\\S]+|\\s?)', // The "content" after the delims
    end: '$',                 // '$' Matches end of input.
    flags: ''                 // RegExp flags: g, m, i
  }, options);
}
459705
function splitAt(arr, n) {
  if (!Array.isArray(arr)) {
    throw new Error('expected an array for the first argument');
  }
  if (n != null && typeof n != 'number') {
    throw new Error('expected a number or null for the second argument');
  }
  if (n == null) {
    n = 0;
  }
  return [arr.slice(0, n), arr.slice(n)];
}
259676
static String formatMultipleSynthesis(String[] matches,
      String leftSide, String rightSide) {
    String errorMessage;
    String suggestionLeft = "";
    String suggestionRight = "";
    String rightSideNew = rightSide;
    int sPos = leftSide.lastIndexOf(SUGGESTION_START_TAG);
    if (sPos >= 0) {
      suggestionLeft = leftSide.substring(sPos + SUGGESTION_START_TAG.length());
    }
    if (StringTools.isEmpty(suggestionLeft)) {
      errorMessage = leftSide;
    } else {
      errorMessage = leftSide.substring(0, leftSide.lastIndexOf(SUGGESTION_START_TAG)) + SUGGESTION_START_TAG;
    }
    int rPos = rightSide.indexOf(SUGGESTION_END_TAG);
    if (rPos >= 0) {
      suggestionRight = rightSide.substring(0, rPos);
    }
    if (!StringTools.isEmpty(suggestionRight)) {
      rightSideNew = rightSide.substring(rightSide.indexOf(SUGGESTION_END_TAG));
    }
    int lastLeftSugEnd = leftSide.indexOf(SUGGESTION_END_TAG);
    int lastLeftSugStart = leftSide.lastIndexOf(SUGGESTION_START_TAG);
    StringBuilder sb = new StringBuilder();
    sb.append(errorMessage);
    for (int z = 0; z < matches.length; z++) {
      sb.append(suggestionLeft);
      sb.append(matches[z]);
      sb.append(suggestionRight);
      if (z < matches.length - 1 && lastLeftSugEnd < lastLeftSugStart) {
        sb.append(SUGGESTION_END_TAG);
        sb.append(", ");
        sb.append(SUGGESTION_START_TAG);
      }
    }
    sb.append(rightSideNew);
    return sb.toString();
  }
75530
def flatten_list(l):
    
    if (l == []) or (l is None):
        return l
    if isinstance(l[0], list):
        return flatten_list(l[0]) + flatten_list(l[1:])
    return l[:1] + flatten_list(l[1:])
1107768
function processFormat( value, src, dst ) {
  if( !dst.format ) return value;
  try {
    if( !Array.isArray( dst.format ) )
      throw "Must be an array with two elements!";
    var intlFunc = dst.format[0];
    if( typeof intlFunc !== 'function' )
      throw "First element of the array must be a function!";
    var intlId = dst.format[1];
    if( typeof intlId !== 'string' )
      throw "Second element of the array must be a string!";
    return intlFunc( intlId, value );
  }
  catch( ex ) {
    console.error( ex );
    fail(
      "Error in format of link "
        + PropertyManager(src.obj) + "." + src.name
        + " -> "
        + PropertyManager(dst.obj) + "." + dst.name + "!\n"
        + ex
    );
  }
}
905692
function formatYear(year) {
    var from, to;

    year = year.split('–');

    if (year.length === 2) {
        from = +year[0];

        if (year[1]) {
            to = +year[1];
        }

        return { from: from, to: to };
    }

    return +year;
}
214538
def _format_list(self, data):
        
        dataset = "["
        i = 0
        for el in data:
            if pd.isnull(el):
                dataset += "null"
            else:
                dtype = type(data[i])
                if dtype == int or dtype == float:
                    dataset += str(el)
                else:
                    dataset += '"' + el + '"'
            if i < len(data) - 1:
                dataset += ', '
        dataset += "]"
        return dataset
447358
function parse_ArrayParsedFormula(blob, length, opts) {
	var target = blob.l + length, len = opts.biff == 2 ? 1 : 2;
	var rgcb, cce = blob.read_shift(len); // length of rgce
	if(cce == 0xFFFF) return [[],parsenoop(blob, length-2)];
	var rgce = parse_Rgce(blob, cce, opts);
	if(length !== cce + len) rgcb = parse_RgbExtra(blob, length - cce - len, rgce, opts);
	blob.l = target;
	return [rgce, rgcb];
}
1239939
function formatInputOptions(inputOptions) {
  var result = [];

  if (typeof Map !== 'undefined' && inputOptions instanceof Map) {
    inputOptions.forEach(function (value, key) {
      result.push([key, value]);
    });
  } else {
    Object.keys(inputOptions).forEach(function (key) {
      result.push([key, inputOptions[key]]);
    });
  }

  return result;
}
74636
private static Tuple2<Integer, Integer> commonPrefixSuffixLengths(List<?> l1, List<?> l2) {
        int n1 = l1.size();
        int n2 = l2.size();

        if(n1 == 0 || n2 == 0) {
            return Tuples.t(0, 0);
        }

        int pref = commonPrefixLength(l1, l2);
        if(pref == n1 || pref == n2) {
            return Tuples.t(pref, 0);
        }

        int suff = commonSuffixLength(l1, l2);

        return Tuples.t(pref, suff);
    }
908303
function parseFormat(index, args, formatOptions) {
	let nextValue = args.getNextValue(index);
	if(nextValue != null) {
		formatOptions.style = getFormat(nextValue);
		return index + 2;
	}
	
	throw new Error('No format provided');
}
1205282
function pairs(_) {
    var o = [];
    for (var i in _) o.push([i, _[i]]);
    return o;
}