Skip to content

Commit

Permalink
q-dev: unify protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Oct 15, 2024
1 parent fd6e4a8 commit 6dd8f56
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions qubes/device_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, ':')
Expand Down

0 comments on commit 6dd8f56

Please sign in to comment.