def get_default_parameters( self, ) -> tp.Tuple[tp.Optional[types.Parameters], types.ParameterCollection]: param_tree = self._get_parameters(defaults=True) collections = utils.split_into_collections(param_tree) parameters = collections.pop("parameters", None) return parameters, collections
def get_parameters_internal( self, defaults: bool = False ) -> tp.Tuple[tp.Optional[types.Parameters], types.ParameterCollection]: param_tree = self._get_parameters(defaults=defaults) collections = utils.split_into_collections(param_tree) parameters = collections.pop("parameters", None) return parameters, collections
def set_default_parameters( self, parameters: tp.Optional[types.Parameters], collections: types.ParameterCollection, ): if parameters is not None: collections = collections.copy() collections["parameters"] = parameters old_colletions = self._get_parameters(defaults=True) old_colletions = utils.split_into_collections(old_colletions) try: self._set_parameters_internal( collections=collections, set_default_params=True, ) except: self._set_parameters_internal( collections=old_colletions, set_default_params=True, ) raise
def get_parameters_internal(self, defaults: bool = False ) -> types.ParameterCollection: parameters = self._get_parameters(defaults=defaults) return utils.split_into_collections(parameters)
def get_default_parameters(self) -> types.ParameterCollection: parameters = self._get_parameters(defaults=True) return utils.split_into_collections(parameters)