Enable hacking H301 and disable H304, H302
Enable hacking H301: one import per line. H304 and H302 check enables too, so we temporarily disable it since it does not pass. Fix imports in files below. Add # noqa to migration scripts. Change-Id: I6a8d4dcd9c3195d2848f218aafe304b1240ab60c
This commit is contained in:
parent
870030e1b0
commit
67c79540c7
@ -22,11 +22,11 @@ import copy
|
||||
import eventlet
|
||||
from oslo.config import cfg
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from webob.exc import (HTTPNotFound,
|
||||
HTTPConflict,
|
||||
HTTPBadRequest,
|
||||
HTTPForbidden,
|
||||
HTTPRequestEntityTooLarge)
|
||||
from webob.exc import HTTPBadRequest
|
||||
from webob.exc import HTTPConflict
|
||||
from webob.exc import HTTPForbidden
|
||||
from webob.exc import HTTPNotFound
|
||||
from webob.exc import HTTPRequestEntityTooLarge
|
||||
from webob import Response
|
||||
|
||||
from glance.api import common
|
||||
@ -43,12 +43,12 @@ from glance import notifier
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.openstack.common import strutils
|
||||
import glance.registry.client.v1.api as registry
|
||||
from glance.store import (get_from_backend,
|
||||
get_known_schemes,
|
||||
get_known_stores,
|
||||
get_size_from_backend,
|
||||
get_store_from_location,
|
||||
get_store_from_scheme)
|
||||
from glance.store import get_from_backend
|
||||
from glance.store import get_known_schemes
|
||||
from glance.store import get_known_stores
|
||||
from glance.store import get_size_from_backend
|
||||
from glance.store import get_store_from_location
|
||||
from glance.store import get_store_from_scheme
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
SUPPORTED_PARAMS = glance.api.v1.SUPPORTED_PARAMS
|
||||
|
@ -44,7 +44,8 @@ from glance.common import config
|
||||
from glance.common import exception
|
||||
from glance.db import migration as db_migration
|
||||
from glance.openstack.common.db.sqlalchemy import migration
|
||||
from glance.openstack.common import log, strutils
|
||||
from glance.openstack.common import log
|
||||
from glance.openstack.common import strutils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_group("database", "glance.openstack.common.db.sqlalchemy.session")
|
||||
|
@ -27,7 +27,8 @@ import re
|
||||
import urllib
|
||||
|
||||
try:
|
||||
from eventlet.green import socket, ssl
|
||||
from eventlet.green import socket
|
||||
from eventlet.green import ssl
|
||||
except ImportError:
|
||||
import socket
|
||||
import ssl
|
||||
@ -42,7 +43,8 @@ import six.moves.urllib.parse as urlparse
|
||||
from six.moves import xrange
|
||||
|
||||
from glance.common import auth
|
||||
from glance.common import exception, utils
|
||||
from glance.common import exception
|
||||
from glance.common import utils
|
||||
import glance.openstack.common.log as logging
|
||||
from glance.openstack.common import strutils
|
||||
|
||||
|
@ -388,7 +388,8 @@ def get_terminal_size():
|
||||
|
||||
def _get_terminal_size_win32():
|
||||
try:
|
||||
from ctypes import windll, create_string_buffer
|
||||
from ctypes import create_string_buffer
|
||||
from ctypes import windll
|
||||
handle = windll.kernel32.GetStdHandle(-12)
|
||||
csbi = create_string_buffer(22)
|
||||
res = windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi)
|
||||
|
@ -29,7 +29,8 @@ import sys
|
||||
import time
|
||||
|
||||
import eventlet
|
||||
from eventlet.green import socket, ssl
|
||||
from eventlet.green import socket
|
||||
from eventlet.green import ssl
|
||||
import eventlet.greenio
|
||||
import eventlet.wsgi
|
||||
from oslo.config import cfg
|
||||
|
@ -16,7 +16,7 @@
|
||||
from sqlalchemy.schema import (Column, MetaData, Table)
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, create_tables, drop_tables)
|
||||
Boolean, DateTime, Integer, String, Text, create_tables, drop_tables) # noqa
|
||||
|
||||
|
||||
def define_images_table(meta):
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy.schema import (
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, create_tables, drop_tables,
|
||||
from_migration_import)
|
||||
from_migration_import) # noqa
|
||||
|
||||
|
||||
def define_image_properties_table(meta):
|
||||
|
@ -17,7 +17,7 @@ from migrate.changeset import * # noqa
|
||||
from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import)
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -17,7 +17,7 @@ from migrate.changeset import * # noqa
|
||||
from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import)
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, BigInteger, Integer, String,
|
||||
Text, from_migration_import)
|
||||
Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -17,7 +17,7 @@ from migrate.changeset import * # noqa
|
||||
from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import)
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, BigInteger, Integer, String,
|
||||
Text, from_migration_import)
|
||||
Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, create_tables,
|
||||
drop_tables, from_migration_import)
|
||||
drop_tables, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -17,7 +17,7 @@ from migrate.changeset import * # noqa
|
||||
from sqlalchemy import * # noqa
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import)
|
||||
Boolean, DateTime, Integer, String, Text, from_migration_import) # noqa
|
||||
|
||||
|
||||
def get_images_table(meta):
|
||||
|
@ -17,7 +17,7 @@
|
||||
from sqlalchemy.schema import (Column, MetaData, Table, Index)
|
||||
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (
|
||||
Boolean, DateTime, String, Text, create_tables, drop_tables)
|
||||
Boolean, DateTime, String, Text, create_tables, drop_tables) # noqa
|
||||
|
||||
|
||||
def define_tasks_table(meta):
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy.schema import (Column, ForeignKey, MetaData, Table)
|
||||
from glance.db.sqlalchemy.migrate_repo.schema import (String,
|
||||
Text,
|
||||
create_tables,
|
||||
drop_tables)
|
||||
drop_tables) # noqa
|
||||
|
||||
TASKS_MIGRATE_COLUMNS = ['input', 'message', 'result']
|
||||
|
||||
|
@ -23,7 +23,8 @@ import os
|
||||
import stat
|
||||
import time
|
||||
|
||||
from eventlet import sleep, timeout
|
||||
from eventlet import sleep
|
||||
from eventlet import timeout
|
||||
from oslo.config import cfg
|
||||
import sqlite3
|
||||
|
||||
|
@ -26,7 +26,8 @@ from six.moves import xrange
|
||||
from glance.openstack.common import jsonutils
|
||||
from glance.openstack.common import units
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import execute, minimal_headers
|
||||
from glance.tests.utils import execute
|
||||
from glance.tests.utils import minimal_headers
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
|
||||
|
@ -32,13 +32,13 @@ from six.moves import xrange
|
||||
from glance.openstack.common import jsonutils
|
||||
from glance.openstack.common import units
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import (skip_if_disabled,
|
||||
execute,
|
||||
xattr_writes_supported,
|
||||
minimal_headers)
|
||||
from glance.tests.utils import execute
|
||||
from glance.tests.utils import minimal_headers
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
from glance.tests.utils import xattr_writes_supported
|
||||
|
||||
from glance.tests.functional.store_utils import (setup_http,
|
||||
get_http_uri)
|
||||
from glance.tests.functional.store_utils import get_http_uri
|
||||
from glance.tests.functional.store_utils import setup_http
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
|
||||
|
@ -20,7 +20,9 @@ import sys
|
||||
|
||||
from glance.common import utils
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import execute, depends_on_exe, skip_if_disabled
|
||||
from glance.tests.utils import depends_on_exe
|
||||
from glance.tests.utils import execute
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
|
||||
|
||||
class TestGlanceManage(functional.FunctionalTest):
|
||||
|
@ -17,7 +17,9 @@
|
||||
|
||||
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import execute, depends_on_exe, skip_if_disabled
|
||||
from glance.tests.utils import depends_on_exe
|
||||
from glance.tests.utils import execute
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
|
||||
|
||||
class TestSqlite(functional.FunctionalTest):
|
||||
|
@ -22,7 +22,8 @@ import httplib2
|
||||
from glance.openstack.common import jsonutils
|
||||
from glance.openstack.common import units
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import skip_if_disabled, minimal_headers
|
||||
from glance.tests.utils import minimal_headers
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
FIVE_GB = 5 * units.Gi
|
||||
|
@ -29,8 +29,8 @@ from six.moves import xrange
|
||||
from glance.openstack.common import jsonutils
|
||||
from glance.openstack.common import units
|
||||
from glance.tests import functional
|
||||
from glance.tests.functional.store_utils import (setup_http,
|
||||
get_http_uri)
|
||||
from glance.tests.functional.store_utils import get_http_uri
|
||||
from glance.tests.functional.store_utils import setup_http
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
|
@ -20,7 +20,8 @@ import os
|
||||
from glance.openstack.common import jsonutils
|
||||
from glance.openstack.common import units
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import execute, minimal_headers
|
||||
from glance.tests.utils import execute
|
||||
from glance.tests.utils import minimal_headers
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
FIVE_GB = 5 * units.Gi
|
||||
|
@ -40,7 +40,8 @@ from glance.openstack.common import timeutils
|
||||
from glance.openstack.common import units
|
||||
|
||||
from glance.tests import functional
|
||||
from glance.tests.utils import skip_if_disabled, minimal_headers
|
||||
from glance.tests.utils import minimal_headers
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
|
||||
FIVE_KB = 5 * units.Ki
|
||||
FIVE_GB = 5 * units.Gi
|
||||
|
@ -30,7 +30,8 @@ from oslo.config import cfg
|
||||
from glance.common import exception
|
||||
from glance.openstack.common import units
|
||||
|
||||
from glance.store.filesystem import Store, ChunkedFile
|
||||
from glance.store.filesystem import ChunkedFile
|
||||
from glance.store.filesystem import Store
|
||||
from glance.store.location import get_location_from_uri
|
||||
from glance.tests.unit import base
|
||||
|
||||
|
@ -20,12 +20,14 @@ from glance.common import exception
|
||||
from glance import context
|
||||
from glance.db.sqlalchemy import api as db_api
|
||||
from glance.registry.client.v1.api import configure_registry_client
|
||||
from glance.store import (delete_from_backend,
|
||||
safe_delete_from_backend)
|
||||
from glance.store.http import Store, MAX_REDIRECTS
|
||||
from glance.store import delete_from_backend
|
||||
from glance.store.http import MAX_REDIRECTS
|
||||
from glance.store.http import Store
|
||||
from glance.store.location import get_location_from_uri
|
||||
from glance.store import safe_delete_from_backend
|
||||
from glance.tests import stubs as test_stubs
|
||||
from glance.tests.unit import base
|
||||
from glance.tests import utils, stubs as test_stubs
|
||||
from glance.tests import utils
|
||||
|
||||
|
||||
# The response stack is used to return designated responses in order;
|
||||
|
@ -33,7 +33,8 @@ import glance.registry # noqa
|
||||
import glance.store.filesystem as fs_store
|
||||
import glance.store.s3 as s3_store
|
||||
from glance.tests import utils as test_utils
|
||||
from glance.tests.utils import skip_if_disabled, xattr_writes_supported
|
||||
from glance.tests.utils import skip_if_disabled
|
||||
from glance.tests.utils import xattr_writes_supported
|
||||
|
||||
FIXTURE_LENGTH = 1024
|
||||
FIXTURE_DATA = '*' * FIXTURE_LENGTH
|
||||
|
@ -27,7 +27,8 @@ from glance.openstack.common import units
|
||||
|
||||
from glance.store.location import get_location_from_uri
|
||||
import glance.store.s3
|
||||
from glance.store.s3 import Store, get_s3_location
|
||||
from glance.store.s3 import get_s3_location
|
||||
from glance.store.s3 import Store
|
||||
from glance.store import UnsupportedBackend
|
||||
from glance.tests.unit import base
|
||||
|
||||
|
5
tox.ini
5
tox.ini
@ -31,9 +31,10 @@ commands = {posargs}
|
||||
# E711 comparison to None should be 'if cond is not None:'
|
||||
# E712 comparison to True should be 'if cond is True:' or 'if cond:'
|
||||
# F821 undefined name 'name'
|
||||
# H301 one import per line
|
||||
# H302 import only modules
|
||||
# H304 no relative imports
|
||||
# H402 one line docstring needs punctuation.
|
||||
# H404 multi line docstring should start with a summary
|
||||
ignore = E711,E712,F821,H301,H402,H404
|
||||
ignore = E711,E712,F821,H302,H304,H402,H404
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,etc,*glance/locale*,*openstack/common*,*lib/python*,*egg,build
|
||||
|
Loading…
x
Reference in New Issue
Block a user