Add pep8 import order check

Set flake8-import-order version to 0.17.1
Full py3 compatible version.
Add all Python3 modules to stdlib list.
Also includes fix to an enum34 dependency bug.

Change-Id: I58dd80fc33942656c69ce67ee523a1d57f693e93
This commit is contained in:
Riccardo Pittau
2020-04-21 16:26:52 +02:00
parent 1b01c94f15
commit ece9f6e25f
7 changed files with 11 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
# Avoid shadowing of system copy module by copy action plugin. # Avoid shadowing of system copy module by copy action plugin.
from __future__ import absolute_import from __future__ import absolute_import
import abc import abc
from copy import deepcopy from copy import deepcopy
import itertools import itertools

View File

@@ -12,12 +12,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from ansible.module_utils.basic import AnsibleModule # noqa
import json import json
import os.path import os.path
import time import time
from ansible.module_utils.basic import AnsibleModule # noqa
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---

View File

@@ -6,3 +6,5 @@ ansible-lint>=3.0.0 # MIT
coverage>=4.5.1 # Apache-2.0 coverage>=4.5.1 # Apache-2.0
flake8>=3.5.0 # MIT flake8>=3.5.0 # MIT
stestr>=1.0.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0
flake8-import-order>=0.17.1 # LGPLv3

View File

@@ -13,13 +13,14 @@
# under the License. # under the License.
from __future__ import absolute_import from __future__ import absolute_import
import copy import copy
import imp import imp
import os import os
import unittest
from ansible.errors import AnsibleActionFail from ansible.errors import AnsibleActionFail
import six import six
import unittest
# Python 2/3 compatibility. # Python 2/3 compatibility.

View File

@@ -13,6 +13,7 @@
# under the License. # under the License.
from __future__ import absolute_import from __future__ import absolute_import
import copy import copy
import imp import imp
import json import json
@@ -21,7 +22,6 @@ import random
from itertools import repeat, chain, cycle from itertools import repeat, chain, cycle
from ansible.module_utils import basic from ansible.module_utils import basic
from tests.utils import ModuleTestCase, set_module_args, AnsibleExitJson, \ from tests.utils import ModuleTestCase, set_module_args, AnsibleExitJson, \
AnsibleFailJson AnsibleFailJson

View File

@@ -1,5 +1,4 @@
import json import json
import unittest import unittest
from ansible.module_utils import basic from ansible.module_utils import basic

View File

@@ -87,3 +87,6 @@ show-source = True
extend-ignore = E123,E125 extend-ignore = E123,E125
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
import-order-style = pep8
application-import-names = tenks
filename = *.py