(
    pruner_class: Optional[str],
    pruner_keys: Optional[str],
    pruner_values: Optional[str],
)
return pruner(**pruner_params)
Restore a pruner which is defined in `create_study`.

    `AllenNLPPruningCallback` is launched as a sub-process of
    a main script that defines search spaces.
    An instance cannot be passed directly from the parent process
    to its sub-process. For this reason, we set information about
    pruner as environment variables and load them and
    re-create the same pruner in `AllenNLPPruningCallback`.
Restore a pruner which is defined in `create_study`.
Restore a pruner which is defined in create_study .
def _create_pruner(
    pruner_class: Optional[str],
    pruner_keys: Optional[str],
    pruner_values: Optional[str],
) -> Optional[pruners.BasePruner]:

    """Restore a pruner which is defined in `create_study`.

    `AllenNLPPruningCallback` is launched as a sub-process of
    a main script that defines search spaces.
    An instance cannot be passed directly from the parent process
    to its sub-process. For this reason, we set information about
    pruner as environment variables and load them and
    re-create the same pruner in `AllenNLPPruningCallback`.

    """
    if pruner_class is None:
        return None

    pruner_params = _construct_pruner_kwargs(pruner_keys, pruner_values)
    pruner = getattr(pruners, pruner_class, None)

    if pruner is None:
        return None

    return pruner(**pruner_params)
def _create_pruner ( pruner_class : Optional [ str ] , pruner_keys : Optional [ str ] , pruner_values : Optional [ str ] , ) -> Optional [ pruners . BasePruner ] : if pruner_class is None : return None pruner_params = _construct_pruner_kwargs ( pruner_keys , pruner_values ) pruner = getattr ( pruners , pruner_class , None ) if pruner is None : return None return pruner ( * * pruner_params )