tools/linux/dump-static-initializers.py
def QualifyFilename(filename, symbol):
  """Given a bare filename and a symbol that occurs in it, attempt to qualify
  it with a src-relative path.  If more than one file matches, return the
  original filename."""
  if not IS_GIT_WORKSPACE:
    return filename
  match = symbol_code_name_re.match(symbol)
  if not match:
    return filename
  symbol = match.group(1)
  cmd = ['git', 'grep', '-l', symbol, '--', '*/' + filename]
  gitgrep = subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             universal_newlines=True)
  candidate = filename
  for line in gitgrep.stdout:
    if candidate != filename:  # More than one candidate; return bare filename.
      return filename
    candidate = line.strip()
  return candidate
Given a bare filename and a symbol that occurs in it, attempt to qualify
  it with a src-relative path.  If more than one file matches, return the
  original filename.
Given a bare filename and a symbol that occurs in it, attempt to qualify
it with a src-relative path.  If more than one file matches, return the
original filename.
Given a bare filename and a symbol that occurs in it attempt to qualify it with a src - relative path . If more than one file matches return the original filename .
def QualifyFilename(filename, symbol):
  if not IS_GIT_WORKSPACE:
    return filename
  match = symbol_code_name_re.match(symbol)
  if not match:
    return filename
  symbol = match.group(1)
  cmd = ['git', 'grep', '-l', symbol, '--', '*/' + filename]
  gitgrep = subprocess.Popen(cmd,
                             stdout=subprocess.PIPE,
                             universal_newlines=True)
  candidate = filename
  for line in gitgrep.stdout:
    if candidate != filename:  
      return filename
    candidate = line.strip()
  return candidate
def QualifyFilename ( filename , symbol ) : if not IS_GIT_WORKSPACE : return filename match = symbol_code_name_re . match ( symbol ) if not match : return filename symbol = match . group ( 1 ) cmd = [ 'git' , 'grep' , '-l' , symbol , '--' , '*/' + filename ] gitgrep = subprocess . Popen ( cmd , stdout = subprocess . PIPE , universal_newlines = True ) candidate = filename for line in gitgrep . stdout : if candidate != filename : return filename candidate = line . strip ( ) return candidate
Given a bare filename and a symbol that occurs in it, attempt to qualify
it with a src-relative path.
Given a bare filename and a symbol that occurs in it attempt to qualify it with a src - relative path .
"""Given a bare filename and a symbol that occurs in it, attempt to qualify
  it with a src-relative path.  If more than one file matches, return the
  original filename.""" # More than one candidate; return bare filename.
filename
symbol