Skip to content

Commit 6dd8f56

Browse files
committed
q-dev: unify protocol
1 parent fd6e4a8 commit 6dd8f56

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

qubes/device_protocol.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,13 @@ def from_qarg(
272272
return cls._parse(representation, devclass, get_domain, '+')
273273

274274
@classmethod
275-
def from_str(cls, representation: str, devclass, domains) -> 'Port':
276-
get_domain = domains.get
275+
def from_str(
276+
cls, representation: str, devclass, domains, blind=False
277+
) -> 'Port':
278+
if blind:
279+
get_domain = domains.get_blind
280+
else:
281+
get_domain = domains.__getitem__
277282
return cls._parse(representation, devclass, get_domain, ':')
278283

279284
@classmethod
@@ -438,10 +443,13 @@ def from_qarg(
438443
@classmethod
439444
def from_str(
440445
cls, representation: str, devclass: Optional[str], domains,
441-
backend=None
446+
blind=False, backend=None
442447
) -> 'Device':
443448
if backend is None:
444-
get_domain = domains.get
449+
if blind:
450+
get_domain = domains.get_blind
451+
else:
452+
get_domain = domains.__getitem__
445453
else:
446454
get_domain = None
447455
return cls._parse(representation, devclass, get_domain, backend, ':')

0 commit comments

Comments
 (0)