Code formatting

This commit is contained in:
Joel Collins 2020-10-13 15:02:19 +01:00
parent 0234b20ce3
commit 2bfb988460
60 changed files with 392 additions and 396 deletions

View file

@ -1,5 +1,5 @@
from .actions import enabled_root_actions
from .captures import *
from .instrument import *
from .streams import *
from .stage import *
from .streams import *

View file

@ -2,11 +2,11 @@
Top-level representation of enabled actions
"""
from flask import url_for
from . import camera, stage, system
from labthings import current_labthing
from labthings.views import View
from labthings.utilities import description_from_view
from labthings.views import View
from . import camera, stage, system
_actions = {
"capture": {

View file

@ -1,14 +1,13 @@
from openflexure_microscope.api.utilities import get_bool, JsonResponse
from labthings.views import View, ActionView
from labthings import find_component, fields
from openflexure_microscope.utilities import filter_dict
from openflexure_microscope.api.v2.views.captures import CaptureSchema
import logging
import io
from flask import request, abort, url_for, redirect, send_file
import logging
from flask import abort, redirect, request, send_file, url_for
from labthings import fields, find_component
from labthings.views import ActionView, View
from openflexure_microscope.api.utilities import JsonResponse, get_bool
from openflexure_microscope.api.v2.views.captures import CaptureSchema
from openflexure_microscope.utilities import filter_dict
class CaptureAPI(ActionView):
@ -58,11 +57,10 @@ class CaptureAPI(ActionView):
resize=resize,
bayer=args.get("bayer"),
annotations=args.get("annotations"),
tags=args.get("tags")
tags=args.get("tags"),
)
class RAMCaptureAPI(ActionView):
"""
Take a non-persistant image capture.
@ -77,12 +75,8 @@ class RAMCaptureAPI(ActionView):
missing=None, example={"width": 640, "height": 480}
), # TODO: Validate keys
}
responses = {
200: {
"content_type": "image/jpeg"
}
}
responses = {200: {"content_type": "image/jpeg"}}
def post(self, args):
"""

View file

@ -1,12 +1,11 @@
from openflexure_microscope.api.utilities import JsonResponse
from labthings.views import View, ActionView
from labthings import find_component, fields
from openflexure_microscope.utilities import axes_to_array, filter_dict
import logging
from flask import Blueprint, request
from labthings import fields, find_component
from labthings.views import ActionView, View
import logging
from openflexure_microscope.api.utilities import JsonResponse
from openflexure_microscope.utilities import axes_to_array, filter_dict
class MoveStageAPI(ActionView):
@ -65,5 +64,3 @@ class ZeroStageAPI(ActionView):
# TODO: Make schema for microscope state
return microscope.state["stage"]

View file

@ -1,8 +1,9 @@
from labthings.views import View, ActionView
import subprocess
import os
import subprocess
from sys import platform
from labthings.views import ActionView, View
def is_raspberrypi(raise_on_errors=False):
"""

View file

@ -1,15 +1,14 @@
import logging
from flask import abort, request, redirect, url_for, send_file
from openflexure_microscope.api.utilities import get_bool, JsonResponse
from flask import abort, redirect, request, send_file, url_for
from labthings import Schema, fields, find_component
from labthings.views import View, PropertyView
from labthings.utilities import description_from_view
from labthings.marshalling import marshal_with
from labthings.utilities import description_from_view
from labthings.views import PropertyView, View
from marshmallow import pre_dump
from openflexure_microscope.api.utilities import JsonResponse, get_bool
class InstrumentSchema(Schema):
id = fields.UUID()
@ -130,11 +129,7 @@ class CaptureView(View):
class CaptureDownload(View):
tags = ["captures"]
responses = {
200: {
"content_type": "image/jpeg"
}
}
responses = {200: {"content_type": "image/jpeg"}}
def get(self, id, filename):
"""

View file

@ -1,12 +1,12 @@
from openflexure_microscope.api.utilities import JsonResponse
from labthings import find_component
from labthings.views import View, PropertyView
from labthings.utilities import get_by_path, set_by_path, create_from_path
from flask import request, abort
import logging
from flask import abort, request
from labthings import find_component
from labthings.utilities import create_from_path, get_by_path, set_by_path
from labthings.views import PropertyView, View
from openflexure_microscope.api.utilities import JsonResponse
class SettingsProperty(PropertyView):
def get(self):
@ -34,9 +34,7 @@ class SettingsProperty(PropertyView):
class NestedSettingsProperty(View):
tags = ["properties"]
responses = {
404: {"description": "Settings key cannot be found"}
}
responses = {404: {"description": "Settings key cannot be found"}}
def get(self, route):
"""
@ -80,9 +78,7 @@ class StateProperty(PropertyView):
class NestedStateProperty(View):
tags = ["properties"]
responses = {
404: {"description": "Status key cannot be found"}
}
responses = {404: {"description": "Status key cannot be found"}}
def get(self, route):
"""
@ -110,9 +106,7 @@ class ConfigurationProperty(PropertyView):
class NestedConfigurationProperty(View):
tags = ["properties"]
responses = {
404: {"description": "Status key cannot be found"}
}
responses = {404: {"description": "Status key cannot be found"}}
def get(self, route):
"""

View file

@ -1,8 +1,8 @@
from labthings import find_component, fields, schema
from labthings.views import PropertyView
import logging
from labthings import fields, find_component, schema
from labthings.views import PropertyView
class StageTypeProperty(PropertyView):
"""The type of the stage"""

View file

@ -1,21 +1,17 @@
from openflexure_microscope.api.utilities import gen, JsonResponse
from labthings import find_component
from labthings.utilities import get_by_path, set_by_path, create_from_path
from labthings.views import View, PropertyView
from flask import Response
from labthings import find_component
from labthings.utilities import create_from_path, get_by_path, set_by_path
from labthings.views import PropertyView, View
from openflexure_microscope.api.utilities import JsonResponse, gen
class MjpegStream(PropertyView):
"""
Real-time MJPEG stream from the microscope camera
"""
responses = {
200: {
"content_type": "multipart/x-mixed-replace"
}
}
responses = {200: {"content_type": "multipart/x-mixed-replace"}}
def get(self):
"""
@ -44,12 +40,7 @@ class SnapshotStream(PropertyView):
Single JPEG snapshot from the camera stream
"""
responses = {
200: {
"content_type": "image/jpeg",
"description": "Snapshot taken"
}
}
responses = {200: {"content_type": "image/jpeg", "description": "Snapshot taken"}}
def get(self):
"""