Add '_%i' to pattern when requesting multiple screenshots and no variable token is present
330608
function fixPattern(next) {
        var pattern = config.filename || 'tn.png';

        if (pattern.indexOf('.') === -1) {
          pattern += '.png';
        }

        if (config.timemarks.length > 1 && !pattern.match(/%(s|0*i)/)) {
          var ext = path.extname(pattern);
          pattern = path.join(path.dirname(pattern), path.basename(pattern, ext) + '_%i' + ext);
        }

        next(null, pattern);
      }
288870
function checkVariable(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  // Skip `$`.
  if (tokens[i].type === TokenType.DollarSign) i++;
  else return 0;

  if (l = checkIdent(i)) i += l;
  else return 0;

  return i - start;
}
1112891
function tokenize(sOption) {
		var iAt = 1, // The token's position for error messages; we count starting with 1
			sId,
			aMatches,
			sNext = sOption,
			iOffset,
			oToken,
			aTokens = [],
			sValue;

		while (sNext.length) {
			aMatches = rToken.exec(sNext);
			iOffset = 0;
			if (aMatches) {
				sValue = aMatches[0];
				if (aMatches[7]) {
					sId = "OPTION";
				} else if (aMatches[6] || aMatches[4]) {
					sId = "VALUE";
				} else if (aMatches[5]) {
					sId = "PATH";
					if (sValue === "false" || sValue === "true" || sValue === "null") {
						sId = "VALUE";
					} else if (sValue === "not") {
						sId = "not";
						aMatches = rNot.exec(sNext);
						if (aMatches) {
							sValue = aMatches[0];
						}
					}
				} else if (aMatches[3]) { // a %-escaped delimiter
					sId = unescape(aMatches[3]);
				} else if (aMatches[2]) { // an operator
					sId = aMatches[2];
					iOffset = aMatches[1].length;
				} else { // a delimiter
					sId = aMatches[0];
				}
				if (sId === '"') {
					sId = "VALUE";
					sValue = tokenizeDoubleQuotedString(sNext, sOption, iAt);
				} else if (sId === "'") {
					sId = "VALUE";
					sValue = tokenizeSingleQuotedString(sNext, sOption, iAt);
				}
				oToken = {
					at : iAt + iOffset,
					id : sId,
					value : sValue
				};
			} else {
				throw new SyntaxError("Unknown character '" + sNext[0] + "' at " + iAt + ": "
					+ sOption);
			}
			sNext = sNext.slice(sValue.length);
			iAt += sValue.length;
			aTokens.push(oToken);
		}

		return aTokens;
	}
92305
def request_get_variable(self, py_db, seq, thread_id, frame_id, scope, attrs):
        '''
        
        '''
        int_cmd = InternalGetVariable(seq, thread_id, frame_id, scope, attrs)
        py_db.post_internal_command(int_cmd, thread_id)
350252
private void exposeVariables() throws JspTagException {

        if (deferredExpression == null) {
            /*
             * We need to support null items returned from next(); we
             * do this simply by passing such non-items through to the
             * scoped variable as effectively 'null' (that is, by calling
             * removeAttribute()).
             *
             * Also, just to be defensive, we handle the case of a null
             * 'status' object as well.
             *
             * We call getCurrent() and getLoopStatus() (instead of just using
             * 'item' and 'status') to bridge to subclasses correctly.
             * A subclass can override getCurrent() or getLoopStatus() but still
             * depend on our doStartTag() and doAfterBody(), which call this
             * method (exposeVariables()), to expose 'item' and 'status'
             * correctly.
             */
            if (itemId != null) {
                if (getCurrent() == null) {
                    pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
                } else {
                    pageContext.setAttribute(itemId, getCurrent());
                }
            }
        } else { //this is using a DeferredExpression
            ELContext myELContext = pageContext.getELContext();
            VariableMapper vm = myELContext.getVariableMapper();
            vm.setVariable(itemId, (ValueExpression) getCurrent());
        }
        if (statusId != null) {
            if (getLoopStatus() == null) {
                pageContext.removeAttribute(statusId, PageContext.PAGE_SCOPE);
            } else {
                pageContext.setAttribute(statusId, getLoopStatus());
            }
        }

    }
