Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def apply_close_probe(step: Dict[str, Any], layers: Dict[str, Layer]):
"""
Apply the close probe found in this step. If none is defined, does
nothing.
When the name of the probe is not recognized, fails the call with an
:exc:`UnknownProbe` exception.
"""
probe = get_probe_from_step(step, "close")
if probe is None:
return
if "name" not in probe:
raise InvalidPlan("close probe requires a probe name to apply")
if "layer" not in probe:
raise InvalidPlan("close probe requires the target layer to be set")
if probe:
probe_name = probe.pop("name")
layer = layers.get(probe["layer"])
logger.info(" Applying close probe '{name}'".format(name=probe_name))
apply_probe(probe_name, probe, layer)
def apply_steady_probe(step: Dict[str, Any], layers: Dict[str, Layer]):
"""
Apply the steady probe found in this step. If none is defined, does
nothing.
When the name of the probe is not recognized, fails the call with an
:exc:`UnknownProbe` exception.
"""
probe = get_probe_from_step(step, "steady")
if probe is None:
return
if "name" not in probe:
raise InvalidPlan("steady probe requires a probe name to apply")
if "layer" not in probe:
raise InvalidPlan("steady probe requires the target layer to be set")
if probe:
probe_name = probe.pop("name")
layer = layers.get(probe["layer"])
logger.info(" Applying steady probe '{name}'".format(name=probe_name))
apply_probe(probe_name, probe, layer)