def _stash_exp(self, *args, params: Optional[dict]=None, detach_rev: Optional[str]=None, baseline_rev: Optional[str]=None, branch: Optional[str]=None, name: Optional[str]=None, **kwargs):
    "Stash changes from the workspace as an experiment.\n\n        Args:\n            params: Optional dictionary of parameter values to be used.\n                Values take priority over any parameters specified in the\n                user's workspace.\n            baseline_rev: Optional baseline rev for this experiment, defaults\n                to the current SCM rev.\n            branch: Optional experiment branch name. If specified, the\n                experiment will be added to `branch` instead of creating\n                a new branch.\n            name: Optional experiment name. If specified this will be used as\n                the human-readable name in the experiment branch ref. Has no\n                effect of branch is specified.\n        "
    with self.scm.stash_workspace(include_untracked=(detach_rev or branch)) as workspace:
        if ((not (branch or detach_rev)) and workspace):
            self.stash.apply(workspace)
            self._prune_lockfiles()
        if detach_rev:
            head = detach_rev
        elif branch:
            head = branch
        else:
            head = None
        with self.scm.detach_head(head) as rev:
            if (baseline_rev is None):
                baseline_rev = rev
            if params:
                self._update_params(params)
            self._pack_args(*args, **kwargs)
            msg = self._stash_msg(rev, baseline_rev=baseline_rev, branch=branch, name=name)
            stash_rev = self.stash.push(message=msg)
        logger.debug("Stashed experiment '%s' with baseline '%s' for future execution.", stash_rev[:7], baseline_rev[:7])
        self.scm.reset(hard=True)
    return stash_rev
Stash changes from the workspace as an experiment.

Args:
    params: Optional dictionary of parameter values to be used.
        Values take priority over any parameters specified in the
        user's workspace.
    baseline_rev: Optional baseline rev for this experiment, defaults
        to the current SCM rev.
    branch: Optional experiment branch name. If specified, the
        experiment will be added to `branch` instead of creating
        a new branch.
    name: Optional experiment name. If specified this will be used as
        the human-readable name in the experiment branch ref. Has no
        effect of branch is specified.
def _stash_exp(self, *args, params: Optional[dict]=None, detach_rev: Optional[str]=None, baseline_rev: Optional[str]=None, branch: Optional[str]=None, name: Optional[str]=None, **kwargs):
    "Stash changes from the workspace as an experiment.\n\n        Args:\n            params: Optional dictionary of parameter values to be used.\n                Values take priority over any parameters specified in the\n                user's workspace.\n            baseline_rev: Optional baseline rev for this experiment, defaults\n                to the current SCM rev.\n            branch: Optional experiment branch name. If specified, the\n                experiment will be added to `branch` instead of creating\n                a new branch.\n            name: Optional experiment name. If specified this will be used as\n                the human-readable name in the experiment branch ref. Has no\n                effect of branch is specified.\n        "
    with self.scm.stash_workspace(include_untracked=(detach_rev or branch)) as workspace:
        if ((not (branch or detach_rev)) and workspace):
            self.stash.apply(workspace)
            self._prune_lockfiles()
        if detach_rev:
            head = detach_rev
        elif branch:
            head = branch
        else:
            head = None
        with self.scm.detach_head(head) as rev:
            if (baseline_rev is None):
                baseline_rev = rev
            if params:
                self._update_params(params)
            self._pack_args(*args, **kwargs)
            msg = self._stash_msg(rev, baseline_rev=baseline_rev, branch=branch, name=name)
            stash_rev = self.stash.push(message=msg)
        logger.debug("Stashed experiment '%s' with baseline '%s' for future execution.", stash_rev[:7], baseline_rev[:7])
        self.scm.reset(hard=True)
    return stash_rev