original_docstring: Collect modified files and filter those that need linting.
  
      Parameter:
          ref_list: list of references to parse (provided by git in stdin)
          remote: str. The name of the remote being pushed to.
  
      Returns:
          dict. Dict mapping branch names to 2-tuples of the form (list of
          changed files, list of files to lint).
      
docstring: Collect modified files and filter those that need linting.
  Parameter:
  ref_list: list of references to parse (provided by git in stdin)
  remote: str. The name of the remote being pushed to.
docstring_tokens: Collect modified files and filter those that need linting . Parameter : ref_list : list of references to parse ( provided by git in stdin ) remote : str . The name of the remote being pushed to .
code: def collect_files_being_pushed(ref_list, remote):
      """Collect modified files and filter those that need linting.
  
      Parameter:
          ref_list: list of references to parse (provided by git in stdin)
          remote: str. The name of the remote being pushed to.
  
      Returns:
          dict. Dict mapping branch names to 2-tuples of the form (list of
          changed files, list of files to lint).
      """
      if not ref_list:
          return {}
      # Avoid testing of non branch pushes (tags for instance) or deletions.
      # TODO(#11620): Change the following to a denylist instead of an allowlist.
      ref_heads_only = [
          ref for ref in ref_list
          if (ref.local_ref.startswith('refs/heads/') or ref.local_ref == 'HEAD')]
      # Get branch name from e.g. local_ref='refs/heads/lint_hook'.
      branches = [ref.local_ref.split('/')[-1] for ref in ref_heads_only]
      hashes = [ref.local_sha1 for ref in ref_heads_only]
      collected_files = {}
      # Git allows that multiple branches get pushed simultaneously with the "all"
      # flag. Therefore we need to loop over the ref_list provided.
      for branch, _ in python_utils.ZIP(branches, hashes):
          # Get the difference to remote/develop.
          modified_files = compare_to_remote(
              remote, branch, remote_branch=get_parent_branch_name_for_diff())
          files_to_lint = extract_files_to_lint(modified_files)
          collected_files[branch] = (modified_files, files_to_lint)
  
      for branch, (modified_files, files_to_lint) in collected_files.items():
          if modified_files:
              print('\nModified files in %s:' % branch)
              pprint.pprint(modified_files)
              print('\nFiles to lint in %s:' % branch)
              pprint.pprint(files_to_lint)
              print('\n')
      return collected_files
code_tokens: def collect_files_being_pushed ( ref_list , remote ) : if not ref_list : return { } ref_heads_only = [ ref for ref in ref_list if ( ref . local_ref . startswith ( 'refs/heads/' ) or ref . local_ref == 'HEAD' ) ] branches = [ ref . local_ref . split ( '/' ) [ - 1 ] for ref in ref_heads_only ] hashes = [ ref . local_sha1 for ref in ref_heads_only ] collected_files = { } for branch , _ in python_utils . ZIP ( branches , hashes ) : modified_files = compare_to_remote ( remote , branch , remote_branch = get_parent_branch_name_for_diff ( ) ) files_to_lint = extract_files_to_lint ( modified_files ) collected_files [ branch ] = ( modified_files , files_to_lint ) for branch , ( modified_files , files_to_lint ) in collected_files . items ( ) : if modified_files : print ( '\nModified files in %s:' % branch ) pprint . pprint ( modified_files ) print ( '\nFiles to lint in %s:' % branch ) pprint . pprint ( files_to_lint ) print ( '\n' ) return collected_files
short_docstring: Collect modified files and filter those that need linting.
short_docstring_tokens: Collect modified files and filter those that need linting .
comment: """Collect modified files and filter those that need linting.
  
      Parameter:
          ref_list: list of references to parse (provided by git in stdin)
          remote: str. The name of the remote being pushed to.
  
      Returns:
          dict. Dict mapping branch names to 2-tuples of the form (list of
          changed files, list of files to lint).
      """$SEP$# Avoid testing of non branch pushes (tags for instance) or deletions.$SEP$# TODO(#11620): Change the following to a denylist instead of an allowlist.$SEP$# Get branch name from e.g. local_ref='refs/heads/lint_hook'.$SEP$# Git allows that multiple branches get pushed simultaneously with the "all"$SEP$# flag. Therefore we need to loop over the ref_list provided.$SEP$# Get the difference to remote/develop.