dexter submitted this change.

View Change


Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
transport: add return type annotation to method __str__

The abstract class LinkBase has no return type annotation on its
__str__ method.

Related: OS#6210
Change-Id: I26d3d2714708dbe957704b60d17ba2afa325b2c4
---
M pySim/transport/__init__.py
M pySim/transport/calypso.py
M pySim/transport/modem_atcmd.py
M pySim/transport/pcsc.py
M pySim/transport/serial.py
5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py
index 1dd8d18..0b50a4f 100644
--- a/pySim/transport/__init__.py
+++ b/pySim/transport/__init__.py
@@ -68,7 +68,7 @@
self.proactive_handler = proactive_handler

@abc.abstractmethod
- def __str__(self):
+ def __str__(self) -> str:
"""Implementation specific method for printing an information to identify the device."""

@abc.abstractmethod
diff --git a/pySim/transport/calypso.py b/pySim/transport/calypso.py
index b827d88..d7d9649 100644
--- a/pySim/transport/calypso.py
+++ b/pySim/transport/calypso.py
@@ -160,5 +160,5 @@

return b2h(data), b2h(sw)

- def __str__(self):
+ def __str__(self) -> str:
return "osmocon:%s" % (self._sock_path)
diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py
index 58d6f9d..5e5a3dd 100644
--- a/pySim/transport/modem_atcmd.py
+++ b/pySim/transport/modem_atcmd.py
@@ -170,5 +170,5 @@
log.debug('Command response: %s, %s', data, sw)
return data, sw

- def __str__(self):
+ def __str__(self) -> str:
return "modem:%s" % self._device
diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py
index 41c4c19..c7b5878 100644
--- a/pySim/transport/pcsc.py
+++ b/pySim/transport/pcsc.py
@@ -93,5 +93,5 @@
# Return value
return i2h(data), i2h(sw)

- def __str__(self):
+ def __str__(self) -> str:
return "PCSC:%u[%s]" % (self._reader_number, self._reader)
diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py
index f4b1621..e5f7bdb 100644
--- a/pySim/transport/serial.py
+++ b/pySim/transport/serial.py
@@ -237,5 +237,5 @@
# Return value
return b2h(data), b2h(sw)

- def __str__(self):
+ def __str__(self) -> str:
return "serial:%s" % (self._sl.name)

To view, visit change 34696. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I26d3d2714708dbe957704b60d17ba2afa325b2c4
Gerrit-Change-Number: 34696
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged