Skip to content

Commit 1a848a6

Browse files
committed
ADD: add return type hint
1 parent 6ea3fc3 commit 1a848a6

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

src/cc/scpi/keysight/edu36311a.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Channel:
1818
CH2 = "2" # the P30V channel
1919
CH3 = "3" # the N30V channel
2020

21-
def get_voltage(self, channel: Channel):
21+
def get_voltage(self, channel: Channel) -> float:
2222
"""
2323
Get the voltage reading of the output.
2424
@@ -29,7 +29,7 @@ def get_voltage(self, channel: Channel):
2929
reading = float(reading)
3030
return reading
3131

32-
def get_current(self, channel: Channel):
32+
def get_current(self, channel: Channel) -> float:
3333
"""
3434
Get the current reading of the output.
3535
@@ -40,7 +40,7 @@ def get_current(self, channel: Channel):
4040
reading = float(reading)
4141
return reading
4242

43-
def get_power(self, channel: Channel):
43+
def get_power(self, channel: Channel) -> float:
4444
"""
4545
Get the power reading of the output.
4646
@@ -52,7 +52,7 @@ def get_power(self, channel: Channel):
5252
power = voltage * current
5353
return power
5454

55-
def set_voltage(self, value: float, channel: Channel):
55+
def set_voltage(self, value: float, channel: Channel) -> None:
5656
"""
5757
Set the output voltage level of the specified channel.
5858
@@ -62,7 +62,7 @@ def set_voltage(self, value: float, channel: Channel):
6262
"""
6363
self.command("VOLT {val},(@{ch})".format(ch=channel, val=value))
6464

65-
def set_current(self, value: float, channel: Channel):
65+
def set_current(self, value: float, channel: Channel) -> None:
6666
"""
6767
Set the output current limit of the specified channel.
6868
@@ -72,7 +72,7 @@ def set_current(self, value: float, channel: Channel):
7272
"""
7373
self.command("CURR {val},(@{ch})".format(ch=channel, val=value))
7474

75-
def disable_output(self, channel: Channel):
75+
def disable_output(self, channel: Channel) -> None:
7676
"""
7777
Disable the output of the specified channel.
7878
@@ -81,7 +81,7 @@ def disable_output(self, channel: Channel):
8181
"""
8282
self.command("OUTPUT OFF,(@{ch})".format(ch=channel))
8383

84-
def enable_output(self, channel: Channel):
84+
def enable_output(self, channel: Channel) -> None:
8585
"""
8686
Enable the output of the specified channel.
8787

src/cc/scpi/keysight/k33600a.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Channel:
2323
CH1 = "1"
2424
CH2 = "2"
2525

26-
def set_function(self, function: Function, channel: Channel):
26+
def set_function(self, function: Function, channel: Channel) -> None:
2727
"""
2828
Set function of both channels
2929
@@ -33,7 +33,7 @@ def set_function(self, function: Function, channel: Channel):
3333
"""
3434
self.command("SOURCE{ch}:FUNCTION {func}".format(ch=channel, func=function))
3535

36-
def set_frequency(self, value: float, channel: Channel):
36+
def set_frequency(self, value: float, channel: Channel) -> None:
3737
"""
3838
Set frequency of both channels
3939
@@ -43,7 +43,7 @@ def set_frequency(self, value: float, channel: Channel):
4343
"""
4444
self.command("SOURCE{ch}:FREQUENCY {val}".format(ch=channel, val=value))
4545

46-
def set_high_voltage(self, value: float, channel: Channel):
46+
def set_high_voltage(self, value: float, channel: Channel) -> None:
4747
"""
4848
Set the voltage level of the high state of the output waveform.
4949
@@ -53,7 +53,7 @@ def set_high_voltage(self, value: float, channel: Channel):
5353
"""
5454
self.command("SOURCE{ch}:VOLTAGE:HIGH {val}".format(ch=channel, val=value))
5555

