Improved flake8 results
This commit is contained in:
parent
fb606b189d
commit
3b9ef670fe
24 changed files with 256 additions and 126 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from openflexure_microscope.api.utilities import gen, get_bool, JsonPayload
|
||||
from openflexure_microscope.api.utilities import get_bool, JsonPayload
|
||||
from openflexure_microscope.api.v1.views import MicroscopeView
|
||||
from openflexure_microscope.utilities import filter_dict
|
||||
|
||||
|
|
@ -201,7 +201,10 @@ class CaptureAPI(MicroscopeView):
|
|||
|
||||
# If available, also add download link
|
||||
if capture_metadata['available']:
|
||||
uri_dict['uri']['download'] = '{}download/{}'.format(url_for('.capture', capture_id=capture_obj.id), capture_obj.filename)
|
||||
uri_dict['uri']['download'] = '{}download/{}'.format(
|
||||
url_for('.capture', capture_id=capture_obj.id),
|
||||
capture_obj.filename
|
||||
)
|
||||
|
||||
capture_metadata.update(uri_dict)
|
||||
|
||||
|
|
@ -297,7 +300,12 @@ class DownloadRedirectAPI(MicroscopeView):
|
|||
|
||||
thumbnail = get_bool(request.args.get('thumbnail'))
|
||||
|
||||
return redirect(url_for('.capture_download', capture_id=capture_id, filename=capture_obj.filename, thumbnail=thumbnail), code=307)
|
||||
return redirect(url_for(
|
||||
'.capture_download',
|
||||
capture_id=capture_id,
|
||||
filename=capture_obj.filename,
|
||||
thumbnail=thumbnail
|
||||
), code=307)
|
||||
|
||||
|
||||
class DownloadAPI(MicroscopeView):
|
||||
|
|
@ -312,7 +320,12 @@ class DownloadAPI(MicroscopeView):
|
|||
|
||||
# If no filename is specified, redirect to the capture's currently set filename
|
||||
if not filename:
|
||||
return redirect(url_for('capture_download', capture_id=capture_id, filename=capture_obj.filename, thumbnail=thumbnail), code=307)
|
||||
return redirect(url_for(
|
||||
'capture_download',
|
||||
capture_id=capture_id,
|
||||
filename=capture_obj.filename,
|
||||
thumbnail=thumbnail
|
||||
), code=307)
|
||||
|
||||
# Download the image data using the requested filename
|
||||
if thumbnail:
|
||||
|
|
@ -360,7 +373,11 @@ class MetadataRedirectAPI(MicroscopeView):
|
|||
if not capture_obj or not capture_obj.state['available']:
|
||||
return abort(404) # 404 Not Found
|
||||
|
||||
return redirect(url_for('.metadata_download', capture_id=capture_id, filename=capture_obj.metadataname), code=307)
|
||||
return redirect(url_for(
|
||||
'.metadata_download',
|
||||
capture_id=capture_id,
|
||||
filename=capture_obj.metadataname
|
||||
), code=307)
|
||||
|
||||
|
||||
class MetadataAPI(MicroscopeView):
|
||||
|
|
@ -373,7 +390,11 @@ class MetadataAPI(MicroscopeView):
|
|||
|
||||
# If no filename is specified, redirect to the capture's currently set filename
|
||||
if not filename:
|
||||
return redirect(url_for('capture_download', capture_id=capture_id, filename=capture_obj.metadataname), code=307)
|
||||
return redirect(url_for(
|
||||
'capture_download',
|
||||
capture_id=capture_id,
|
||||
filename=capture_obj.metadataname
|
||||
), code=307)
|
||||
|
||||
# Download the metadata using the requested filename
|
||||
data = capture_obj.yaml
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ZoomAPI(MicroscopeView):
|
|||
Accept: application/json
|
||||
|
||||
{
|
||||
"zoom_value": 2.5,
|
||||
"zoom_value": 2.5,
|
||||
}
|
||||
|
||||
:>header Accept: application/json
|
||||
|
|
@ -83,8 +83,8 @@ class OverlayAPI(MicroscopeView):
|
|||
Accept: application/json
|
||||
|
||||
{
|
||||
"text": "2019/01/15 14:48",
|
||||
"size": 50
|
||||
"text": "2019/01/15 14:48",
|
||||
"size": 50
|
||||
}
|
||||
|
||||
:>header Accept: application/json
|
||||
|
|
@ -92,7 +92,7 @@ class OverlayAPI(MicroscopeView):
|
|||
:<header Content-Type: application/json
|
||||
:status 200: preview started/stopped
|
||||
"""
|
||||
|
||||
|
||||
payload = JsonPayload(request)
|
||||
text = payload.param('text', default="", convert=str)
|
||||
size = payload.param('size', default=50, convert=int)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from openflexure_microscope.api.v1.views import MicroscopeView
|
|||
from flask import jsonify, request
|
||||
import logging
|
||||
|
||||
|
||||
class GPUPreviewAPI(MicroscopeView):
|
||||
|
||||
def post(self, operation):
|
||||
|
|
@ -45,8 +46,8 @@ class GPUPreviewAPI(MicroscopeView):
|
|||
fullscreen = True
|
||||
window = None
|
||||
else:
|
||||
fullscreen = False
|
||||
window = [int(w) for w in window]
|
||||
fullscreen = False
|
||||
window = [int(w) for w in window]
|
||||
|
||||
self.microscope.camera.start_preview(fullscreen=fullscreen, window=window)
|
||||
elif operation == "stop":
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from openflexure_microscope.api.utilities import gen, JsonPayload
|
||||
from openflexure_microscope.api.utilities import JsonPayload
|
||||
from openflexure_microscope.api.v1.views import MicroscopeView
|
||||
from openflexure_microscope.utilities import axes_to_array, filter_dict
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class TaskAPI(MicroscopeView):
|
|||
"""
|
||||
|
||||
success = self.microscope.task.delete(task_id)
|
||||
|
||||
|
||||
if success:
|
||||
data = {
|
||||
'status': 'success',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue