From 07121b9b4f13dc458b5c6dc8462b45b6bfcd28b1 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 16 Sep 2019 15:41:07 +0200 Subject: [PATCH] make check fixes Signed-off-by: Sebastian Wagner --- src/pybind/mgr/ansible/ansible_runner_svc.py | 5 ++++- src/pybind/mgr/ansible/module.py | 10 +++++++--- src/pybind/mgr/tests/test_orchestrator.py | 7 ++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/ansible/ansible_runner_svc.py b/src/pybind/mgr/ansible/ansible_runner_svc.py index 116136c6153..70355eab2bf 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 05c86214c67..ba58cecb90b 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 ff4d71ca0dc..fb4dd3e56c0 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 -- 2.39.5