Start explicit metadata argument for marshmallow

A side effect of re-locking dependencies is having a newer marshmallow.
This deprecates having `description=` as a keyword, and puts it in a
separate metadata arg instead.

This commit is the start of my search-and-replaceing to update to the new
format.
This commit is contained in:
Richard Bowman 2022-08-09 12:52:57 +01:00
parent 78ef9c531b
commit e22f36b308
14 changed files with 58 additions and 58 deletions

View file

@ -349,7 +349,7 @@ class AutofocusExtension(BaseExtension):
args={
"dz": fields.List(
fields.Int(),
description="An ascending list of relative z positions",
metadata={"description": "An ascending list of relative z positions"},
example=[int(x) for x in np.linspace(-300, 300, 7)],
)
}
@ -410,7 +410,7 @@ class AutofocusExtension(BaseExtension):
@extension_action(
args={
"dz": fields.Int(required=True, description="The relative Z move to make")
"dz": fields.Int(required=True, metadata={"description": "The relative Z move to make"})
}
)
def move_and_measure(
@ -432,9 +432,9 @@ class AutofocusExtension(BaseExtension):
@extension_action(
args={
"dz": fields.Int(
missing=2000,
load_default=2000,
example=2000,
description="Total Z range to search over (in stage steps)",
metadata={"description": "Total Z range to search over (in stage steps)"},
)
}
)
@ -528,14 +528,14 @@ class AutofocusExtension(BaseExtension):
@extension_action(
args={
"dz": fields.Int(
missing=500,
load_default=500,
example=500,
description="Total Z range to move down, then up (in stage steps)",
metadata={"description": "Total Z range to move down, then up (in stage steps)"},
),
"delay": fields.Int(
missing=5,
load_default=5,
example=5,
description="How long to measure sharpness for after the move",
metadata={"description": "How long to measure sharpness for after the move"},
),
}
)
@ -556,23 +556,23 @@ class AutofocusExtension(BaseExtension):
@extension_action(
args={
"dz": fields.Int(
missing=2000,
load_default=2000,
example=2000,
description="Total Z range to search over (in stage steps)",
metadata={"description": "Total Z range to search over (in stage steps)"},
),
"target_z": fields.Int(
missing=0,
load_default=0,
example=-100,
description="Target finishing position, relative to the focus.",
metadata={"description": "Target finishing position, relative to the focus."},
),
"initial_move_up": fields.Bool(
missing=True,
description="Set to Flase to disable the initial move upwards",
load_default=True,
metadata={"description": "Set to Flase to disable the initial move upwards"},
),
"backlash": fields.Int(
missing=25,
load_default=25,
minimum=0,
description="Distance to undershoot, before correction move.",
metadata={"description": "Distance to undershoot, before correction move."},
),
}
)

View file

@ -298,10 +298,10 @@ class CalibrateXYView(ActionView):
class MoveInImageCoordinatesView(ActionView):
args = {
"x": fields.Float(
description="The number of pixels to move in X", required=True, example=100
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
),
"y": fields.Float(
description="The number of pixels to move in Y", required=True, example=100
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
),
}
@ -316,10 +316,10 @@ class MoveInImageCoordinatesView(ActionView):
class ClosedLoopMoveInImageCoordinatesView(ActionView):
args = {
"x": fields.Float(
description="The number of pixels to move in X", required=True, example=100
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
),
"y": fields.Float(
description="The number of pixels to move in Y", required=True, example=100
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
),
}
@ -336,13 +336,13 @@ class ClosedLoopMoveInImageCoordinatesView(ActionView):
class TestClosedLoopSpiralScanView(ActionView):
args = {
"x_step": fields.Float(
description="The number of pixels to move in X", required=True, example=100
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
),
"y_step": fields.Float(
description="The number of pixels to move in Y", required=True, example=100
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
),
"N": fields.Int(
description="The number of rings in the spiral scan",
metadata={"description": "The number of rings in the spiral scan"},
required=True,
example=3,
),

View file

@ -172,20 +172,20 @@ class DeleteLSTView(ActionView):
class AutoExposureFromRawView(ActionView):
args = {
"target_white_level": fields.Int(
missing=700,
load_default=700,
example=700,
description=(
"The pixel value (10-bit format) that we aim for when adjusting shutter/gain."
),
),
"max_iterations": fields.Int(
missing=20,
load_default=20,
description=(
"The number of adjustments to the camera's settings to make before giving up."
),
),
"tolerance": fields.Float(
missing=0.05,
load_default=0.05,
example=0.05,
description=(
"We stop adjusting when we get within this fraction of the target "
@ -193,7 +193,7 @@ class AutoExposureFromRawView(ActionView):
),
),
"percentile": fields.Float(
missing=99.9,
load_default=99.9,
example=99.9,
description=(
"A float between 0 and 100 setting the centile to use "
@ -212,7 +212,7 @@ class AutoExposureFromRawView(ActionView):
class AutoWhiteBalanceFromRawView(ActionView):
args = {
"percentile": fields.Float(
missing=99.9,
load_default=99.9,
example=99.9,
description=(
"A float between 0 and 100 setting the centile to use "
@ -232,7 +232,7 @@ class GetRawChannelPercentilesView(ActionView):
args = {
"percentile": fields.Float(
example=99.9,
description="A float between 0 and 100 setting the centile to calculate",
metadata={"description": "A float between 0 and 100 setting the centile to calculate"},
)
}
schema = fields.List(fields.Integer)

View file

@ -578,19 +578,19 @@ class ScanExtension(BaseExtension):
class TileScanArgs(FullCaptureArgs):
namemode = fields.String(missing="coordinates", example="coordinates")
namemode = fields.String(load_default="coordinates", example="coordinates")
grid = fields.List(
fields.Integer(validate=marshmallow.validate.Range(min=1)),
missing=[3, 3, 3],
load_default=[3, 3, 3],
example=[3, 3, 3],
)
style = fields.String(missing="raster")
autofocus_dz = fields.Integer(missing=50)
fast_autofocus = fields.Boolean(missing=False)
style = fields.String(load_default="raster")
autofocus_dz = fields.Integer(load_default=50)
fast_autofocus = fields.Boolean(load_default=False)
stride_size = fields.List(
fields.Integer, missing=[2000, 1500, 100], example=[2000, 1500, 100]
fields.Integer, load_default=[2000, 1500, 100], example=[2000, 1500, 100]
)
detect_empty_fields_and_skip_autofocus = fields.Boolean(missing=False)
detect_empty_fields_and_skip_autofocus = fields.Boolean(load_default=False)
class TileScanAPI(ActionView):