diff --git a/openstack/accelerator/accelerator_service.py b/openstack/accelerator/accelerator_service.py index 9d7f1784a..f8210e23e 100644 --- a/openstack/accelerator/accelerator_service.py +++ b/openstack/accelerator/accelerator_service.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import service_description from openstack.accelerator.v2 import _proxy as _proxy_v2 +from openstack import service_description class AcceleratorService(service_description.ServiceDescription): diff --git a/openstack/accelerator/v2/_proxy.py b/openstack/accelerator/v2/_proxy.py index 480c873b5..5f54b631b 100644 --- a/openstack/accelerator/v2/_proxy.py +++ b/openstack/accelerator/v2/_proxy.py @@ -9,11 +9,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack import proxy + +from openstack.accelerator.v2 import accelerator_request as _arq from openstack.accelerator.v2 import deployable as _deployable from openstack.accelerator.v2 import device as _device from openstack.accelerator.v2 import device_profile as _device_profile -from openstack.accelerator.v2 import accelerator_request as _arq +from openstack import proxy class Proxy(proxy.Proxy): diff --git a/openstack/accelerator/v2/accelerator_request.py b/openstack/accelerator/v2/accelerator_request.py index 1453544be..1be505883 100644 --- a/openstack/accelerator/v2/accelerator_request.py +++ b/openstack/accelerator/v2/accelerator_request.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import resource from openstack import exceptions +from openstack import resource class AcceleratorRequest(resource.Resource): diff --git a/openstack/baremetal/baremetal_service.py b/openstack/baremetal/baremetal_service.py index 0b0cb818a..5bbecf6bd 100644 --- a/openstack/baremetal/baremetal_service.py +++ b/openstack/baremetal/baremetal_service.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import service_description from openstack.baremetal.v1 import _proxy +from openstack import service_description class BaremetalService(service_description.ServiceDescription): diff --git a/openstack/baremetal/v1/_proxy.py b/openstack/baremetal/v1/_proxy.py index 0fb8a4978..6ac6728e3 100644 --- a/openstack/baremetal/v1/_proxy.py +++ b/openstack/baremetal/v1/_proxy.py @@ -13,15 +13,14 @@ from openstack.baremetal.v1 import _common from openstack.baremetal.v1 import allocation as _allocation from openstack.baremetal.v1 import chassis as _chassis +from openstack.baremetal.v1 import conductor as _conductor +from openstack.baremetal.v1 import deploy_templates as _deploytemplates from openstack.baremetal.v1 import driver as _driver from openstack.baremetal.v1 import node as _node from openstack.baremetal.v1 import port as _port from openstack.baremetal.v1 import port_group as _portgroup from openstack.baremetal.v1 import volume_connector as _volumeconnector from openstack.baremetal.v1 import volume_target as _volumetarget -from openstack.baremetal.v1 import deploy_templates as _deploytemplates -from openstack.baremetal.v1 import conductor as _conductor - from openstack import exceptions from openstack import proxy from openstack import utils diff --git a/openstack/baremetal_introspection/baremetal_introspection_service.py b/openstack/baremetal_introspection/baremetal_introspection_service.py index aec3adbab..acbdaa894 100644 --- a/openstack/baremetal_introspection/baremetal_introspection_service.py +++ b/openstack/baremetal_introspection/baremetal_introspection_service.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import service_description from openstack.baremetal_introspection.v1 import _proxy +from openstack import service_description class BaremetalIntrospectionService(service_description.ServiceDescription): diff --git a/openstack/cloud/_baremetal.py b/openstack/cloud/_baremetal.py index 8e8986cce..c3c413571 100644 --- a/openstack/cloud/_baremetal.py +++ b/openstack/cloud/_baremetal.py @@ -13,13 +13,14 @@ # import types so that we can reference ListType in sphinx param declarations. # We can't just use list, because sphinx gets confused by # openstack.resource.Resource.list and openstack.resource2.Resource.list -import jsonpatch import types # noqa import warnings -from openstack.cloud import exc +import jsonpatch + from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import utils diff --git a/openstack/cloud/_block_storage.py b/openstack/cloud/_block_storage.py index 870f0f059..dc6fd140f 100644 --- a/openstack/cloud/_block_storage.py +++ b/openstack/cloud/_block_storage.py @@ -16,9 +16,9 @@ import types # noqa import warnings -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import proxy from openstack import utils diff --git a/openstack/cloud/_clustering.py b/openstack/cloud/_clustering.py index ca45befde..b7aa60b01 100644 --- a/openstack/cloud/_clustering.py +++ b/openstack/cloud/_clustering.py @@ -15,9 +15,9 @@ # openstack.resource.Resource.list and openstack.resource2.Resource.list import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import utils diff --git a/openstack/cloud/_coe.py b/openstack/cloud/_coe.py index 08d6a52a9..3778341c2 100644 --- a/openstack/cloud/_coe.py +++ b/openstack/cloud/_coe.py @@ -15,9 +15,9 @@ # openstack.resource.Resource.list and openstack.resource2.Resource.list import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc class CoeCloudMixin(_normalize.Normalizer): diff --git a/openstack/cloud/_compute.py b/openstack/cloud/_compute.py index 15b93658b..8bee8f90b 100644 --- a/openstack/cloud/_compute.py +++ b/openstack/cloud/_compute.py @@ -16,16 +16,17 @@ import base64 import datetime import functools -import iso8601 import operator import threading import time import types # noqa -from openstack.cloud import exc -from openstack.cloud import meta +import iso8601 + from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud import meta from openstack import exceptions from openstack import proxy from openstack import utils diff --git a/openstack/cloud/_dns.py b/openstack/cloud/_dns.py index 8c4ce4427..bb534215a 100644 --- a/openstack/cloud/_dns.py +++ b/openstack/cloud/_dns.py @@ -15,11 +15,11 @@ # openstack.resource.Resource.list and openstack.resource2.Resource.list import types # noqa -from openstack import exceptions -from openstack import resource -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc +from openstack import exceptions +from openstack import resource class DnsCloudMixin(_normalize.Normalizer): diff --git a/openstack/cloud/_floating_ip.py b/openstack/cloud/_floating_ip.py index bca6cdd5e..5519ace67 100644 --- a/openstack/cloud/_floating_ip.py +++ b/openstack/cloud/_floating_ip.py @@ -19,10 +19,10 @@ import threading import time import types # noqa -from openstack.cloud import exc -from openstack.cloud import meta from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud import meta from openstack import exceptions from openstack import proxy from openstack import utils diff --git a/openstack/cloud/_identity.py b/openstack/cloud/_identity.py index 4a9a9bfcd..3864ff3c5 100644 --- a/openstack/cloud/_identity.py +++ b/openstack/cloud/_identity.py @@ -17,9 +17,9 @@ import types # noqa import munch -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import utils diff --git a/openstack/cloud/_image.py b/openstack/cloud/_image.py index 53265d9e1..a74ec64dd 100644 --- a/openstack/cloud/_image.py +++ b/openstack/cloud/_image.py @@ -15,9 +15,9 @@ # openstack.resource.Resource.list and openstack.resource2.Resource.list import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import utils diff --git a/openstack/cloud/_network.py b/openstack/cloud/_network.py index 16e78fb41..0200e3d83 100644 --- a/openstack/cloud/_network.py +++ b/openstack/cloud/_network.py @@ -13,13 +13,13 @@ # import types so that we can reference ListType in sphinx param declarations. # We can't just use list, because sphinx gets confused by # openstack.resource.Resource.list and openstack.resource2.Resource.list -import time import threading +import time import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import exceptions from openstack import proxy diff --git a/openstack/cloud/_network_common.py b/openstack/cloud/_network_common.py index 2c2bdd724..e83309403 100644 --- a/openstack/cloud/_network_common.py +++ b/openstack/cloud/_network_common.py @@ -16,8 +16,8 @@ import threading import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize +from openstack.cloud import exc class NetworkCommonCloudMixin(_normalize.Normalizer): diff --git a/openstack/cloud/_normalize.py b/openstack/cloud/_normalize.py index 4cbcd9f85..ea00c9f6d 100644 --- a/openstack/cloud/_normalize.py +++ b/openstack/cloud/_normalize.py @@ -17,6 +17,7 @@ # the sdk resource objects. import datetime + import munch from openstack import resource diff --git a/openstack/cloud/_object_store.py b/openstack/cloud/_object_store.py index e291d0310..829b11db5 100644 --- a/openstack/cloud/_object_store.py +++ b/openstack/cloud/_object_store.py @@ -23,9 +23,9 @@ import urllib.parse import keystoneauth1.exceptions -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import exceptions from openstack import proxy from openstack import utils diff --git a/openstack/cloud/_orchestration.py b/openstack/cloud/_orchestration.py index 5bcc5ae11..eb22825e2 100644 --- a/openstack/cloud/_orchestration.py +++ b/openstack/cloud/_orchestration.py @@ -15,10 +15,10 @@ # openstack.resource.Resource.list and openstack.resource2.Resource.list import types # noqa -from openstack.cloud import exc -from openstack.orchestration.util import event_utils from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.orchestration.util import event_utils def _no_pending_stacks(stacks): diff --git a/openstack/cloud/_security_group.py b/openstack/cloud/_security_group.py index c5ccb369e..496e588f3 100644 --- a/openstack/cloud/_security_group.py +++ b/openstack/cloud/_security_group.py @@ -16,9 +16,9 @@ # import jsonpatch import types # noqa -from openstack.cloud import exc from openstack.cloud import _normalize from openstack.cloud import _utils +from openstack.cloud import exc from openstack import exceptions from openstack import proxy diff --git a/openstack/cloud/_utils.py b/openstack/cloud/_utils.py index e19870986..9c7488087 100644 --- a/openstack/cloud/_utils.py +++ b/openstack/cloud/_utils.py @@ -16,20 +16,21 @@ import contextlib import fnmatch import functools import inspect -import jmespath -import munch -import netifaces import re -import sre_constants import time import uuid from decorator import decorator +import jmespath +import munch +import netifaces +import sre_constants from openstack import _log from openstack.cloud import exc from openstack.cloud import meta + _decorated_methods = [] diff --git a/openstack/cloud/cmd/inventory.py b/openstack/cloud/cmd/inventory.py index 0f1186e5e..450669b1f 100755 --- a/openstack/cloud/cmd/inventory.py +++ b/openstack/cloud/cmd/inventory.py @@ -16,6 +16,7 @@ import argparse import json import sys + import yaml import openstack.cloud diff --git a/openstack/cloud/inventory.py b/openstack/cloud/inventory.py index 32a26821b..f8e9040ba 100644 --- a/openstack/cloud/inventory.py +++ b/openstack/cloud/inventory.py @@ -14,10 +14,10 @@ import functools +from openstack.cloud import _utils from openstack.config import loader from openstack import connection from openstack import exceptions -from openstack.cloud import _utils __all__ = ['OpenStackInventory'] diff --git a/openstack/cloud/meta.py b/openstack/cloud/meta.py index cdd372436..a70d9e2d7 100644 --- a/openstack/cloud/meta.py +++ b/openstack/cloud/meta.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. - -import munch import ipaddress import socket +import munch + from openstack import _log -from openstack import utils from openstack.cloud import exc +from openstack import utils NON_CALLABLES = (str, bool, dict, int, float, list, type(None)) diff --git a/openstack/cloud/openstackcloud.py b/openstack/cloud/openstackcloud.py index bb520a7d1..96e7bca44 100755 --- a/openstack/cloud/openstackcloud.py +++ b/openstack/cloud/openstackcloud.py @@ -19,29 +19,28 @@ import types # noqa import warnings import dogpile.cache +import keystoneauth1.exceptions +import keystoneauth1.session import munch import requests.models import requestsexceptions -import keystoneauth1.exceptions -import keystoneauth1.session - from openstack import _log -from openstack.cloud import exc from openstack.cloud import _floating_ip from openstack.cloud import _object_store -from openstack.cloud import meta from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud import meta import openstack.config from openstack.config import cloud_region as cloud_region_mod from openstack import proxy from openstack import utils + DEFAULT_SERVER_AGE = 5 DEFAULT_PORT_AGE = 5 DEFAULT_FLOAT_AGE = 5 _CONFIG_DOC_URL = _floating_ip._CONFIG_DOC_URL - DEFAULT_OBJECT_SEGMENT_SIZE = _object_store.DEFAULT_OBJECT_SEGMENT_SIZE # This halves the current default for Swift DEFAULT_MAX_FILE_SIZE = _object_store.DEFAULT_MAX_FILE_SIZE diff --git a/openstack/clustering/v1/_async_resource.py b/openstack/clustering/v1/_async_resource.py index cd01ac3fe..819433902 100644 --- a/openstack/clustering/v1/_async_resource.py +++ b/openstack/clustering/v1/_async_resource.py @@ -10,11 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from openstack.clustering.v1 import action as _action from openstack import exceptions from openstack import resource -from openstack.clustering.v1 import action as _action - class AsyncResource(resource.Resource): diff --git a/openstack/clustering/v1/cluster.py b/openstack/clustering/v1/cluster.py index e545080c4..2e8663232 100644 --- a/openstack/clustering/v1/cluster.py +++ b/openstack/clustering/v1/cluster.py @@ -10,11 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from openstack.clustering.v1 import _async_resource from openstack import resource from openstack import utils -from openstack.clustering.v1 import _async_resource - class Cluster(_async_resource.AsyncResource): resource_key = 'cluster' diff --git a/openstack/clustering/v1/node.py b/openstack/clustering/v1/node.py index 7dae01522..c914a7210 100644 --- a/openstack/clustering/v1/node.py +++ b/openstack/clustering/v1/node.py @@ -10,11 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from openstack.clustering.v1 import _async_resource from openstack import resource from openstack import utils -from openstack.clustering.v1 import _async_resource - class Node(_async_resource.AsyncResource): resource_key = 'node' diff --git a/openstack/compute/compute_service.py b/openstack/compute/compute_service.py index 2204f04d4..03397cbe8 100644 --- a/openstack/compute/compute_service.py +++ b/openstack/compute/compute_service.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import service_description from openstack.compute.v2 import _proxy +from openstack import service_description class ComputeService(service_description.ServiceDescription): diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index 5cc6fc187..16160502a 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -9,6 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + import warnings from openstack.compute.v2 import aggregate as _aggregate @@ -23,13 +24,12 @@ from openstack.compute.v2 import server as _server from openstack.compute.v2 import server_diagnostics as _server_diagnostics from openstack.compute.v2 import server_group as _server_group from openstack.compute.v2 import server_interface as _server_interface -from openstack.compute.v2 import ( - server_remote_console as _server_remote_console) from openstack.compute.v2 import server_ip +from openstack.compute.v2 import server_remote_console as _src from openstack.compute.v2 import service as _service from openstack.compute.v2 import volume_attachment as _volume_attachment -from openstack.network.v2 import security_group as _sg from openstack import exceptions +from openstack.network.v2 import security_group as _sg from openstack import proxy from openstack import resource from openstack import utils @@ -1768,7 +1768,7 @@ class Proxy(proxy.Proxy): ServerRemoteConsole` """ server_id = resource.Resource._get_id(server) - return self._create(_server_remote_console.ServerRemoteConsole, + return self._create(_src.ServerRemoteConsole, server_id=server_id, **attrs) def get_server_console_url(self, server, console_type): @@ -1806,7 +1806,7 @@ class Proxy(proxy.Proxy): # historically by OSC. We support it, but do not document either. if utils.supports_microversion(self, '2.6'): console = self._create( - _server_remote_console.ServerRemoteConsole, + _src.ServerRemoteConsole, server_id=server.id, type=console_type, protocol=console_protocol) diff --git a/openstack/compute/v2/server.py b/openstack/compute/v2/server.py index ef027b363..fe492c897 100644 --- a/openstack/compute/v2/server.py +++ b/openstack/compute/v2/server.py @@ -11,8 +11,8 @@ # under the License. from openstack.compute.v2 import metadata -from openstack.image.v2 import image from openstack import exceptions +from openstack.image.v2 import image from openstack import resource from openstack import utils diff --git a/openstack/compute/v2/server_remote_console.py b/openstack/compute/v2/server_remote_console.py index a60c47678..2cafdb9f9 100644 --- a/openstack/compute/v2/server_remote_console.py +++ b/openstack/compute/v2/server_remote_console.py @@ -11,7 +11,6 @@ # under the License. from openstack import resource - from openstack import utils CONSOLE_TYPE_PROTOCOL_MAPPING = { diff --git a/openstack/config/cloud_region.py b/openstack/config/cloud_region.py index 346d38f4c..9e29a811d 100644 --- a/openstack/config/cloud_region.py +++ b/openstack/config/cloud_region.py @@ -14,8 +14,8 @@ import copy import os.path -import warnings import urllib +import warnings from keystoneauth1 import discover import keystoneauth1.exceptions.catalog @@ -36,13 +36,12 @@ try: except ImportError: influxdb = None - -from openstack import version as openstack_version from openstack import _log from openstack.config import _util from openstack.config import defaults as config_defaults from openstack import exceptions from openstack import proxy +from openstack import version as openstack_version _logger = _log.setup_logging('openstack') @@ -53,7 +52,6 @@ SCOPE_KEYS = { 'system_scope' } - # Sentinel for nonexistence _ENOENT = object() diff --git a/openstack/connection.py b/openstack/connection.py index 8b8994941..b00d756be 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -176,6 +176,7 @@ try to find it and if that fails, you would create it:: Additional information about the services can be found in the :ref:`service-proxies` documentation. """ +import concurrent.futures import warnings import weakref @@ -185,20 +186,17 @@ try: except ImportError: # For everyone else import importlib_metadata - -import concurrent.futures import keystoneauth1.exceptions import requestsexceptions from openstack import _log from openstack import _services_mixin -from openstack.cloud import openstackcloud as _cloud from openstack.cloud import _accelerator from openstack.cloud import _baremetal from openstack.cloud import _block_storage -from openstack.cloud import _compute from openstack.cloud import _clustering from openstack.cloud import _coe +from openstack.cloud import _compute from openstack.cloud import _dns from openstack.cloud import _floating_ip from openstack.cloud import _identity @@ -209,6 +207,7 @@ from openstack.cloud import _object_store from openstack.cloud import _orchestration from openstack.cloud import _security_group from openstack.cloud import _shared_file_system +from openstack.cloud import openstackcloud as _cloud from openstack import config as _config from openstack.config import cloud_region from openstack import exceptions diff --git a/openstack/dns/v2/_proxy.py b/openstack/dns/v2/_proxy.py index 980d4c8e4..9fdcb602a 100644 --- a/openstack/dns/v2/_proxy.py +++ b/openstack/dns/v2/_proxy.py @@ -9,13 +9,14 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack import proxy + +from openstack.dns.v2 import floating_ip as _fip from openstack.dns.v2 import recordset as _rs from openstack.dns.v2 import zone as _zone -from openstack.dns.v2 import zone_import as _zone_import from openstack.dns.v2 import zone_export as _zone_export +from openstack.dns.v2 import zone_import as _zone_import from openstack.dns.v2 import zone_transfer as _zone_transfer -from openstack.dns.v2 import floating_ip as _fip +from openstack import proxy class Proxy(proxy.Proxy): diff --git a/openstack/dns/v2/floating_ip.py b/openstack/dns/v2/floating_ip.py index 703b04570..cc7487b43 100644 --- a/openstack/dns/v2/floating_ip.py +++ b/openstack/dns/v2/floating_ip.py @@ -9,9 +9,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack import resource from openstack.dns.v2 import _base +from openstack import resource class FloatingIP(_base.Resource): diff --git a/openstack/dns/v2/recordset.py b/openstack/dns/v2/recordset.py index 3ad5aace9..9688657f9 100644 --- a/openstack/dns/v2/recordset.py +++ b/openstack/dns/v2/recordset.py @@ -9,9 +9,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack import resource from openstack.dns.v2 import _base +from openstack import resource class Recordset(_base.Resource): diff --git a/openstack/dns/v2/zone.py b/openstack/dns/v2/zone.py index ccee3015a..bc8c4c09b 100644 --- a/openstack/dns/v2/zone.py +++ b/openstack/dns/v2/zone.py @@ -9,12 +9,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +from openstack.dns.v2 import _base from openstack import exceptions from openstack import resource from openstack import utils -from openstack.dns.v2 import _base - class Zone(_base.Resource): """DNS ZONE Resource""" diff --git a/openstack/dns/v2/zone_export.py b/openstack/dns/v2/zone_export.py index 1d551235e..d1320e186 100644 --- a/openstack/dns/v2/zone_export.py +++ b/openstack/dns/v2/zone_export.py @@ -9,10 +9,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. -from openstack import exceptions -from openstack import resource from openstack.dns.v2 import _base +from openstack import exceptions +from openstack import resource class ZoneExport(_base.Resource): diff --git a/openstack/dns/v2/zone_import.py b/openstack/dns/v2/zone_import.py index 1f642e00b..8e0ce8cc0 100644 --- a/openstack/dns/v2/zone_import.py +++ b/openstack/dns/v2/zone_import.py @@ -9,10 +9,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. -from openstack import exceptions -from openstack import resource from openstack.dns.v2 import _base +from openstack import exceptions +from openstack import resource class ZoneImport(_base.Resource): diff --git a/openstack/dns/v2/zone_transfer.py b/openstack/dns/v2/zone_transfer.py index 989b6f62f..417df265d 100644 --- a/openstack/dns/v2/zone_transfer.py +++ b/openstack/dns/v2/zone_transfer.py @@ -9,9 +9,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack import resource from openstack.dns.v2 import _base +from openstack import resource class ZoneTransferBase(_base.Resource): diff --git a/openstack/image/image_signer.py b/openstack/image/image_signer.py index 23d294811..c9ef993c3 100644 --- a/openstack/image/image_signer.py +++ b/openstack/image/image_signer.py @@ -11,11 +11,10 @@ # under the License. # - -from cryptography.hazmat.primitives import hashes +from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric import utils -from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import serialization from openstack.image.iterable_chunked_file import IterableChunkedFile diff --git a/openstack/image/v1/image.py b/openstack/image/v1/image.py index c4905abfd..20d66ad8b 100644 --- a/openstack/image/v1/image.py +++ b/openstack/image/v1/image.py @@ -9,8 +9,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack.image import _download + from openstack import exceptions +from openstack.image import _download from openstack import resource diff --git a/openstack/image/v2/_proxy.py b/openstack/image/v2/_proxy.py index 82c0f4350..a11e08f6f 100644 --- a/openstack/image/v2/_proxy.py +++ b/openstack/image/v2/_proxy.py @@ -18,8 +18,8 @@ from openstack.image import _base_proxy from openstack.image.v2 import image as _image from openstack.image.v2 import member as _member from openstack.image.v2 import schema as _schema -from openstack.image.v2 import task as _task from openstack.image.v2 import service_info as _si +from openstack.image.v2 import task as _task from openstack import resource from openstack import utils diff --git a/openstack/key_manager/v1/_format.py b/openstack/key_manager/v1/_format.py index 4ff41efde..56dbca774 100644 --- a/openstack/key_manager/v1/_format.py +++ b/openstack/key_manager/v1/_format.py @@ -10,10 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import format - from urllib import parse +from openstack import format + class HREFToUUID(format.Formatter): diff --git a/openstack/network/v2/firewall_policy.py b/openstack/network/v2/firewall_policy.py index bc4afe484..c8fb70f9d 100644 --- a/openstack/network/v2/firewall_policy.py +++ b/openstack/network/v2/firewall_policy.py @@ -12,8 +12,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from openstack.exceptions import HttpException +from openstack.exceptions import HttpException from openstack import resource from openstack import utils diff --git a/openstack/object_store/v1/_proxy.py b/openstack/object_store/v1/_proxy.py index d0874f96e..7fa36a551 100644 --- a/openstack/object_store/v1/_proxy.py +++ b/openstack/object_store/v1/_proxy.py @@ -19,14 +19,14 @@ import os import time from urllib import parse +from openstack import _log +from openstack.cloud import _utils +from openstack import exceptions from openstack.object_store.v1 import account as _account from openstack.object_store.v1 import container as _container -from openstack.object_store.v1 import obj as _obj from openstack.object_store.v1 import info as _info -from openstack import exceptions -from openstack import _log +from openstack.object_store.v1 import obj as _obj from openstack import proxy -from openstack.cloud import _utils DEFAULT_OBJECT_SEGMENT_SIZE = 1073741824 # 1GB DEFAULT_MAX_FILE_SIZE = (5 * 1024 * 1024 * 1024 + 2) / 2 diff --git a/openstack/orchestration/util/template_format.py b/openstack/orchestration/util/template_format.py index 9b95ef24e..f98e97fbb 100644 --- a/openstack/orchestration/util/template_format.py +++ b/openstack/orchestration/util/template_format.py @@ -11,6 +11,7 @@ # under the License. import json + import yaml if hasattr(yaml, 'CSafeLoader'): diff --git a/openstack/orchestration/util/template_utils.py b/openstack/orchestration/util/template_utils.py index 48213bc46..7280b54d6 100644 --- a/openstack/orchestration/util/template_utils.py +++ b/openstack/orchestration/util/template_utils.py @@ -17,10 +17,10 @@ import json from urllib import parse from urllib import request +from openstack import exceptions from openstack.orchestration.util import environment_format from openstack.orchestration.util import template_format from openstack.orchestration.util import utils -from openstack import exceptions def get_template_contents(template_file=None, template_url=None, diff --git a/openstack/orchestration/v1/_proxy.py b/openstack/orchestration/v1/_proxy.py index a94589ff9..a39f2671a 100644 --- a/openstack/orchestration/v1/_proxy.py +++ b/openstack/orchestration/v1/_proxy.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +from openstack import exceptions +from openstack.orchestration.util import template_utils from openstack.orchestration.v1 import resource as _resource from openstack.orchestration.v1 import software_config as _sc from openstack.orchestration.v1 import software_deployment as _sd @@ -18,8 +20,6 @@ from openstack.orchestration.v1 import stack_environment as _stack_environment from openstack.orchestration.v1 import stack_files as _stack_files from openstack.orchestration.v1 import stack_template as _stack_template from openstack.orchestration.v1 import template as _template -from openstack.orchestration.util import template_utils -from openstack import exceptions from openstack import proxy from openstack import resource diff --git a/openstack/proxy.py b/openstack/proxy.py index e135408d2..baa92205a 100644 --- a/openstack/proxy.py +++ b/openstack/proxy.py @@ -10,14 +10,14 @@ # License for the specific language governing permissions and limitations # under the License. +import urllib + try: import simplejson JSONDecodeError = simplejson.scanner.JSONDecodeError except ImportError: JSONDecodeError = ValueError import iso8601 -import urllib - from keystoneauth1 import adapter from openstack import _log diff --git a/openstack/resource.py b/openstack/resource.py index bfc512c8f..035b08be5 100644 --- a/openstack/resource.py +++ b/openstack/resource.py @@ -34,10 +34,10 @@ and then returned to the caller. import collections import inspect import itertools +import operator import urllib.parse import jsonpatch -import operator from keystoneauth1 import adapter from keystoneauth1 import discover import munch diff --git a/openstack/tests/unit/cloud/test_stack.py b/openstack/tests/unit/cloud/test_stack.py index 1da6381d2..3006b185a 100644 --- a/openstack/tests/unit/cloud/test_stack.py +++ b/openstack/tests/unit/cloud/test_stack.py @@ -256,7 +256,7 @@ class TestStack(base.TestCase): dict(method='GET', uri='{endpoint}/stacks/{name}?{resolve}'.format( endpoint=fakes.ORCHESTRATION_ENDPOINT, - id=self.stack_id, name=self.stack_name, resolve=resolve), + name=self.stack_name, resolve=resolve), status_code=404), ]) diff --git a/test-requirements.txt b/test-requirements.txt index ac8dbedee..3f22c9d11 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=3.1.0,<4.0.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT @@ -15,5 +15,3 @@ statsd>=3.3.0 stestr>=1.0.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT -doc8>=0.8.0 # Apache-2.0 -Pygments>=2.2.0 # BSD license diff --git a/tox.ini b/tox.ini index 6804a88ef..aad741513 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 3.1 +minversion = 3.9.0 envlist = pep8,py38 skipsdist = True ignore_basepython_conflict = True @@ -41,8 +41,14 @@ commands = stestr --test-path ./openstack/tests/functional/{env:OPENSTACKSDK_TES stestr slowest [testenv:pep8] +deps = + hacking>=3.1.0,<4.0.0 # Apache-2.0 + flake8-import-order>=0.17.1 # LGPLv3 + pycodestyle>=2.0.0,<2.7.0 # MIT + Pygments>=2.2.0 # BSD + doc8>=0.8.0 # Apache 2.0 commands = - flake8 + flake8 {posargs} doc8 doc/source README.rst [testenv:venv] @@ -102,18 +108,21 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html [flake8] +application-import-names = openstack # The following are ignored on purpose. It's not super worth it to fix them. # However, if you feel strongly about it, patches will be accepted to fix them # if they fix ALL of the occurances of one and only one of them. # H238 New Style Classes are the default in Python3 -# H306 Is about alphabetical imports - there's a lot to fix. # H4 Are about docstrings and there's just a huge pile of pre-existing issues. # W503 Is supposed to be off by default but in the latest pycodestyle isn't. # Also, both openstacksdk and Donald Knuth disagree with the rule. Line # breaks should occur before the binary operator for readability. -ignore = H238,H306,H4,W503 +ignore = H238,H4,W503 +import-order-style = pep8 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,openstack/_services_mixin.py +per-file-ignores = + openstack/tests/*:H306,I100,I201,I202 [flake8:local-plugins] extension =