Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy error in channels.py #77

Merged
merged 4 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pyvisa_sim/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class Channels(Component):
can_select: bool

def __init__(self, device: "Device", ids: List[str], can_select: bool):

super(Channels, self).__init__()
self.can_select: bool = can_select
self._selected = None
Expand Down Expand Up @@ -194,9 +193,9 @@ def _match_setters(self, query: bytes) -> Optional[OptionalBytes]:
try:
if isinstance(parsed, dict) and "ch_id" in parsed:
self._selected = parsed["ch_id"]
self._properties[name].set_value(parsed["0"])
self._properties[name].set_value(str(parsed["0"]))
else:
self._properties[name].set_value(parsed)
self._properties[name].set_value(str(parsed))
return response
except ValueError:
if isinstance(error_response, bytes):
Expand Down
1 change: 0 additions & 1 deletion pyvisa_sim/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class Device(Component):
delimiter: bytes

def __init__(self, name: str, delimiter: bytes) -> None:

super(Device, self).__init__()
self.name = name
self.delimiter = delimiter
Expand Down
1 change: 0 additions & 1 deletion pyvisa_sim/sessions/gpib.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@session.Session.register(constants.InterfaceType.gpib, "INSTR")
class GPIBInstrumentSession(session.Session):

parsed: rname.GPIBInstr

def after_parsing(self) -> None:
Expand Down
4 changes: 0 additions & 4 deletions pyvisa_sim/sessions/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

@session.Session.register(constants.InterfaceType.asrl, "INSTR")
class SerialInstrumentSession(session.Session):

parsed: rname.ASRLInstr

def after_parsing(self) -> None:
Expand All @@ -25,7 +24,6 @@ def after_parsing(self) -> None:
)

def read(self, count: int) -> Tuple[bytes, constants.StatusCode]:

# TODO: Implement VI_ATTR_SUPPRESS_END_EN
end_in, _ = self.get_attribute(constants.ResourceAttribute.asrl_end_in)

Expand Down Expand Up @@ -56,7 +54,6 @@ def read(self, count: int) -> Tuple[bytes, constants.StatusCode]:
return out, constants.StatusCode.success_termination_character_read

elif end_in == constants.SerialTermination.last_bit:

if common.last_int(out) & mask:
return out, constants.StatusCode.success

Expand Down Expand Up @@ -90,7 +87,6 @@ def write(self, data: bytes) -> Tuple[int, constants.StatusCode]:
for val in common.iter_bytes(data, mask, send_end):
self.device.write(val)
else:

for i in range(len(data)):
self.device.write(data[i : i + 1])

Expand Down
2 changes: 0 additions & 2 deletions pyvisa_sim/sessions/tcpip.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def write(self, data: bytes) -> Tuple[int, constants.StatusCode]:

@session.Session.register(constants.InterfaceType.tcpip, "INSTR")
class TCPIPInstrumentSession(BaseTCPIPSession):

parsed: rname.TCPIPInstr

def after_parsing(self) -> None:
Expand All @@ -74,7 +73,6 @@ def after_parsing(self) -> None:

@session.Session.register(constants.InterfaceType.tcpip, "SOCKET")
class TCPIPSocketSession(BaseTCPIPSession):

parsed: rname.TCPIPSocket

def after_parsing(self) -> None:
Expand Down
1 change: 0 additions & 1 deletion pyvisa_sim/sessions/usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def write(self, data: bytes) -> Tuple[int, constants.StatusCode]:

@session.Session.register(constants.InterfaceType.usb, "RAW")
class USBRawSession(session.Session):

parsed: rname.USBRaw

def after_parsing(self) -> None:
Expand Down