pylint: fix several coding convention violations
openstack_dashboard/context_processors.py:94:15: C0122: Comparison should be link['url'] != 'horizon:project:api_access:openrcv2' (misplaced-comparison-constant) openstack_dashboard/settings.py:467:4: C0412: Imports from package horizon are not grouped (ungrouped-imports) openstack_dashboard/enabled/_1370_project_vg_snapshots.py:9:0: C0301: Line too long (86/80) (line-too-long) openstack_dashboard/enabled/_1360_project_volume_groups.py:9:0: C0301: Line too long (85/80) (line-too-long) openstack_dashboard/usage/base.py:62:8: W0106: Expression "[instance_list.extend(u.server_usages) for u in self.usage_list]" is assigned to nothing (expression-not-assigned) openstack_dashboard/dashboards/project/images/utils.py:43:12: W0106: Expression "[public_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned) openstack_dashboard/dashboards/project/images/utils.py:75:12: W0106: Expression "[community_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned) openstack_dashboard/api/glance.py:47:4: C0412: Imports from package glanceclient are not grouped (ungrouped-imports) openstack_dashboard/api/cinder.py:60:4: C0412: Imports from package cinderclient are not grouped (ungrouped-imports) openstack_auth/user.py:358:4: E0211: Method has no argument (no-method-argument) openstack_auth/user.py:362:4: E0211: Method has no argument (no-method-argument) openstack_dashboard/api/keystone.py:75:4: C0412: Imports from package keystoneclient are not grouped (ungrouped-imports) horizon/loaders.py:43:16: W0706: The except handler raises immediately (try-except-raise) horizon/themes.py:174:8: W0706: The except handler raises immediately (try-except-raise) Change-Id: I40cf3ffbc4519657e11180d2e2fe7401387c5556
This commit is contained in:
parent
c9536342c2
commit
ac7ac272b3
@ -42,17 +42,11 @@ disable=
|
|||||||
bad-builtin,
|
bad-builtin,
|
||||||
bad-continuation,
|
bad-continuation,
|
||||||
deprecated-lambda,
|
deprecated-lambda,
|
||||||
expression-not-assigned,
|
|
||||||
global-statement,
|
global-statement,
|
||||||
invalid-name,
|
invalid-name,
|
||||||
line-too-long,
|
|
||||||
misplaced-comparison-constant,
|
|
||||||
missing-docstring,
|
missing-docstring,
|
||||||
no-method-argument,
|
|
||||||
superfluous-parens,
|
superfluous-parens,
|
||||||
too-many-lines,
|
too-many-lines,
|
||||||
try-except-raise,
|
|
||||||
ungrouped-imports,
|
|
||||||
unused-variable,
|
unused-variable,
|
||||||
wrong-import-order, # TODO
|
wrong-import-order, # TODO
|
||||||
# "R" Refactor recommendations
|
# "R" Refactor recommendations
|
||||||
|
@ -40,6 +40,7 @@ class TemplateLoader(filesystem_loader.Loader):
|
|||||||
yield Origin(name=name,
|
yield Origin(name=name,
|
||||||
template_name=template_name,
|
template_name=template_name,
|
||||||
loader=self)
|
loader=self)
|
||||||
|
# pylint: disable=try-except-raise
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
# The template dir name wasn't valid UTF-8.
|
# The template dir name wasn't valid UTF-8.
|
||||||
raise
|
raise
|
||||||
|
@ -170,7 +170,7 @@ class ThemeTemplateLoader(filesystem_loader.Loader):
|
|||||||
yield Origin(name=name,
|
yield Origin(name=name,
|
||||||
template_name=template_name,
|
template_name=template_name,
|
||||||
loader=self)
|
loader=self)
|
||||||
|
# pylint: disable=try-except-raise
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
# The template dir name wasn't valid UTF-8.
|
# The template dir name wasn't valid UTF-8.
|
||||||
raise
|
raise
|
||||||
|
@ -331,11 +331,11 @@ class User(models.AbstractBaseUser, models.AnonymousUser):
|
|||||||
regions.append(region)
|
regions.append(region)
|
||||||
return regions
|
return regions
|
||||||
|
|
||||||
def save(*args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
# Presume we can't write to Keystone.
|
# Presume we can't write to Keystone.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def delete(*args, **kwargs):
|
def delete(self, *args, **kwargs):
|
||||||
# Presume we can't write to Keystone.
|
# Presume we can't write to Keystone.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ CONSUMER_CHOICES = (
|
|||||||
VERSIONS = base.APIVersionManager("volume", preferred_version='3')
|
VERSIONS = base.APIVersionManager("volume", preferred_version='3')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from cinderclient.v2 import client as cinder_client_v2
|
from cinderclient.v2 import client as cinder_client_v2
|
||||||
VERSIONS.load_supported_version('2', {"client": cinder_client_v2,
|
VERSIONS.load_supported_version('2', {"client": cinder_client_v2,
|
||||||
"version": '2'})
|
"version": '2'})
|
||||||
|
@ -44,13 +44,14 @@ LOG = logging.getLogger(__name__)
|
|||||||
VERSIONS = base.APIVersionManager("image", preferred_version=2)
|
VERSIONS = base.APIVersionManager("image", preferred_version=2)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from glanceclient.v2 import client as glance_client_v2
|
from glanceclient.v2 import client as glance_client_v2
|
||||||
VERSIONS.load_supported_version(2, {"client": glance_client_v2,
|
VERSIONS.load_supported_version(2, {"client": glance_client_v2,
|
||||||
"version": 2})
|
"version": 2})
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from glanceclient.v1 import client as glance_client_v1
|
from glanceclient.v1 import client as glance_client_v1
|
||||||
VERSIONS.load_supported_version(1, {"client": glance_client_v1,
|
VERSIONS.load_supported_version(1, {"client": glance_client_v1,
|
||||||
"version": 1})
|
"version": 1})
|
||||||
|
@ -72,12 +72,14 @@ VERSIONS = IdentityAPIVersionManager(
|
|||||||
|
|
||||||
# Import from oldest to newest so that "preferred" takes correct precedence.
|
# Import from oldest to newest so that "preferred" takes correct precedence.
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from keystoneclient.v2_0 import client as keystone_client_v2
|
from keystoneclient.v2_0 import client as keystone_client_v2
|
||||||
VERSIONS.load_supported_version(2.0, {"client": keystone_client_v2})
|
VERSIONS.load_supported_version(2.0, {"client": keystone_client_v2})
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from keystoneclient.v3 import client as keystone_client_v3
|
from keystoneclient.v3 import client as keystone_client_v3
|
||||||
VERSIONS.load_supported_version(3, {"client": keystone_client_v3})
|
VERSIONS.load_supported_version(3, {"client": keystone_client_v3})
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -91,7 +91,7 @@ def openstack(request):
|
|||||||
if not getattr(settings, "SHOW_KEYSTONE_V2_RC", False):
|
if not getattr(settings, "SHOW_KEYSTONE_V2_RC", False):
|
||||||
user_menu_links = [
|
user_menu_links = [
|
||||||
link for link in user_menu_links
|
link for link in user_menu_links
|
||||||
if 'horizon:project:api_access:openrcv2' != link['url']]
|
if link['url'] != 'horizon:project:api_access:openrcv2']
|
||||||
|
|
||||||
context['USER_MENU_LINKS'] = user_menu_links
|
context['USER_MENU_LINKS'] = user_menu_links
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def get_available_images(request, project_id=None, images_cache=None):
|
|||||||
try:
|
try:
|
||||||
images, _more, _prev = glance.image_list_detailed(
|
images, _more, _prev = glance.image_list_detailed(
|
||||||
request, filters=public)
|
request, filters=public)
|
||||||
[public_images.append(image) for image in images]
|
public_images += images
|
||||||
images_cache['public_images'] = public_images
|
images_cache['public_images'] = public_images
|
||||||
except Exception:
|
except Exception:
|
||||||
exceptions.handle(request,
|
exceptions.handle(request,
|
||||||
@ -72,7 +72,7 @@ def get_available_images(request, project_id=None, images_cache=None):
|
|||||||
try:
|
try:
|
||||||
images, _more, _prev = glance.image_list_detailed(
|
images, _more, _prev = glance.image_list_detailed(
|
||||||
request, filters=community)
|
request, filters=community)
|
||||||
[community_images.append(image) for image in images]
|
community_images += images
|
||||||
images_cache['community_images'] = community_images
|
images_cache['community_images'] = community_images
|
||||||
except Exception:
|
except Exception:
|
||||||
exceptions.handle(request,
|
exceptions.handle(request,
|
||||||
|
@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'project'
|
|||||||
PANEL_GROUP = 'volumes'
|
PANEL_GROUP = 'volumes'
|
||||||
|
|
||||||
# Python panel class of the PANEL to be added.
|
# Python panel class of the PANEL to be added.
|
||||||
ADD_PANEL = 'openstack_dashboard.dashboards.project.volume_groups.panel.VolumeGroups'
|
ADD_PANEL = ('openstack_dashboard.dashboards.project.volume_groups.panel.'
|
||||||
|
'VolumeGroups')
|
||||||
|
@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'project'
|
|||||||
PANEL_GROUP = 'volumes'
|
PANEL_GROUP = 'volumes'
|
||||||
|
|
||||||
# Python panel class of the PANEL to be added.
|
# Python panel class of the PANEL to be added.
|
||||||
ADD_PANEL = 'openstack_dashboard.dashboards.project.vg_snapshots.panel.GroupSnapshots'
|
ADD_PANEL = ('openstack_dashboard.dashboards.project.vg_snapshots.panel.'
|
||||||
|
'GroupSnapshots')
|
||||||
|
@ -478,6 +478,7 @@ if not SECRET_KEY:
|
|||||||
LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||||
'local')
|
'local')
|
||||||
|
|
||||||
|
# pylint: disable=ungrouped-imports
|
||||||
from horizon.utils import secret_key
|
from horizon.utils import secret_key
|
||||||
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
|
SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
|
||||||
'.secret_key_store'))
|
'.secret_key_store'))
|
||||||
|
@ -59,7 +59,8 @@ class BaseUsage(object):
|
|||||||
|
|
||||||
def get_instances(self):
|
def get_instances(self):
|
||||||
instance_list = []
|
instance_list = []
|
||||||
[instance_list.extend(u.server_usages) for u in self.usage_list]
|
for u in self.usage_list:
|
||||||
|
instance_list.extend(u.server_usages)
|
||||||
return instance_list
|
return instance_list
|
||||||
|
|
||||||
def get_date_range(self):
|
def get_date_range(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user