From bb4fad27927c6fba2c6231d136661da050f6f5c6 Mon Sep 17 00:00:00 2001 From: kong wei Date: Wed, 21 Dec 2016 00:46:58 +0000 Subject: There are some flake8 errors. Clear them before other work. Change-Id: Ied9ce8cd0d3c3537c34713ea26cc596914caca85 Signed-off-by: kongwei --- api/escalator/api/v1/__init__.py | 1 - api/escalator/cmd/api.py | 2 -- api/escalator/common/utils.py | 16 +++++----------- api/escalator/common/wsgi.py | 10 +--------- api/escalator/i18n.py | 2 +- client/escalatorclient/common/base.py | 5 ++--- client/escalatorclient/shell.py | 3 ++- client/escalatorclient/v1/shell.py | 4 ---- docs/design/etc/conf.py | 6 +----- docs/etc/conf.py | 6 +----- docs/gap_analysis/etc/conf.py | 6 +----- docs/requirements/etc/conf.py | 6 +----- 12 files changed, 15 insertions(+), 52 deletions(-) diff --git a/api/escalator/api/v1/__init__.py b/api/escalator/api/v1/__init__.py index 151165a..31285c4 100644 --- a/api/escalator/api/v1/__init__.py +++ b/api/escalator/api/v1/__init__.py @@ -12,4 +12,3 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - diff --git a/api/escalator/cmd/api.py b/api/escalator/cmd/api.py index 7b29589..a0f63dc 100644 --- a/api/escalator/cmd/api.py +++ b/api/escalator/cmd/api.py @@ -32,9 +32,7 @@ from oslo_log import log as logging import osprofiler.notifier import osprofiler.web -from escalator.common import utils from escalator.common import config -from escalator.common import exception from escalator.common import wsgi from escalator import notifier diff --git a/api/escalator/common/utils.py b/api/escalator/common/utils.py index ccdc7f8..6cb1784 100644 --- a/api/escalator/common/utils.py +++ b/api/escalator/common/utils.py @@ -43,15 +43,10 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import encodeutils from oslo_utils import excutils -from oslo_utils import netutils -from oslo_utils import strutils import six from webob import exc -import ConfigParser - from escalator.common import exception from escalator import i18n -# from providerclient.v1 import client as provider_client CONF = cfg.CONF @@ -666,9 +661,11 @@ def ip_into_int(ip): def int_into_ip(num): - inter_ip = lambda x: '.'.join( - [str(x / (256 ** i) % 256) for i in range(3, -1, -1)]) - return inter_ip(num) + s = [] + for i in range(4): + s.append(str(num % 256)) + num /= 256 + return '.'.join(s[::-1]) def is_ip_in_cidr(ip, cidr): @@ -939,6 +936,3 @@ def translate_marks_4_sed_command(ori_str): translated_str = translated_str.\ replace(translated_mark, translated_marks[translated_mark]) return translated_str - - - diff --git a/api/escalator/common/wsgi.py b/api/escalator/common/wsgi.py index c4e8bfd..8884ea4 100644 --- a/api/escalator/common/wsgi.py +++ b/api/escalator/common/wsgi.py @@ -232,12 +232,9 @@ def get_asynchronous_eventlet_pool(size=1000): class Server(object): """Server class to manage multiple WSGI sockets and applications. - - This class requires initialize_escalator_store set to True if - escalator store needs to be initialized. """ - def __init__(self, threads=1000, initialize_escalator_store=False): + def __init__(self, threads=1000): os.umask(0o27) # ensure files are created with the correct privileges self._logger = logging.getLogger("eventlet.wsgi.server") self._wsgi_logger = loggers.WritableLogger(self._logger) @@ -245,9 +242,6 @@ class Server(object): self.children = set() self.stale_children = set() self.running = True - # NOTE(abhishek): Allows us to only re-initialize escalator_store when - # the API's configuration reloads. - self.initialize_escalator_store = initialize_escalator_store self.pgid = os.getpid() try: # NOTE(flaper87): Make sure this process @@ -362,8 +356,6 @@ class Server(object): """ eventlet.wsgi.MAX_HEADER_LINE = CONF.max_header_line self.configure_socket(old_conf, has_changed) - if self.initialize_escalator_store: - initialize_escalator_store() def reload(self): """ diff --git a/api/escalator/i18n.py b/api/escalator/i18n.py index 02384a5..56bfde3 100644 --- a/api/escalator/i18n.py +++ b/api/escalator/i18n.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_i18n import * # noqa +from oslo_i18n import TranslatorFactory # noqa _translators = TranslatorFactory(domain='escalator') diff --git a/client/escalatorclient/common/base.py b/client/escalatorclient/common/base.py index 329ca6b..b85dc19 100644 --- a/client/escalatorclient/common/base.py +++ b/client/escalatorclient/common/base.py @@ -25,9 +25,8 @@ import warnings from escalatorclient.openstack.common.apiclient import base -warnings.warn("The 'escalatorclient.common.base' module is deprecated post " - "v.0.12.0. Use 'escalatorclient.openstack.common.apiclient.base' " - "instead of this one.", DeprecationWarning) +warnings.warn("The 'escalatorclient.common.base' module is deprecated", + DeprecationWarning) getid = base.getid diff --git a/client/escalatorclient/shell.py b/client/escalatorclient/shell.py index 8f452b0..782106c 100644 --- a/client/escalatorclient/shell.py +++ b/client/escalatorclient/shell.py @@ -280,7 +280,8 @@ class escalatorShell(object): 'escalator, it is specified in paste ' 'configuration file at ' '/etc/escalator/api-paste.ini and ' - '/etc/escalator/registry-paste.ini. Without key ' + '/etc/escalator/registry-paste.ini. ' + 'Without key ' 'the profiling will not be triggered even ' 'if osprofiler is enabled on server side.') diff --git a/client/escalatorclient/v1/shell.py b/client/escalatorclient/v1/shell.py index 9f9ea4f..f926a8a 100644 --- a/client/escalatorclient/v1/shell.py +++ b/client/escalatorclient/v1/shell.py @@ -17,10 +17,6 @@ from __future__ import print_function import copy import functools -import pprint -import os -import json - from oslo_utils import encodeutils from oslo_utils import strutils import escalatorclient.v1.versions diff --git a/docs/design/etc/conf.py b/docs/design/etc/conf.py index 8baaf78..c933038 100644 --- a/docs/design/etc/conf.py +++ b/docs/design/etc/conf.py @@ -12,8 +12,6 @@ # limitations under the License. import datetime -import sys -import os try: __import__('imp').find_module('sphinx.ext.numfig') @@ -33,9 +31,7 @@ html_use_index = False pdf_documents = [('index', u'OPNFV', u'OPNFV Project', u'OPNFV')] pdf_fit_mode = "shrink" -pdf_stylesheets = ['sphinx','kerning','a4'] -#latex_domain_indices = False -#latex_use_modindex = False +pdf_stylesheets = ['sphinx', 'kerning', 'a4'] latex_elements = { 'printindex': '', diff --git a/docs/etc/conf.py b/docs/etc/conf.py index acc00ca..e2579d9 100644 --- a/docs/etc/conf.py +++ b/docs/etc/conf.py @@ -13,8 +13,6 @@ import datetime -import sys -import os try: __import__('imp').find_module('sphinx.ext.numfig') @@ -34,9 +32,7 @@ html_use_index = False pdf_documents = [('index', u'OPNFV', u'OPNFV Project', u'OPNFV')] pdf_fit_mode = "shrink" -pdf_stylesheets = ['sphinx','kerning','a4'] -#latex_domain_indices = False -#latex_use_modindex = False +pdf_stylesheets = ['sphinx', 'kerning', 'a4'] latex_elements = { 'printindex': '', diff --git a/docs/gap_analysis/etc/conf.py b/docs/gap_analysis/etc/conf.py index 8baaf78..c933038 100644 --- a/docs/gap_analysis/etc/conf.py +++ b/docs/gap_analysis/etc/conf.py @@ -12,8 +12,6 @@ # limitations under the License. import datetime -import sys -import os try: __import__('imp').find_module('sphinx.ext.numfig') @@ -33,9 +31,7 @@ html_use_index = False pdf_documents = [('index', u'OPNFV', u'OPNFV Project', u'OPNFV')] pdf_fit_mode = "shrink" -pdf_stylesheets = ['sphinx','kerning','a4'] -#latex_domain_indices = False -#latex_use_modindex = False +pdf_stylesheets = ['sphinx', 'kerning', 'a4'] latex_elements = { 'printindex': '', diff --git a/docs/requirements/etc/conf.py b/docs/requirements/etc/conf.py index 8baaf78..c933038 100644 --- a/docs/requirements/etc/conf.py +++ b/docs/requirements/etc/conf.py @@ -12,8 +12,6 @@ # limitations under the License. import datetime -import sys -import os try: __import__('imp').find_module('sphinx.ext.numfig') @@ -33,9 +31,7 @@ html_use_index = False pdf_documents = [('index', u'OPNFV', u'OPNFV Project', u'OPNFV')] pdf_fit_mode = "shrink" -pdf_stylesheets = ['sphinx','kerning','a4'] -#latex_domain_indices = False -#latex_use_modindex = False +pdf_stylesheets = ['sphinx', 'kerning', 'a4'] latex_elements = { 'printindex': '', -- cgit 1.2.3-korg