python类_MAXCACHE的实例源码

test_fnmatch.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def test_cache_clearing(self):
        # check that caches do not grow too large
        # http://bugs.python.org/issue7846

        # string pattern cache
        for i in range(_MAXCACHE + 1):
            fnmatch('foo', '?' * i)

        self.assertLessEqual(len(_cache), _MAXCACHE)
test_fnmatch.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def test_cache_clearing(self):
        # check that caches do not grow too large
        # http://bugs.python.org/issue7846

        # string pattern cache
        for i in range(_MAXCACHE + 1):
            fnmatch('foo', '?' * i)

        self.assertLessEqual(len(_cache), _MAXCACHE)
iglob.py 文件源码 项目:vsi_common 作者: VisionSystemsInc 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def fnmatch_filter(names, pat, casesensitive):
  """Return the subset of the list NAMES that match PAT"""
  result=[]

  if casesensitive:
    if not pat in _casecache:
      res = translate(pat)
      if len(_casecache) >= _MAXCACHE:
        _casecache.clear()
      _casecache[pat] = re.compile(res)
    match=_casecache[pat].match

    for name in names:
      if match(name):
        result.append(name)
  else:
    if not pat in _nocasecache:
      res = translate(pat)
      if len(_nocasecache) >= _MAXCACHE:
        _nocasecache.clear()
      _nocasecache[pat] = re.compile(res, re.IGNORECASE)
    match=_nocasecache[pat].match

    pat=ntpath.normcase(pat)
    for name in names:
      if match(ntpath.normcase(name)):
        result.append(name)
  return result
test_fnmatch.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def test_cache_clearing(self):
        # check that caches do not grow too large
        # http://bugs.python.org/issue7846

        # string pattern cache
        for i in range(_MAXCACHE + 1):
            fnmatch('foo', '?' * i)

        self.assertLessEqual(len(_cache), _MAXCACHE)
test_fnmatch.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def test_cache_clearing(self):
        # check that caches do not grow too large
        # http://bugs.python.org/issue7846

        # string pattern cache
        for i in range(_MAXCACHE + 1):
            fnmatch('foo', '?' * i)

        self.assertLessEqual(len(_cache), _MAXCACHE)


问题


面经


文章

微信
公众号

扫码关注公众号