3535import sys
3636import typing
3737from enum import Enum
38- from typing import Optional , Any
38+ from typing import Any
3939from collections .abc import Callable
4040
4141import qubesadmin .exc
@@ -176,7 +176,7 @@ def pack_property(cls, key: str, value: str | None):
176176
177177 @staticmethod
178178 def parse_basic_device_properties (
179- expected_device : " VirtualDevice" , properties : dict [str , Any ]
179+ expected_device : VirtualDevice , properties : dict [str , Any ]
180180 ):
181181 """
182182 Validates properties against an expected port configuration.
@@ -330,7 +330,7 @@ def backend_name(self) -> str:
330330 @classmethod
331331 def from_qarg (
332332 cls , representation : str , devclass , domains , blind = False
333- ) -> " Port" :
333+ ) -> Port :
334334 """
335335 Parse qrexec argument <back_vm>+<port_id> to retrieve Port.
336336 """
@@ -343,7 +343,7 @@ def from_qarg(
343343 @classmethod
344344 def from_str (
345345 cls , representation : str , devclass , domains , blind = False
346- ) -> " Port" :
346+ ) -> Port :
347347 """
348348 Parse string <back_vm>:<port_id> to retrieve Port.
349349 """
@@ -356,7 +356,7 @@ def from_str(
356356 @classmethod
357357 def _parse (
358358 cls , representation : str , devclass : str , get_domain : Callable , sep : str
359- ) -> " Port" :
359+ ) -> Port :
360360 """
361361 Parse string representation and return instance of Port.
362362 """
@@ -427,7 +427,7 @@ def __init__(
427427 self .port : Port | None = port # type: ignore
428428 self ._device_id = device_id
429429
430- def clone (self , ** kwargs ) -> " VirtualDevice" :
430+ def clone (self , ** kwargs ) -> VirtualDevice :
431431 """
432432 Clone object and substitute attributes with explicitly given.
433433 """
@@ -567,7 +567,7 @@ def from_qarg(
567567 domains ,
568568 blind : bool = False ,
569569 backend : QubesVM | None = None ,
570- ) -> " VirtualDevice" :
570+ ) -> VirtualDevice :
571571 """
572572 Parse qrexec argument <back_vm>+<port_id>:<device_id> to get device info
573573 """
@@ -588,7 +588,7 @@ def from_str(
588588 domains ,
589589 blind : bool = False ,
590590 backend : QubesVM | None = None ,
591- ) -> " VirtualDevice" :
591+ ) -> VirtualDevice :
592592 """
593593 Parse string <back_vm>+<port_id>:<device_id> to get device info
594594 """
@@ -609,7 +609,7 @@ def _parse(
609609 get_domain : Callable ,
610610 backend : QubesVM | None ,
611611 sep : str ,
612- ) -> " VirtualDevice" :
612+ ) -> VirtualDevice :
613613 """
614614 Parse string representation and return instance of VirtualDevice.
615615 """
@@ -691,7 +691,7 @@ class DeviceCategory(Enum):
691691 PCI_USB = ("p0c03**" ,)
692692
693693 @staticmethod
694- def from_str (interface_encoding : str ) -> " DeviceCategory" :
694+ def from_str (interface_encoding : str ) -> DeviceCategory :
695695 """
696696 Returns `DeviceCategory` from data encoded in string.
697697 """
@@ -773,12 +773,12 @@ def category(self) -> DeviceCategory:
773773 return self ._category
774774
775775 @classmethod
776- def unknown (cls ) -> " DeviceInterface" :
776+ def unknown (cls ) -> DeviceInterface :
777777 """Value for unknown device interface."""
778778 return cls ("?******" )
779779
780780 @staticmethod
781- def from_str_bulk (interfaces : str | None ) -> list [" DeviceInterface" ]:
781+ def from_str_bulk (interfaces : str | None ) -> list [DeviceInterface ]:
782782 """Interprets string of interfaces as list of `DeviceInterface`.
783783
784784 Examples:
@@ -885,7 +885,7 @@ def _load_classes(bus: str):
885885
886886 return result
887887
888- def matches (self , other : " DeviceInterface" ) -> bool :
888+ def matches (self , other : DeviceInterface ) -> bool :
889889 """
890890 Check if this `DeviceInterface` (pattern) matches given one.
891891
@@ -920,7 +920,7 @@ def __init__(
920920 name : str | None = None ,
921921 serial : str | None = None ,
922922 interfaces : list [DeviceInterface ] | None = None ,
923- parent : Optional [ " DeviceInfo" ] = None ,
923+ parent : DeviceInfo | None = None ,
924924 attachment : QubesVM | None = None ,
925925 device_id : str | None = None ,
926926 ** kwargs ,
@@ -1137,7 +1137,7 @@ def deserialize(
11371137 serialization : bytes ,
11381138 expected_backend_domain : QubesVM ,
11391139 expected_devclass : str | None = None ,
1140- ) -> " DeviceInfo" :
1140+ ) -> DeviceInfo :
11411141 """
11421142 Recovers a serialized object, see: :py:meth:`serialize`.
11431143 """
@@ -1161,7 +1161,7 @@ def deserialize(
11611161 @classmethod
11621162 def _deserialize (
11631163 cls , untrusted_serialization : bytes , expected_device : VirtualDevice
1164- ) -> " DeviceInfo" :
1164+ ) -> DeviceInfo :
11651165 """
11661166 Actually deserializes the object.
11671167 """
@@ -1228,7 +1228,7 @@ class UnknownDevice(DeviceInfo):
12281228 """Unknown device - for example, exposed by domain not running currently"""
12291229
12301230 @staticmethod
1231- def from_device (device : VirtualDevice ) -> " UnknownDevice" :
1231+ def from_device (device : VirtualDevice ) -> UnknownDevice :
12321232 """
12331233 Return `UnknownDevice` based on any virtual device.
12341234 """
@@ -1279,7 +1279,7 @@ def new(
12791279 frontend_domain : QubesVM | None = None ,
12801280 options = None ,
12811281 mode : str | AssignmentMode = "manual" ,
1282- ) -> " DeviceAssignment" :
1282+ ) -> DeviceAssignment :
12831283 """Helper method to create a DeviceAssignment object."""
12841284 return cls (
12851285 VirtualDevice (Port (backend_domain , port_id , devclass ), device_id ),
@@ -1484,7 +1484,7 @@ def deserialize(
14841484 cls ,
14851485 serialization : bytes ,
14861486 expected_device : VirtualDevice ,
1487- ) -> " DeviceAssignment" :
1487+ ) -> DeviceAssignment :
14881488 """
14891489 Recovers a serialized object, see: :py:meth:`serialize`.
14901490 """
@@ -1499,7 +1499,7 @@ def _deserialize(
14991499 cls ,
15001500 untrusted_serialization : bytes ,
15011501 expected_device : VirtualDevice ,
1502- ) -> " DeviceAssignment" :
1502+ ) -> DeviceAssignment :
15031503 """
15041504 Actually deserializes the object.
15051505 """
0 commit comments