56-
def set_low_voltage(self, value: float, channel: Channel):
56+
def set_low_voltage(self, value: float, channel: Channel) -> None:
5757
"""
5858
Set the voltage level of the low state of the output waveform.
5959
@@ -63,7 +63,7 @@ def set_low_voltage(self, value: float, channel: Channel):
6363
"""
6464
self.command("SOURCE{ch}:VOLTAGE:LOW {val}".format(ch=channel, val=value))
6565

66-
def set_output_load(self, value: float, channel: Channel):
66+
def set_output_load(self, value: float, channel: Channel) -> None:
6767
"""
6868
Set the output load impedance.
6969
@@ -75,7 +75,7 @@ def set_output_load(self, value: float, channel: Channel):
7575
value = "INFINITY"
7676
self.command("OUTPUT{ch}:LOAD {val}".format(ch=channel, val=value))
7777

78-
def disable_output(self, channel: Channel):
78+
def disable_output(self, channel: Channel) -> None:
7979
"""
8080
Disable the output of the specified channel.
8181
@@ -84,7 +84,7 @@ def disable_output(self, channel: Channel):
8484
"""
8585
self.command("OUTPUT{ch} OFF".format(ch=channel))
8686

87-
def enable_output(self, channel: Channel):
87+
def enable_output(self, channel: Channel) -> None:
8888
"""
8989
Enable the output of the specified channel.
9090

src/cc/scpi/keysight/k81134a.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Function:
2424
SQUARE = "SQUARE"
2525
DATA = "DATA"
2626

27-
def set_function(self, function: Function, channel: Channel):
27+
def set_function(self, function: Function, channel: Channel) -> None:
2828
"""
2929
Set function of both channels
3030
@@ -34,7 +34,7 @@ def set_function(self, function: Function, channel: Channel):
3434
"""
3535
self.command(":SOURCE:FUNCTION:MODE{ch} {func}".format(ch=channel, func=function))
3636

37-
def set_frequency(self, value: int):
37+
def set_frequency(self, value: int) -> None:
3838
"""
3939
Set frequency of both channels
4040
@@ -44,7 +44,7 @@ def set_frequency(self, value: int):
4444
assert 15000000. <= value and value <= 3350000000.
4545
self.command(":FREQUENCY {val}".format(val=value))
4646

47-
def set_frequency_divisor(self, value: int, channel: Channel):
47+
def set_frequency_divisor(self, value: int, channel: Channel) -> None:
4848
"""
4949
Set the frequency divider of both channels
5050
@@ -54,7 +54,7 @@ def set_frequency_divisor(self, value: int, channel: Channel):
5454
assert value in [1, 2, 4, 8, 16, 32, 64, 128], "Invalid frequency divisor"
5555
self.command(":OUTPUT{ch}:DIVIDER {val}".format(ch=channel, val=value))
5656

57-
def set_voltage_high(self, value: float, channel: Channel):
57+
def set_voltage_high(self, value: float, channel: Channel) -> None:
5858
"""
5959
Set the voltage level of the high state of the output waveform.
6060
@@ -65,7 +65,7 @@ def set_voltage_high(self, value: float, channel: Channel):
6565
assert 0. <= value and value <= 2.
6666
self.command(":SOURCE:VOLTAGE{ch}:HIGH {val}V".format(ch=channel, val=value))
6767

68-
def set_voltage_low(self, value: float, channel: Channel):
68+
def set_voltage_low(self, value: float, channel: Channel) -> None:
6969
"""
7070
Set the voltage level of the high state of the output waveform.
7171
@@ -76,7 +76,7 @@ def set_voltage_low(self, value: float, channel: Channel):
7676
assert 0. <= value and value <= 2.
7777
self.command(":SOURCE:VOLTAGE{ch}:LOW {val}V".format(ch=channel, val=value))
7878

79-
def disable_output(self, channel: Channel):
79+
def disable_output(self, channel: Channel) -> None:
8080
"""
8181
Disable the output of both phases of the specified channel.
8282
@@ -85,7 +85,7 @@ def disable_output(self, channel: Channel):
8585
"""
8686
self.command(":OUTPUT{ch} OFF".format(ch=channel))
8787

