extensions/common/api/externs_checker.py
def ParseApiFileList(input_api, api_root=None):
    """Extract the API pairs from the registered list."""
    if api_root is None:
      api_root = input_api.PresubmitLocalPath()
    externs_root = input_api.os_path.join(
        input_api.change.RepositoryRoot(), 'third_party', 'closure_compiler',
        'externs')

    ret = {}
    listing = input_api.os_path.join(api_root, 'generated_externs_list.txt')
    for line in input_api.ReadFile(listing).splitlines():
      # Skip blank & comment lines.
      if not line.split('#', 1)[0].strip():
        continue

      source = input_api.os_path.join(api_root, line)
      api_name, ext = line.rsplit('.', 1)
      assert ext == 'json' or ext == 'idl'
      externs = input_api.os_path.join(externs_root, api_name + '.js')
      ret[source] = externs

    assert ret
    return ret
Extract the API pairs from the registered list.
Extract the API pairs from the registered list.
Extract the API pairs from the registered list .
def ParseApiFileList(input_api, api_root=None):
    if api_root is None:
      api_root = input_api.PresubmitLocalPath()
    externs_root = input_api.os_path.join(
        input_api.change.RepositoryRoot(), 'third_party', 'closure_compiler',
        'externs')
    ret = {}
    listing = input_api.os_path.join(api_root, 'generated_externs_list.txt')
    for line in input_api.ReadFile(listing).splitlines():
      if not line.split('#', 1)[0].strip():
        continue
      source = input_api.os_path.join(api_root, line)
      api_name, ext = line.rsplit('.', 1)
      assert ext == 'json' or ext == 'idl'
      externs = input_api.os_path.join(externs_root, api_name + '.js')
      ret[source] = externs
    assert ret
    return ret
def ParseApiFileList ( input_api , api_root = None ) : if api_root is None : api_root = input_api . PresubmitLocalPath ( ) externs_root = input_api . os_path . join ( input_api . change . RepositoryRoot ( ) , 'third_party' , 'closure_compiler' , 'externs' ) ret = { } listing = input_api . os_path . join ( api_root , 'generated_externs_list.txt' ) for line in input_api . ReadFile ( listing ) . splitlines ( ) : if not line . split ( '#' , 1 ) [ 0 ] . strip ( ) : continue source = input_api . os_path . join ( api_root , line ) api_name , ext = line . rsplit ( '.' , 1 ) assert ext == 'json' or ext == 'idl' externs = input_api . os_path . join ( externs_root , api_name + '.js' ) ret [ source ] = externs assert ret return ret
Extract the API pairs from the registered list.
Extract the API pairs from the registered list .
"""Extract the API pairs from the registered list.""" # Skip blank & comment lines.
input_api
api_root