Skip to content

Commit 1ce0abb

Browse files
committed
driver/power/gude8031: Fix line ending
This file has been created with CRLF, but all other files in this repo seem to be LF-only. This changes the line-ending of the file to LF-only. Signed-off-by: Chris Fiege <[email protected]>
1 parent 71bfcd2 commit 1ce0abb

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

labgrid/driver/power/gude8031.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
import requests
2-
3-
# Driver has been tested with:
4-
# Gude Expert Power Control 8031()
5-
6-
# HTTP-GET API is defined in the Gude EPC-HTTP-Interface specification:
7-
# http://wiki.gude.info/EPC_HTTP_Interface
8-
#
9-
# The `components=<N>` parameter defines which status information are
10-
# included into the returned JSON.
11-
# * `components=0` happily returns an empty response but still switches the
12-
# outputs as requestd.
13-
# * `components=1` only includes the output's state into the JSON.
14-
15-
PORT = 80
16-
17-
def power_set(host, port, index, value):
18-
index = int(index)
19-
assert 1 <= index <= 8
20-
# access the web interface...
21-
value = 1 if value else 0
22-
r = requests.get(
23-
f"http://{host}:{port}/status.json?components=0&cmd=1&p={index}&s={value}"
24-
)
25-
r.raise_for_status()
26-
27-
def power_get(host, port, index):
28-
index = int(index)
29-
assert 1 <= index <= 8
30-
31-
# get the component status
32-
r = requests.get(f"http://{host}:{port}/status.json?components=1")
33-
r.raise_for_status()
34-
35-
state = r.json()['outputs'][index - 1]['state']
36-
37-
return state
1+
import requests
2+
3+
# Driver has been tested with:
4+
# Gude Expert Power Control 8031()
5+
6+
# HTTP-GET API is defined in the Gude EPC-HTTP-Interface specification:
7+
# http://wiki.gude.info/EPC_HTTP_Interface
8+
#
9+
# The `components=<N>` parameter defines which status information are
10+
# included into the returned JSON.
11+
# * `components=0` happily returns an empty response but still switches the
12+
# outputs as requestd.
13+
# * `components=1` only includes the output's state into the JSON.
14+
15+
PORT = 80
16+
17+
def power_set(host, port, index, value):
18+
index = int(index)
19+
assert 1 <= index <= 8
20+
# access the web interface...
21+
value = 1 if value else 0
22+
r = requests.get(
23+
f"http://{host}:{port}/status.json?components=0&cmd=1&p={index}&s={value}"
24+
)
25+
r.raise_for_status()
26+
27+
def power_get(host, port, index):
28+
index = int(index)
29+
assert 1 <= index <= 8
30+
31+
# get the component status
32+
r = requests.get(f"http://{host}:{port}/status.json?components=1")
33+
r.raise_for_status()
34+
35+
state = r.json()['outputs'][index - 1]['state']
36+
37+
return state

0 commit comments

Comments
 (0)