Reorder imports to match hacking guidelines

Ensure that the imports follow the standard OpenStack hacking
guidelines.

Change-Id: Iaa4326aef118ddfd807dd006934f1d9ca80a1cfa
This commit is contained in:
Darragh Bailey 2014-11-10 13:07:55 +00:00 committed by Wayne Warren
parent 245f643522
commit 8805a34c0f
48 changed files with 213 additions and 133 deletions

View File

@ -16,23 +16,25 @@
# Manage jobs in Jenkins server
import errno
import io
import os
import operator
import hashlib
import yaml
import xml.etree.ElementTree as XML
import jenkins
import re
from pprint import pformat
import io
import logging
import operator
import os
from pprint import pformat
import re
import time
import xml.etree.ElementTree as XML
import yaml
import jenkins
from jenkins_jobs.constants import MAGIC_MANAGE_STRING
from jenkins_jobs.parallel import parallelize
from jenkins_jobs.parser import YamlParser
from jenkins_jobs import utils
logger = logging.getLogger(__name__)
_DEFAULT_TIMEOUT = object()

View File

@ -14,18 +14,22 @@
# under the License.
import argparse
import io
from six.moves import configparser, StringIO, input
import fnmatch
import io
import logging
import os
import platform
import sys
import yaml
import jenkins_jobs.version
from six.moves import configparser
from six.moves import input
from six.moves import StringIO
from jenkins_jobs.builder import Builder
from jenkins_jobs.errors import JenkinsJobsException
import jenkins_jobs.version
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()

View File

@ -95,8 +95,9 @@ character.
import functools
import io
import logging
import re
import os
import re
import yaml
from yaml.constructor import BaseConstructor
from yaml import YAMLObject
@ -106,6 +107,7 @@ try:
except ImportError:
from ordereddict import OrderedDict
logger = logging.getLogger(__name__)

View File

@ -36,21 +36,21 @@ Example::
"""
import logging
import xml.etree.ElementTree as XML
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules import hudson_model
from jenkins_jobs.modules.helpers import cloudformation_init
from jenkins_jobs.modules.helpers import cloudformation_region_dict
from jenkins_jobs.modules.helpers import cloudformation_stack
from jenkins_jobs.modules.helpers import config_file_provider_builder
from jenkins_jobs.modules.helpers import config_file_provider_settings
from jenkins_jobs.modules.helpers import copyartifact_build_selector
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
from jenkins_jobs.errors import (JenkinsJobsException,
MissingAttributeError,
InvalidAttributeError)
import logging
from jenkins_jobs.modules.helpers import copyartifact_build_selector
from jenkins_jobs.modules import hudson_model
logger = logging.getLogger(__name__)

View File

@ -102,6 +102,7 @@ Example:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.xml_config import remove_ignorable_whitespace

View File

@ -12,13 +12,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import xml.etree.ElementTree as XML
import logging
import xml.etree.ElementTree as XML
from six.moves import configparser
from jenkins_jobs.errors import (JenkinsJobsException,
MissingAttributeError,
InvalidAttributeError)
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
def build_trends_publisher(plugin_name, xml_element, data):

View File

@ -68,13 +68,16 @@ Example:
# The global config object is therefore passed down to the registry object,
# and this object is passed to the HipChat() class initialiser.
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
import jenkins_jobs.errors
import logging
import pkg_resources
from six.moves import configparser
import sys
import xml.etree.ElementTree as XML
from six.moves import configparser
import jenkins_jobs.errors
import jenkins_jobs.modules.base
logger = logging.getLogger(__name__)

View File

@ -31,8 +31,8 @@ Example::
expose-to-env: true
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -25,8 +25,9 @@ Jenkins notification plugin.
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.errors import JenkinsJobsException
import jenkins_jobs.modules.base
def http_endpoint(parser, xml_parent, data):

View File

@ -32,11 +32,11 @@ Example::
description: "A parameter named FOO, defaults to 'bar'."
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import copyartifact_build_selector

View File

@ -31,8 +31,8 @@ Example:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -50,6 +50,7 @@ Job example runninng a DSL file from the workspace:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -27,8 +27,8 @@ Example::
project-type: freestyle
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -69,8 +69,8 @@ Example:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -76,10 +76,11 @@ CFP Example:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.modules import hudson_model
from jenkins_jobs.modules.helpers import config_file_provider_settings
from jenkins_jobs.errors import InvalidAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import config_file_provider_settings
from jenkins_jobs.modules import hudson_model
class Maven(jenkins_jobs.modules.base.Base):

View File

@ -50,8 +50,8 @@ Example::
current-parameters: false
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base

View File

@ -47,8 +47,8 @@ Job template example:
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
class Workflow(jenkins_jobs.modules.base.Base):

View File

@ -31,11 +31,12 @@ Example::
url: https://github.com/openstack-infra/jenkins-job-builder/
"""
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.errors import InvalidAttributeError, JenkinsJobsException
import logging
import xml.etree.ElementTree as XML
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
import jenkins_jobs.modules.base
def builds_chain_fingerprinter(parser, xml_parent, data):

View File

