code: def __init__(
      self,
      resdef,
      uri,
      name=None,
      sha256=None,
      unpack=None,
      type=None,
      select=None,
      select_min=None,
      select_max=None,
      warn_if_empty=True,
      optional=False,
      fail_if_empty=False,
      rename=None,
      help=None,
      post_process=None,
      target_path=None,
      target_type=None,
      replace_existing=None,
      always_resolve=None,
      path=None,
      preserve_path=False,
      params=None,
      flag_name=None,
      **kw,
  ):
      self.resdef = resdef
      self.uri = uri
      self._parsed_uri = None
      self.name = name
      self.flag_name = flag_name
      self.sha256 = sha256
      if unpack is not None:
          self.unpack = unpack
      else:
          self.unpack = resdef.default_unpack
      self.type = type
      self.select = _init_resource_source_select(
          select, select_min, select_max
      )
      self.optional = optional
      self.warn_if_empty = warn_if_empty
      self.fail_if_empty = fail_if_empty
      self.rename = _init_rename(rename)
      self.post_process = post_process
      self.target_path = _init_target_path(
          target_path,
          path,
          f"source {self.resolving_name}",
      )
      self.target_type = target_type
      self.replace_existing = replace_existing
      self.preserve_path = preserve_path
      self.params = params
      self.always_resolve = always_resolve
      self.help = help
      for key in sorted(kw):
          log.warning(
              "unexpected source attribute '%s' in resource %r",
              self.resdef._uncoerce_attr_key(key),
              self.resolving_name,
          )
  
imports: import collections
  import copy
  import logging
  import operator
  import pprint
  from guild import util
label_desc: Use image node_id 1 to create a new ResourceSource object  with example: obj = ResourceSource(resdef, uri, name, sha256, unpack, type, select, select_min, select_max, warn_if_empty, optional, fail_if_empty, rename, help, post_process, target_path, target_type, replace_existing, always_resolve, path, preserve_path, params, flag_name)