scanner: add the Interface.plainname property

Returns "connection" for the "ei_connection" interface, i.e. the
interface stripped of any component prefix.
This commit is contained in:
Peter Hutterer 2023-05-19 16:09:53 +10:00
parent 708d0f57e8
commit f142f802f4

View file

@ -317,6 +317,16 @@ class Interface:
"""
return Interface.mangle_name(self.protocol_name, self.mode)
@property
def plainname(self) -> str:
"""
Returns the plain name of the interface, i.e. this returns
"pointer", "handshake", etc. without the "ei_" or "eis_" prefix.
"""
if self.protocol_name.startswith("ei_"):
return f"{self.protocol_name[3:]}"
return self.protocol_name
@staticmethod
def mangle_name(name: str, component: str) -> str:
"""