Skip to content

Commit

Permalink
isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Nov 25, 2020
1 parent 9bcaf3c commit 5f666ce
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/labthings/actions/pool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import threading

from typing import Dict

from ..deque import Deque
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/actions/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import threading
import traceback
import uuid
from typing import Any, Callable, Dict, Iterable, Optional

from flask import copy_current_request_context, has_request_context, request
from werkzeug.exceptions import BadRequest

from typing import Optional, Iterable, Dict, Any, Callable

from ..deque import LockableDeque
from ..utilities import TimeoutTracker

Expand Down
4 changes: 3 additions & 1 deletion src/labthings/apispec/plugins.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import re

from apispec import BasePlugin # type: ignore
from apispec.ext.marshmallow import MarshmallowPlugin as _MarshmallowPlugin # type: ignore
from apispec.ext.marshmallow import (
MarshmallowPlugin as _MarshmallowPlugin, # type: ignore
)
from apispec.ext.marshmallow import OpenAPIConverter
from flask.views import http_method_funcs

Expand Down
3 changes: 1 addition & 2 deletions src/labthings/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import sys
import traceback
from importlib import util
from typing import Callable, Dict, List, Union

from flask import url_for

from typing import List, Dict, Callable, Union

from .utilities import camel_to_snake, get_docstring, snake_to_spine
from .views.builder import static_from

Expand Down
4 changes: 2 additions & 2 deletions src/labthings/json/schemas.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import re
from typing import Any, Dict, List, Optional, Union

import werkzeug.routing
from marshmallow import Schema, fields

from typing import Dict, List, Union, Optional, Any

from .marshmallow_jsonschema import JSONSchema

PATH_RE = re.compile(r"<(?:[^:<>]+:)?([^<>]+)>")
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/labthing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
import uuid
import weakref

from typing import Dict, List, Set, Any, Tuple, Type, Optional
from typing import Any, Dict, List, Optional, Set, Tuple, Type

from apispec import APISpec # type: ignore
from apispec_webframeworks.flask import FlaskPlugin # type: ignore
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/marshalling/args.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from functools import update_wrapper, wraps
from typing import Callable, Dict, Union

from flask import abort, request
from marshmallow.exceptions import ValidationError
Expand All @@ -8,8 +9,6 @@
from ..fields import Field
from ..schema import FieldSchema, Schema

from typing import Union, Dict, Callable


class use_body:
"""Gets the request body as a single value and adds it as a positional argument"""
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/marshalling/marshalling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Mapping
from functools import wraps
from typing import Callable, Dict, Tuple, Union

from marshmallow import Schema as _Schema
from werkzeug.wrappers import Response as ResponseBase
Expand All @@ -8,8 +9,6 @@
from ..schema import FieldSchema, Schema
from ..utilities import unpack

from typing import Union, Dict, Callable, Tuple


def schema_to_converter(schema: Union[Schema, Field, Dict[str, Union[Field, type]]]):
"""Convert a schema into a converter function,
Expand Down
9 changes: 3 additions & 6 deletions src/labthings/representations.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from collections import OrderedDict
from typing import Any, Optional

from flask import current_app, make_response, Response
from flask import Response, current_app, make_response

from .find import current_labthing
from .json.encoder import (
LabThingsJSONEncoder,
encode_json,
JSONEncoder as FlaskJSONEncoder,
)
from .json.encoder import JSONEncoder as FlaskJSONEncoder
from .json.encoder import LabThingsJSONEncoder, encode_json
from .utilities import PY3

__all__ = ["LabThingsJSONEncoder", "DEFAULT_REPRESENTATIONS", "output_json"]
Expand Down
2 changes: 1 addition & 1 deletion src/labthings/schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import logging
from typing import Optional, Union, Dict, Any
from datetime import datetime
from typing import Any, Dict, Optional, Union

from flask import url_for
from marshmallow import Schema, pre_dump, pre_load, validate
Expand Down
1 change: 0 additions & 1 deletion src/labthings/sync/lock.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
from contextlib import contextmanager
from threading import _RLock, current_thread

from typing import Optional

sentinel = object()
Expand Down
6 changes: 3 additions & 3 deletions src/labthings/td.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from flask import has_request_context, request
from typing import Any, Dict, List, Type

from typing import Dict, List, Type, Any
from flask import has_request_context, request

from .find import current_labthing
from .json.schemas import rule_to_params, rule_to_path, schema_to_json
from .schema import build_action_schema
from .utilities import ResourceURL, get_docstring
from .views import View, PropertyView, ActionView, EventView
from .views import ActionView, EventView, PropertyView, View


def view_to_thing_forms(
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import time
from collections import UserString
from functools import reduce

from typing import Type, Callable, Dict, Any, Tuple, Union, List
from typing import Any, Callable, Dict, List, Tuple, Type, Union

from flask import current_app, has_request_context, request
from werkzeug.http import HTTP_STATUS_CODES
Expand Down
3 changes: 1 addition & 2 deletions src/labthings/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import datetime
from collections import OrderedDict
from typing import Dict, List, Optional, Set

from flask import request
from flask.views import MethodView
from werkzeug.wrappers import Response as ResponseBase

from typing import Dict, Optional, Set, List

from ..actions.pool import Pool
from ..deque import Deque
from ..find import current_labthing
Expand Down
1 change: 0 additions & 1 deletion src/labthings/views/builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import glob
import os
import uuid

from typing import Type

from flask import abort, send_file
Expand Down

0 comments on commit 5f666ce

Please sign in to comment.