docstr: Called immediately after a Guild file is loaded.
  
  If op config for an R op is defined in guild.yml, this
  augments that OpDef with r script guild data
  (i.e., flags, user supplied hashpipe yaml frontmatter)
docstr_tok: ["Called","immediately","after","a","Guild","file","is","loaded",".","If","op","config","for","an","R","op","is","defined","in","guild.yml",",","this","augments","that","OpDef","with","r","script","guild","data","(","i.e.",",","flags",",","user","supplied","hashpipe","yaml","frontmatter",")"]
code: def guildfile_loaded(self, gf):
      """Called immediately after a Guild file is loaded.
  
      If op config for an R op is defined in guild.yml, this
      augments that OpDef with r script guild data
      (i.e., flags, user supplied hashpipe yaml frontmatter)
      """
      for m in gf.models.values():
          for i, opdef in enumerate(m.operations):
              if not r_util.is_r_script(opdef.name):
                  continue
  
              script_data = _op_data_for_script(opdef.name)
              guildfile_data = opdef._data
  
              # build up the new data by merging the two dicts
              # config in the script frontmatter takes precedence
              data = guildfile_data.copy()
              data.update(script_data)
  
              # TODO: merge select rules, other custom logic to be implemented
              if (
                  "sourcecode" in guildfile_data
                  and "sourcecode" in script_data
              ):
                  # data['sourcecode'] = ...
                  pass
  
              # replace the opdef with a new one built from the merged data dict
              m.operations[i] = guildfile.OpDef(opdef.name, data, m)
  
imports: import logging
  import os
  import yaml
  import guild
  from guild import config
  from guild import guildfile
  from guild import model
  from guild import model_proxy
  from guild import plugin
  from .None import r_util
label_desc: Use image node_id 3 for calling the RScriptPlugin obj's underlying member method code with example usage: obj.guildfile_loaded(gf) without return types