tools/translation/helper/translation_helper.py
def _parse_grd_file(grd_path):
  """Reads a grd(p) file and any subfiles included via <part file="..." />.

  Args:
    grd_path: The path of the .grd or .grdp file.
  Returns:
    A tuple (grd_dom, grdp_paths). dom is an ElementTree DOM for the grd file,
    with the <part> elements inlined. grdp_paths is the list of grdp files that
    were included via <part> elements.
  """
  grdp_paths = []
  grd_dom = ElementTree.parse(grd_path)
  # We modify grd in the loop, so listify this iterable to be safe.
  part_nodes = list(grd_dom.findall('.//part'))
  for part_node in part_nodes:
    grdp_rel_path = part_node.get('file')
    grdp_path = os.path.join(os.path.dirname(grd_path), grdp_rel_path)
    grdp_paths.append(grdp_path)
    grdp_dom, grdp_grdp_paths = _parse_grd_file(grdp_path)
    grdp_paths.extend(grdp_grdp_paths)
    part_node.append(grdp_dom.getroot())
  return grd_dom, grdp_paths
Reads a grd(p) file and any subfiles included via <part file="..." />.

  Args:
    grd_path: The path of the .grd or .grdp file.
  Returns:
    A tuple (grd_dom, grdp_paths). dom is an ElementTree DOM for the grd file,
    with the <part> elements inlined. grdp_paths is the list of grdp files that
    were included via <part> elements.
  
Reads a grd(p) file and any subfiles included via .
Reads a grd ( p ) file and any subfiles included via .
def _parse_grd_file(grd_path):
  grdp_paths = []
  grd_dom = ElementTree.parse(grd_path)
  part_nodes = list(grd_dom.findall('.//part'))
  for part_node in part_nodes:
    grdp_rel_path = part_node.get('file')
    grdp_path = os.path.join(os.path.dirname(grd_path), grdp_rel_path)
    grdp_paths.append(grdp_path)
    grdp_dom, grdp_grdp_paths = _parse_grd_file(grdp_path)
    grdp_paths.extend(grdp_grdp_paths)
    part_node.append(grdp_dom.getroot())
  return grd_dom, grdp_paths
def _parse_grd_file ( grd_path ) : grdp_paths = [ ] grd_dom = ElementTree . parse ( grd_path ) part_nodes = list ( grd_dom . findall ( './/part' ) ) for part_node in part_nodes : grdp_rel_path = part_node . get ( 'file' ) grdp_path = os . path . join ( os . path . dirname ( grd_path ) , grdp_rel_path ) grdp_paths . append ( grdp_path ) grdp_dom , grdp_grdp_paths = _parse_grd_file ( grdp_path ) grdp_paths . extend ( grdp_grdp_paths ) part_node . append ( grdp_dom . getroot ( ) ) return grd_dom , grdp_paths
Reads a grd(p) file and any subfiles included via <part file="..." />.
Reads a grd ( p ) file and any subfiles included via <part file = " ... " / > .
"""Reads a grd(p) file and any subfiles included via <part file="..." />.

  Args:
    grd_path: The path of the .grd or .grdp file.
  Returns:
    A tuple (grd_dom, grdp_paths). dom is an ElementTree DOM for the grd file,
    with the <part> elements inlined. grdp_paths is the list of grdp files that
    were included via <part> elements.
  """ # We modify grd in the loop, so listify this iterable to be safe.
A tuple (grd_dom, grdp_paths). dom is an ElementTree DOM for the grd file,
with the  elements inlined. grdp_paths is the list of grdp files that
were included via  elements.
A tuple ( grd_dom grdp_paths ) . dom is an ElementTree DOM for the grd file with the elements inlined . grdp_paths is the list of grdp files that were included via elements .
grd_path
The path of the .grd or .grdp file.
The path of the . grd or . grdp file .