Fix mypy static type checker
mypy was not working. This change: - fixes mypy call in tox.ini and adds mypy job to zuul - fix a couple of errors that mypy found - add import typing as needed to files Implements: blueprint initial-testing Change-Id: I94719f7064c29168721dc37a2148638b927cd2e4
This commit is contained in:
parent
8b2f52e2c6
commit
7c0bc714f1
|
@ -5,3 +5,4 @@ etc/
|
|||
.idea/*
|
||||
kolla_cli.egg-info/*
|
||||
.testrepository
|
||||
.mypy_cache/*
|
||||
|
|
11
.zuul.yaml
11
.zuul.yaml
|
@ -13,12 +13,23 @@
|
|||
tox_envlist: functional
|
||||
timeout: 3600
|
||||
|
||||
- job:
|
||||
name: kollacli-tox-mypy
|
||||
parent: openstack-tox
|
||||
description: |
|
||||
Run static mypy type checker for the OpenStack Kolla-cli project.
|
||||
vars:
|
||||
tox_envlist: mypy
|
||||
timeout: 3600
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- kollacli-tox-mypy
|
||||
- kollacli-tox-functional
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- kollacli-tox-mypy
|
||||
- kollacli-tox-functional
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
from kolla_cli.api.job import Job
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
from copy import copy
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
|
@ -59,7 +63,7 @@ class GroupApi(object):
|
|||
:return: groups
|
||||
:rtype: list of Group objects
|
||||
"""
|
||||
return self._get_groups(None, get_all=True)
|
||||
return self._get_groups([], get_all=True)
|
||||
|
||||
def group_get(self, groupnames):
|
||||
# type: (List[str]) -> List[Group]
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import Dict # noqa
|
||||
from typing import List # noqa
|
||||
|
||||
from copy import copy
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
from kolla_cli.common.passwords import clear_password
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import Dict # noqa
|
||||
from typing import List # noqa
|
||||
|
||||
import logging
|
||||
import yaml
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
from copy import copy
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
|
@ -28,7 +32,7 @@ class ServiceApi(object):
|
|||
:return: services
|
||||
:rtype: List of Service objects
|
||||
"""
|
||||
return self._get_services(None, get_all=True)
|
||||
return self._get_services([], get_all=True)
|
||||
|
||||
def service_get(self, servicenames):
|
||||
# type: (List[str]) -> List[Service]
|
||||
|
@ -92,7 +96,7 @@ class Service(object):
|
|||
|
||||
def __init__(self, servicename, parentnames=[],
|
||||
childnames=[], groupnames=[]):
|
||||
# type: (str, str, List[str], List[str]) -> None
|
||||
# type: (str, List[str], List[str], List[str]) -> None
|
||||
self.name = servicename
|
||||
self._parentnames = parentnames
|
||||
self._childnames = childnames
|
||||
|
@ -108,7 +112,7 @@ class Service(object):
|
|||
return self.name
|
||||
|
||||
def get_parents(self):
|
||||
# type: () -> str
|
||||
# type: () -> List[str]
|
||||
"""Get name of parent services
|
||||
|
||||
:return: parent service names
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
import kolla_cli.i18n as u
|
||||
|
||||
import os
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
from typing import List # noqa
|
||||
|
||||
import logging
|
||||
import os
|
||||
import traceback
|
||||
|
|
|
@ -9,9 +9,11 @@ coverage>=3.6
|
|||
discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
mypy>=0.6; python_version>'2.7'
|
||||
os-testr>=1.0.0 # Apache-2.0
|
||||
pexpect>=4.0.1
|
||||
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||
sphinxcontrib-pecanwsme>=0.8
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.36,!=1.2.0
|
||||
typing>=3.6; python_version>'2.7'
|
||||
|
|
Loading…
Reference in New Issue