Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Fix imports in serialize.py
Browse files Browse the repository at this point in the history
- We don't need the try catch anymore on modern Python
  • Loading branch information
kalkin committed Jun 27, 2017
1 parent 147cc67 commit b353162
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions qubesdbus/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,16 @@
''' Collection of serialization helpers '''

import re
from typing import Any, Dict, List

import dbus

import qubesadmin
import qubesadmin.devices as devices
from qubesadmin.devices import DeviceCollection, DeviceInfo
import qubesadmin.vm

try:
# Check mypy dependencies. pylint: disable=ungrouped-imports,unused-import
from typing import Any, Callable, Tuple, List, Dict
from qubesadmin.vm import QubesVM
from qubesadmin import Qubes
from qubesadmin.label import Label
except ImportError:
pass
from qubesadmin.label import Label
from qubesadmin.vm import QubesVM
from qubesadmin.devices import DeviceInfo

DOMAIN_STATE_PROPERTIES = ['is_halted',
'is_paused',
Expand Down Expand Up @@ -131,9 +127,9 @@ def serialize_val(value):
return label_path(value)
elif isinstance(value, qubesadmin.vm.QubesVM):
return domain_path(value)
elif isinstance(value, devices.DeviceCollection):
elif isinstance(value, DeviceCollection):
return dbus.Array(device_collection_data(value), signature='a{sv}')
elif isinstance(value, devices.DeviceInfo):
elif isinstance(value, DeviceInfo):
return dbus.Dictionary(device_data(value), signature='sv')
elif isinstance(value, re._pattern_type):
return dbus.String(value.pattern)
Expand Down

0 comments on commit b353162

Please sign in to comment.