Skip to content

Commit dd6e92c

Browse files
committed
Lint/format example code
1 parent ccce6c5 commit dd6e92c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

docs/source/dependencies/example.py

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

77
MyThingDep = direct_thing_client_dependency(MyThing, "/mything/")
88

9+
910
class TestThing(Thing):
1011
"""A test thing with a counter property and a couple of actions"""
1112

@@ -14,10 +15,12 @@ def increment_counter(self, my_thing: MyThingDep) -> None:
1415
"""Increment the counter on another thing"""
1516
my_thing.increment_counter()
1617

18+
1719
server = ThingServer()
1820
server.add_thing(MyThing(), "/mything/")
1921
server.add_thing(TestThing(), "/testthing/")
2022

2123
if __name__ == "__main__":
2224
import uvicorn
23-
uvicorn.run(server.app, port=5000)
25+
26+
uvicorn.run(server.app, port=5000)

docs/source/quickstart/counter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def slowly_increase_counter(self) -> None:
2828
model=int, initial_value=0, readonly=True, description="A pointless counter"
2929
)
3030

31+
3132
if __name__ == "__main__":
3233
from labthings_fastapi.server import ThingServer
3334
import uvicorn
@@ -39,4 +40,3 @@ def slowly_increase_counter(self) -> None:
3940

4041
# We run the server using `uvicorn`:
4142
uvicorn.run(server.app, port=5000)
42-

tests/test_docs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from subprocess import Popen, PIPE, STDOUT
2-
import os
31
from pathlib import Path
42
from runpy import run_path
53
from test_server_cli import MonitoredProcess
@@ -11,6 +9,7 @@
119
repo = this_file.parents[1]
1210
docs = repo / "docs" / "source"
1311

12+
1413
def run_quickstart_counter():
1514
# A server is started in the `__name__ == "__main__" block`
1615
run_path(docs / "quickstart" / "counter.py")
@@ -21,6 +20,7 @@ def test_quickstart_counter():
2120
p = MonitoredProcess(target=run_quickstart_counter)
2221
p.run_monitored(terminate_outputs=["Application startup complete"])
2322

23+
2424
def test_dependency_example():
2525
globals = run_path(docs / "dependencies" / "example.py", run_name="not_main")
2626
with TestClient(globals["server"].app) as client:

0 commit comments

Comments
 (0)