Skip to content

Commit e043b74

Browse files
committed
fix lint
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
1 parent 227da61 commit e043b74

File tree

9 files changed

+15
-13
lines changed

9 files changed

+15
-13
lines changed

csp_gateway/server/modules/controls/controls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MountControls(GatewayModule):
2222
mount_heartbeat: bool = True
2323
mount_stats: bool = True
2424
mount_shutdown: bool = True
25-
25+
2626
def connect(self, channels: GatewayChannels) -> None:
2727
self.subscribe(channels.get_channel("controls"))
2828
channels.add_send_channel("controls")
@@ -38,7 +38,7 @@ def rest(self, app: GatewayWebApp) -> None:
3838
if self.mount_shutdown:
3939
app.add_controls_api(field="shutdown")
4040
available.append("shutdown")
41-
41+
4242
app.add_controls_available_channels(fields=set(available))
4343

4444
@csp.node

csp_gateway/server/web/routes/controls.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222

2323
def add_controls_routes(api_router: APIRouter, field: str) -> None:
24-
2524
if field == "heartbeat":
2625
# Add heartbeat channel
2726
@api_router.get(
@@ -50,6 +49,7 @@ async def heartbeat(request: Request) -> Controls:
5049
return prepare_response(data, is_list_model=False)
5150

5251
elif field == "stats":
52+
5353
@api_router.get(
5454
"/stats",
5555
responses=get_default_responses(),
@@ -83,6 +83,7 @@ async def stats(request: Request) -> Controls:
8383
return prepare_response(data, is_list_model=False)
8484

8585
elif field == "shutdown":
86+
8687
@api_router.post(
8788
"/shutdown",
8889
responses=get_default_responses(),
@@ -100,13 +101,12 @@ async def shutdown(request: Request, background_tasks: BackgroundTasks) -> Contr
100101

101102
data = Controls(name="shutdown", status="ok")
102103
return prepare_response(data, is_list_model=False)
103-
104+
104105
else:
105106
raise ValueError(f"Unsupported controls field: {field}. Supported fields are 'heartbeat', 'stats', and 'shutdown'.")
106107

107108

108109
def add_controls_available_channels(api_router: APIRouter, fields: Optional[Set[str]] = None) -> None:
109-
110110
@api_router.get(
111111
"/",
112112
responses=get_default_responses(),
@@ -117,4 +117,3 @@ async def get_controls(request: Request) -> List[str]:
117117
This endpoint will return a list of string values of all available channels under the `/controls` route.
118118
"""
119119
return sorted(fields if fields else ("heartbeat", "stats", "shutdown"))
120-

csp_gateway/server/web/routes/last.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"add_last_available_channels",
1515
)
1616

17+
1718
def add_last_routes(
1819
api_router: APIRouter,
1920
field: str,
@@ -151,7 +152,6 @@ async def get_last(request: Request) -> list_model: # type: ignore[misc, valid-
151152

152153

153154
def add_last_available_channels(api_router: APIRouter, fields: Optional[Set[str]] = None) -> None:
154-
155155
@api_router.get(
156156
"/",
157157
responses=get_default_responses(),
@@ -162,4 +162,3 @@ async def get_last(request: Request) -> List[str]:
162162
This endpoint will return a list of string values of all available channels under the `/last` route.
163163
"""
164164
return sorted(ChannelSelection().select_from(request.app.gateway.channels) if fields is None else fields)
165-

csp_gateway/server/web/routes/lookup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"add_lookup_available_channels",
1414
)
1515

16+
1617
def add_lookup_routes(
1718
api_router: APIRouter,
1819
field: str,
@@ -48,8 +49,8 @@ async def lookup(id: str, request: Request) -> List[model]: # type: ignore[misc
4849
include_in_schema=False,
4950
)(lookup)
5051

52+
5153
def add_lookup_available_channels(api_router: APIRouter, fields: Optional[Set[str]] = None) -> None:
52-
5354
@api_router.get(
5455
"/",
5556
responses=get_default_responses(),
@@ -60,5 +61,3 @@ async def get_lookup(request: Request) -> List[str]:
6061
This endpoint will return a list of string values of all available channels under the `/lookup` route.
6162
"""
6263
return sorted(ChannelSelection().select_from(request.app.gateway.channels) if fields is None else fields)
63-
64-

csp_gateway/server/web/routes/next.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"add_next_available_channels",
1515
)
1616

17+
1718
def add_next_routes(
1819
api_router: APIRouter,
1920
field: str,

csp_gateway/server/web/routes/send.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"add_send_available_channels",
1818
)
1919

20+
2021
def add_send_routes(
2122
api_router: APIRouter,
2223
field: str,

csp_gateway/server/web/routes/shared.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"get_next_tick",
99
)
1010

11+
1112
def prepare_response(
1213
res: Any,
1314
is_list_model: bool = False,

csp_gateway/server/web/routes/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"add_state_available_channels",
1515
)
1616

17+
1718
def add_state_routes(
1819
api_router: APIRouter,
1920
field: str = "",

csp_gateway/tests/server/gateway/test_gateway_start_stop.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import requests
1313
from fastapi.testclient import TestClient
1414

15-
from csp_gateway import Gateway, GatewaySettings, MountRestRoutes
15+
from csp_gateway import Gateway, GatewaySettings, MountControls, MountRestRoutes
1616
from csp_gateway.server.demo import ExampleGatewayChannels, ExampleModule
1717
from csp_gateway.testing import CspDieModule, LongStartModule
1818
from csp_gateway.tests.server.gateway.test_gateway import MyBuildFailureModule
@@ -119,10 +119,11 @@ def test_start_and_then_graph_start_error(caplog, free_port):
119119
def test_stop_with_shutdown(free_port):
120120
# instantiate gateway
121121
gateway = Gateway(
122-
settings=GatewaySettings(API_KEY="12345", AUTHENTICATE=False, PORT=free_port),
122+
settings=GatewaySettings(AUTHENTICATE=False, PORT=free_port),
123123
modules=[
124124
ExampleModule(),
125125
MountRestRoutes(force_mount_all=True),
126+
MountControls(),
126127
],
127128
channels=ExampleGatewayChannels(),
128129
)

0 commit comments

Comments
 (0)