code: def _flag_data_for_file(source):
      """Returns a flag def for a 'file' source.
  
      Because required files are generally not user-configurable
      (e.g. their content and paths are relied on by the operation) a
      flag is only generated when the source `flag-name` attribute is
      specified.
  
      For the same reason, `arg-skip` is true for generated flags to
      avoid passing required files as command arguments.
  
      The source `type` is `string` to avoid the side-effects of using
      `path` (e.g. convertion of the value to an absolute path).
      """
      assert source.parsed_uri.scheme == "file", source.parsed_uri
      if not source.flag_name:
          return None
      return {
          "name": source.flag_name,
          "arg-skip": True,
          "default": source.parsed_uri.path,
          "type": "string",
      }
  
file_path: guildai/guild/plugins/resource_flags.py
imports: import logging
  from guild import guildfile
  from guild import op_dep
  from guild import plugin
label_desc: Use image node_id 5 for calling a global function with example usage: _flag_data_for_file(source) and returns: dict, None