Format fixes from black
This commit is contained in:
parent
9dbb083ee7
commit
106b50d333
13 changed files with 101 additions and 32 deletions
|
|
@ -49,7 +49,11 @@ class ExampleRenameView(View):
|
|||
# Format our returned object using MicroscopeIdentifySchema
|
||||
schema = MicroscopeIdentifySchema()
|
||||
# Expect a request parameter called "name", which is a string. Pass to argument "args".
|
||||
args = {"name": fields.String(required=True, metadata={"example": "My Example Microscope"})}
|
||||
args = {
|
||||
"name": fields.String(
|
||||
required=True, metadata={"example": "My Example Microscope"}
|
||||
)
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
# Look for our "name" parameter in the request arguments
|
||||
|
|
|
|||
|
|
@ -53,7 +53,11 @@ class ExampleIdentifyView(PropertyView):
|
|||
# We can use a single schema as the input and output will be formatted identically
|
||||
# Eg. We always expect a "name" string argument, and always return a "name" string attribute
|
||||
class ExampleRenameView(PropertyView):
|
||||
schema = {"name": fields.String(required=True, metadata={"example": "My Example Microscope"})}
|
||||
schema = {
|
||||
"name": fields.String(
|
||||
required=True, metadata={"example": "My Example Microscope"}
|
||||
)
|
||||
}
|
||||
|
||||
def get(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -56,7 +56,11 @@ class ExampleIdentifyView(PropertyView):
|
|||
# We can use a single schema as the input and output will be formatted identically
|
||||
# Eg. We always expect a "name" string argument, and always return a "name" string attribute
|
||||
class ExampleRenameView(PropertyView):
|
||||
schema = {"name": fields.String(required=True, metadata={"example": "My Example Microscope"})}
|
||||
schema = {
|
||||
"name": fields.String(
|
||||
required=True, metadata={"example": "My Example Microscope"}
|
||||
)
|
||||
}
|
||||
|
||||
def get(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ class TimelapseAPIView(ActionView):
|
|||
required=True, metadata={"example": 5, "description": "Number of images"}
|
||||
),
|
||||
"t_between": fields.Number(
|
||||
load_default=1, metadata={"example": 1, "description": "Time (seconds) between images"}
|
||||
load_default=1,
|
||||
metadata={"example": 1, "description": "Time (seconds) between images"},
|
||||
),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ class TimelapseAPIView(ActionView):
|
|||
required=True, metadata={"example": 5, "description": "Number of images"}
|
||||
),
|
||||
"t_between": fields.Number(
|
||||
load_default=1, metadata={"example": 1, "description": "Time (seconds) between images"}
|
||||
load_default=1,
|
||||
metadata={"example": 1, "description": "Time (seconds) between images"},
|
||||
),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ class AutofocusExtension(BaseExtension):
|
|||
metadata={
|
||||
"description": "An ascending list of relative z positions",
|
||||
"example": [int(x) for x in np.linspace(-300, 300, 7)],
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
@ -412,7 +412,9 @@ class AutofocusExtension(BaseExtension):
|
|||
|
||||
@extension_action(
|
||||
args={
|
||||
"dz": fields.Int(required=True, metadata={"description": "The relative Z move to make"})
|
||||
"dz": fields.Int(
|
||||
required=True, metadata={"description": "The relative Z move to make"}
|
||||
)
|
||||
}
|
||||
)
|
||||
def move_and_measure(
|
||||
|
|
@ -579,7 +581,9 @@ class AutofocusExtension(BaseExtension):
|
|||
),
|
||||
"initial_move_up": fields.Bool(
|
||||
load_default=True,
|
||||
metadata={"description": "Set to Flase to disable the initial move upwards"},
|
||||
metadata={
|
||||
"description": "Set to Flase to disable the initial move upwards"
|
||||
},
|
||||
),
|
||||
"backlash": fields.Int(
|
||||
load_default=25,
|
||||
|
|
|
|||
|
|
@ -279,7 +279,11 @@ class CSMExtension(BaseExtension):
|
|||
|
||||
|
||||
class Calibrate1DView(ActionView):
|
||||
args = {"direction": fields.List(fields.Float(), required=True, metadata={"example": [1, 0, 0]})}
|
||||
args = {
|
||||
"direction": fields.List(
|
||||
fields.Float(), required=True, metadata={"example": [1, 0, 0]}
|
||||
)
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
"""Calibrate one axis of the microscope stage against the camera."""
|
||||
|
|
@ -298,10 +302,18 @@ class CalibrateXYView(ActionView):
|
|||
class MoveInImageCoordinatesView(ActionView):
|
||||
args = {
|
||||
"x": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in X",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
"y": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in Y",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
||||
|
|
@ -316,10 +328,18 @@ class MoveInImageCoordinatesView(ActionView):
|
|||
class ClosedLoopMoveInImageCoordinatesView(ActionView):
|
||||
args = {
|
||||
"x": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in X",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
"y": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in Y",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
||||
|
|
@ -336,13 +356,24 @@ class ClosedLoopMoveInImageCoordinatesView(ActionView):
|
|||
class TestClosedLoopSpiralScanView(ActionView):
|
||||
args = {
|
||||
"x_step": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in X",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
"y_step": fields.Float(
|
||||
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
|
||||
metadata={
|
||||
"description": "The number of pixels to move in Y",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
"N": fields.Int(
|
||||
metadata={"description": "The number of rings in the spiral scan", "example": 100,},
|
||||
metadata={
|
||||
"description": "The number of rings in the spiral scan",
|
||||
"example": 100,
|
||||
},
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,10 +195,11 @@ class AutoExposureFromRawView(ActionView):
|
|||
},
|
||||
),
|
||||
"max_iterations": fields.Int(
|
||||
load_default=20,metadata={
|
||||
load_default=20,
|
||||
metadata={
|
||||
"description": (
|
||||
"The number of adjustments to the camera's settings to make before giving up."
|
||||
),
|
||||
)
|
||||
},
|
||||
),
|
||||
"tolerance": fields.Float(
|
||||
|
|
@ -220,9 +221,7 @@ class AutoExposureFromRawView(ActionView):
|
|||
|
||||
|
||||
class AutoWhiteBalanceFromRawView(ActionView):
|
||||
args = {
|
||||
"percentile": percentile_field,
|
||||
}
|
||||
args = {"percentile": percentile_field}
|
||||
|
||||
def post(self, args):
|
||||
with find_picamera() as (picamera, _, _):
|
||||
|
|
@ -235,7 +234,7 @@ class GetRawChannelPercentilesView(ActionView):
|
|||
metadata={
|
||||
"description": "A float between 0 and 100 setting the centile to calculate",
|
||||
"example": 99.9,
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
schema = fields.List(fields.Integer)
|
||||
|
|
|
|||
|
|
@ -578,7 +578,9 @@ class ScanExtension(BaseExtension):
|
|||
|
||||
|
||||
class TileScanArgs(FullCaptureArgs):
|
||||
namemode = fields.String(load_default="coordinates", metadata={"example": "coordinates"})
|
||||
namemode = fields.String(
|
||||
load_default="coordinates", metadata={"example": "coordinates"}
|
||||
)
|
||||
grid = fields.List(
|
||||
fields.Integer(validate=marshmallow.validate.Range(min=1)),
|
||||
load_default=[3, 3, 3],
|
||||
|
|
@ -588,7 +590,9 @@ class TileScanArgs(FullCaptureArgs):
|
|||
autofocus_dz = fields.Integer(load_default=50)
|
||||
fast_autofocus = fields.Boolean(load_default=False)
|
||||
stride_size = fields.List(
|
||||
fields.Integer, load_default=[2000, 1500, 100], metadata={"example":[2000, 1500, 100]}
|
||||
fields.Integer,
|
||||
load_default=[2000, 1500, 100],
|
||||
metadata={"example": [2000, 1500, 100]},
|
||||
)
|
||||
detect_empty_fields_and_skip_autofocus = fields.Boolean(load_default=False)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ class RaiseException(ActionView):
|
|||
|
||||
class SleepFor(ActionView):
|
||||
schema = {"TimeAsleep": fields.Float()}
|
||||
args = {"time": fields.Float(metadata={"description": "Time to sleep, in seconds", "example": 0.5})}
|
||||
args = {
|
||||
"time": fields.Float(
|
||||
metadata={"description": "Time to sleep, in seconds", "example": 0.5}
|
||||
)
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
sleep_time: int = args.get("time", 0)
|
||||
|
|
|
|||
|
|
@ -10,22 +10,27 @@ from openflexure_microscope.api.v2.views.captures import CaptureSchema
|
|||
|
||||
|
||||
class CaptureResizeSchema(Schema):
|
||||
width = fields.Integer(metadata={"example":640}, required=True)
|
||||
width = fields.Integer(metadata={"example": 640}, required=True)
|
||||
height = fields.Integer(metadata={"example": 480}, required=True)
|
||||
|
||||
|
||||
class BasicCaptureArgs(Schema):
|
||||
use_video_port = fields.Boolean(load_default=False)
|
||||
bayer = fields.Boolean(
|
||||
load_default=False, metadata={"description": "Include raw bayer data in capture"}
|
||||
load_default=False,
|
||||
metadata={"description": "Include raw bayer data in capture"},
|
||||
)
|
||||
resize = fields.Nested(CaptureResizeSchema(), required=False)
|
||||
|
||||
|
||||
class FullCaptureArgs(BasicCaptureArgs):
|
||||
filename = fields.String(metadata={"example": "MyFileName"})
|
||||
temporary = fields.Boolean(load_default=False, metadata={"description": "Delete capture on shutdown"})
|
||||
annotations = fields.Dict(load_default={}, metadata={"example": {"Client": "SwaggerUI"}})
|
||||
temporary = fields.Boolean(
|
||||
load_default=False, metadata={"description": "Delete capture on shutdown"}
|
||||
)
|
||||
annotations = fields.Dict(
|
||||
load_default={}, metadata={"example": {"Client": "SwaggerUI"}}
|
||||
)
|
||||
tags = fields.List(fields.String, load_default=[], metadata={"example": ["docs"]})
|
||||
|
||||
|
||||
|
|
@ -113,7 +118,11 @@ class GPUPreviewStartAPI(ActionView):
|
|||
in the format ``[x, y, width, height]``.
|
||||
"""
|
||||
|
||||
args = {"window": fields.List(fields.Integer, load_default=[], metadata={"example": [0, 0, 640, 480]})}
|
||||
args = {
|
||||
"window": fields.List(
|
||||
fields.Integer, load_default=[], metadata={"example": [0, 0, 640, 480]}
|
||||
)
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ from labthings.views import ActionView
|
|||
class MoveStageAPI(ActionView):
|
||||
args = {
|
||||
"absolute": fields.Boolean(
|
||||
load_default=False, metadata={"description": "Move to an absolute position", "example": False}
|
||||
load_default=False,
|
||||
metadata={"description": "Move to an absolute position", "example": False},
|
||||
),
|
||||
"x": fields.Int(load_default=None, metadata={"example": 100}, allow_none=False),
|
||||
"y": fields.Int(load_default=None, metadata={"example": 100}, allow_none=False),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ class StageTypeProperty(PropertyView):
|
|||
schema = fields.String(
|
||||
load_default=None,
|
||||
validate=validate.OneOf(["SangaStage", "SangaDeltaStage"]),
|
||||
metadata={"description": "The translation stage geometry", "example": "SangaStage",},
|
||||
metadata={
|
||||
"description": "The translation stage geometry",
|
||||
"example": "SangaStage",
|
||||
},
|
||||
allow_none=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue