检查请求缓存是否“新鲜”，也就是内容没有改变。
        此方法用于 If-None-Match / ETag, 和 If-Modified-Since 和 Last-Modified 之间的缓存协商。
        在设置一个或多个这些响应头后应该引用它。
766464
def fresh(self) -> bool:
        
        method_str = self.method
        if method_str != 'GET' and method_str != 'HEAD':
            return False
        s = self.ctx.status
        if (s >= 200 and s < 300) or s == 304:
            return fresh(
                self.headers,
                (self.response and self.response.headers) or {},
            )
        return False
1075719
function isCTag (str, cTag, index) {
    var l = cTag.length, s = str.substr(index, l);
    if (cTag === s) {
        return {
            str: s,
            index: index,
            type: 1,
            jump: l - 1
        };
    }
}
1230738
function(newinput, bestmatch) {
		var matches = this._matches,
			oldindex = -1,
			oldrating = -1,
			newrating = edb.InputPlugin._rateone(newinput.type, bestmatch);
		matches.forEach(function oldbestmatch(match, i) {
			oldrating = edb.InputPlugin._rateone(match.type, bestmatch);
			if (oldrating > -1 && oldrating <= newrating) {
				oldindex = i;
			}
		});
		if (oldindex > -1) {
			matches[oldindex] = newinput;
		} else {
			matches.push(newinput);
		}
	}
532757
public void setMatchETag(String etag) throws InvalidArgumentException {
    if (etag == null) {
      throw new InvalidArgumentException("ETag cannot be empty");
    }
    copyConditions.put("x-amz-copy-source-if-match", etag);
  }
1040254
def acgt_match(string):
    
    search = re.compile(r'[^ACGT]').search
    return not bool(search(string))
223339
def _is_updated(old_conf, new_conf):
    '''
    
    '''
    changed = {}

    # Dirty json hacking to get parameters in the same format
    new_conf = _json_to_unicode(salt.utils.json.loads(
        salt.utils.json.dumps(new_conf, ensure_ascii=False)))
    old_conf = salt.utils.json.loads(salt.utils.json.dumps(old_conf, ensure_ascii=False))

    for key, value in old_conf.items():
        oldval = six.text_type(value).lower()
        if key in new_conf:
            newval = six.text_type(new_conf[key]).lower()
        if oldval == 'null' or oldval == 'none':
            oldval = ''
        if key in new_conf and newval != oldval:
            changed[key] = {'old': oldval, 'new': newval}
    return changed
159019
public static boolean isNotModified(Context context, long lastModified, String etag) {
        // First check etag. Important, if there is an If-None-Match header, we MUST not check the
        // If-Modified-Since header, regardless of whether If-None-Match matches or not. This is in
        // accordance with section 14.26 of RFC2616.

        final String browserEtag = context.header(HeaderNames.IF_NONE_MATCH);
        if (browserEtag != null) {
            // We check the given etag against the given one.
            // If the given one is null, that means that etags are disabled.
            return browserEtag.equals(etag);
        }

        // IF_NONE_MATCH not set, check IF_MODIFIED_SINCE
        final String ifModifiedSince = context.header(HeaderNames.IF_MODIFIED_SINCE);
        if (ifModifiedSince != null && lastModified > 0 && !ifModifiedSince.isEmpty()) {
            try {
                // We do a double check here because the time granularity is important here.
                // If the written date headers are still the same, we are unchanged (the granularity is the
                // second).
                return ifModifiedSince.equals(DateUtil.formatForHttpHeader(lastModified));
            } catch (IllegalArgumentException ex) {
                LoggerFactory.getLogger(CacheUtils.class)
                        .error("Cannot build the date string for {}", lastModified, ex);
                return true;
            }
        }
        return false;
    }
1229179
def unmatched(match):
    """"""
    start, end = match.span(0)
    return match.string[:start]+match.string[end:]
7252
function matchesCustom(ctx, opts) {
  if (opts.custom) {
    return opts.custom.call(ctx);
  }
  return false;
}
806658
def contains_raw(self, etag):
        """"""
        etag, weak = unquote_etag(etag)
        if weak:
            return self.contains_weak(etag)
        return self.contains(etag)