@ -25,10 +25,22 @@ the build is complete.
:Entry Point: jenkins_jobs.publishers
"""
import logging
import pkg_resources
import random
import sys
import xml.etree.ElementTree as XML
import six
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules import hudson_model
from jenkins_jobs.modules.helpers import artifactory_common_details
from jenkins_jobs.modules.helpers import artifactory_deployment_patterns
from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns
from jenkins_jobs.modules.helpers import artifactory_optional_props
from jenkins_jobs.modules.helpers import build_trends_publisher
from jenkins_jobs.modules.helpers import cloudformation_init
from jenkins_jobs.modules.helpers import cloudformation_region_dict
@ -36,18 +48,7 @@ from jenkins_jobs.modules.helpers import cloudformation_stack
from jenkins_jobs.modules.helpers import config_file_provider_settings
from jenkins_jobs.modules.helpers import findbugs_settings
from jenkins_jobs.modules.helpers import get_value_from_yaml_or_config_file
from jenkins_jobs.modules.helpers import artifactory_deployment_patterns
from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns
from jenkins_jobs.modules.helpers import artifactory_optional_props
from jenkins_jobs.modules.helpers import artifactory_common_details
from jenkins_jobs.errors import (InvalidAttributeError,
JenkinsJobsException,
MissingAttributeError)
import logging
import pkg_resources
import sys
import six
import random
from jenkins_jobs.modules import hudson_model
def archive(parser, xml_parent, data):

View File

@ -31,12 +31,12 @@ Example::
recipients: breakage@example.com
"""
import xml.etree.ElementTree as XML
from jenkins_jobs.errors import JenkinsJobsException
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import build_trends_publisher
from jenkins_jobs.modules.helpers import findbugs_settings
from jenkins_jobs.errors import JenkinsJobsException
def email(parser, xml_parent, data):

View File

@ -38,11 +38,12 @@ Example of an empty ``scm``:
import logging
import xml.etree.ElementTree as XML
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
from jenkins_jobs.errors import (InvalidAttributeError,
JenkinsJobsException,
MissingAttributeError)
def git(parser, xml_parent, data):

View File

@ -29,16 +29,18 @@ Example::
- timed: '@daily'
"""
import six
import xml.etree.ElementTree as XML
import jenkins_jobs.modules.base
from jenkins_jobs.modules import hudson_model
from jenkins_jobs.errors import (InvalidAttributeError,
JenkinsJobsException,
MissingAttributeError)
import logging
import re
import xml.etree.ElementTree as XML
import six
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.modules import hudson_model
try:
from collections import OrderedDict
except ImportError:

View File

@ -23,19 +23,20 @@ Wrappers can alter the way the build is run as well as the build output.
"""
import logging
import xml.etree.ElementTree as XML
import pkg_resources
import xml.etree.ElementTree as XML
from jenkins_jobs.errors import InvalidAttributeError
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.errors import MissingAttributeError
import jenkins_jobs.modules.base
from jenkins_jobs.errors import (JenkinsJobsException,
InvalidAttributeError,
MissingAttributeError)
from jenkins_jobs.modules.builders import create_builders
from jenkins_jobs.modules.helpers import config_file_provider_builder
from jenkins_jobs.modules.helpers import artifactory_common_details
from jenkins_jobs.modules.helpers import artifactory_repository
from jenkins_jobs.modules.helpers import artifactory_deployment_patterns
from jenkins_jobs.modules.helpers import artifactory_env_vars_patterns
from jenkins_jobs.modules.helpers import artifactory_optional_props
from jenkins_jobs.modules.helpers import artifactory_repository
from jenkins_jobs.modules.helpers import config_file_provider_builder
logger = logging.getLogger(__name__)

View File

@ -22,11 +22,11 @@ import itertools
import logging
import pkg_resources
import jenkins_jobs.local_yaml as local_yaml
from jenkins_jobs.constants import MAGIC_MANAGE_STRING
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.registry import ModuleRegistry
from jenkins_jobs.formatter import deep_format
import jenkins_jobs.local_yaml as local_yaml
from jenkins_jobs.registry import ModuleRegistry
from jenkins_jobs import utils
from jenkins_jobs.xml_config import XmlJob

View File

@ -20,11 +20,15 @@
# :license: BSD, see LICENSE for details.
import re
from sphinx.ext.autodoc import Documenter, FunctionDocumenter
from sphinx.domains.python import PyModulelevel, _pseudo_parse_arglist
from sphinx import addnodes
from sphinx.domains.python import _pseudo_parse_arglist
from sphinx.domains.python import PyModulelevel
from sphinx.ext.autodoc import Documenter
from sphinx.ext.autodoc import FunctionDocumenter
from sphinx.locale import _
yaml_sig_re = re.compile('yaml:\s*(.*)')

View File

