code: def updatecache(filename, module_globals=None):
      """Update a cache entry and return its list of lines.
      If something's wrong, print a message, discard the cache entry,
      and return an empty list."""
  
      if filename in cache:
          if len(cache[filename]) != 1:
              cache.pop(filename, None)
      if not filename or (
          filename.startswith("<") and filename.endswith(">")
      ):
          return []
  
      if not os.path.isabs(filename):
          # Do not read builtin code from the filesystem.
          import __res
  
          key = __res.py_src_key(filename)
          if data := __res.resfs_read(key):
              assert data is not None, filename
              data = data.decode("UTF-8")
              lines = [line + "\n" for line in data.splitlines()]
              cache[filename] = (len(data), None, lines, filename)
              return cache[filename][2]
  
      fullname = filename
      try:
          stat = os.stat(fullname)
      except OSError:
          basename = filename
  
          # Realise a lazy loader based lookup if there is one
          # otherwise try to lookup right now.
          if lazycache(filename, module_globals):
              try:
                  data = cache[filename][0]()
              except (ImportError, OSError):
                  pass
              else:
                  if data is None:
                      # No luck, the PEP302 loader cannot find the source
                      # for this module.
                      return []
                  cache[filename] = (
                      len(data),
                      None,
                      [line + "\n" for line in data.splitlines()],
                      fullname,
                  )
                  return cache[filename][2]
  
          # Try looking through the module search path, which is only useful
          # when handling a relative filename.
          if os.path.isabs(filename):
              return []
  
          for dirname in sys.path:
              try:
                  fullname = os.path.join(dirname, basename)
              except (TypeError, AttributeError):
                  # Not sufficiently string-like to do anything useful with.
                  continue
              try:
                  stat = os.stat(fullname)
                  break
              except OSError:
                  pass
          else:
              return []
      try:
          with tokenize.open(fullname) as fp:
              lines = fp.readlines()
      except (OSError, UnicodeDecodeError, SyntaxError):
          return []
      if lines and not lines[-1].endswith("\n"):
          lines[-1] += "\n"
      size, mtime = stat.st_size, stat.st_mtime
      cache[filename] = size, mtime, lines, fullname
      return lines
  
file_path: catboost/contrib/tools/python3/src/Lib/linecache.py
imports: import functools
  import sys
  import os
  import tokenize
label_desc: Use image node_id 5 for calling a global function with example usage: updatecache(filename, module_globals) and returns: lines, list, cache, list, list, list, cache, list