From 6dd8f56ab1220fa5b9883356ba9829eecb2114cd Mon Sep 17 00:00:00 2001 From: Piotr Bartman-Szwarc Date: Thu, 15 Aug 2024 13:34:27 +0200 Subject: [PATCH] q-dev: unify protocol --- qubes/device_protocol.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qubes/device_protocol.py b/qubes/device_protocol.py index 22078ab19..c23208a9e 100644 --- a/qubes/device_protocol.py +++ b/qubes/device_protocol.py @@ -272,8 +272,13 @@ def from_qarg( return cls._parse(representation, devclass, get_domain, '+') @classmethod - def from_str(cls, representation: str, devclass, domains) -> 'Port': - get_domain = domains.get + def from_str( + cls, representation: str, devclass, domains, blind=False + ) -> 'Port': + if blind: + get_domain = domains.get_blind + else: + get_domain = domains.__getitem__ return cls._parse(representation, devclass, get_domain, ':') @classmethod @@ -438,10 +443,13 @@ def from_qarg( @classmethod def from_str( cls, representation: str, devclass: Optional[str], domains, - backend=None + blind=False, backend=None ) -> 'Device': if backend is None: - get_domain = domains.get + if blind: + get_domain = domains.get_blind + else: + get_domain = domains.__getitem__ else: get_domain = None return cls._parse(representation, devclass, get_domain, backend, ':')