function to convert google tag slot sizes to [[w,h],...]
558160
function mapGptSlotSizes(aGPTSlotSizes) {
      var aSlotSizes = [];
      for (var i = 0; i < aGPTSlotSizes.length; i++) {
        try {
          aSlotSizes.push([aGPTSlotSizes[i].getWidth(), aGPTSlotSizes[i].getHeight()]);
        } catch (e) {
          utils.logWarn('slot size ' + aGPTSlotSizes[i].toString() + ' not supported by' + MODULE_NAME);
        }
      }
      return aSlotSizes;
    }
844863
def _get_slot(self):
        ""

        x = y = 10
        for k, p in self.previews.items():
            y += p.height() + self.padding
        return x, y
43924
function trimTrailingWhitespace(index, nextTag) {
    for (var endTag = null; index >= 0 && _canTrimWhitespace(endTag); index--) {
      var str = buffer[index];
      var match = str.match(/^<\/([\w:-]+)>$/);
      if (match) {
        endTag = match[1];
      }
      else if (/>$/.test(str) || (buffer[index] = collapseWhitespaceSmart(str, null, nextTag, options))) {
        break;
      }
    }
  }
44545
function (str) {
            return _(str).chain()
                .unescapeHTML()
                .stripTags()
                .clean()
                .value()
                .replace( matchJunk, '' )
                .toLowerCase();
        }
777807
def list_to_rows(src, size):
    

    row = []
    for item in src:
        row.append(item)
        if len(row) == size:
            yield row
            row = []

    if row:
        yield row
862459
def list_tags():
    
    # Build reverse dictionary. Keys are closing tags, values are [closing ansi, opening tag, opening ansi].
    reverse_dict = dict()
    for tag, ansi in sorted(BASE_CODES.items()):
        if tag.startswith('/'):
            reverse_dict[tag] = [ansi, None, None]
        else:
            reverse_dict['/' + tag][1:] = [tag, ansi]

    # Collapse
    four_item_tuples = [(v[1], k, v[2], v[0]) for k, v in reverse_dict.items()]

    # Sort.
    def sorter(four_item):
        """Sort /all /fg /bg first, then b i u flash, then auto colors, then dark colors, finally light colors.

        :param iter four_item: [opening tag, closing tag, main ansi value, closing ansi value]

        :return Sorting weight.
        :rtype: int
        """
        if not four_item[2]:  # /all /fg /bg
            return four_item[3] - 200
        if four_item[2] < 10 or four_item[0].startswith('auto'):  # b f i u or auto colors
            return four_item[2] - 100
        return four_item[2]
    four_item_tuples.sort(key=sorter)

    return four_item_tuples
321973
function replaceSizeTokens(pattern, width, height, next) {
        pattern = pattern
          .replace(/%r/g, '%wx%h')
          .replace(/%w/g, width)
          .replace(/%h/g, height);

        next(null, pattern);
      }
411850
def coarse_tag_str(pos_seq):
	""""""
	global tag2coarse
	tags = [tag2coarse.get(tag, 'O') for tag in pos_seq]
	return ''.join(tags)
1259410
function(obj_) {
  var obj = sg.smartAttrs(obj_ || {});

  if (!obj.tags)              { return obj; }

  var arr = obj.tags;
  if (_.isString(obj.tags)) {
    arr = obj.tags.split(/[, ]+/g);
  }

  // Turn a string into tags: 'foo, bar, baz=quxx'
  obj.tags = sg.reduce(arr, {}, function(m, str) {
    var result   = {};
    var parts    = str.split(/[=] ?/g);
    var key      = parts.shift();

    if (parts.length <= 0) {
      return sg.kv(m, key, true);
    }

    return sg.kv(m, key, parts.join('='));
  });

  return obj;
}
1042496
function defaultSlots(slots) {
      return Array.isArray(slots)
        ? slots.slice()
        : googletag.pubads().getSlots().slice();
    }
560265
def _normalize_tags(self, tags):
        '''
        

        '''

        lowered_str_tags = []
        for tag in tags:
            lowered_str_tags.append(str(tag).lower())

        return lowered_str_tags
893089
function htmlTagObjectToString (tagDefinition, xhtml) {
  const attributes = Object.keys(tagDefinition.attributes || {})
    .filter(function (attributeName) {
      return tagDefinition.attributes[attributeName] !== false;
    })
    .map(function (attributeName) {
      if (tagDefinition.attributes[attributeName] === true) {
        return xhtml ? attributeName + '="' + attributeName + '"' : attributeName;
      }
      return attributeName + '="' + tagDefinition.attributes[attributeName] + '"';
    });
  return '<' + [tagDefinition.tagName].concat(attributes).join(' ') + (tagDefinition.voidTag && xhtml ? '/' : '') + '>' +
    (tagDefinition.innerHTML || '') +
    (tagDefinition.voidTag ? '' : '</' + tagDefinition.tagName + '>');
}
726605
function convertShape (shape, tag) {
  return templates.element({
    'tag': tag,
    'width': shape.width,
    'height': shape.height,
    'fill': shape.properties.fill
  });
}
690284
function stringifySlotSizes(sizes) {
  let result = '';
  if (utils.isArray(sizes)) {
    result = sizes.reduce((acc, size) => {
      acc.push(size.join('.'));
      return acc;
    }, []);
    result = '[' + result.join(',') + ']';
  }
  return result;
}
993373
function generateSizeParam(sizes) {
  return sizes.map(size => size.join(DIMENSION_SEPARATOR)).join(SIZE_SEPARATOR);
}
47858
def _split_params(tag_prefix, tag_suffix):
    ""
    if tag_suffix[-1:] != ')':
        raise ValueError, "unbalanced parenthesis in type %s%s" % (tag_prefix, tag_suffix)
    return map(_maybe_int, tag_suffix[:-1].split(','))
821573
def [](new_size)
      if new_size.is_a? Directive
        tags.merge! new_size.tags_for_sized_directive
      else
        tags[:size] = new_size
      end

      self
    end