181361
function matchDetails(m, isSearch) {
    var id, regexp, segment, type, cfg, arrayMode;
    id          = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null
    cfg         = config.params[id];
    segment     = pattern.substring(last, m.index);
    regexp      = isSearch ? m[4] : m[4] || (m[1] == '*' ? '.*' : null);

    if (regexp) {
      type      = $$UMFP.type(regexp) || inherit($$UMFP.type("string"), { pattern: new RegExp(regexp, config.caseInsensitive ? 'i' : undefined) });
    }

    return {
      id: id, regexp: regexp, segment: segment, type: type, cfg: cfg
    };
  }
81336
function rawIgnoreRegex(html, opts) {
    var ignore = opts['raw-ignore-regex'];
    if (!ignore) { return [html, function (issue) { return issue; }]; }

    var origLineCol = knife.getLineColFunc(html),
        l = 1, // Current line in the modified string
        d = 0; // Difference between original and modified line numbers
    var lines = [],
        cols = [];
    var total = html.length;
    html = html.replace(ignore, function (match) {
        var offset = arguments[arguments.length - 2],
            start = origLineCol(offset),
            end = origLineCol(offset + match.length),
            linediff = end[0] - start[0],
            newcol = start[0] - d;
        if (linediff) {
            for (; l < newcol; l++) { lines[l] = l + d; }
            d += linediff;
        }
        if (!cols[newcol]) { cols[newcol] = [[1,0,start[0]]]; }
        var col = cols[newcol],
            st = start[1] - col[col.length - 1][1];
        col.push([st, end[1] - st, end[0]]);
        return '';
    });

    var recoverLineCol;
    function findInCol(col, i) {
        var lo = 0, hi = col.length;
        while (lo < hi - 1) {
            var mid = Math.floor((lo + hi) / 2),
                v = col[mid][0];
            if (v === i) {
                return col[mid];
            } else if (v < i) {
                lo = mid;
            } else {
                hi = mid;
            }
        }
        return col[lo];
    }
    if (d === 0) { // No multi-line ignores
        recoverLineCol = function (issue) {
            var col = cols[issue.line];
            if (col) {
                issue.column += findInCol(col, issue.column)[1];
            }
            return issue;
        };
    } else {
        for (; l < total - d; l++) { lines[l] = l + d; }
        recoverLineCol = function (issue) {
            var col = cols[issue.line];
            if (col) {
                var c = findInCol(col, issue.column);
                issue.column += c[1];
                issue.line = c[2];
            } else {
                issue.line = lines[issue.line];
            }
            return issue;
        };
    }
    return [html, recoverLineCol];
}
85599
async function checkNewVersion() {
    try {
        const file = path.join(constants.GLOBAL_DIR, constants.GLOBAL_INFO);

        // If it does not exist, create it.
        if (!fs.existsSync(file)) {
            createFile({
                name: file,
                source: `{"lastCheckForUpdate": 0}\n`,
            });
        }

        // Read info file
        const json = fs.readJsonSync(file, 'utf8');
        const lastCheckForUpdate = json.lastCheckForUpdate;

        // Show update message
        if (lastCheckForUpdate + (6 * 3600 * 1000) < Date.now()) {
            const latestVersion = await request(`${constants.FIREBASE_DATABASE_URL}/version/cli/latest.json`);
            if (latestVersion && latestVersion !== 'null' && latestVersion !== `"${pjson.version}"`) {
                const scale = pjson.version.length + latestVersion.length - 10;

                console.log();
                console.log(`${`   ┏`.yellow}${`─`.repeat(scale + 45).yellow}${`┓`.yellow}`);
                console.log(`${`   │`.yellow}${` `.repeat(scale + 45)}${`│`.yellow}`);
                console.log(`${`   │`.yellow}${`      Update available ${pjson.version} -> `}${`${latestVersion}`.green}${`        │`.yellow}`);
                console.log(`${`   │`.yellow}${`  Run `}${`npm i -g google-apps-script`.red}${` to update`}${` `.repeat(scale + 2)}${`│`.yellow}`);
                console.log(`${`   │`.yellow}${` `.repeat(scale + 45)}${`│`.yellow}`);
                console.log(`${`   ┗`.yellow}${`─`.repeat(scale + 45).yellow}${`┛`.yellow}`);
                console.log();
            }

            // Update lastCheckForUpdate
            json.lastCheckForUpdate = Date.now();
            createFile({
                name: file,
                source: JSON.stringify(json),
            });
            return true;
        }
        return false;
    } catch (err) {
        err.origin = 'checkNewVersion';
        await error.log(err);
        return false;
    }
}
1369276
function replaceMatch(match,i) {
            /**
             * 匹配 url('path/to/image.png')
             * 中的 path/to/image.png
             */

            var reg = /\(\s*(['"]?)([^'"\)]*)\1\s*\)/,
                parsed = "",
                imgpath = match.match(reg)[2],
                parsed_url;

            /**
             * 若非相对路径则取得其相对路径进行parse
             */
            parsed = self.calculateImagePath(csspath,imgpath,!isRelative(imgpath));

            if(!parsed){
                return;
            }
            // image_paths.push((parsed.name+parsed.ext).substr(1));

            parsed_url = "url(" + self.connector(parsed) + ")";

            if(parsed_url !== match){
                matches[match] = parsed_url;
            }
        }
214407
function createNthFilter(isNext, isType) {
    var next, prev, cacheKey, getStart;
    if (isNext) {
      cacheKey = isType ? "type" : "child";
      // if(typeof isType === "function") cacheKey = "match"
      next = nthNext;
      prev = nthPrev;
      getStart = nthChild;
    } else {
      // Fixed:!!! 这里cache是首次生成的cache被写死了，即使后面clear了也没有用,
      // 即永远无法被释放
      cacheKey = "last" + (isType ? "type" : "child");
      // if(typeof isType === "function") cacheKey = "last-match"
      prev = nthNext;
      next = nthPrev;
      getStart = nthLastChild;
    }
    // 实际返回函数, param即pesudo的action定义的参数形如
    // `{step:1, start:1}` 所有的类似even、odd或者其他形如n、-3n-11都会标准化
    // 成这种形势
    return function(node, param) {
      var cache = nthPositionCache[cacheKey];
      if (node === root) return false; // 如果是html直接返回false 坑爹啊
      var _uid = getUid(node),
        parent = node.parentNode,
        traverse = param.step > 0 ? next : prev,
        step = param.step,
        start = param.start,
        type = isType && node.nodeName;
        //Fixed
      if (step === null) return false; //means always false
      if (!cache[_uid]) {
        var startNode = getStart(parent, type),
          index = 0;
          do {
            cache[getUid(startNode)] = ++index;
            nthPositionCache.length++;
          } while (startNode = next(startNode, type));
      }
      var position = cache[_uid];
      if (step === 0) return position === start;
      return ((position - start) / step >= 0) && ((position - start) % step === 0);
    };
  }
134052
private static boolean updateAttributeIfExist(String key, CoreDictionary.Attribute attribute, TreeMap<String, CoreDictionary.Attribute> map, TreeMap<Integer, CoreDictionary.Attribute> rewriteTable)
    {
        int wordID = CoreDictionary.getWordID(key);
        CoreDictionary.Attribute attributeExisted;
        if (wordID != -1)
        {
            attributeExisted = CoreDictionary.get(wordID);
            attributeExisted.nature = attribute.nature;
            attributeExisted.frequency = attribute.frequency;
            attributeExisted.totalFrequency = attribute.totalFrequency;
            // 收集该覆写
            rewriteTable.put(wordID, attribute);
            return true;
        }

        attributeExisted = map.get(key);
        if (attributeExisted != null)
        {
            attributeExisted.nature = attribute.nature;
            attributeExisted.frequency = attribute.frequency;
            attributeExisted.totalFrequency = attribute.totalFrequency;
            return true;
        }

        return false;
    }
671280
function defaultVersionMatcher(raw) {
  // sanity check
  if (ramda.isNil(raw) || ramda.isEmpty(raw)) return null

  try {
    // look for something that looks like semver
    var rx = /([0-9]+\.[0-9]+\.[0-9]+)/
    var match = ramda.match(rx, raw)
    if (match.length > 0) {
      return match[0]
    } else {
      return null
    }
  } catch (err) {
    // something tragic happened
    return false
  }
}