diff --git a/.pylintrc b/.pylintrc index 4467968d55..f42af644cd 100644 --- a/.pylintrc +++ b/.pylintrc @@ -42,17 +42,11 @@ disable= bad-builtin, bad-continuation, deprecated-lambda, - expression-not-assigned, global-statement, invalid-name, - line-too-long, - misplaced-comparison-constant, missing-docstring, - no-method-argument, superfluous-parens, too-many-lines, - try-except-raise, - ungrouped-imports, unused-variable, wrong-import-order, # TODO # "R" Refactor recommendations diff --git a/horizon/loaders.py b/horizon/loaders.py index 65d85c7499..7136838815 100644 --- a/horizon/loaders.py +++ b/horizon/loaders.py @@ -40,6 +40,7 @@ class TemplateLoader(filesystem_loader.Loader): yield Origin(name=name, template_name=template_name, loader=self) + # pylint: disable=try-except-raise except UnicodeDecodeError: # The template dir name wasn't valid UTF-8. raise diff --git a/horizon/themes.py b/horizon/themes.py index ff69be46ac..1227ac255a 100644 --- a/horizon/themes.py +++ b/horizon/themes.py @@ -170,7 +170,7 @@ class ThemeTemplateLoader(filesystem_loader.Loader): yield Origin(name=name, template_name=template_name, loader=self) - + # pylint: disable=try-except-raise except UnicodeDecodeError: # The template dir name wasn't valid UTF-8. raise diff --git a/openstack_auth/user.py b/openstack_auth/user.py index 05f45ead56..ebc2ba1cc9 100644 --- a/openstack_auth/user.py +++ b/openstack_auth/user.py @@ -331,11 +331,11 @@ class User(models.AbstractBaseUser, models.AnonymousUser): regions.append(region) return regions - def save(*args, **kwargs): + def save(self, *args, **kwargs): # Presume we can't write to Keystone. pass - def delete(*args, **kwargs): + def delete(self, *args, **kwargs): # Presume we can't write to Keystone. pass diff --git a/openstack_dashboard/api/cinder.py b/openstack_dashboard/api/cinder.py index 93f341888f..f3e9aa6f69 100644 --- a/openstack_dashboard/api/cinder.py +++ b/openstack_dashboard/api/cinder.py @@ -57,6 +57,7 @@ CONSUMER_CHOICES = ( VERSIONS = base.APIVersionManager("volume", preferred_version='3') try: + # pylint: disable=ungrouped-imports from cinderclient.v2 import client as cinder_client_v2 VERSIONS.load_supported_version('2', {"client": cinder_client_v2, "version": '2'}) diff --git a/openstack_dashboard/api/glance.py b/openstack_dashboard/api/glance.py index 80e6b2b849..1e7d46aec1 100644 --- a/openstack_dashboard/api/glance.py +++ b/openstack_dashboard/api/glance.py @@ -44,13 +44,14 @@ LOG = logging.getLogger(__name__) VERSIONS = base.APIVersionManager("image", preferred_version=2) try: + # pylint: disable=ungrouped-imports from glanceclient.v2 import client as glance_client_v2 VERSIONS.load_supported_version(2, {"client": glance_client_v2, "version": 2}) except ImportError: pass - try: + # pylint: disable=ungrouped-imports from glanceclient.v1 import client as glance_client_v1 VERSIONS.load_supported_version(1, {"client": glance_client_v1, "version": 1}) diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 0ca69cfcf0..2ca995807a 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -72,12 +72,14 @@ VERSIONS = IdentityAPIVersionManager( # Import from oldest to newest so that "preferred" takes correct precedence. try: + # pylint: disable=ungrouped-imports from keystoneclient.v2_0 import client as keystone_client_v2 VERSIONS.load_supported_version(2.0, {"client": keystone_client_v2}) except ImportError: pass try: + # pylint: disable=ungrouped-imports from keystoneclient.v3 import client as keystone_client_v3 VERSIONS.load_supported_version(3, {"client": keystone_client_v3}) except ImportError: diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index cd655abc94..b595f16914 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -91,7 +91,7 @@ def openstack(request): if not getattr(settings, "SHOW_KEYSTONE_V2_RC", False): 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 diff --git a/openstack_dashboard/dashboards/project/images/utils.py b/openstack_dashboard/dashboards/project/images/utils.py index a58ce5b3a1..65626949f3 100644 --- a/openstack_dashboard/dashboards/project/images/utils.py +++ b/openstack_dashboard/dashboards/project/images/utils.py @@ -41,7 +41,7 @@ def get_available_images(request, project_id=None, images_cache=None): try: images, _more, _prev = glance.image_list_detailed( request, filters=public) - [public_images.append(image) for image in images] + public_images += images images_cache['public_images'] = public_images except Exception: exceptions.handle(request, @@ -72,7 +72,7 @@ def get_available_images(request, project_id=None, images_cache=None): try: images, _more, _prev = glance.image_list_detailed( request, filters=community) - [community_images.append(image) for image in images] + community_images += images images_cache['community_images'] = community_images except Exception: exceptions.handle(request, diff --git a/openstack_dashboard/enabled/_1360_project_volume_groups.py b/openstack_dashboard/enabled/_1360_project_volume_groups.py index cc9621c533..a8856b7178 100644 --- a/openstack_dashboard/enabled/_1360_project_volume_groups.py +++ b/openstack_dashboard/enabled/_1360_project_volume_groups.py @@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'project' PANEL_GROUP = 'volumes' # 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') diff --git a/openstack_dashboard/enabled/_1370_project_vg_snapshots.py b/openstack_dashboard/enabled/_1370_project_vg_snapshots.py index 86da94bf69..62950b6f86 100644 --- a/openstack_dashboard/enabled/_1370_project_vg_snapshots.py +++ b/openstack_dashboard/enabled/_1370_project_vg_snapshots.py @@ -6,4 +6,5 @@ PANEL_DASHBOARD = 'project' PANEL_GROUP = 'volumes' # 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') diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index 74a7fd51e7..033797fe44 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -478,6 +478,7 @@ if not SECRET_KEY: LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'local') + # pylint: disable=ungrouped-imports from horizon.utils import secret_key SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store')) diff --git a/openstack_dashboard/usage/base.py b/openstack_dashboard/usage/base.py index d86d48ec3b..7107efa802 100644 --- a/openstack_dashboard/usage/base.py +++ b/openstack_dashboard/usage/base.py @@ -59,7 +59,8 @@ class BaseUsage(object): def get_instances(self): 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 def get_date_range(self):