From: Sebastian Wagner Date: Mon, 16 Sep 2019 13:41:07 +0000 (+0200) Subject: make check fixes X-Git-Tag: v15.1.0~737^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=07121b9b4f13dc458b5c6dc8462b45b6bfcd28b1;p=ceph.git make check fixes Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/ansible/ansible_runner_svc.py b/src/pybind/mgr/ansible/ansible_runner_svc.py index 116136c615303..70355eab2bf12 100644 --- a/src/pybind/mgr/ansible/ansible_runner_svc.py +++ b/src/pybind/mgr/ansible/ansible_runner_svc.py @@ -7,7 +7,10 @@ import re from functools import wraps import collections import logging -from typing import Optional +try: + from typing import Optional +except ImportError: + pass # just for type checking import requests from orchestrator import OrchestratorError diff --git a/src/pybind/mgr/ansible/module.py b/src/pybind/mgr/ansible/module.py index 05c86214c673b..ba58cecb90b7d 100644 --- a/src/pybind/mgr/ansible/module.py +++ b/src/pybind/mgr/ansible/module.py @@ -10,8 +10,12 @@ import json import os import errno import tempfile -from typing import List, Any, Optional, Callable, Tuple, TypeVar -T = TypeVar('T') + +try: + from typing import List, Optional, Callable +except ImportError: + pass # just for type checking + import requests @@ -66,7 +70,7 @@ URL_GET_HOSTS = "api/v1/hosts" def deferred(f): - # type: (Callable[..., T]) -> Callable[..., orchestrator.Completion[T]] + # type: (Callable) -> Callable[..., orchestrator.Completion] """ Decorator to make RookOrchestrator methods return a completion object that executes themselves. diff --git a/src/pybind/mgr/tests/test_orchestrator.py b/src/pybind/mgr/tests/test_orchestrator.py index ff4d71ca0dc00..fb4dd3e56c05f 100644 --- a/src/pybind/mgr/tests/test_orchestrator.py +++ b/src/pybind/mgr/tests/test_orchestrator.py @@ -1,6 +1,11 @@ from __future__ import absolute_import import json -from unittest.mock import MagicMock + +try: + from unittest.mock import MagicMock +except ImportError: + # py2 + from mock import MagicMock import pytest