263530
def make_dynamic_prompt(self, prompt):
        """"""
        patterns = ["[\r\n]" + pattern_manager.pattern(
            self.platform, pattern_name, compiled=False) for pattern_name in self.target_prompt_components]

        patterns_re = "|".join(patterns).format(hostname=re.escape(prompt))

        try:
            prompt_re = re.compile(patterns_re)
        except re.error as e:  # pylint: disable=invalid-name
            raise RuntimeError("Pattern compile error: {} ({}:{})".format(e.message, self.platform, patterns_re))

        self.log("Dynamic prompt: '{}'".format(repr(prompt_re.pattern)))
        return prompt_re
92220
def no_param_shortcut(parser, token):
    
    bits = smart_split(token.contents)
    tagname = bits.next()
    try:
        imageurl = bits.next()
    except StopIteration:
        raise template.TemplateSyntaxError("%r tag requires at least the image url" % tagname)

    return MogrifyNode(imageurl, [(tagname, ), ])
11215
function makeRequest(title, cacheHitExpected, next) {
  var start = Date.now();

  request({
    url: 'http://localhost:1337/',
    encoding: null
  }, function(err, data, body) {
    var time = Date.now() - start;

    var receivedImage = new Buffer(body, 'binary');

    console.log(title);
    console.log('  status:', data.statusCode);
    console.log('  sent image length:', IMAGE.length);
    console.log('  received image length  :', receivedImage.length);
    console.log('  time  :', time);
    
    common.verify(function() {
      common.shouldEquals(IMAGE, receivedImage);
    });

    console.log();

    next();
  });
}
1220657
def assert_image_exists(self, pattern, timeout=20.0, **kwargs):
        
        pattern = self.d.pattern_open(pattern)
        match_kwargs = kwargs.copy()
        match_kwargs.pop('safe', None)
        match_kwargs.update({
            'timeout': timeout,
            'safe': True,
        })
        res = self.d.wait(pattern, **match_kwargs)
        is_success = res is not None
        message = 'assert image exists'
        if res:
            x, y = res.pos
            kwargs['position'] = {'x': x, 'y': y}
            message = 'image exists\npos %s\nconfidence=%.2f\nmethod=%s' % (res.pos, res.confidence, res.method)
        else:
            res = self.d.match(pattern)
            if res is None:
                message = 'Image not found'
            else:
                th = kwargs.get('threshold') or pattern.threshold or self.image_match_threshold
                message = 'Matched: %s\nPosition: %s\nConfidence: %.2f\nThreshold: %.2f' % (
                    res.matched, res.pos, res.confidence, th)

        kwargs['target'] = self._save_screenshot(pattern, name_prefix='target')
        kwargs['screenshot'] = self.last_screenshot
        kwargs.update({
            'action': 'assert_image_exists',
            'message': message,
            'success': is_success,
        })
        self._add_assert(**kwargs)
