From: Sebastian Wagner Date: Wed, 29 Apr 2020 11:22:22 +0000 (+0200) Subject: python-common: Fix wrong type annotation X-Git-Tag: v16.1.0~2452^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34824%2Fhead;p=ceph.git python-common: Fix wrong type annotation Signed-off-by: Sebastian Wagner --- diff --git a/src/python-common/ceph/deployment/drive_selection/selector.py b/src/python-common/ceph/deployment/drive_selection/selector.py index ff71803003ab..cdc21caa52ff 100644 --- a/src/python-common/ceph/deployment/drive_selection/selector.py +++ b/src/python-common/ceph/deployment/drive_selection/selector.py @@ -5,9 +5,7 @@ try: except ImportError: pass -from ceph.deployment.inventory import Device - -from ..inventory import Devices +from ..inventory import Device from ..drive_group import DriveGroupSpec, DeviceSelection from .filter import FilterGenerator @@ -18,7 +16,7 @@ logger = logging.getLogger(__name__) class DriveSelection(object): def __init__(self, spec, # type: DriveGroupSpec - disks, # type: Devices + disks, # type: List[Device] ): self.disks = disks.copy() self.spec = spec diff --git a/src/python-common/ceph/deployment/inventory.py b/src/python-common/ceph/deployment/inventory.py index 361adf3c3684..94dcb5024b5b 100644 --- a/src/python-common/ceph/deployment/inventory.py +++ b/src/python-common/ceph/deployment/inventory.py @@ -28,6 +28,7 @@ class Devices(object): return cls([Device.from_json(i) for i in input]) def copy(self): + # type: () -> Devices return Devices(devices=list(self.devices)) diff --git a/src/python-common/ceph/tests/utils.py b/src/python-common/ceph/tests/utils.py index 2d714a6b2038..ebba43094bc1 100644 --- a/src/python-common/ceph/tests/utils.py +++ b/src/python-common/ceph/tests/utils.py @@ -1,5 +1,10 @@ from ceph.deployment.inventory import Devices, Device +try: + from typing import Any, List +except ImportError: + pass # for type checking + def _mk_device(rotational=True, locked=False, @@ -29,6 +34,7 @@ def _mk_device(rotational=True, def _mk_inventory(devices): + # type: (Any) -> List[Device] devs = [] for dev_, name in zip(devices, map(chr, range(ord('a'), ord('z')))): dev = Device.from_json(dev_.to_json())