Skip to content

Commit 264474b

Browse files
author
Joel Collins
committed
Ran Isort
1 parent 04af64c commit 264474b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+217
-279
lines changed

examples/nested_thing.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import random
1+
import logging
22
import math
3+
import random
34
import uuid
4-
import logging
55

6-
from labthings.server.quick import create_app
7-
from labthings.server.view import PropertyView
6+
from labthings.server import fields
87
from labthings.server.find import find_component
8+
from labthings.server.quick import create_app
99
from labthings.server.schema import Schema
10-
from labthings.server import fields
11-
10+
from labthings.server.view import PropertyView
1211

1312
"""
1413
Class for our lab component functionality. This could include serial communication,

examples/simple_extensions.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22

33
patch_all()
44

5-
import random
5+
import logging
66
import math
7+
import random
78
import time
8-
import logging
99

10-
from labthings.server.quick import create_app
11-
from labthings.server.view import ActionView, PropertyView
12-
from labthings.server.find import find_component
13-
from labthings.server import fields
1410
from labthings.core.utilities import path_relative_to
15-
11+
from labthings.server import fields
1612
from labthings.server.extensions import BaseExtension
17-
18-
import logging
13+
from labthings.server.find import find_component
14+
from labthings.server.quick import create_app
15+
from labthings.server.view import ActionView, PropertyView
1916

2017
logging.basicConfig(level=logging.DEBUG)
2118

examples/simple_thing.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env python
22
import time
33

4-
from labthings import create_app, semantics, find_component, fields
5-
from labthings.views import ActionView, PropertyView, op
4+
from labthings import create_app, fields, find_component, semantics
65
from labthings.example_components import PretendSpectrometer
76
from labthings.json import encode_json
8-
7+
from labthings.views import ActionView, PropertyView, op
98

109
"""
1110
Class for our lab component functionality. This could include serial communication,

src/labthings/__init__.py

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,21 @@
11
# Main LabThing class
2+
# Submodules
3+
from . import extensions, fields, json, marshalling, semantics, views
4+
# Action threads
5+
from .actions import (ActionKilledException, current_action,
6+
update_action_data, update_action_progress)
7+
# Functions to speed up finding global objects
8+
from .find import (current_labthing, find_component, find_extension,
9+
registered_components, registered_extensions)
210
from .labthing import LabThing
3-
411
# Quick-create app+LabThing function
512
from .quick import create_app
6-
7-
# Suggested WSGI+WebSocket server class
8-
from .wsgi import Server
9-
10-
# Functions to speed up finding global objects
11-
from .find import current_labthing
12-
from .find import registered_extensions
13-
from .find import registered_components
14-
from .find import find_extension
15-
from .find import find_component
16-
17-
# Synchronisation classes
18-
from .sync import StrictLock
19-
from .sync import CompositeLock
20-
from .sync import ClientEvent
21-
22-
# Action threads
23-
from .actions import current_action
24-
from .actions import update_action_progress
25-
from .actions import update_action_data
26-
from .actions import ActionKilledException
27-
2813
# Schema and field
2914
from .schema import Schema
30-
from . import fields
31-
32-
# Submodules
33-
from . import extensions
34-
from . import views
35-
from . import marshalling
36-
from . import semantics
37-
from . import json
15+
# Synchronisation classes
16+
from .sync import ClientEvent, CompositeLock, StrictLock
17+
# Suggested WSGI+WebSocket server class
18+
from .wsgi import Server
3819

3920
__all__ = [
4021
"LabThing",

src/labthings/actions/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
"ActionKilledException",
66
]
77

8-
from .pool import (
9-
Pool,
10-
current_action,
11-
update_action_progress,
12-
update_action_data,
13-
)
14-
from .thread import ActionThread, ActionKilledException
8+
from .pool import (Pool, current_action, update_action_data,
9+
update_action_progress)
10+
from .thread import ActionKilledException, ActionThread
1511

1612
__all__ = [
1713
"Pool",

src/labthings/actions/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
2+
import threading
23
from functools import wraps
34

4-
import threading
55
from .thread import ActionThread
66

77

src/labthings/actions/thread.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import ctypes
2-
from flask import copy_current_request_context, has_request_context
32
import datetime
43
import logging
4+
import threading
55
import traceback
66
import uuid
7-
import threading
7+
8+
from flask import copy_current_request_context, has_request_context
89

910
from ..utilities import TimeoutTracker
1011

src/labthings/apispec/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .plugins import MarshmallowPlugin, FlaskLabThingsPlugin
1+
from .plugins import FlaskLabThingsPlugin, MarshmallowPlugin
22

33
__all__ = ["MarshmallowPlugin", "FlaskLabThingsPlugin"]

src/labthings/apispec/plugins.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
from apispec.ext.marshmallow import MarshmallowPlugin as _MarshmallowPlugin
2-
from apispec.ext.marshmallow import OpenAPIConverter
31
import re
42

5-
from flask.views import http_method_funcs
6-
73
from apispec import BasePlugin
4+
from apispec.ext.marshmallow import MarshmallowPlugin as _MarshmallowPlugin
5+
from apispec.ext.marshmallow import OpenAPIConverter
6+
from flask.views import http_method_funcs
87

9-
from ..utilities import merge, get_docstring, get_summary
10-
from ..views import PropertyView, ActionView
8+
from .. import fields
119
from ..json.schemas import schema_to_json
1210
from ..schema import build_action_schema
13-
from .. import fields
11+
from ..utilities import get_docstring, get_summary, merge
12+
from ..views import ActionView, PropertyView
1413

1514

1615
class ExtendedOpenAPIConverter(OpenAPIConverter):

src/labthings/default_views/actions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from flask import abort
22

3-
from ..views import View
3+
from .. import fields
4+
from ..find import current_labthing
45
from ..marshalling import use_args
56
from ..schema import ActionSchema
6-
from ..find import current_labthing
7-
from .. import fields
7+
from ..views import View
88

99

1010
class ActionQueueView(View):

0 commit comments

Comments
 (0)