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

Commit a61e28b

Browse files
authored
Merge pull request #4 from jtc42/w3c-compat-poetry
W3c compat poetry
2 parents 1d8a704 + 528bbcb commit a61e28b

21 files changed

Lines changed: 571 additions & 191 deletions

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
ignore = E203, E266, E501, W503
3+
max-line-length = 88
4+
max-complexity = 18
5+
select = B,C,E,F,W,T4

MANIFEST.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/mjpeg-stream.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
from __future__ import division
2-
from webthing import (
3-
Action,
4-
Event,
5-
Property,
6-
Value,
7-
Thing,
8-
WebThingServer,
9-
)
10-
import logging
11-
import time
12-
import uuid
13-
import asyncio
142

3+
import asyncio
154
import io
5+
import logging
6+
import sys
167
from datetime import datetime
17-
from PIL import Image, ImageFont, ImageDraw
188

19-
import os
20-
import pathlib
9+
from PIL import Image, ImageDraw
10+
11+
from thingserver import Property, Thing, Value, WebThingServer
12+
13+
if (
14+
sys.version_info[0] == 3
15+
and sys.version_info[1] >= 8
16+
and sys.platform.startswith("win")
17+
):
18+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
2119

2220
"""
2321
PIL spams the logger with debug-level information. This is a pain when debugging api.app.
@@ -41,11 +39,7 @@ def _start_runner(self):
4139

4240
def generate_new_dummy_image(self):
4341
# Create a dummy image to serve in the stream
44-
image = Image.new(
45-
"RGB",
46-
(640, 480),
47-
color=(0, 0, 0),
48-
)
42+
image = Image.new("RGB", (640, 480), color=(0, 0, 0),)
4943

5044
draw = ImageDraw.Draw(image)
5145
draw.text(

example/single-thing.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
from __future__ import division
2-
from webthing import Action, Event, Property, Value, Thing, WebThingServer
2+
3+
import asyncio
34
import logging
5+
import sys
46
import time
57
import uuid
6-
import asyncio
8+
9+
from thingserver import Action, Event, Property, Thing, Value, WebThingServer
10+
11+
if (
12+
sys.version_info[0] == 3
13+
and sys.version_info[1] >= 8
14+
and sys.platform.startswith("win")
15+
):
16+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
717

818

919
class OverheatedEvent(Event):
@@ -62,33 +72,21 @@ async def fade_function(args):
6272
thing,
6373
"fade",
6474
fade_function,
65-
metadata={
66-
"title": "Fade",
67-
"description": "Fade the lamp to a given level",
68-
},
69-
input_ = {
75+
metadata={"title": "Fade", "description": "Fade the lamp to a given level",},
76+
input_={
7077
"type": "object",
71-
"required": [
72-
"brightness",
73-
"duration",
74-
],
78+
"required": ["brightness", "duration",],
7579
"properties": {
7680
"brightness": {
7781
"type": "integer",
7882
"minimum": 0,
7983
"maximum": 100,
8084
"unit": "percent",
8185
},
82-
"duration": {
83-
"type": "integer",
84-
"minimum": 1,
85-
"unit": "milliseconds",
86-
},
86+
"duration": {"type": "integer", "minimum": 1, "unit": "milliseconds",},
8787
},
8888
},
89-
output = {
90-
"type": "string"
91-
}
89+
output={"type": "string"},
9290
)
9391

9492
thing.add_action(fade_action)

package.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)