@ -17,20 +17,32 @@
# License for the specific language governing permissions and limitations
# under the License.
import doctest
import io
import json
import logging
import operator
import os
import re
import doctest
import logging
import fixtures
import json
import operator
import testtools
from testtools.content import text_content
import xml.etree.ElementTree as XML
import fixtures
from six.moves import configparser
from six.moves import StringIO
import testtools
from testtools.content import text_content
from yaml import safe_dump
from jenkins_jobs.cmd import DEFAULT_CONF
import jenkins_jobs.local_yaml as yaml
from jenkins_jobs.modules import project_externaljob
from jenkins_jobs.modules import project_flow
from jenkins_jobs.modules import project_matrix
from jenkins_jobs.modules import project_maven
from jenkins_jobs.modules import project_multijob
from jenkins_jobs.parser import YamlParser
from jenkins_jobs.xml_config import XmlJob
# This dance deals with the fact that we want unittest.mock if
# we're on Python 3.4 and later, and non-stdlib mock otherwise.
try:
@ -38,16 +50,6 @@ try:
except ImportError:
import mock # noqa
from jenkins_jobs.cmd import DEFAULT_CONF
import jenkins_jobs.local_yaml as yaml
from jenkins_jobs.parser import YamlParser
from jenkins_jobs.xml_config import XmlJob
from jenkins_jobs.modules import (project_flow,
project_matrix,
project_maven,
project_multijob,
project_externaljob)
def get_scenarios(fixtures_path, in_ext='yaml', out_ext='xml',
plugins_info_ext='plugins_info.yaml',

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import jenkins_jobs.builder
from tests.base import LoggingFixture
from tests.base import mock

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import builders
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleBuilders(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -1,4 +1,5 @@
import os
from jenkins_jobs import cmd
from tests.base import mock
from tests.cmd.test_cmd import CmdTestsBase

View File

@ -17,8 +17,8 @@
import os
import six
from jenkins_jobs import cmd
from jenkins_jobs import builder
from jenkins_jobs import cmd
from tests.base import mock
from tests.cmd.test_cmd import CmdTestsBase

View File

@ -1,6 +1,9 @@
import os
from six.moves import configparser, StringIO
from six.moves import configparser
from six.moves import StringIO
import testtools
from jenkins_jobs import cmd
from tests.base import LoggingFixture
from tests.base import mock

View File

@ -15,13 +15,14 @@
import os
from testtools import TestCase, ExpectedException
from testscenarios.testcase import TestWithScenarios
from testtools import ExpectedException
from testtools import TestCase
from jenkins_jobs.errors import JenkinsJobsException
from tests.base import SingleJobTestCase
from tests.base import get_scenarios
from tests.base import mock
from tests.base import SingleJobTestCase
class TestCaseModuleDuplicates(TestWithScenarios,

View File

@ -1,4 +1,5 @@
from testtools import ExpectedException, TestCase
from testtools import ExpectedException
from testtools import TestCase
from jenkins_jobs import errors
from tests.base import LoggingFixture

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import general
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleGeneral(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -13,10 +13,13 @@
# under the License.
import os
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import hipchat_notif
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModulePublishers(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,9 +16,12 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from tests.base import get_scenarios, SingleJobTestCase
from testtools import TestCase
from tests.base import get_scenarios
from tests.base import SingleJobTestCase
class TestCaseModuleJsonParser(TestWithScenarios,

View File

@ -15,14 +15,17 @@
# under the License.
import os
from testscenarios.testcase import TestWithScenarios
from testtools import ExpectedException
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from yaml.composer import ComposerError
from jenkins_jobs import builder
from tests.base import get_scenarios, JsonTestCase, YamlTestCase
from tests.base import get_scenarios
from tests.base import JsonTestCase
from tests.base import LoggingFixture
from tests.base import YamlTestCase
def _exclude_scenarios(input_filename):

View File

@ -16,9 +16,12 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from tests.base import get_scenarios, SingleJobTestCase
from testtools import TestCase
from tests.base import get_scenarios
from tests.base import SingleJobTestCase
class TestCaseModuleSCMMacro(TestWithScenarios, SingleJobTestCase, TestCase):

View File

@ -1,8 +1,10 @@
import testtools as tt
import pkg_resources
from testtools.content import text_content
from six.moves import configparser
from six.moves import StringIO
from testscenarios.testcase import TestWithScenarios
from six.moves import configparser, StringIO
import testtools as tt
from testtools.content import text_content
from jenkins_jobs import cmd
from jenkins_jobs.registry import ModuleRegistry

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import notifications
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleNotifications(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import parameters
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleParameters(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import properties
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleProperties(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import publishers
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModulePublishers(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -15,10 +15,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import reporters
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleReporters(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import scm
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleSCM(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import triggers
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleTriggers(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,10 +16,13 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from testtools import TestCase
from jenkins_jobs.modules import wrappers
from tests.base import get_scenarios, BaseTestCase
from tests.base import BaseTestCase
from tests.base import get_scenarios
class TestCaseModuleWrappers(TestWithScenarios, BaseTestCase, TestCase):

View File

@ -16,9 +16,12 @@
# under the License.
import os
from testtools import TestCase
from testscenarios.testcase import TestWithScenarios
from tests.base import get_scenarios, SingleJobTestCase
from testtools import TestCase
from tests.base import get_scenarios
from tests.base import SingleJobTestCase
class TestCaseModuleYamlInclude(TestWithScenarios,