code: def _apply_resource_flagdefs(opdef, flag_vals):
      from guild import op_dep
  
      for depdef in opdef.dependencies:
          try:
              dep = op_dep.dep_for_depdef(depdef, flag_vals)
          except op_dep.OpDependencyError:
              # Can occur when there's a unresolvable flag reference in
              # a resource source def - we ignore here
              pass
          else:
              for source in dep.resdef.sources:
                  candidate_flag_names = (
                      _candidate_flag_names_for_source(source)
                  )
                  if not candidate_flag_names:
                      break
                  flagdef = _flagdef_for_candidate_names(
                      opdef, candidate_flag_names
                  )
                  if flagdef:
                      _maybe_apply_run_id_choices(
                          source, flag_vals, flagdef
                      )
                      break
                  # Apply the first candidate name as a new flag def
                  _apply_resource_flagdef(
                      candidate_flag_names[0], opdef, source, flag_vals
                  )
  
imports: import click
  from guild import click_util
  from .None import ac_support
  from .None import remote_support
label_desc: Use image node_id 9 for calling a global function with example usage: _apply_resource_flagdefs(opdef, flag_vals) without return types