docstr: Set hyper-parameters for this task.
  :param iterables: Hyper parameter iterables, each can be:
      * A dictionary of string key (name) to either a string value (value), a tasks.ParamsItem or a dict
       (hyperparam details). If ``default_section`` is not provided, each dict must contain a "section" field.
      * An iterable of tasks.ParamsItem or dicts (each representing hyperparam details).
        Each dict must contain a "name" field. If ``default_section`` is not provided, each dict must
      also contain a "section" field.
  :param replace: Optional replace strategy, values are:
      * 'all' - provided hyper-params replace all existing hyper-params in task
      * 'section' - only sections present in the provided hyper-params are replaced
      * 'none' (default) - provided hyper-params will be merged into existing task hyper-params (i.e. will be
        added or update existing hyper-params)
  :param default_section: Optional section name to be used when section is not explicitly provided.
  :param force_section: Optional section name to be used for all hyper-params.
docstr_tok: ["Set","hyper-parameters","for","this","task",".",":","param","iterables",":","Hyper","parameter","iterables",",","each","can","be",":","*","A","dictionary","of","string","key","(","name",")","to","either","a","string","value","(","value",")",",","a","tasks.ParamsItem","or","a","dict","(","hyperparam","details",")",".","If","``","default_section","``","is","not","provided",",","each","dict","must","contain","a","``","section","''","field",".","*","An","iterable","of","tasks.ParamsItem","or","dicts","(","each","representing","hyperparam","details",")",".","Each","dict","must","contain","a","``","name","''","field",".","If","``","default_section","``","is","not","provided",",","each","dict","must","also","contain","a","``","section","''","field",".",":","param","replace",":","Optional","replace","strategy",",","values","are",":","*","'all","'","-","provided","hyper-params","replace","all","existing","hyper-params","in","task","*","'section","'","-","only","sections","present","in","the","provided","hyper-params","are","replaced","*","'none","'","(","default",")","-","provided","hyper-params","will","be","merged","into","existing","task","hyper-params","(","i.e",".","will","be","added","or","update","existing","hyper-params",")",":","param","default_section",":","Optional","section","name","to","be","used","when","section","is","not","explicitly","provided",".",":","param","force_section",":","Optional","section","name","to","be","used","for","all","hyper-params","."]
code: def edit_hyper_params(
      self,
      iterables,  # type: Union[Mapping[str, Union[str, dict, None]], Iterable[dict, tasks.ParamsItem]]
      replace=None,  # type: Optional[str]
      default_section=None,  # type: Optional[str]
      force_section=None,  # type: Optional[str]
  ):
      # type: (...) -> bool
      """
      Set hyper-parameters for this task.
      :param iterables: Hyper parameter iterables, each can be:
          * A dictionary of string key (name) to either a string value (value), a tasks.ParamsItem or a dict
           (hyperparam details). If ``default_section`` is not provided, each dict must contain a "section" field.
          * An iterable of tasks.ParamsItem or dicts (each representing hyperparam details).
            Each dict must contain a "name" field. If ``default_section`` is not provided, each dict must
          also contain a "section" field.
      :param replace: Optional replace strategy, values are:
          * 'all' - provided hyper-params replace all existing hyper-params in task
          * 'section' - only sections present in the provided hyper-params are replaced
          * 'none' (default) - provided hyper-params will be merged into existing task hyper-params (i.e. will be
            added or update existing hyper-params)
      :param default_section: Optional section name to be used when section is not explicitly provided.
      :param force_section: Optional section name to be used for all hyper-params.
      """
      if not Session.check_min_api_version("2.9"):
          raise ValueError("Not supported by server")
  
      escape_unsafe = not Session.check_min_api_version("2.11")
  
      if not tasks.ReplaceHyperparamsEnum.has_value(replace):
          replace = None
  
      def make_item(value, name=None):
          if isinstance(value, tasks.ParamsItem):
              a_item = value
          elif isinstance(value, dict):
              a_item = tasks.ParamsItem(
                  **{
                      k: None if v is None else str(v)
                      for k, v in value.items()
                  }
              )
          elif (
              isinstance(value, tuple)
              and len(value) == 2
              and isinstance(value[1], dict)
              and "value" in value[1]
          ):
              a_item = tasks.ParamsItem(
                  name=str(value[0]),
                  **{
                      k: None if v is None else str(v)
                      for k, v in value[1].items()
                  },
              )
          elif isinstance(value, tuple):
              a_item = tasks.ParamsItem(
                  name=str(value[0]), value=str(value[1])
              )
          else:
              a_item = tasks.ParamsItem(value=str(value))
  
          if name:
              a_item.name = str(name)
          if not a_item.name:
              raise ValueError(
                  "Missing hyper-param name for '{}'".format(value)
              )
          section = force_section or a_item.section or default_section
          if not section:
              raise ValueError(
                  "Missing hyper-param section for '{}'".format(value)
              )
          # force string value
          if escape_unsafe:
              a_item.section, a_item.name = self._escape_unsafe_values(
                  section, a_item.name
              )
          else:
              a_item.section = section
          return a_item
  
      props = {}
      if isinstance(iterables, dict):
          props.update(
              {
                  name: make_item(name=name, value=value)
                  for name, value in iterables.items()
              }
          )
      else:
          for i in iterables:
              item = make_item(i)
              props.update({item.name: item})
  
      if self.task.is_offline():
          hyperparams = self.task.data.hyperparams or {}
          hyperparams.setdefault("properties", tasks.SectionParams())
          hyperparams["properties"].update(props)
          self.task._save_data_to_offline_dir(hyperparams=hyperparams)
          return True
  
      res = self.task.session.send(
          tasks.EditHyperParamsRequest(
              task=self.task.task_id,
              hyperparams=props.values(),
              replace_hyperparams=replace,
          ),
      )
      if res.ok():
          self.task.reload()
          return True
  
      return False
  
file_path: clearml/clearml/backend_interface/task/hyperparams.py
imports: from collections import defaultdict
  from typing import Optional, Any, Sequence, Callable, Mapping, Union, Dict, Iterable, Generator
  from ...backend_api import Session
  from ...backend_api.services import tasks
label_desc: Use image node_id 3 for calling the HyperParams obj's underlying member method code with example usage: obj.edit_hyper_params(iterables, replace, default_section, force_section) and returns: False, a_item, True, True