parameters: (src_module_zip, tmp_dir, split_dimensions)
docstring: Splits assets in a module if needed.
  
    Args:
      src_module_zip: input zip module path.
      tmp_dir: Path to temporary directory, where the new output module might
        be written to.
      split_dimensions: list of split dimensions.
  
    Returns:
      If the module doesn't need asset targeting, doesn't do anything and
      returns src_module_zip. Otherwise, create a new module zip archive under
      tmp_dir with the same file name, but which contains assets paths targeting
      the proper dimensions.
docstring_summary: Splits assets in a module if needed.
docstring_tokens: Splits assets in a module if needed .
function: def _SplitModuleForAssetTargeting(src_module_zip, tmp_dir, split_dimensions):
    """Splits assets in a module if needed.
  
    Args:
      src_module_zip: input zip module path.
      tmp_dir: Path to temporary directory, where the new output module might
        be written to.
      split_dimensions: list of split dimensions.
  
    Returns:
      If the module doesn't need asset targeting, doesn't do anything and
      returns src_module_zip. Otherwise, create a new module zip archive under
      tmp_dir with the same file name, but which contains assets paths targeting
      the proper dimensions.
    """
    split_language = 'LANGUAGE' in split_dimensions
    if not split_language:
      # Nothing to target, so return original module path.
      return src_module_zip
  
    with zipfile.ZipFile(src_module_zip, 'r') as src_zip:
      language_files = [
        f for f in src_zip.namelist() if f.startswith(_LOCALES_SUBDIR)]
  
      if not language_files:
        # Not language-based assets to split in this module.
        return src_module_zip
  
      tmp_zip = os.path.join(tmp_dir, os.path.basename(src_module_zip))
      with zipfile.ZipFile(tmp_zip, 'w') as dst_zip:
        for info in src_zip.infolist():
          src_path = info.filename
          is_compressed = info.compress_type != zipfile.ZIP_STORED
  
          dst_path = src_path
          if src_path in language_files:
            dst_path = _RewriteLanguageAssetPath(src_path)
  
          build_utils.AddToZipHermetic(
              dst_zip,
              dst_path,
              data=src_zip.read(src_path),
              compress=is_compressed)
  
      return tmp_zip
function_tokens: def _SplitModuleForAssetTargeting ( src_module_zip , tmp_dir , split_dimensions ) : split_language = 'LANGUAGE' in split_dimensions if not split_language : # Nothing to target, so return original module path. return src_module_zip with zipfile . ZipFile ( src_module_zip , 'r' ) as src_zip : language_files = [ f for f in src_zip . namelist ( ) if f . startswith ( _LOCALES_SUBDIR ) ] if not language_files : # Not language-based assets to split in this module. return src_module_zip tmp_zip = os . path . join ( tmp_dir , os . path . basename ( src_module_zip ) ) with zipfile . ZipFile ( tmp_zip , 'w' ) as dst_zip : for info in src_zip . infolist ( ) : src_path = info . filename is_compressed = info . compress_type != zipfile . ZIP_STORED dst_path = src_path if src_path in language_files : dst_path = _RewriteLanguageAssetPath ( src_path ) build_utils . AddToZipHermetic ( dst_zip , dst_path , data = src_zip . read ( src_path ) , compress = is_compressed ) return tmp_zip