88-
def disable_output_p(self, channel: Channel):
88+
def disable_output_p(self, channel: Channel) -> None:
8989
"""
9090
Disable the output of the positive phase of the specified channel.
9191
@@ -94,7 +94,7 @@ def disable_output_p(self, channel: Channel):
9494
"""
9595
self.command(":OUTPUT{ch}:POS OFF".format(ch=channel))
9696

97-
def disable_output_n(self, channel: Channel):
97+
def disable_output_n(self, channel: Channel) -> None:
9898
"""
9999
Disable the output of the negative phase of the specified channel.
100100
@@ -103,7 +103,7 @@ def disable_output_n(self, channel: Channel):
103103
"""
104104
self.command(":OUTPUT{ch}:NEG OFF".format(ch=channel))
105105

106-
def enable_output(self, channel: Channel):
106+
def enable_output(self, channel: Channel) -> None:
107107
"""
108108
Enable the output of both phases of the specified channel.
109109
@@ -112,7 +112,7 @@ def enable_output(self, channel: Channel):
112112
"""
113113
self.command(":OUTPUT{ch} ON".format(ch=channel))
114114

115-
def enable_output_p(self, channel: Channel):
115+
def enable_output_p(self, channel: Channel) -> None:
116116
"""
117117
Enable the output of the positive phase of the specified channel.
118118
@@ -121,7 +121,7 @@ def enable_output_p(self, channel: Channel):
121121
"""
122122
self.command(":OUTPUT{ch}:POS ON".format(ch=channel))
123123

124-
def enable_output_n(self, channel: Channel):
124+
def enable_output_n(self, channel: Channel) -> None:
125125
"""
126126
Enable the output of the negative phase of the specified channel.
127127

src/cc/scpi/siglent/spd3303x.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Channel:
1717
CH1 = "CH1"
1818
CH2 = "CH2"
1919

20-
def get_current(self, channel: Channel):
20+
def get_current(self, channel: Channel) -> float:
2121
"""
2222
Get the current reading of the output.
2323
@@ -29,7 +29,7 @@ def get_current(self, channel: Channel):
2929
"""
3030
return float(self.query("MEASURE:CURRENT? {ch}".format(ch=channel)))
3131

32-
def get_voltage(self, channel: Channel):
32+
def get_voltage(self, channel: Channel) -> float:
3333
"""
3434
Get the voltage reading of the output.
3535
@@ -41,7 +41,7 @@ def get_voltage(self, channel: Channel):
4141
"""
4242
return float(self.query("MEASURE:VOLTAGE? {ch}".format(ch=channel)))
4343

44-
def get_power(self, channel: Channel):
44+
def get_power(self, channel: Channel) -> float:
4545
"""
4646
Get the power reading of the output.
4747
@@ -53,7 +53,7 @@ def get_power(self, channel: Channel):
5353
"""
5454
return float(self.query("MEASURE:POWER? {ch}".format(ch=channel)))
5555

56-
def set_current(self, value: float, channel: Channel):
56+
def set_current(self, value: float, channel: Channel) -> None:
5757
"""
5858
Set the current limit of the output.
5959
@@ -63,7 +63,7 @@ def set_current(self, value: float, channel: Channel):
6363
"""
6464
self.command("{ch}:CURRENT {val}".format(ch=channel, val=value))
6565

66-
def set_voltage(self, value: float, channel: Channel):
66+
def set_voltage(self, value: float, channel: Channel) -> None:
6767
"""
6868
Set the voltage of the output.
6969
@@ -73,7 +73,7 @@ def set_voltage(self, value: float, channel: Channel):
7373
"""
7474
self.command("{ch}:VOLTAGE {val}".format(ch=channel, val=value))
7575

76-
def disable_output(self, channel: Channel):
76+
def disable_output(self, channel: Channel) -> None:
7777
"""
7878
Disable the output.
7979
@@ -82,7 +82,7 @@ def disable_output(self, channel: Channel):
8282
"""
8383
self.command("OUTPUT {ch},OFF".format(ch=channel))
8484

85-
def enable_output(self, channel: Channel):
85+
def enable_output(self, channel: Channel) -> None:
8686
"""
8787
Enable the output.
8888

0 commit comments

Comments
 (0)