Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit 7b2991b

Browse files
committed
Isort
1 parent 1d8a704 commit 7b2991b

9 files changed

Lines changed: 46 additions & 37 deletions

File tree

example/mjpeg-stream.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
from __future__ import division
2-
from webthing import (
3-
Action,
4-
Event,
5-
Property,
6-
Value,
7-
Thing,
8-
WebThingServer,
9-
)
2+
3+
import asyncio
4+
import io
105
import logging
6+
import os
7+
import pathlib
118
import time
129
import uuid
13-
import asyncio
14-
15-
import io
1610
from datetime import datetime
17-
from PIL import Image, ImageFont, ImageDraw
1811

19-
import os
20-
import pathlib
12+
from PIL import Image, ImageDraw, ImageFont
13+
14+
from webthing import Action, Event, Property, Thing, Value, WebThingServer
2115

2216
"""
2317
PIL spams the logger with debug-level information. This is a pain when debugging api.app.

example/single-thing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from __future__ import division
2-
from webthing import Action, Event, Property, Value, Thing, WebThingServer
2+
3+
import asyncio
34
import logging
45
import time
56
import uuid
6-
import asyncio
7+
8+
from webthing import Action, Event, Property, Thing, Value, WebThingServer
79

810

911
class OverheatedEvent(Event):
@@ -66,7 +68,7 @@ async def fade_function(args):
6668
"title": "Fade",
6769
"description": "Fade the lamp to a given level",
6870
},
69-
input_ = {
71+
input_={
7072
"type": "object",
7173
"required": [
7274
"brightness",
@@ -86,9 +88,7 @@ async def fade_function(args):
8688
},
8789
},
8890
},
89-
output = {
90-
"type": "string"
91-
}
91+
output={"type": "string"},
9292
)
9393

9494
thing.add_action(fade_action)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""A setuptools based setup module."""
22

3-
from setuptools import setup, find_packages
3+
import sys
44
from codecs import open
55
from os import path
6-
import sys
76

7+
from setuptools import find_packages, setup
88

99
here = path.abspath(path.dirname(__file__))
1010

webthing/action.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""High-level Action base class implementation."""
22

3-
from copy import deepcopy
4-
import uuid
53
import asyncio
4+
import uuid
5+
from copy import deepcopy
6+
67
from .utils import timestamp
78

89

@@ -133,7 +134,9 @@ def finish(self, future):
133134
class Action:
134135
"""An Action represents a class of actions on a thing."""
135136

136-
def __init__(self, thing, name, invokeaction=None, metadata=None, input_=None, output=None):
137+
def __init__(
138+
self, thing, name, invokeaction=None, metadata=None, input_=None, output=None
139+
):
137140
self.thing = thing
138141
self.name = name
139142
self.href_prefix = ""
@@ -168,10 +171,19 @@ def as_action_description(self):
168171
"href": {"type": "string", "format": "uri"},
169172
"timeRequested": {"type": "string", "format": "date-time"},
170173
"timeCompleted": {"type": "string", "format": "date-time"},
171-
"status": {"type": "string", "enum": ["pending", "running", "completed", "cancelled", "error"]},
174+
"status": {
175+
"type": "string",
176+
"enum": [
177+
"pending",
178+
"running",
179+
"completed",
180+
"cancelled",
181+
"error",
182+
],
183+
},
172184
**({"output": self.output} if self.output else {}),
173185
**({"input": self.input} if self.input else {}),
174-
}
186+
},
175187
}
176188

177189
# Create forms

webthing/json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import json as _json
21
import datetime
3-
import uuid
2+
import json as _json
43
import types
54
import typing
5+
import uuid
66
from base64 import b64encode
77

88
try:

webthing/property.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""High-level Property base class implementation."""
22

33
from copy import deepcopy
4+
45
from jsonschema import validate
56
from jsonschema.exceptions import ValidationError
67

webthing/server.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
"""Python Web Thing server implementation."""
22

3-
from zeroconf import ServiceInfo, Zeroconf
3+
import asyncio
44
import json
5+
import logging
56
import socket
67
import sys
7-
import typing
88
import types
9-
import logging
10-
import asyncio
9+
import typing
10+
1111
import tornado.concurrent
1212
import tornado.gen
1313
import tornado.httpserver
1414
import tornado.ioloop
1515
import tornado.web
1616
import tornado.websocket
1717
from tornado.iostream import StreamClosedError
18+
from zeroconf import ServiceInfo, Zeroconf
1819

1920
from .errors import PropertyError
21+
from .json import JSONEncoder
2022
from .subscriber import Subscriber
2123
from .utils import get_addresses, get_ip
22-
from .json import JSONEncoder
2324

2425

2526
class BaseHandler(tornado.web.RequestHandler):

webthing/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Utility functions."""
22

33
import datetime
4-
import ifaddr
54
import socket
65

6+
import ifaddr
7+
78

89
def timestamp():
910
"""

webthing/value.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""An observable, settable value interface."""
22

3-
import sys
4-
import inspect
53
import asyncio
4+
import inspect
5+
import sys
66

77
if sys.version_info.major == 3:
88
from pyee import AsyncIOEventEmitter as EventEmitter

0 commit comments

Comments
 (0)