1129260
function tokensToRegExp (tokens, keys, options) {
  if (!isarray(keys)) {
    options = /** @type {!Object} */ (keys || options);
    keys = [];
  }

  options = options || {};

  var strict = options.strict;
  var end = options.end !== false;
  var route = '';

  // Iterate over the tokens and create our regexp string.
  for (var i = 0; i < tokens.length; i++) {
    var token = tokens[i];

    if (typeof token === 'string') {
      route += escapeString(token);
    } else {
      var prefix = escapeString(token.prefix);
      var capture = '(?:' + token.pattern + ')';

      keys.push(token);

      if (token.repeat) {
        capture += '(?:' + prefix + capture + ')*';
      }

      if (token.optional) {
        if (!token.partial) {
          capture = '(?:' + prefix + '(' + capture + '))?';
        } else {
          capture = prefix + '(' + capture + ')?';
        }
      } else {
        capture = prefix + '(' + capture + ')';
      }

      route += capture;
    }
  }

  var delimiter = escapeString(options.delimiter || '/');
  var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;

  // In non-strict mode we allow a slash at the end of match. If the path to
  // match already ends with a slash, we remove it for consistency. The slash
  // is valid at the end of a path match, not in the middle. This is important
  // in non-ending mode, where "/test/" shouldn't match "/test//route".
  if (!strict) {
    route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  }

  if (end) {
    route += '$';
  } else {
    // In non-ending mode, we need the capturing groups to match as much as
    // possible by using a positive lookahead to the end or next path segment.
    route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  }

  return attachKeys(new RegExp('^' + route, flags(options)), keys)
}
1272610
function markVariableAsUsed(context, name) {
  let scope = context.getScope();
  let variables;
  let i;
  let len;
  let found = false;

  // Special Node.js scope means we need to start one level deeper
  if (scope.type === 'global') {
    while (scope.childScopes.length) {
      scope = scope.childScopes[0];
    }
  }

  do {
    variables = scope.variables;
    for (i = 0, len = variables.length; i < len; i++) { // eslint-disable-line no-plusplus
      if (variables[i].name === name) {
        variables[i].eslintUsed = true;
        found = true;
      }
    }
    scope = scope.upper;
  } while (scope);

  return found;
}
538628
function() {
    this.jsonInit({
      "message0": Blockly.Msg.VARIABLES_SET,
      "args0": [
        {
          "type": "field_variable",
          "name": "VAR",
          "variable": Blockly.Msg.VARIABLES_DEFAULT_NAME
        },
        {
          "type": "input_value",
          "name": "VALUE"
        }
      ],
      "previousStatement": null,
      "nextStatement": null,
      "colour": Blockly.Blocks.variables.HUE,
      "tooltip": Blockly.Msg.VARIABLES_SET_TOOLTIP,
      "helpUrl": Blockly.Msg.VARIABLES_SET_HELPURL
    });
    this.contextMenuMsg_ = Blockly.Msg.VARIABLES_SET_CREATE_GET;
  }
1168101
function tokenizeInterpolate(match, value) {
    var index = tokenized.length;
    tokenized[index] = "'+\n((__t = (" + value + ")) == null ? '' : __t) +\n'";
    return token + index;
  }
1265221
function renderTmpl (path, vars, callback) {
    fs.readFile(path, 'utf8', function (err, file) {
        if (err) {
            return callback(err);
        }
        var out = file.replace(/\{\{([a-z]+)\}\}/ig, function (all, name) {
            return vars[name];
        });
        callback(null, out);
    });
}
551754
function eachImg(layer, callback) {
      var imgtags = layer._container.children[0].children;
      for (var i in imgtags) {
        if (imgtags[i].tagName === 'IMG') {
          callback(imgtags[i]);
        }
      }
    }
466399
function getFilesList(pattern) {
		//If pattern empty return all avaliable fonts
		if (pattern === undefined || pattern === '') {
			formatingFontsArray(serverFonts);
			closeConnection();
			return; // We are completed, close connection and end the program
		}

		var serverFiles = [],
			preg = new RegExp('[\\w\\-\\.]*' + pattern + '[\\w\\-\\.]*');


		function regular() {
			if (serverFonts.length < 1) {
				if (serverFiles.length !== 0){
					formatingFontsArray(serverFiles);
				}else{
					grunt.log.warn('We haven\'t any suitable fonts');
				}
				closeConnection();
				return; // We are completed, close connection and end the program
			}
			var file = serverFonts.pop();
			if (preg.test(file)) {
				serverFiles.push(file);
			}
			regular();
		}
		regular();
	}
720213
function images(user, keyPath, ipAddress, cb) {
  var cmd = [
    'sh',
    __dirname + '/scripts/getImages.sh',
    user,
    keyPath,
    ipAddress
  ].join(' ');

  logger.debug('images: ' + cmd);
  childProcess.exec(cmd, function(err, stdout, stderr) {
    logger.debug('images err: ' + err);
    logger.debug('images stdout: ' + stdout);
    logger.debug('images stderr: ' + stderr);
    cb(err, parseOutput(stdout, stderr));
  });
}