Skip to content

Commit e27e904

Browse files
committed
formatting fixes
1 parent 7ba0950 commit e27e904

File tree

9 files changed

+30
-25
lines changed

9 files changed

+30
-25
lines changed

src/labthings/apispec/plugins.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import re
2-
3-
from apispec import BasePlugin
42
from copy import deepcopy
53

6-
from apispec.ext.marshmallow import (
7-
MarshmallowPlugin as _MarshmallowPlugin,
8-
)
4+
from apispec import BasePlugin
5+
from apispec.ext.marshmallow import MarshmallowPlugin as _MarshmallowPlugin
96
from apispec.ext.marshmallow import OpenAPIConverter
107
from flask.views import http_method_funcs
118

129
from .. import fields
1310
from ..json.schemas import schema_to_json
14-
from ..schema import EventSchema, ActionSchema
11+
from ..schema import ActionSchema, EventSchema
1512
from ..utilities import get_docstring, get_summary, merge
16-
from .utilities import ensure_schema, get_marshamallow_plugin
1713
from ..views import ActionView, EventView, PropertyView, View
14+
from .utilities import ensure_schema, get_marshamallow_plugin
1815

1916

2017
class ExtendedOpenAPIConverter(OpenAPIConverter):
@@ -102,11 +99,17 @@ def spec_for_interaction(cls, interaction):
10299
"parameters": [],
103100
}
104101
# Allow custom responses from the class, overridden by the method
105-
d[method]["responses"].update(deepcopy(getattr(interaction, "responses", {})))
102+
d[method]["responses"].update(
103+
deepcopy(getattr(interaction, "responses", {}))
104+
)
106105
d[method]["responses"].update(deepcopy(getattr(prop, "responses", {})))
107106
# Allow custom parameters from the class & method
108-
d[method]["parameters"].extend(deepcopy(getattr(interaction, "parameters", {})))
109-
d[method]["parameters"].extend(deepcopy(getattr(prop, "parameters", {})))
107+
d[method]["parameters"].extend(
108+
deepcopy(getattr(interaction, "parameters", {}))
109+
)
110+
d[method]["parameters"].extend(
111+
deepcopy(getattr(prop, "parameters", {}))
112+
)
110113
return d
111114

112115
@classmethod

src/labthings/apispec/utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from typing import Dict, Union
2+
13
from apispec.ext.marshmallow import MarshmallowPlugin
24
from apispec.ext.marshmallow.field_converter import FieldConverterMixin
35
from marshmallow import Schema
4-
from typing import Dict, Union
6+
57
from .. import fields
68

79

src/labthings/default_views/docs/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import Blueprint, make_response, render_template, Response
1+
from flask import Blueprint, Response, make_response, render_template
22

33
from ...find import current_labthing
44
from ...views import View
@@ -18,9 +18,10 @@ def get(self):
1818
"""OpenAPI v3 documentation"""
1919
return current_labthing().spec.to_dict()
2020

21+
2122
class APISpecYAMLView(View):
2223
"""OpenAPI v3 documentation
23-
24+
2425
A YAML document containing an API description in OpenAPI format
2526
"""
2627

@@ -34,6 +35,7 @@ class APISpecYAMLView(View):
3435
def get(self):
3536
return Response(current_labthing().spec.to_yaml(), mimetype="text/yaml")
3637

38+
3739
class SwaggerUIView(View):
3840
"""Swagger UI documentation"""
3941

@@ -49,7 +51,9 @@ def get(self):
4951
docs_blueprint.add_url_rule("/swagger", view_func=APISpecView.as_view("swagger_json"))
5052
docs_blueprint.add_url_rule("/openapi", endpoint="swagger_json")
5153
docs_blueprint.add_url_rule("/openapi.json", endpoint="swagger_json")
52-
docs_blueprint.add_url_rule("/openapi.yaml", view_func=APISpecYAMLView.as_view("openapi_yaml"))
54+
docs_blueprint.add_url_rule(
55+
"/openapi.yaml", view_func=APISpecYAMLView.as_view("openapi_yaml")
56+
)
5357
docs_blueprint.add_url_rule(
5458
"/swagger-ui", view_func=SwaggerUIView.as_view("swagger_ui")
5559
)

src/labthings/extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import glob
2+
import inspect
23
import logging
34
import os
45
import sys
56
import traceback
6-
import inspect
77
from importlib import util
88
from typing import Callable, Dict, List, Union
99

src/labthings/labthing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from apispec import APISpec
88
from apispec_webframeworks.flask import FlaskPlugin
9-
from flask import url_for, Flask
9+
from flask import Flask, url_for
1010

1111
from .actions.pool import Pool
1212
from .apispec import FlaskLabThingsPlugin, MarshmallowPlugin

src/labthings/marshalling/args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from functools import update_wrapper, wraps
3-
from typing import Callable, Union, Mapping
3+
from typing import Callable, Mapping, Union
44

55
from flask import abort, request
66
from marshmallow.exceptions import ValidationError

src/labthings/marshalling/marshalling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import Mapping
22
from functools import wraps
3-
from typing import Callable, Dict, Tuple, Union, Optional
3+
from typing import Callable, Dict, Optional, Tuple, Union
44

55
from marshmallow import Schema as _Schema
66
from werkzeug.wrappers import Response as ResponseBase

src/labthings/views/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import datetime
22
from collections import OrderedDict
33
from typing import Callable, Dict, List, Optional, Set, cast
4-
from typing_extensions import Protocol
54

65
from flask import request
76
from flask.views import MethodView
7+
from typing_extensions import Protocol
88
from werkzeug.wrappers import Response as ResponseBase
99

1010
from ..actions.pool import Pool
1111
from ..deque import Deque
1212
from ..find import current_labthing, find_extension
1313
from ..marshalling import marshal_with, use_args
1414
from ..representations import DEFAULT_REPRESENTATIONS
15-
from ..schema import (
16-
ActionSchema,
17-
EventSchema,
18-
FuzzySchemaType,
19-
build_action_schema,
20-
)
15+
from ..schema import ActionSchema, EventSchema, FuzzySchemaType, build_action_schema
2116
from ..utilities import unpack
2217

2318
__all__ = ["MethodView", "View", "ActionView", "PropertyView", "op", "builder"]

src/labthings/views/builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Type
55

66
from flask import abort, send_file
7+
78
from . import View, described_operation
89

910

0 commit comments

Comments
 (0)