diff --git a/.pylintrc b/.pylintrc index f377306557..7ae204787b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -56,8 +56,6 @@ disable= inconsistent-return-statements, # TODO interface-not-implemented, no-self-use, - # python3 way: Let's do it once we have a consensus. - super-with-arguments, # TODO too-many-ancestors, too-many-arguments, too-many-branches, diff --git a/horizon/base.py b/horizon/base.py index 7c577f3fb7..7d91cfbd8c 100644 --- a/horizon/base.py +++ b/horizon/base.py @@ -108,7 +108,7 @@ class HorizonComponent(object): policy_rules = tuple() def __init__(self): - super(HorizonComponent, self).__init__() + super().__init__() if not self.slug: raise ImproperlyConfigured('Every %s must have a slug.' % self.__class__) @@ -476,7 +476,7 @@ class Dashboard(Registry, HorizonComponent): return "" % self.slug def __init__(self, *args, **kwargs): - super(Dashboard, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._panel_groups = None def get_panel(self, panel): @@ -1023,8 +1023,7 @@ class HorizonSite(Site): def __new__(cls, *args, **kwargs): if not cls._instance: - cls._instance = super(HorizonSite, cls).__new__(cls, - *args, **kwargs) + cls._instance = super().__new__(cls, *args, **kwargs) return cls._instance diff --git a/horizon/browsers/base.py b/horizon/browsers/base.py index 907428c89e..d8bd0fb8d8 100644 --- a/horizon/browsers/base.py +++ b/horizon/browsers/base.py @@ -93,7 +93,7 @@ class ResourceBrowser(html.HTMLElement): breadcrumb_url = None def __init__(self, request, tables_dict=None, attrs=None, **kwargs): - super(ResourceBrowser, self).__init__() + super().__init__() self.name = self.name or self.__class__.__name__ self.verbose_name = self.verbose_name or self.name.title() self.request = request diff --git a/horizon/browsers/breadcrumb.py b/horizon/browsers/breadcrumb.py index 567da56e56..ea384aa396 100644 --- a/horizon/browsers/breadcrumb.py +++ b/horizon/browsers/breadcrumb.py @@ -20,7 +20,7 @@ from horizon.utils import html class Breadcrumb(html.HTMLElement): def __init__(self, request, template, root, subfolder_path, url, attr=None): - super(Breadcrumb, self).__init__() + super().__init__() self.template = template self.request = request self.root = root diff --git a/horizon/browsers/views.py b/horizon/browsers/views.py index bf1565761d..8439d1afe6 100644 --- a/horizon/browsers/views.py +++ b/horizon/browsers/views.py @@ -32,7 +32,7 @@ class ResourceBrowserView(MultiTableView): self.table_classes = (self.browser_class.navigation_table_class, self.browser_class.content_table_class) self.navigation_selection = False - super(ResourceBrowserView, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @memoized.memoized_method def get_browser(self): @@ -45,7 +45,7 @@ class ResourceBrowserView(MultiTableView): return browser def get_tables(self): - tables = super(ResourceBrowserView, self).get_tables() + tables = super().get_tables() # Tells the navigation table what is selected. navigation_table = tables[ self.browser_class.navigation_table_class._meta.name] @@ -55,7 +55,7 @@ class ResourceBrowserView(MultiTableView): return tables def get_context_data(self, **kwargs): - context = super(ResourceBrowserView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) browser = self.get_browser() context["%s_browser" % browser.name] = browser return context @@ -78,7 +78,7 @@ class AngularIndexView(generic.TemplateView): page_title = None def get_context_data(self, **kwargs): - context = super(AngularIndexView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["title"] = self.title context["csrf_http"] = settings.CSRF_COOKIE_HTTPONLY if self.page_title is None: @@ -97,7 +97,7 @@ class AngularDetailsView(generic.TemplateView): template_name = 'angular.html' def get_context_data(self, **kwargs): - context = super(AngularDetailsView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) # some parameters are needed for navigation side bar and breadcrumb. title = _("Horizon") context["title"] = title diff --git a/horizon/contrib/staticfiles/finders.py b/horizon/contrib/staticfiles/finders.py index 0b147b71bc..7c65fb6000 100644 --- a/horizon/contrib/staticfiles/finders.py +++ b/horizon/contrib/staticfiles/finders.py @@ -22,7 +22,7 @@ class HorizonStaticFinder(AppDirectoriesFinder): """Static files finder that also looks into the directory of each panel.""" def __init__(self, app_names=None, *args, **kwargs): - super(HorizonStaticFinder, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) app_configs = apps.get_app_configs() for app_config in app_configs: if 'openstack_dashboard' in app_config.path: diff --git a/horizon/exceptions.py b/horizon/exceptions.py index 576cc51233..075009e937 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -108,7 +108,7 @@ class ServiceCatalogException(HorizonException): """ def __init__(self, service_name): message = _('Invalid service catalog: %s') % service_name - super(ServiceCatalogException, self).__init__(message) + super().__init__(message) class AlreadyExists(HorizonException): diff --git a/horizon/forms/base.py b/horizon/forms/base.py index bd78ad3f9f..7d09874c38 100644 --- a/horizon/forms/base.py +++ b/horizon/forms/base.py @@ -26,7 +26,7 @@ class SelfHandlingMixin(object): if not hasattr(self, "handle"): raise NotImplementedError("%s does not define a handle method." % self.__class__.__name__) - super(SelfHandlingMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class SelfHandlingForm(SelfHandlingMixin, forms.Form): @@ -56,6 +56,6 @@ class DateForm(forms.Form): end = forms.DateField(input_formats=("%Y-%m-%d",)) def __init__(self, *args, **kwargs): - super(DateForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['start'].widget.attrs['data-date-format'] = "yyyy-mm-dd" self.fields['end'].widget.attrs['data-date-format'] = "yyyy-mm-dd" diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py index defe331063..560581b0de 100644 --- a/horizon/forms/fields.py +++ b/horizon/forms/fields.py @@ -80,10 +80,10 @@ class IPField(fields.Field): self.min_mask = kwargs.pop("mask_range_from", 0) self.version = kwargs.pop('version', IPv4) - super(IPField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def validate(self, value): - super(IPField, self).validate(value) + super().validate(value) if not value and not self.required: return @@ -109,7 +109,7 @@ class IPField(fields.Field): raise ValidationError(self.invalid_mask_message) def clean(self, value): - super(IPField, self).clean(value) + super().clean(value) return str(getattr(self, "ip", "")) @@ -120,13 +120,13 @@ class MultiIPField(IPField): if value: addresses = value.split(',') for ip in addresses: - super(MultiIPField, self).validate(ip) + super().validate(ip) self.addresses.append(ip) else: - super(MultiIPField, self).validate(value) + super().validate(value) def clean(self, value): - super(MultiIPField, self).clean(value) + super().clean(value) return str(','.join(getattr(self, "addresses", []))) @@ -139,7 +139,7 @@ class MACAddressField(fields.Field): .. xxxx.xxxx.xxxx """ def validate(self, value): - super(MACAddressField, self).validate(value) + super().validate(value) if not value: return @@ -153,7 +153,7 @@ class MACAddressField(fields.Field): code="invalid_mac") def clean(self, value): - super(MACAddressField, self).clean(value) + super().clean(value) return str(getattr(self, "mac_address", "")) @@ -221,7 +221,7 @@ class SelectWidget(widgets.Widget): self.data_attrs = data_attrs self.transform = transform self.transform_html_attrs = transform_html_attrs - super(SelectWidget, self).__init__(attrs) + super().__init__(attrs) def render(self, name, value, attrs=None, renderer=None): if value is None: @@ -356,7 +356,7 @@ class DynamicSelectWidget(SelectWidget): add_item_url = self.get_add_item_url() if add_item_url is not None: self.attrs[self._data_add_url_attr] = add_item_url - return super(DynamicSelectWidget, self).render(*args, **kwargs) + return super().render(*args, **kwargs) def get_add_item_url(self): if callable(self.add_item_link): @@ -393,7 +393,7 @@ class DynamicChoiceField(fields.ChoiceField): add_item_link_args=None, *args, **kwargs): - super(DynamicChoiceField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.widget.add_item_link = add_item_link self.widget.add_item_link_args = add_item_link_args @@ -425,7 +425,7 @@ class ThemableCheckboxInput(widgets.CheckboxInput): return html.format_html( u'
{}
', - super(ThemableCheckboxInput, self).render(name, value, attrs), + super().render(name, value, attrs), label_for ) @@ -520,7 +520,7 @@ class ThemableCheckboxChoiceInput(ChoiceInput): input_type = 'checkbox' def __init__(self, *args, **kwargs): - super(ThemableCheckboxChoiceInput, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # NOTE(e0ne): Django sets default value to None if self.value: self.value = set(force_text(v) for v in self.value) @@ -601,7 +601,7 @@ class ExternalFileField(fields.FileField): paired with ExternalUploadMeta metaclass embedded into the Form class. """ def __init__(self, *args, **kwargs): - super(ExternalFileField, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.widget.attrs.update({'data-external-upload': 'true'}) @@ -651,5 +651,4 @@ class ExternalUploadMeta(forms.DeclarativeFieldsMetaclass): new_attrs[new_attr_name] = hidden_field meth_name = 'clean_' + new_attr_name new_attrs[meth_name] = make_clean_method(new_attr_name) - return super(ExternalUploadMeta, cls).__new__( - cls, name, bases, new_attrs) + return super().__new__(cls, name, bases, new_attrs) diff --git a/horizon/forms/views.py b/horizon/forms/views.py index 50f0ecfcbe..e681ed4f23 100644 --- a/horizon/forms/views.py +++ b/horizon/forms/views.py @@ -46,13 +46,13 @@ class ModalBackdropMixin(object): modal_backdrop = 'static' def __init__(self, *args, **kwargs): - super(ModalBackdropMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) config = settings.HORIZON_CONFIG if 'modal_backdrop' in config: self.modal_backdrop = config['modal_backdrop'] def get_context_data(self, **kwargs): - context = super(ModalBackdropMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['modal_backdrop'] = self.modal_backdrop return context @@ -73,7 +73,7 @@ class ModalFormMixin(ModalBackdropMixin): return template def get_context_data(self, **kwargs): - context = super(ModalFormMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) if self.request.is_ajax(): context['hide'] = True if ADD_TO_FIELD_HEADER in self.request.META: @@ -140,7 +140,7 @@ class ModalFormView(ModalFormMixin, views.HorizonFormView): cancel_url = None def get_context_data(self, **kwargs): - context = super(ModalFormView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['modal_id'] = self.modal_id context['modal_header'] = self.modal_header context['form_id'] = self.form_id diff --git a/horizon/management/commands/startdash.py b/horizon/management/commands/startdash.py index 18f0e3e30b..fda2035669 100644 --- a/horizon/management/commands/startdash.py +++ b/horizon/management/commands/startdash.py @@ -59,7 +59,7 @@ class Command(TemplateCommand): "Python module and cannot be used as an app " "name. Please try another name." % dash_name) - super(Command, self).handle('dash', dash_name, **options) + super().handle('dash', dash_name, **options) target = options.pop("target", None) if not target: diff --git a/horizon/management/commands/startpanel.py b/horizon/management/commands/startpanel.py index 5b4904ecd0..1ff087846e 100644 --- a/horizon/management/commands/startpanel.py +++ b/horizon/management/commands/startpanel.py @@ -92,7 +92,7 @@ class Command(TemplateCommand): "Python module and cannot be used as an app " "name. Please try another name." % panel_name) - super(Command, self).handle('panel', panel_name, target, **options) + super().handle('panel', panel_name, target, **options) if not target: target = os.path.join(os.curdir, panel_name) diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py index 617c1f5087..28bfb357f6 100644 --- a/horizon/tables/actions.py +++ b/horizon/tables/actions.py @@ -76,8 +76,7 @@ class BaseActionMetaClass(type): def __call__(cls, *args, **kwargs): cls.base_options.update(kwargs) # Adding cls.base_options to each init call. - klass = super(BaseActionMetaClass, cls).__call__( - *args, **cls.base_options) + klass = super().__call__(*args, **cls.base_options) return klass @@ -85,7 +84,7 @@ class BaseAction(html.HTMLElement, metaclass=BaseActionMetaClass): """Common base class for all ``Action`` classes.""" def __init__(self, **kwargs): - super(BaseAction, self).__init__() + super().__init__() self.datum = kwargs.get('datum', None) self.table = kwargs.get('table', None) self.handles_multiple = kwargs.get('handles_multiple', False) @@ -258,7 +257,7 @@ class Action(BaseAction): def __init__(self, single_func=None, multiple_func=None, handle_func=None, attrs=None, **kwargs): - super(Action, self).__init__(**kwargs) + super().__init__(**kwargs) self.method = kwargs.get('method', "POST") self.requires_input = kwargs.get('requires_input', True) @@ -344,7 +343,7 @@ class LinkAction(BaseAction): ajax = False def __init__(self, attrs=None, **kwargs): - super(LinkAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.method = kwargs.get('method', "GET") self.bound_url = kwargs.get('bound_url', None) self.name = kwargs.get('name', self.name) @@ -377,7 +376,7 @@ class LinkAction(BaseAction): action_dict) def associate_with_table(self, table): - super(LinkAction, self).associate_with_table(table) + super().associate_with_table(table) if self.ajax: self.attrs['data-update-url'] = self.get_ajax_update_url() @@ -468,7 +467,7 @@ class FilterAction(BaseAction): name = "filter" def __init__(self, **kwargs): - super(FilterAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.method = kwargs.get('method', "POST") self.name = kwargs.get('name', self.name) self.verbose_name = kwargs.get('verbose_name', _("Filter")) @@ -560,7 +559,7 @@ class FixedFilterAction(FilterAction): """A filter action with fixed buttons.""" def __init__(self, **kwargs): - super(FixedFilterAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.filter_type = kwargs.get('filter_type', "fixed") self.needs_preloading = kwargs.get('needs_preloading', True) @@ -654,7 +653,7 @@ class BatchAction(Action): default_message_level = "success" def __init__(self, **kwargs): - super(BatchAction, self).__init__(**kwargs) + super().__init__(**kwargs) action_present_method = callable(getattr(self, 'action_present', None)) action_past_method = callable(getattr(self, 'action_past', None)) @@ -687,7 +686,7 @@ class BatchAction(Action): action = request.GET.get('action') if action != 'row_update' and not self.table.data and not datum: return False - return super(BatchAction, self)._allowed(request, datum) + return super()._allowed(request, datum) def _get_action_name(self, items=None, past=False): """Retreive action name based on the number of items and `past` flag. @@ -746,7 +745,7 @@ class BatchAction(Action): def get_default_attrs(self): """Returns a list of the default HTML attributes for the action.""" - attrs = super(BatchAction, self).get_default_attrs() + attrs = super().get_default_attrs() attrs.update({'data-batch-action': 'true'}) return attrs @@ -869,7 +868,7 @@ class DeleteAction(BatchAction): name = "delete" def __init__(self, **kwargs): - super(DeleteAction, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = kwargs.get('name', self.name) self.icon = "trash" self.action_type = "danger" diff --git a/horizon/tables/base.py b/horizon/tables/base.py index 93d44f8d82..2837b3d26b 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -305,7 +305,7 @@ class Column(html.HTMLElement): allowed_data_types = allowed_data_types or [] self.classes = list(classes or getattr(self, "classes", [])) - super(Column, self).__init__() + super().__init__() self.attrs.update(attrs or {}) if callable(transform): @@ -478,7 +478,7 @@ class Column(html.HTMLElement): if settings.INTEGRATION_TESTS_SUPPORT: def get_default_attrs(self): - attrs = super(Column, self).get_default_attrs() + attrs = super().get_default_attrs() attrs.update({'data-selenium': self.name}) return attrs @@ -510,7 +510,7 @@ class WrappingColumn(Column): """A column that wraps its contents. Useful for data like UUIDs or names""" def __init__(self, *args, **kwargs): - super(WrappingColumn, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.classes.append('word-break') @@ -580,7 +580,7 @@ class Row(html.HTMLElement): ajax_cell_action_name = "cell_update" def __init__(self, table, datum=None): - super(Row, self).__init__() + super().__init__() self.table = table self.datum = datum self.selected = False @@ -709,7 +709,7 @@ class Cell(html.HTMLElement): def __init__(self, datum, column, row, attrs=None, classes=None): self.classes = classes or getattr(self, "classes", []) - super(Cell, self).__init__() + super().__init__() self.attrs.update(attrs or {}) self.datum = datum diff --git a/horizon/tables/formset.py b/horizon/tables/formset.py index 7f3d32c650..ad572a1cff 100644 --- a/horizon/tables/formset.py +++ b/horizon/tables/formset.py @@ -27,7 +27,7 @@ class FormsetCell(horizon_tables.Cell): """A DataTable cell that knows about its field from the formset.""" def __init__(self, *args, **kwargs): - super(FormsetCell, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) try: self.field = (self.row.form or {})[self.column.name] except KeyError: @@ -46,7 +46,7 @@ class FormsetRow(horizon_tables.Row): def __init__(self, column, datum, form): self.form = form - super(FormsetRow, self).__init__(column, datum) + super().__init__(column, datum) if not self.cells: # We need to be able to handle empty rows, because there may # be extra empty forms in a formset. The original DataTable breaks @@ -72,7 +72,7 @@ class FormsetDataTableMixin(object): formset_class = None def __init__(self, *args, **kwargs): - super(FormsetDataTableMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._formset = None # Override Meta settings, because we need custom Form and Cell classes, @@ -151,7 +151,7 @@ class FormsetDataTableMixin(object): # We need to support ``None`` when there are more forms than data. if datum is None: return None - return super(FormsetDataTableMixin, self).get_object_id(datum) + return super().get_object_id(datum) class FormsetDataTable(FormsetDataTableMixin, horizon_tables.DataTable): diff --git a/horizon/tables/views.py b/horizon/tables/views.py index a4f4681628..b7e19d7171 100644 --- a/horizon/tables/views.py +++ b/horizon/tables/views.py @@ -26,7 +26,7 @@ class MultiTableMixin(object): data_method_pattern = "get_%s_data" def __init__(self, *args, **kwargs): - super(MultiTableMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.table_classes = getattr(self, "table_classes", []) self._data = {} self._tables = {} @@ -102,7 +102,7 @@ class MultiTableMixin(object): return self._tables def get_context_data(self, **kwargs): - context = super(MultiTableMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) tables = self.get_tables() for name, table in tables.items(): context["%s_table" % name] = table @@ -274,7 +274,7 @@ class DataTableView(MultiTableView): return self.table def get_context_data(self, **kwargs): - context = super(DataTableView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) if hasattr(self, "table"): context[self.context_object_name] = self.table return context @@ -354,7 +354,7 @@ class MixedDataTableView(DataTableView): type_string) def get_table(self): - self.table = super(MixedDataTableView, self).get_table() + self.table = super().get_table() if not self.table._meta.mixed_data_type: raise AttributeError('You must have at least two elements in ' 'the data_types attribute ' @@ -365,7 +365,7 @@ class MixedDataTableView(DataTableView): class PagedTableMixin(object): def __init__(self, *args, **kwargs): - super(PagedTableMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._has_prev_data = False self._has_more_data = False @@ -391,7 +391,7 @@ class PagedTableMixin(object): class PagedTableWithPageMenu(object): def __init__(self, *args, **kwargs): - super(PagedTableWithPageMenu, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._current_page = 1 self._number_of_pages = 0 self._total_of_entries = 0 @@ -401,7 +401,7 @@ class PagedTableWithPageMenu(object): name = table.name self._tables[name]._meta.current_page = self.current_page self._tables[name]._meta.number_of_pages = self.number_of_pages - return super(PagedTableWithPageMenu, self).handle_table(table) + return super().handle_table(table) def has_prev_data(self, table): return self._current_page > 1 diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py index 5ef7fddb0c..ba9bf097be 100644 --- a/horizon/tabs/base.py +++ b/horizon/tabs/base.py @@ -102,7 +102,7 @@ class TabGroup(html.HTMLElement): return self._active def __init__(self, request, **kwargs): - super(TabGroup, self).__init__() + super().__init__() if not hasattr(self, "tabs"): raise NotImplementedError('%s must declare a "tabs" attribute.' % self.__class__) @@ -187,7 +187,7 @@ class TabGroup(html.HTMLElement): Defaults to ``["nav", "nav-tabs", "ajax-tabs"]``. """ - default_classes = super(TabGroup, self).get_default_classes() + default_classes = super().get_default_classes() default_classes.extend(CSS_TAB_GROUP_CLASSES) return default_classes @@ -309,7 +309,7 @@ class Tab(html.HTMLElement): permissions = [] def __init__(self, tab_group, request=None): - super(Tab, self).__init__() + super().__init__() # Priority: constructor, class-defined, fallback if not self.name: raise ValueError("%s must have a name." % self.__class__.__name__) @@ -393,7 +393,7 @@ class Tab(html.HTMLElement): If the tab is not enabled, the classes the class ``"disabled"`` will be added. """ - default_classes = super(Tab, self).get_default_classes() + default_classes = super().get_default_classes() if self.is_active(): default_classes.extend(CSS_ACTIVE_TAB_CLASSES) if not self._enabled: @@ -471,7 +471,7 @@ class TableTab(Tab): table_classes = [] def __init__(self, tab_group, request): - super(TableTab, self).__init__(tab_group, request) + super().__init__(tab_group, request) if not self.table_classes: class_name = self.__class__.__name__ raise NotImplementedError("You must define a table_class " @@ -522,7 +522,7 @@ class TableTab(Tab): If only one table class is provided, a shortcut ``table`` context variable is also added containing the single table. """ - context = super(TableTab, self).get_context_data(request, **kwargs) + context = super().get_context_data(request, **kwargs) # If the data hasn't been manually loaded before now, # make certain it's loaded before setting the context. self.load_table_data() diff --git a/horizon/tabs/views.py b/horizon/tabs/views.py index 50f3a94188..7dc93cb039 100644 --- a/horizon/tabs/views.py +++ b/horizon/tabs/views.py @@ -45,7 +45,7 @@ class TabView(views.HorizonTemplateView): def get_context_data(self, **kwargs): """Adds the ``tab_group`` variable to the context data.""" - context = super(TabView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: tab_group = self.get_tabs(self.request, **kwargs) context["tab_group"] = tab_group @@ -73,7 +73,7 @@ class TabView(views.HorizonTemplateView): class TabbedTableView(tables.MultiTableMixin, TabView): def __init__(self, *args, **kwargs): - super(TabbedTableView, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.table_classes = [] self._table_dict = {} diff --git a/horizon/test/firefox_binary.py b/horizon/test/firefox_binary.py index e2c4a058d8..34cf7f50f1 100644 --- a/horizon/test/firefox_binary.py +++ b/horizon/test/firefox_binary.py @@ -82,7 +82,7 @@ class WebDriver(firefox.webdriver.WebDriver): # called from WebDriver.__init__, retry __init__. for i in range(self.CONNREFUSED_RETRY_COUNT + 1): try: - super(WebDriver, self).__init__( + super().__init__( firefox_profile, FirefoxBinary(), timeout, desired_capabilities, proxy) if i > 0: diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index bae39b823c..cc02de7cd4 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -118,14 +118,14 @@ class SessionStore(SessionBase): class RequestFactoryWithMessages(RequestFactory): def get(self, *args, **kwargs): - req = super(RequestFactoryWithMessages, self).get(*args, **kwargs) + req = super().get(*args, **kwargs) req.user = User() req.session = SessionStore() req._messages = default_storage(req) return req def post(self, *args, **kwargs): - req = super(RequestFactoryWithMessages, self).post(*args, **kwargs) + req = super().post(*args, **kwargs) req.user = User() req.session = SessionStore() req._messages = default_storage(req) @@ -143,7 +143,7 @@ class TestCase(django_test.TestCase): """ def setUp(self): - super(TestCase, self).setUp() + super().setUp() self._setup_test_data() self._setup_factory() self._setup_user() @@ -171,7 +171,7 @@ class TestCase(django_test.TestCase): self.request.session = self.client.session def tearDown(self): - super(TestCase, self).tearDown() + super().tearDown() del os.environ["HORIZON_TEST_RUN"] def set_permissions(self, permissions=None): @@ -250,7 +250,7 @@ class SeleniumTestCase(LiveServerTestCase): cls.vdisplay = xvfbwrapper.Xvfb(width=1280, height=720) cls.vdisplay.start() cls.selenium = WebDriver() - super(SeleniumTestCase, cls).setUpClass() + super().setUpClass() @classmethod def tearDownClass(cls): @@ -259,13 +259,13 @@ class SeleniumTestCase(LiveServerTestCase): time.sleep(1) if hasattr(cls, 'vdisplay'): cls.vdisplay.stop() - super(SeleniumTestCase, cls).tearDownClass() + super().tearDownClass() def setUp(self): socket.setdefaulttimeout(60) self.selenium.implicitly_wait(30) self.ui = selenium_ui - super(SeleniumTestCase, self).setUp() + super().setUp() class JasmineTests(SeleniumTestCase): @@ -351,7 +351,7 @@ class update_settings(django_test_utils.override_settings): copied = copy.copy(value) copied.update(new_value) kwargs[key] = copied - super(update_settings, self).__init__(**kwargs) + super().__init__(**kwargs) class IsA(object): @@ -366,4 +366,4 @@ class IsA(object): class IsHttpRequest(IsA): """Class to compare param is django.http.HttpRequest.""" def __init__(self): - super(IsHttpRequest, self).__init__(http.HttpRequest) + super().__init__(http.HttpRequest) diff --git a/horizon/test/selenium/selenium_tests.py b/horizon/test/selenium/selenium_tests.py index 77af4c9735..319dc2cab9 100644 --- a/horizon/test/selenium/selenium_tests.py +++ b/horizon/test/selenium/selenium_tests.py @@ -41,7 +41,7 @@ class LazyLoadedTabsTests(test.SeleniumTestCase): select_all_selector = 'th.multi_select_column input[type=checkbox]' def setUp(self): - super(LazyLoadedTabsTests, self).setUp() + super().setUp() wait = self.ui.WebDriverWait(self.selenium, 120) self.get_element = self.selenium.find_element_by_css_selector self.get_elements = self.selenium.find_elements_by_css_selector diff --git a/horizon/test/unit/forms/test_fields.py b/horizon/test/unit/forms/test_fields.py index 7d7784d96d..80f3385cd4 100644 --- a/horizon/test/unit/forms/test_fields.py +++ b/horizon/test/unit/forms/test_fields.py @@ -227,7 +227,7 @@ class ChoiceFieldForm(forms.SelfHandlingForm): transform_html_attrs=title_dic.get)) def __init__(self, request, *args, **kwargs): - super(ChoiceFieldForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) choices = ([('choice1', 'label1'), ('choice2', 'label2')]) self.fields['test_choices'].choices = choices @@ -241,7 +241,7 @@ class ChoiceFieldTests(test.TestCase): template = 'horizon/common/_form_fields.html' def setUp(self): - super(ChoiceFieldTests, self).setUp() + super().setUp() self.form = ChoiceFieldForm(self.request) def _render_form(self): @@ -282,7 +282,7 @@ class ThemableChoiceFieldForm(forms.SelfHandlingForm): transform_html_attrs=title_dic.get)) def __init__(self, request, *args, **kwargs): - super(ThemableChoiceFieldForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) choices = ([('choice1', 'label1'), ('choice2', 'label2')]) self.fields['test_choices'].choices = choices @@ -296,7 +296,7 @@ class ThemableChoiceFieldTests(test.TestCase): template = 'horizon/common/_form_fields.html' def setUp(self): - super(ThemableChoiceFieldTests, self).setUp() + super().setUp() self.form = ThemableChoiceFieldForm(self.request) def _render_form(self): diff --git a/horizon/test/unit/forms/test_forms.py b/horizon/test/unit/forms/test_forms.py index f8f2f1c6e4..61b3350fab 100644 --- a/horizon/test/unit/forms/test_forms.py +++ b/horizon/test/unit/forms/test_forms.py @@ -80,7 +80,7 @@ class FormErrorTests(test.TestCase): template = 'horizon/common/_form_fields.html' def setUp(self): - super(FormErrorTests, self).setUp() + super().setUp() # Note(Itxaka): We pass data to the form so its bound and has the # proper cleaned_data fields self.form = FormForTesting(self.request, data={'fake': 'data'}) diff --git a/horizon/test/unit/middleware/test_base.py b/horizon/test/unit/middleware/test_base.py index 8528f681de..b1425258c6 100644 --- a/horizon/test/unit/middleware/test_base.py +++ b/horizon/test/unit/middleware/test_base.py @@ -35,11 +35,11 @@ class MiddlewareTests(django_test.TestCase): self._timezone_backup = timezone.get_current_timezone_name() self.factory = test.RequestFactoryWithMessages() self.get_response = mock.Mock() - super(MiddlewareTests, self).setUp() + super().setUp() def tearDown(self): timezone.activate(self._timezone_backup) - super(MiddlewareTests, self).tearDown() + super().tearDown() def test_redirect_login_fail_to_login(self): url = settings.LOGIN_URL diff --git a/horizon/test/unit/middleware/test_operation_log.py b/horizon/test/unit/middleware/test_operation_log.py index 117a2dcc94..136b4bad63 100644 --- a/horizon/test/unit/middleware/test_operation_log.py +++ b/horizon/test/unit/middleware/test_operation_log.py @@ -33,7 +33,7 @@ class OperationLogMiddlewareTest(django_test.TestCase): http_referer = u'/dashboard/test_http_referer' def setUp(self): - super(OperationLogMiddlewareTest, self).setUp() + super().setUp() self.factory = test.RequestFactoryWithMessages() def test_middleware_not_used(self): diff --git a/horizon/test/unit/tabs/test_tabs.py b/horizon/test/unit/tabs/test_tabs.py index 2f009e8c23..0e509d0339 100644 --- a/horizon/test/unit/tabs/test_tabs.py +++ b/horizon/test/unit/tabs/test_tabs.py @@ -340,11 +340,11 @@ class TabTests(test.TestCase): class TabExceptionTests(test.TestCase): def setUp(self): - super(TabExceptionTests, self).setUp() + super().setUp() self._original_tabs = copy.copy(TabWithTableView.tab_group_class.tabs) def tearDown(self): - super(TabExceptionTests, self).tearDown() + super().tearDown() TabWithTableView.tab_group_class.tabs = self._original_tabs @override_settings(SESSION_REFRESH=False) diff --git a/horizon/test/unit/test_base.py b/horizon/test/unit/test_base.py index e24ec2a60e..1c54d2d9cd 100644 --- a/horizon/test/unit/test_base.py +++ b/horizon/test/unit/test_base.py @@ -70,7 +70,7 @@ class RbacYesAccessPanel(horizon.Panel): class BaseHorizonTests(test.TestCase): def setUp(self): - super(BaseHorizonTests, self).setUp() + super().setUp() # Adjust our horizon config and register our custom dashboards/panels. self.old_default_dash = settings.HORIZON_CONFIG['default_dashboard'] settings.HORIZON_CONFIG['default_dashboard'] = 'cats' @@ -93,7 +93,7 @@ class BaseHorizonTests(test.TestCase): self._discovered_panels[dash] = panels def tearDown(self): - super(BaseHorizonTests, self).tearDown() + super().tearDown() # Restore our settings settings.HORIZON_CONFIG['default_dashboard'] = self.old_default_dash settings.HORIZON_CONFIG['dashboards'] = self.old_dashboards @@ -349,12 +349,12 @@ class HorizonTests(BaseHorizonTests): settings.SECURE_PROXY_SSL_HEADER = None -class GetUserHomeTests(BaseHorizonTests): +class GetUserHomeTests(test.TestCase): """Test get_user_home parameters.""" def setUp(self): self.orig_user_home = settings.HORIZON_CONFIG['user_home'] - super(BaseHorizonTests, self).setUp() + super().setUp() self.original_username = "testname" self.test_user = User() self.test_user.username = self.original_username @@ -362,6 +362,7 @@ class GetUserHomeTests(BaseHorizonTests): def tearDown(self): settings.HORIZON_CONFIG['user_home'] = self.orig_user_home conf.HORIZON_CONFIG._setup() + super().tearDown() def test_using_callable(self): def themable_user_fnc(user): @@ -399,7 +400,7 @@ class CustomPanelTests(BaseHorizonTests): """ def setUp(self): - super(CustomPanelTests, self).setUp() + super().setUp() settings.HORIZON_CONFIG['customization_module'] = \ 'horizon.test.customization.cust_test1' # refresh config @@ -414,7 +415,7 @@ class CustomPanelTests(BaseHorizonTests): self._discovered_dashboards.append(Dogs) Dogs.register(Puppies) Cats.register(Tigers) - super(CustomPanelTests, self).tearDown() + super().tearDown() settings.HORIZON_CONFIG.pop('customization_module') # refresh config conf.HORIZON_CONFIG._setup() @@ -440,14 +441,14 @@ class CustomPermissionsTests(BaseHorizonTests): 'horizon.test.customization.cust_test2' # refresh config conf.HORIZON_CONFIG._setup() - super(CustomPermissionsTests, self).setUp() + super().setUp() def tearDown(self): # Restore permissions dogs = horizon.get_dashboard("dogs") puppies = dogs.get_panel("puppies") puppies.permissions = tuple([]) - super(CustomPermissionsTests, self).tearDown() + super().tearDown() settings.HORIZON_CONFIG.pop('customization_module') # refresh config conf.HORIZON_CONFIG._setup() @@ -489,7 +490,7 @@ class CustomPermissionsTests(BaseHorizonTests): class RbacHorizonTests(test.TestCase): def setUp(self): - super(RbacHorizonTests, self).setUp() + super().setUp() # Adjust our horizon config and register our custom dashboards/panels. self.old_default_dash = settings.HORIZON_CONFIG['default_dashboard'] settings.HORIZON_CONFIG['default_dashboard'] = 'cats' @@ -513,7 +514,7 @@ class RbacHorizonTests(test.TestCase): self._discovered_panels[dash] = panels def tearDown(self): - super(RbacHorizonTests, self).tearDown() + super().tearDown() # Restore our settings settings.HORIZON_CONFIG['default_dashboard'] = self.old_default_dash settings.HORIZON_CONFIG['dashboards'] = self.old_dashboards diff --git a/horizon/test/unit/test_views.py b/horizon/test/unit/test_views.py index b22b9ababc..aea105b8b8 100644 --- a/horizon/test/unit/test_views.py +++ b/horizon/test/unit/test_views.py @@ -28,7 +28,7 @@ class ViewData(object): template_name = 'fake' def get_context_data(self, **kwargs): - context = super(ViewData, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['object'] = {'name': 'myName'} return context @@ -61,7 +61,7 @@ class ViewWithTransTitle(views.PageTitleMixin, generic.TemplateView): class PageTitleTests(test.TestCase): def setUp(self): - super(PageTitleTests, self).setUp() + super().setUp() self.request = client.RequestFactory().get('fake') def _dispatch(self, viewClass): diff --git a/horizon/test/unit/workflows/test_workflows.py b/horizon/test/unit/workflows/test_workflows.py index cd872b0c98..b2d3135a3b 100644 --- a/horizon/test/unit/workflows/test_workflows.py +++ b/horizon/test/unit/workflows/test_workflows.py @@ -184,14 +184,14 @@ class FullscreenWorkflowView(workflows.WorkflowView): class WorkflowsTests(test.TestCase): def setUp(self): - super(WorkflowsTests, self).setUp() + super().setUp() self.policy_patcher = mock.patch( 'openstack_auth.policy.check', lambda action, request: True) self.policy_check = self.policy_patcher.start() self.addCleanup(mock.patch.stopall) def tearDown(self): - super(WorkflowsTests, self).tearDown() + super().tearDown() self._reset_workflow() def _reset_workflow(self): diff --git a/horizon/test/utils.py b/horizon/test/utils.py index 9a5dd34a06..2dc116d7d2 100644 --- a/horizon/test/utils.py +++ b/horizon/test/utils.py @@ -23,4 +23,4 @@ class ObjDictWrapper(dict): self[item] = value def __repr__(self): - return '' % super(ObjDictWrapper, self).__repr__() + return '' % super().__repr__() diff --git a/horizon/test/webdriver.py b/horizon/test/webdriver.py index 1049cbdd65..3edb71dcb6 100644 --- a/horizon/test/webdriver.py +++ b/horizon/test/webdriver.py @@ -40,8 +40,7 @@ class WrapperFindOverride(object): repeat = range(2) for i in repeat: try: - web_el = super(WrapperFindOverride, self).find_element( - by, value) + web_el = super().find_element(by, value) except exceptions.NoSuchElementException: if i == repeat[-1]: raise @@ -52,8 +51,7 @@ class WrapperFindOverride(object): repeat = range(2) for i in repeat: try: - web_els = super(WrapperFindOverride, self).find_elements( - by, value) + web_els = super().find_elements(by, value) except exceptions.NoSuchElementException: if i == repeat[-1]: raise @@ -77,7 +75,7 @@ class WebElementWrapper(WrapperFindOverride, webelement.WebElement): """ def __init__(self, parent, id_, locator, src_element, index=None): - super(WebElementWrapper, self).__init__(parent, id_) + super().__init__(parent, id_) self.locator = locator self.src_element = src_element # in case element was looked up previously via find_elements @@ -102,7 +100,7 @@ class WebElementWrapper(WrapperFindOverride, webelement.WebElement): repeat = range(20) for i in repeat: try: - return super(WebElementWrapper, self)._execute(command, params) + return super()._execute(command, params) except (exceptions.StaleElementReferenceException, exceptions.ElementClickInterceptedException): if i == repeat[-1]: diff --git a/horizon/utils/babel_extract_angular.py b/horizon/utils/babel_extract_angular.py index 1179287c2e..f6ecc5a568 100644 --- a/horizon/utils/babel_extract_angular.py +++ b/horizon/utils/babel_extract_angular.py @@ -54,7 +54,7 @@ class AngularGettextHTMLParser(parser.HTMLParser): """ def __init__(self): - super(AngularGettextHTMLParser, self).__init__( + super().__init__( convert_charrefs=False ) diff --git a/horizon/utils/csvbase.py b/horizon/utils/csvbase.py index b5c5627e12..4009cc44c6 100644 --- a/horizon/utils/csvbase.py +++ b/horizon/utils/csvbase.py @@ -29,7 +29,7 @@ class CsvDataMixin(object): """ def __init__(self): self.out = io.StringIO() - super(CsvDataMixin, self).__init__() + super().__init__() if hasattr(self, "columns"): columns = [self.encode(col) for col in self.columns] self.writer = csv.DictWriter(self.out, columns, @@ -65,7 +65,7 @@ class BaseCsvResponse(CsvDataMixin, HttpResponse): """Base CSV response class. Provides handling of CSV data.""" def __init__(self, request, template, context, content_type, **kwargs): - super(BaseCsvResponse, self).__init__() + super().__init__() self['Content-Disposition'] = 'attachment; filename="%s"' % ( kwargs.get("filename", "export.csv"),) self['Content-Type'] = content_type @@ -97,7 +97,7 @@ class BaseCsvStreamingResponse(CsvDataMixin, StreamingHttpResponse): """Base CSV Streaming class. Provides streaming response for CSV data.""" def __init__(self, request, template, context, content_type, **kwargs): - super(BaseCsvStreamingResponse, self).__init__() + super().__init__() self['Content-Disposition'] = 'attachment; filename="%s"' % ( kwargs.get("filename", "export.csv"),) self['Content-Type'] = content_type diff --git a/horizon/utils/lazy_encoder.py b/horizon/utils/lazy_encoder.py index 320bc27ece..e48d76a07f 100644 --- a/horizon/utils/lazy_encoder.py +++ b/horizon/utils/lazy_encoder.py @@ -22,4 +22,4 @@ class LazyTranslationEncoder(DjangoJSONEncoder): def default(self, obj): if isinstance(obj, Promise): return force_text(obj) - return super(LazyTranslationEncoder, self).default(obj) + return super().default(obj) diff --git a/horizon/utils/scss_filter.py b/horizon/utils/scss_filter.py index 27eb46017d..609cb7f38a 100644 --- a/horizon/utils/scss_filter.py +++ b/horizon/utils/scss_filter.py @@ -23,7 +23,7 @@ from scss.types import String class HorizonScssFilter(DjangoScssFilter): def __init__(self, *args, **kwargs): - super(HorizonScssFilter, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.namespace = Namespace() diff --git a/horizon/views.py b/horizon/views.py index 9b0a4718a6..532c435203 100644 --- a/horizon/views.py +++ b/horizon/views.py @@ -68,7 +68,7 @@ class PageTitleMixin(object): """ context = self.render_context_with_title(context) - return super(PageTitleMixin, self).render_to_response(context) + return super().render_to_response(context) def trace(name): @@ -83,7 +83,7 @@ def trace(name): class HorizonTemplateView(PageTitleMixin, generic.TemplateView): @trace('horizon.render_to_response') def render_to_response(self, context): - return super(HorizonTemplateView, self).render_to_response(context) + return super().render_to_response(context) class HorizonFormView(PageTitleMixin, generic.FormView): diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py index cfd33f9e5f..66f63006ff 100644 --- a/horizon/workflows/base.py +++ b/horizon/workflows/base.py @@ -42,11 +42,11 @@ LOG = logging.getLogger(__name__) class WorkflowContext(dict): def __init__(self, workflow, *args, **kwargs): - super(WorkflowContext, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._workflow = workflow def __setitem__(self, key, val): - super(WorkflowContext, self).__setitem__(key, val) + super().__setitem__(key, val) return self._workflow._trigger_handlers(key) def __delitem__(self, key): @@ -64,7 +64,7 @@ class ActionMetaclass(forms.forms.DeclarativeFieldsMetaclass): # Pop Meta for later processing opts = attrs.pop("Meta", None) # Create our new class - cls_ = super(ActionMetaclass, cls).__new__(cls, name, bases, attrs) + cls_ = super().__new__(cls, name, bases, attrs) # Process options from Meta cls_.name = getattr(opts, "name", name) cls_.slug = getattr(opts, "slug", slugify(name)) @@ -151,9 +151,9 @@ class Action(forms.Form, metaclass=ActionMetaclass): def __init__(self, request, context, *args, **kwargs): if request.method == "POST": - super(Action, self).__init__(request.POST, initial=context) + super().__init__(request.POST, initial=context) else: - super(Action, self).__init__(initial=context) + super().__init__(initial=context) if not hasattr(self, "handle"): raise AttributeError("The action %s must define a handle method." @@ -313,7 +313,7 @@ class Step(object): return force_text(self.name) def __init__(self, workflow): - super(Step, self).__init__() + super().__init__() self.workflow = workflow cls = self.__class__.__name__ @@ -478,7 +478,7 @@ class Step(object): class WorkflowMetaclass(type): def __new__(cls, name, bases, attrs): - super(WorkflowMetaclass, cls).__new__(cls, name, bases, attrs) + super().__new__(cls, name, bases, attrs) attrs["_cls_registry"] = [] return type.__new__(cls, name, bases, attrs) @@ -636,7 +636,7 @@ class Workflow(html.HTMLElement, metaclass=WorkflowMetaclass): def __init__(self, request=None, context_seed=None, entry_point=None, *args, **kwargs): - super(Workflow, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.slug is None: raise AttributeError("The workflow %s must have a slug." % self.__class__.__name__) diff --git a/horizon/workflows/views.py b/horizon/workflows/views.py index 107669acc9..55c642ac4b 100644 --- a/horizon/workflows/views.py +++ b/horizon/workflows/views.py @@ -59,7 +59,7 @@ class WorkflowView(hz_views.ModalBackdropMixin, generic.TemplateView): step_errors = {} def __init__(self): - super(WorkflowView, self).__init__() + super().__init__() if not self.workflow_class: raise AttributeError("You must set the workflow_class attribute " "on %s." % self.__class__.__name__) @@ -87,7 +87,7 @@ class WorkflowView(hz_views.ModalBackdropMixin, generic.TemplateView): This method should be overridden in subclasses to provide additional context data to the template. """ - context = super(WorkflowView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) workflow = self.get_workflow() workflow.verify_integrity() context[self.context_object_name] = workflow diff --git a/openstack_auth/forms.py b/openstack_auth/forms.py index b941e41ae0..e49ff871d7 100644 --- a/openstack_auth/forms.py +++ b/openstack_auth/forms.py @@ -77,7 +77,7 @@ class Login(django_auth_forms.AuthenticationForm): widget=forms.PasswordInput(render_value=False)) def __init__(self, *args, **kwargs): - super(Login, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) fields_ordering = ['username', 'password', 'region'] if settings.OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT: last_domain = self.request.COOKIES.get('login_domain', None) @@ -185,7 +185,7 @@ class DummyAuth(auth_plugin.BaseAuthPlugin): class Password(forms.Form): """Form used for changing user's password without having to log in.""" def __init__(self, *args, **kwargs): - super(Password, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields = collections.OrderedDict([ ( 'region', diff --git a/openstack_auth/tests/data_v3.py b/openstack_auth/tests/data_v3.py index ae12514290..f53f11ee29 100644 --- a/openstack_auth/tests/data_v3.py +++ b/openstack_auth/tests/data_v3.py @@ -37,7 +37,7 @@ class TestResponse(requests.Response): def __init__(self, data): self._text = None - super(TestResponse, self).__init__() + super().__init__() if isinstance(data, dict): self.status_code = data.get('status_code', 200) self.headers = data.get('headers', None) diff --git a/openstack_auth/tests/unit/test_auth.py b/openstack_auth/tests/unit/test_auth.py index 98c062d26c..f4e7117aa0 100644 --- a/openstack_auth/tests/unit/test_auth.py +++ b/openstack_auth/tests/unit/test_auth.py @@ -995,7 +995,7 @@ class OpenStackAuthTestsV3WithMock(test.TestCase): 'username': user.name} def setUp(self): - super(OpenStackAuthTestsV3WithMock, self).setUp() + super().setUp() if getattr(self, 'interface', None): override = self.settings(OPENSTACK_ENDPOINT_TYPE=self.interface) diff --git a/openstack_auth/tests/unit/test_utils.py b/openstack_auth/tests/unit/test_utils.py index ab91fdd012..59f1427bf6 100644 --- a/openstack_auth/tests/unit/test_utils.py +++ b/openstack_auth/tests/unit/test_utils.py @@ -85,7 +85,7 @@ class UtilsTestCase(test.TestCase): class BehindProxyTestCase(test.TestCase): def setUp(self): - super(BehindProxyTestCase, self).setUp() + super().setUp() self.request = http.HttpRequest() def test_without_proxy(self): diff --git a/openstack_dashboard/api/_nova.py b/openstack_dashboard/api/_nova.py index 264f98fb76..93bd5a7a9f 100644 --- a/openstack_dashboard/api/_nova.py +++ b/openstack_dashboard/api/_nova.py @@ -57,7 +57,7 @@ class Server(base.APIResourceWrapper): 'OS-EXT-AZ:availability_zone', 'OS-DCF:diskConfig'] def __init__(self, apiresource, request): - super(Server, self).__init__(apiresource) + super().__init__(apiresource) self.request = request # TODO(gabriel): deprecate making a call to Glance as a fallback. diff --git a/openstack_dashboard/api/glance.py b/openstack_dashboard/api/glance.py index 9de13843fb..71e9525df8 100644 --- a/openstack_dashboard/api/glance.py +++ b/openstack_dashboard/api/glance.py @@ -109,7 +109,7 @@ class Image(base.APIResourceWrapper): def to_dict(self, show_ext_attrs=False): if not isinstance(self._apiresource, abc.Iterable): return self._apiresource.to_dict() - image_dict = super(Image, self).to_dict() + image_dict = super().to_dict() image_dict['is_public'] = self.is_public image_dict['properties'] = { k: self._apiresource[k] for k in self._apiresource @@ -372,14 +372,14 @@ def get_image_upload_mode(): class ExternallyUploadedImage(Image): def __init__(self, apiresource, request): - super(ExternallyUploadedImage, self).__init__(apiresource) + super().__init__(apiresource) image_endpoint = base.url_for(request, 'image', 'publicURL') upload_template = "%s/v2/images/%s/file" self._url = upload_template % (image_endpoint, self.id) self._token_id = request.user.token.id def to_dict(self): - base_dict = super(ExternallyUploadedImage, self).to_dict() + base_dict = super().to_dict() base_dict.update({ 'upload_url': self._url, 'token_id': self._token_id diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index e9ed56ec86..6195ee79c7 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -74,7 +74,7 @@ class Service(base.APIDictWrapper): _attrs = ['id', 'type', 'name'] def __init__(self, service, region, *args, **kwargs): - super(Service, self).__init__(service, *args, **kwargs) + super().__init__(service, *args, **kwargs) self.public_url = base.get_url_for_service(service, region, 'publicURL') self.url = base.get_url_for_service(service, region, diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index c1c32cbaa1..dfb661bac9 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -78,7 +78,7 @@ class NeutronAPIDictWrapper(base.APIDictWrapper): for key, value in apidict.items() if ':' in key }) - super(NeutronAPIDictWrapper, self).__init__(apidict) + super().__init__(apidict) def set_id_as_name_if_empty(self, length=8): try: @@ -112,7 +112,7 @@ class Subnet(NeutronAPIDictWrapper): def __init__(self, apidict): apidict['ipver_str'] = get_ipver_str(apidict['ip_version']) - super(Subnet, self).__init__(apidict) + super().__init__(apidict) AUTO_ALLOCATE_ID = '__auto_allocate__' @@ -142,7 +142,7 @@ class PreAutoAllocateNetwork(Network): 'subnets': [auto_allocated_subnet], 'tenant_id': tenant_id, } - super(PreAutoAllocateNetwork, self).__init__(auto_allocated_network) + super().__init__(auto_allocated_network) class Trunk(NeutronAPIDictWrapper): @@ -153,7 +153,7 @@ class Trunk(NeutronAPIDictWrapper): return len(self._apidict.get('sub_ports', [])) def to_dict(self): - trunk_dict = super(Trunk, self).to_dict() + trunk_dict = super().to_dict() trunk_dict['name_or_id'] = self.name_or_id trunk_dict['subport_count'] = self.subport_count return trunk_dict @@ -175,7 +175,7 @@ class Port(NeutronAPIDictWrapper): apidict = copy.deepcopy(apidict) wrapped_pairs = [PortAllowedAddressPair(pair) for pair in pairs] apidict['allowed_address_pairs'] = wrapped_pairs - super(Port, self).__init__(apidict) + super().__init__(apidict) class PortTrunkParent(Port): @@ -203,14 +203,14 @@ class PortTrunkSubport(Port): def __init__(self, apidict, trunk_subport_info): for field in ['trunk_id', 'segmentation_type', 'segmentation_id']: apidict[field] = trunk_subport_info[field] - super(PortTrunkSubport, self).__init__(apidict) + super().__init__(apidict) class PortAllowedAddressPair(NeutronAPIDictWrapper): """Wrapper for neutron port allowed address pairs.""" def __init__(self, addr_pair): - super(PortAllowedAddressPair, self).__init__(addr_pair) + super().__init__(addr_pair) # Horizon references id property for table operations self.id = addr_pair['ip_address'] @@ -223,7 +223,7 @@ class RouterStaticRoute(NeutronAPIDictWrapper): """Wrapper for neutron routes extra route.""" def __init__(self, route): - super(RouterStaticRoute, self).__init__(route) + super().__init__(route) # Horizon references id property for table operations self.id = route['nexthop'] + ":" + route['destination'] @@ -238,7 +238,7 @@ class SecurityGroup(NeutronAPIDictWrapper): sg['security_group_rules'] = [] sg['rules'] = [SecurityGroupRule(rule, sg_dict) for rule in sg['security_group_rules']] - super(SecurityGroup, self).__init__(sg) + super().__init__(sg) def to_dict(self): return {k: self._apidict[k] for k in self._apidict if k != 'rules'} @@ -283,7 +283,7 @@ class SecurityGroupRule(NeutronAPIDictWrapper): rule['ip_range'] = {'cidr': cidr} if cidr else {} group = self._get_secgroup_name(sgr['remote_group_id'], sg_dict) rule['group'] = {'name': group} if group else {} - super(SecurityGroupRule, self).__init__(rule) + super().__init__(rule) def __str__(self): if 'name' in self.group: @@ -497,7 +497,7 @@ class FloatingIp(base.APIDictWrapper): fip['ip'] = fip['floating_ip_address'] fip['fixed_ip'] = fip['fixed_ip_address'] fip['pool'] = fip['floating_network_id'] - super(FloatingIp, self).__init__(fip) + super().__init__(fip) class FloatingIpPool(base.APIDictWrapper): @@ -522,7 +522,7 @@ class FloatingIpTarget(base.APIDictWrapper): 'id': '%s_%s' % (port.id, ip_address), 'port_id': port.id, 'instance_id': port.device_id} - super(FloatingIpTarget, self).__init__(target) + super().__init__(target) class FloatingIpManager(object): diff --git a/openstack_dashboard/api/rest/json_encoder.py b/openstack_dashboard/api/rest/json_encoder.py index 50cf8d3586..574a744985 100644 --- a/openstack_dashboard/api/rest/json_encoder.py +++ b/openstack_dashboard/api/rest/json_encoder.py @@ -21,7 +21,7 @@ class NaNJSONEncoder(json.JSONEncoder): def __init__(self, nan_str='NaN', inf_str='1e+999', **kwargs): self.nan_str = nan_str self.inf_str = inf_str - super(NaNJSONEncoder, self).__init__(**kwargs) + super().__init__(**kwargs) def iterencode(self, o, _one_shot=False): """JSON encoder with NaN and float inf support. diff --git a/openstack_dashboard/api/rest/utils.py b/openstack_dashboard/api/rest/utils.py index c3eab19d6c..a9bc3ea55c 100644 --- a/openstack_dashboard/api/rest/utils.py +++ b/openstack_dashboard/api/rest/utils.py @@ -29,7 +29,7 @@ LOG = logging.getLogger(__name__) class AjaxError(Exception): def __init__(self, http_status, msg): self.http_status = http_status - super(AjaxError, self).__init__(msg) + super().__init__(msg) http_errors = exceptions.UNAUTHORIZED + exceptions.NOT_FOUND + \ @@ -53,8 +53,8 @@ class CreatedResponse(_RestResponse): else: content = '' content_type = None - super(CreatedResponse, self).__init__(status=201, content=content, - content_type=content_type) + super().__init__(status=201, content=content, + content_type=content_type) self['Location'] = location @@ -66,7 +66,7 @@ class JSONResponse(_RestResponse): content = jsonutils.dumps(data, sort_keys=settings.DEBUG, cls=json_encoder) - super(JSONResponse, self).__init__( + super().__init__( status=status, content=content, content_type='application/json', diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index 72ff52918d..d5af8eadb4 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -56,7 +56,7 @@ class Container(base.APIDictWrapper): class StorageObject(base.APIDictWrapper): def __init__(self, apidict, container_name, orig_name=None, data=None): - super(StorageObject, self).__init__(apidict) + super().__init__(apidict) self.container_name = container_name self.orig_name = orig_name self.data = data @@ -68,7 +68,7 @@ class StorageObject(base.APIDictWrapper): class PseudoFolder(base.APIDictWrapper): def __init__(self, apidict, container_name): - super(PseudoFolder, self).__init__(apidict) + super().__init__(apidict) self.container_name = container_name @property diff --git a/openstack_dashboard/contrib/developer/dashboard.py b/openstack_dashboard/contrib/developer/dashboard.py index cdc5eb8271..7502e83c2b 100644 --- a/openstack_dashboard/contrib/developer/dashboard.py +++ b/openstack_dashboard/contrib/developer/dashboard.py @@ -26,7 +26,7 @@ class Developer(horizon.Dashboard): def allowed(self, context): if not settings.DEBUG: return False - return super(Developer, self).allowed(context) + return super().allowed(context) horizon.register(Developer) diff --git a/openstack_dashboard/contrib/developer/profiler/middleware.py b/openstack_dashboard/contrib/developer/profiler/middleware.py index dfd2056e04..6751dc9eb8 100644 --- a/openstack_dashboard/contrib/developer/profiler/middleware.py +++ b/openstack_dashboard/contrib/developer/profiler/middleware.py @@ -42,7 +42,7 @@ class ProfilerClientMiddleware(object): def __init__(self, get_response): if not PROFILER_ENABLED: raise exceptions.MiddlewareNotUsed() - super(ProfilerClientMiddleware, self).__init__() + super().__init__() self.get_response = get_response def __call__(self, request): diff --git a/openstack_dashboard/contrib/developer/profiler/views.py b/openstack_dashboard/contrib/developer/profiler/views.py index 68ba351303..762f0ed3de 100644 --- a/openstack_dashboard/contrib/developer/profiler/views.py +++ b/openstack_dashboard/contrib/developer/profiler/views.py @@ -27,7 +27,7 @@ class IndexView(views.HorizonTemplateView): page_title = _("OpenStack Profiler") def get_context_data(self, **kwargs): - context = super(IndexView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) return context diff --git a/openstack_dashboard/dashboards/admin/aggregates/forms.py b/openstack_dashboard/dashboards/admin/aggregates/forms.py index ac238a39c7..f857f85c14 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/forms.py +++ b/openstack_dashboard/dashboards/admin/aggregates/forms.py @@ -38,7 +38,7 @@ class UpdateAggregateForm(forms.SelfHandlingForm): ) def __init__(self, request, *args, **kwargs): - super(UpdateAggregateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) old_availability_zone = self.initial['availability_zone'] if not old_availability_zone: self.fields['availability_zone'].required = False diff --git a/openstack_dashboard/dashboards/admin/aggregates/panel.py b/openstack_dashboard/dashboards/admin/aggregates/panel.py index 96796d2379..f542497315 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/panel.py +++ b/openstack_dashboard/dashboards/admin/aggregates/panel.py @@ -40,4 +40,4 @@ class Aggregates(horizon.Panel): "likely due to a problem communicating with the Nova " "endpoint. Host Aggregates panel will not be displayed.") return False - return super(Aggregates, self).allowed(context) + return super().allowed(context) diff --git a/openstack_dashboard/dashboards/admin/aggregates/tables.py b/openstack_dashboard/dashboards/admin/aggregates/tables.py index b67ff753ee..443773232f 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/tables.py +++ b/openstack_dashboard/dashboards/admin/aggregates/tables.py @@ -75,7 +75,7 @@ class UpdateMetadataAction(tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(UpdateMetadataAction, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): aggregate_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/admin/aggregates/views.py b/openstack_dashboard/dashboards/admin/aggregates/views.py index acda8e7d2d..edd841b9a6 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/views.py +++ b/openstack_dashboard/dashboards/admin/aggregates/views.py @@ -81,7 +81,7 @@ class UpdateView(forms.ModalFormView): 'availability_zone': aggregate.availability_zone} def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['id'] = self.kwargs['id'] return context @@ -107,6 +107,6 @@ class ManageHostsView(workflows.WorkflowView): return {'id': self.kwargs["id"]} def get_context_data(self, **kwargs): - context = super(ManageHostsView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['id'] = self.kwargs['id'] return context diff --git a/openstack_dashboard/dashboards/admin/aggregates/workflows.py b/openstack_dashboard/dashboards/admin/aggregates/workflows.py index fc2e4f6835..df81341f90 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/workflows.py +++ b/openstack_dashboard/dashboards/admin/aggregates/workflows.py @@ -36,7 +36,7 @@ class SetAggregateInfoAction(workflows.Action): slug = "set_aggregate_info" def clean(self): - cleaned_data = super(SetAggregateInfoAction, self).clean() + cleaned_data = super().clean() name = cleaned_data.get('name', '') try: @@ -64,9 +64,7 @@ class SetAggregateInfoStep(workflows.Step): class AddHostsToAggregateAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(AddHostsToAggregateAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to get the available hosts') default_role_field_name = self.get_default_role_field_name() @@ -95,9 +93,7 @@ class AddHostsToAggregateAction(workflows.MembershipAction): class ManageAggregateHostsAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(ManageAggregateHostsAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to get the available hosts') default_role_field_name = self.get_default_role_field_name() diff --git a/openstack_dashboard/dashboards/admin/defaults/views.py b/openstack_dashboard/dashboards/admin/defaults/views.py index 8dc878dcd9..6040c88ae4 100644 --- a/openstack_dashboard/dashboards/admin/defaults/views.py +++ b/openstack_dashboard/dashboards/admin/defaults/views.py @@ -33,6 +33,6 @@ class UpdateDefaultQuotasView(workflows.WorkflowView): workflow_class = project_workflows.UpdateDefaultQuotas def get_initial(self): - initial = super(UpdateDefaultQuotasView, self).get_initial() + initial = super().get_initial() initial['disabled_quotas'] = quotas.get_disabled_quotas(self.request) return initial diff --git a/openstack_dashboard/dashboards/admin/defaults/workflows.py b/openstack_dashboard/dashboards/admin/defaults/workflows.py index 3ea8970d8c..e404dc0abe 100644 --- a/openstack_dashboard/dashboards/admin/defaults/workflows.py +++ b/openstack_dashboard/dashboards/admin/defaults/workflows.py @@ -48,8 +48,7 @@ class UpdateDefaultComputeQuotasAction(workflows.Action): label=_("Length of Injected File Path")) def __init__(self, request, context, *args, **kwargs): - super(UpdateDefaultComputeQuotasAction, self).__init__( - request, context, *args, **kwargs) + super().__init__(request, context, *args, **kwargs) disabled_quotas = context['disabled_quotas'] for field in disabled_quotas: if field in self.fields: @@ -104,8 +103,7 @@ class UpdateDefaultVolumeQuotasAction(workflows.Action): snapshots = forms.IntegerField(min_value=-1, label=_("Volume Snapshots")) def __init__(self, request, context, *args, **kwargs): - super(UpdateDefaultVolumeQuotasAction, self).__init__( - request, context, *args, **kwargs) + super().__init__(request, context, *args, **kwargs) disabled_quotas = context['disabled_quotas'] for field in disabled_quotas: if field in self.fields: diff --git a/openstack_dashboard/dashboards/admin/flavors/tables.py b/openstack_dashboard/dashboards/admin/flavors/tables.py index 67c0510c96..4cdf680c5f 100644 --- a/openstack_dashboard/dashboards/admin/flavors/tables.py +++ b/openstack_dashboard/dashboards/admin/flavors/tables.py @@ -69,7 +69,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(**kwargs) + super().__init__(**kwargs) def get_link_url(self, datum): obj_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/admin/flavors/workflows.py b/openstack_dashboard/dashboards/admin/flavors/workflows.py index 2d32d33f12..5bec755031 100644 --- a/openstack_dashboard/dashboards/admin/flavors/workflows.py +++ b/openstack_dashboard/dashboards/admin/flavors/workflows.py @@ -76,7 +76,7 @@ class CreateFlavorInfoAction(workflows.Action): return name def clean(self): - cleaned_data = super(CreateFlavorInfoAction, self).clean() + cleaned_data = super().clean() name = cleaned_data.get('name') flavor_id = cleaned_data.get('flavor_id') @@ -114,7 +114,7 @@ class CreateFlavorInfo(workflows.Step): class FlavorAccessAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(FlavorAccessAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve flavor access list. ' 'Please try again later.') context = args[0] diff --git a/openstack_dashboard/dashboards/admin/floating_ips/forms.py b/openstack_dashboard/dashboards/admin/floating_ips/forms.py index 459e206211..cdb6daea6e 100644 --- a/openstack_dashboard/dashboards/admin/floating_ips/forms.py +++ b/openstack_dashboard/dashboards/admin/floating_ips/forms.py @@ -39,7 +39,7 @@ class AdminFloatingIpAllocate(forms.SelfHandlingForm): required=False) def __init__(self, *args, **kwargs): - super(AdminFloatingIpAllocate, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) floating_pool_list = kwargs.get('initial', {}).get('pool_list', []) self.fields['pool'].choices = floating_pool_list tenant_list = kwargs.get('initial', {}).get('tenant_list', []) diff --git a/openstack_dashboard/dashboards/admin/floating_ips/views.py b/openstack_dashboard/dashboards/admin/floating_ips/views.py index 5ec6dd0745..c6e291acde 100644 --- a/openstack_dashboard/dashboards/admin/floating_ips/views.py +++ b/openstack_dashboard/dashboards/admin/floating_ips/views.py @@ -129,7 +129,7 @@ class DetailView(views.HorizonTemplateView): exceptions.handle(self.request, msg, redirect=url) def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) floating_ip_id = self.kwargs['floating_ip_id'] floating_ip = self._get_corresponding_data("floating IP", diff --git a/openstack_dashboard/dashboards/admin/group_types/specs/views.py b/openstack_dashboard/dashboards/admin/group_types/specs/views.py index e3c1853971..ce207f35ce 100644 --- a/openstack_dashboard/dashboards/admin/group_types/specs/views.py +++ b/openstack_dashboard/dashboards/admin/group_types/specs/views.py @@ -27,7 +27,7 @@ from openstack_dashboard.dashboards.admin.group_types.specs \ class GroupTypeSpecMixin(object): def get_context_data(self, **kwargs): - context = super(GroupTypeSpecMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context['group_type'] = api.cinder.group_type_get( self.request, self.kwargs['type_id']) @@ -74,7 +74,7 @@ class CreateView(GroupTypeSpecMixin, forms.ModalFormView): return reverse(self.success_url) def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -111,14 +111,14 @@ class EditView(GroupTypeSpecMixin, forms.ModalFormView): 'value': group_specs.get(key, '')} def get_context_data(self, **kwargs): - context = super(EditView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['type_id'], self.kwargs['key'],) context['submit_url'] = reverse(self.submit_url, args=args) context['modal_header'] = self.modal_header % self.kwargs['key'] return context def form_invalid(self, form): - context = super(EditView, self).get_context_data() + context = super().get_context_data() context = self._populate_context(context) context['form'] = form context['modal_header'] = self.modal_header % self.kwargs['key'] diff --git a/openstack_dashboard/dashboards/admin/group_types/views.py b/openstack_dashboard/dashboards/admin/group_types/views.py index fe83c3895b..9fb6f8ee1d 100644 --- a/openstack_dashboard/dashboards/admin/group_types/views.py +++ b/openstack_dashboard/dashboards/admin/group_types/views.py @@ -77,7 +77,7 @@ class EditGroupTypeView(forms.ModalFormView): return group_type def get_context_data(self, **kwargs): - context = super(EditGroupTypeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_type'] = self.get_data() return context diff --git a/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py b/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py index 8082e82689..c3f3e2383c 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/compute/forms.py @@ -35,7 +35,7 @@ class EvacuateHostForm(forms.SelfHandlingForm): initial=False, required=False) def __init__(self, request, *args, **kwargs): - super(EvacuateHostForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) initial = kwargs.get('initial', {}) self.fields['target_host'].choices = \ self.populate_host_choices(request, initial) diff --git a/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py b/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py index e31b881326..67a361931a 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py @@ -30,7 +30,7 @@ class EvacuateHost(tables.LinkAction): policy_rules = (("compute", "os_compute_api:os-evacuate"),) def __init__(self, **kwargs): - super(EvacuateHost, self).__init__(**kwargs) + super().__init__(**kwargs) self.name = kwargs.get('name', self.name) def allowed(self, request, instance): diff --git a/openstack_dashboard/dashboards/admin/hypervisors/compute/views.py b/openstack_dashboard/dashboards/admin/hypervisors/compute/views.py index c549111ff4..8520f885d3 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/compute/views.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/compute/views.py @@ -31,7 +31,7 @@ class EvacuateHostView(forms.ModalFormView): submit_label = page_title def get_context_data(self, **kwargs): - context = super(EvacuateHostView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["compute_host"] = self.kwargs['compute_host'] return context @@ -47,7 +47,7 @@ class EvacuateHostView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=redirect) def get_initial(self): - initial = super(EvacuateHostView, self).get_initial() + initial = super().get_initial() hosts = self.get_active_compute_hosts_names() current_host = self.kwargs['compute_host'] initial.update({'current_host': current_host, @@ -64,12 +64,12 @@ class DisableServiceView(forms.ModalFormView): submit_label = page_title def get_context_data(self, **kwargs): - context = super(DisableServiceView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["compute_host"] = self.kwargs['compute_host'] return context def get_initial(self): - initial = super(DisableServiceView, self).get_initial() + initial = super().get_initial() initial.update({'host': self.kwargs['compute_host']}) return initial @@ -83,12 +83,12 @@ class MigrateHostView(forms.ModalFormView): submit_label = page_title def get_context_data(self, **kwargs): - context = super(MigrateHostView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["compute_host"] = self.kwargs['compute_host'] return context def get_initial(self): - initial = super(MigrateHostView, self).get_initial() + initial = super().get_initial() current_host = self.kwargs['compute_host'] initial.update({ diff --git a/openstack_dashboard/dashboards/admin/hypervisors/views.py b/openstack_dashboard/dashboards/admin/hypervisors/views.py index 5e770f6e27..7b6fc93917 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/views.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/views.py @@ -31,7 +31,7 @@ class AdminIndexView(tabs.TabbedTableView): page_title = _("All Hypervisors") def get_context_data(self, **kwargs): - context = super(AdminIndexView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context["stats"] = api.nova.hypervisor_stats(self.request) except Exception: @@ -65,7 +65,7 @@ class AdminDetailView(tables.DataTableView): return instances def get_context_data(self, **kwargs): - context = super(AdminDetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) hypervisor_name = self.kwargs['hypervisor'].split('_', 1)[1] breadcrumb = [(hypervisor_name, None)] context['custom_breadcrumb'] = breadcrumb diff --git a/openstack_dashboard/dashboards/admin/images/tables.py b/openstack_dashboard/dashboards/admin/images/tables.py index a3760942cd..9086e703be 100644 --- a/openstack_dashboard/dashboards/admin/images/tables.py +++ b/openstack_dashboard/dashboards/admin/images/tables.py @@ -49,7 +49,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): image_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/admin/images/views.py b/openstack_dashboard/dashboards/admin/images/views.py index f22dca6420..35a55ed73b 100644 --- a/openstack_dashboard/dashboards/admin/images/views.py +++ b/openstack_dashboard/dashboards/admin/images/views.py @@ -164,7 +164,7 @@ class UpdateView(views.UpdateView): class DetailView(views.DetailView): def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) table = project_tables.AdminImagesTable(self.request) context["url"] = reverse('horizon:admin:images:index') context["actions"] = table.render_row_actions(context["image"]) diff --git a/openstack_dashboard/dashboards/admin/info/tables.py b/openstack_dashboard/dashboards/admin/info/tables.py index e4325e7839..22543a5cbf 100644 --- a/openstack_dashboard/dashboards/admin/info/tables.py +++ b/openstack_dashboard/dashboards/admin/info/tables.py @@ -214,11 +214,9 @@ class NetworkAgentsTable(tables.DataTable): filters.timesince)) def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(NetworkAgentsTable, self).__init__( - request, - data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, + **kwargs) availability_zone_supported = api.neutron.is_extension_supported( request, diff --git a/openstack_dashboard/dashboards/admin/info/views.py b/openstack_dashboard/dashboards/admin/info/views.py index 5c1f57fc7b..941e242fbf 100644 --- a/openstack_dashboard/dashboards/admin/info/views.py +++ b/openstack_dashboard/dashboards/admin/info/views.py @@ -32,7 +32,7 @@ class IndexView(tabs.TabbedTableView): page_title = _("System Information") def get_context_data(self, **kwargs): - context = super(IndexView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context["version"] = version.version_info.version_string() except Exception: diff --git a/openstack_dashboard/dashboards/admin/instances/forms.py b/openstack_dashboard/dashboards/admin/instances/forms.py index ba898c1067..f6adb876ab 100644 --- a/openstack_dashboard/dashboards/admin/instances/forms.py +++ b/openstack_dashboard/dashboards/admin/instances/forms.py @@ -39,7 +39,7 @@ class LiveMigrateForm(forms.SelfHandlingForm): initial=False, required=False) def __init__(self, request, *args, **kwargs): - super(LiveMigrateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) initial = kwargs.get('initial', {}) instance_id = initial.get('instance_id') self.fields['instance_id'] = forms.CharField(widget=forms.HiddenInput, diff --git a/openstack_dashboard/dashboards/admin/instances/tables.py b/openstack_dashboard/dashboards/admin/instances/tables.py index 5844e3c264..3bb147cc74 100644 --- a/openstack_dashboard/dashboards/admin/instances/tables.py +++ b/openstack_dashboard/dashboards/admin/instances/tables.py @@ -94,7 +94,7 @@ class LiveMigrateInstance(policy.PolicyTargetMixin, class AdminUpdateRow(project_tables.UpdateRow): def get_data(self, request, instance_id): - instance = super(AdminUpdateRow, self).get_data(request, instance_id) + instance = super().get_data(request, instance_id) try: tenant = api.keystone.tenant_get(request, instance.tenant_id, diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index 8ca1987721..41e97464b9 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -205,7 +205,7 @@ class LiveMigrateView(forms.ModalFormView): success_label = page_title def get_context_data(self, **kwargs): - context = super(LiveMigrateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["instance_id"] = self.kwargs['instance_id'] return context @@ -231,7 +231,7 @@ class LiveMigrateView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=redirect) def get_initial(self): - initial = super(LiveMigrateView, self).get_initial() + initial = super().get_initial() _object = self.get_object() if _object: current_host = getattr(_object, 'OS-EXT-SRV-ATTR:host', '') diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/forms.py b/openstack_dashboard/dashboards/admin/metadata_defs/forms.py index 5ef64ac8f1..4055337b85 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/forms.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/forms.py @@ -61,7 +61,7 @@ class CreateNamespaceForm(forms.SelfHandlingForm): protected = forms.BooleanField(label=_("Protected"), required=False) def clean(self): - data = super(CreateNamespaceForm, self).clean() + data = super().clean() # The key can be missing based on particular upload # conditions. Code defensively for it here... diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/views.py b/openstack_dashboard/dashboards/admin/metadata_defs/views.py index 1a7e44f7dc..2d90bc7a71 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/views.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/views.py @@ -101,7 +101,7 @@ class UpdateView(forms.ModalFormView): submit_label = _("Save Changes") def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['namespace_id'],) context["namespace_id"] = self.kwargs['namespace_id'] context["submit_url"] = reverse(self.submit_url, args=args) @@ -132,7 +132,7 @@ class DetailView(tabs.TabView): page_title = "{{ namespace.namespace }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["namespace"] = self.get_data() return context @@ -171,7 +171,7 @@ class ManageResourceTypes(forms.ModalFormView): 'resource_types': resource_types} def get_context_data(self, **kwargs): - context = super(ManageResourceTypes, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) selected_type_names = [selected_type['name'] for selected_type in context['form'].initial['resource_types']] diff --git a/openstack_dashboard/dashboards/admin/networks/agents/forms.py b/openstack_dashboard/dashboards/admin/networks/agents/forms.py index 0c4ff4dbf0..1cdd8c298a 100644 --- a/openstack_dashboard/dashboards/admin/networks/agents/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/agents/forms.py @@ -32,7 +32,7 @@ class AddDHCPAgent(forms.SelfHandlingForm): help_text=_("Choose an DHCP Agent to attach to.")) def __init__(self, request, *args, **kwargs): - super(AddDHCPAgent, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) initial = kwargs.get('initial', {}) self.fields['agent'].choices = self._populate_agent_choices(request, initial) diff --git a/openstack_dashboard/dashboards/admin/networks/agents/views.py b/openstack_dashboard/dashboards/admin/networks/agents/views.py index 140e2ec21c..1f38db3ade 100644 --- a/openstack_dashboard/dashboards/admin/networks/agents/views.py +++ b/openstack_dashboard/dashboards/admin/networks/agents/views.py @@ -40,7 +40,7 @@ class AddView(forms.ModalFormView): args=(self.kwargs['network_id'],)) def get_context_data(self, **kwargs): - context = super(AddView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['network_id'] = self.kwargs['network_id'] args = (self.kwargs['network_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -48,7 +48,7 @@ class AddView(forms.ModalFormView): return context def get_initial(self): - initial = super(AddView, self).get_initial() + initial = super().get_initial() agents = self._get_agents() network_id = self.kwargs['network_id'] try: diff --git a/openstack_dashboard/dashboards/admin/networks/forms.py b/openstack_dashboard/dashboards/admin/networks/forms.py index e3aab72be9..00d5c1faeb 100644 --- a/openstack_dashboard/dashboards/admin/networks/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/forms.py @@ -153,7 +153,7 @@ class CreateNetwork(forms.SelfHandlingForm): return cls(request, *args, **kwargs) def __init__(self, request, *args, **kwargs): - super(CreateNetwork, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) tenant_choices = [('', _("Select a project"))] tenants, has_more = api.keystone.tenant_list(request) for tenant in tenants: @@ -293,7 +293,7 @@ class CreateNetwork(forms.SelfHandlingForm): exceptions.handle(request, msg, redirect=redirect) def clean(self): - cleaned_data = super(CreateNetwork, self).clean() + cleaned_data = super().clean() if api.neutron.is_extension_supported(self.request, 'provider'): self._clean_physical_network(cleaned_data) self._clean_segmentation_id(cleaned_data) diff --git a/openstack_dashboard/dashboards/admin/networks/ports/views.py b/openstack_dashboard/dashboards/admin/networks/ports/views.py index 10de33a64e..1f6635d382 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/views.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/views.py @@ -40,7 +40,7 @@ class DetailView(project_views.DetailView): tab_group_class = ports_tabs.PortDetailTabs def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) port = context["port"] network_url = "horizon:admin:networks:detail" subnet_url = "horizon:admin:networks:subnets:detail" @@ -70,7 +70,7 @@ class UpdateView(project_views.UpdateView): failure_url = 'horizon:admin:networks:detail' def get_initial(self): - initial = super(UpdateView, self).get_initial() + initial = super().get_initial() port = self._get_object() if 'binding__host_id' in port: initial['binding__host_id'] = port['binding__host_id'] diff --git a/openstack_dashboard/dashboards/admin/networks/ports/workflows.py b/openstack_dashboard/dashboards/admin/networks/ports/workflows.py index f6f5c056d3..089c8b273e 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/workflows.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/workflows.py @@ -56,7 +56,7 @@ class CreatePort(project_workflow.CreatePort): args=(self.context['network_id'],)) def _construct_parameters(self, context): - params = super(CreatePort, self)._construct_parameters(context) + params = super()._construct_parameters(context) params.update({'tenant_id': context['target_tenant_id'], 'binding__host_id': context['binding__host_id']}) return params @@ -97,7 +97,7 @@ class UpdatePort(project_workflow.UpdatePort): args=(self.context['network_id'],)) def _construct_parameters(self, data): - params = super(UpdatePort, self)._construct_parameters(data) + params = super()._construct_parameters(data) params.update({'device_id': data['device_id'], 'device_owner': data['device_owner'], 'binding__host_id': data['binding__host_id'], diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py index dc8490b1df..9ce9567f6e 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py @@ -120,10 +120,9 @@ class SubnetsTable(tables.DataTable): hidden_title = False def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(SubnetsTable, self).__init__( - request, data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, + **kwargs) if not api.neutron.is_extension_supported(request, 'network-ip-availability'): del self.columns['subnet_used_ips'] @@ -168,7 +167,7 @@ class SubnetsTab(project_tabs_subnets_tab): def get_subnets_data(self): try: - subnets = super(SubnetsTab, self).get_subnets_data() + subnets = super().get_subnets_data() network_id = self.tab_group.kwargs['network_id'] if api.neutron.is_extension_supported(self.request, diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/views.py b/openstack_dashboard/dashboards/admin/networks/subnets/views.py index 03368f716c..c54e4fcf6f 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/views.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/views.py @@ -32,7 +32,7 @@ class UpdateView(project_views.UpdateView): class DetailView(project_views.DetailView): def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) subnet = context['subnet'] table = admin_tables.SubnetsTable(self.request, network_id=subnet.network_id) diff --git a/openstack_dashboard/dashboards/admin/networks/tables.py b/openstack_dashboard/dashboards/admin/networks/tables.py index 4f7d77d042..9af7cfdc8d 100644 --- a/openstack_dashboard/dashboards/admin/networks/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/tables.py @@ -119,10 +119,9 @@ class NetworksTable(tables.DataTable): row_actions = (EditNetwork, CreateSubnet, project_tables.DeleteNetwork) def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(NetworksTable, self).__init__( - request, data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, + **kwargs) try: if not api.neutron.is_extension_supported( request, "network_availability_zone"): diff --git a/openstack_dashboard/dashboards/admin/networks/views.py b/openstack_dashboard/dashboards/admin/networks/views.py index bf6f81f305..df0d1d67e8 100644 --- a/openstack_dashboard/dashboards/admin/networks/views.py +++ b/openstack_dashboard/dashboards/admin/networks/views.py @@ -118,7 +118,7 @@ class IndexView(tables.DataTableView): return networks def get_filters(self, filters=None, filters_map=None): - filters = super(IndexView, self).get_filters(filters, filters_map) + filters = super().get_filters(filters, filters_map) if 'project' in filters: tenants = api.keystone.tenant_list(self.request)[0] tenant_filter_ids = [t.id for t in tenants @@ -179,7 +179,7 @@ class DetailView(tabs.TabbedTableView): return reverse_lazy('horizon:admin:networks:index') def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) network = self._get_data() context["network"] = network table = networks_tables.NetworksTable(self.request) diff --git a/openstack_dashboard/dashboards/admin/networks/workflows.py b/openstack_dashboard/dashboards/admin/networks/workflows.py index e1b9620635..1fa0a97b9f 100644 --- a/openstack_dashboard/dashboards/admin/networks/workflows.py +++ b/openstack_dashboard/dashboards/admin/networks/workflows.py @@ -26,13 +26,11 @@ class CreateNetworkInfoAction(network_workflows.CreateNetworkInfoAction): self.create_network_form = context.get('create_network_form') self.base_fields = self.create_network_form.base_fields - super(CreateNetworkInfoAction, self).__init__( - request, context, *args, **kwargs) + super().__init__(request, context, *args, **kwargs) self.fields = self.create_network_form.fields def clean(self): - self.create_network_form.cleaned_data = super( - CreateNetworkInfoAction, self).clean() + self.create_network_form.cleaned_data = super().clean() self.create_network_form._changed_data = self.changed_data self.create_network_form._errors = self.errors return self.create_network_form.clean() @@ -48,11 +46,10 @@ class CreateNetworkInfo(network_workflows.CreateNetworkInfo): def __init__(self, workflow): self.contributes = tuple(workflow.create_network_form.fields.keys()) - super(CreateNetworkInfo, self).__init__(workflow) + super().__init__(workflow) def prepare_action_context(self, request, context): - context = super(CreateNetworkInfo, self).prepare_action_context( - request, context) + context = super().prepare_action_context(request, context) context['create_network_form'] = self.workflow.create_network_form return context @@ -66,11 +63,8 @@ class CreateNetwork(network_workflows.CreateNetwork): *args, **kwargs): self.create_network_form = networks_forms.CreateNetwork( request, *args, **kwargs) - super(CreateNetwork, self).__init__( - request=request, - context_seed=context_seed, - entry_point=entry_point, - *args, **kwargs) + super().__init__(request=request, context_seed=context_seed, + entry_point=entry_point, *args, **kwargs) def get_success_url(self): return reverse("horizon:admin:networks:index") diff --git a/openstack_dashboard/dashboards/admin/overview/views.py b/openstack_dashboard/dashboards/admin/overview/views.py index ab5093fb92..dde3ab9f06 100644 --- a/openstack_dashboard/dashboards/admin/overview/views.py +++ b/openstack_dashboard/dashboards/admin/overview/views.py @@ -50,12 +50,12 @@ class GlobalOverview(usage.UsageView): csv_response_class = GlobalUsageCsvRenderer def get_context_data(self, **kwargs): - context = super(GlobalOverview, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['monitoring'] = settings.EXTERNAL_MONITORING return context def get_data(self): - data = super(GlobalOverview, self).get_data() + data = super().get_data() # Pre-fill project names try: projects, has_more = api.keystone.tenant_list(self.request) diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/forms.py b/openstack_dashboard/dashboards/admin/rbac_policies/forms.py index af02a238e1..1fb1e5347a 100644 --- a/openstack_dashboard/dashboards/admin/rbac_policies/forms.py +++ b/openstack_dashboard/dashboards/admin/rbac_policies/forms.py @@ -79,7 +79,7 @@ class CreatePolicyForm(forms.SelfHandlingForm): required=False) def clean(self): - cleaned_data = super(CreatePolicyForm, self).clean() + cleaned_data = super().clean() action_object_type = cleaned_data.get("action_object_type") error_msg = _("This field is required.") if action_object_type in ["shared_network", "external_network"]: @@ -91,7 +91,7 @@ class CreatePolicyForm(forms.SelfHandlingForm): return cleaned_data def __init__(self, request, *args, **kwargs): - super(CreatePolicyForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) tenant_choices = [('', _("Select a project"))] tenants, has_more = api.keystone.tenant_list(request) tenant_choices.append(("*", "*")) @@ -161,7 +161,7 @@ class UpdatePolicyForm(forms.SelfHandlingForm): failure_url = 'horizon:admin:rbac_policies:index' def __init__(self, request, *args, **kwargs): - super(UpdatePolicyForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) tenant_choices = [('', _("Select a project"))] tenant_choices.append(("*", "*")) tenants, has_more = api.keystone.tenant_list(request) diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/tabs.py b/openstack_dashboard/dashboards/admin/rbac_policies/tabs.py index 80dd2bf9e0..8ea058354e 100644 --- a/openstack_dashboard/dashboards/admin/rbac_policies/tabs.py +++ b/openstack_dashboard/dashboards/admin/rbac_policies/tabs.py @@ -44,7 +44,7 @@ class OverviewTab(tabs.Tab): return rbac_policy def get_context_data(self, request, **kwargs): - context = super(OverviewTab, self).get_context_data(request, **kwargs) + context = super().get_context_data(request, **kwargs) rbac_policy = self._get_data() context["rbac_policy"] = rbac_policy diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/views.py b/openstack_dashboard/dashboards/admin/rbac_policies/views.py index a0adc871df..c9af346978 100644 --- a/openstack_dashboard/dashboards/admin/rbac_policies/views.py +++ b/openstack_dashboard/dashboards/admin/rbac_policies/views.py @@ -116,7 +116,7 @@ class UpdateView(forms.ModalFormView): page_title = _("Update RBAC Policy") def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['rbac_policy_id'],) context["rbac_policy_id"] = self.kwargs['rbac_policy_id'] context["submit_url"] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/admin/routers/forms.py b/openstack_dashboard/dashboards/admin/routers/forms.py index f32c6aaf1d..465ce36d5f 100644 --- a/openstack_dashboard/dashboards/admin/routers/forms.py +++ b/openstack_dashboard/dashboards/admin/routers/forms.py @@ -27,7 +27,7 @@ class CreateForm(r_forms.CreateForm): failure_url = 'horizon:admin:routers:index' def __init__(self, request, *args, **kwargs): - super(CreateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) tenant_choices = [('', _("Select a project"))] tenants, __ = api.keystone.tenant_list(request) for tenant in tenants: diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py index f9718bc060..2ad9d6573a 100644 --- a/openstack_dashboard/dashboards/admin/routers/tests.py +++ b/openstack_dashboard/dashboards/admin/routers/tests.py @@ -55,7 +55,7 @@ class RouterMixin(r_test.RouterMixin): return res def _check_get_detail(self, router, extraroute=True): - super(RouterMixin, self)._check_get_detail(router, extraroute) + super()._check_get_detail(router, extraroute) self.mock_is_extension_supported.assert_any_call( test.IsHttpRequest(), 'l3_agent_scheduler') if self.support_l3_agent: @@ -191,7 +191,7 @@ class RouterTests(RouterMixin, r_test.RouterTestCase, test.BaseAdminViewTests): @test.create_mocks({api.neutron: ('list_l3_agent_hosting_router',)}) def test_router_detail(self): - super(RouterTests, self).test_router_detail() + super().test_router_detail() @test.create_mocks({api.neutron: ('router_list', 'network_list', @@ -358,8 +358,8 @@ class RouterRouteTests(RouterMixin, @test.create_mocks({api.neutron: ('list_l3_agent_hosting_router',)}) def test_extension_hides_without_routes(self): - super(RouterRouteTests, self).test_extension_hides_without_routes() + super().test_extension_hides_without_routes() @test.create_mocks({api.neutron: ('list_l3_agent_hosting_router',)}) def test_routerroute_detail(self): - super(RouterRouteTests, self).test_routerroute_detail() + super().test_routerroute_detail() diff --git a/openstack_dashboard/dashboards/admin/routers/views.py b/openstack_dashboard/dashboards/admin/routers/views.py index 55c3ab3f40..cbd301a707 100644 --- a/openstack_dashboard/dashboards/admin/routers/views.py +++ b/openstack_dashboard/dashboards/admin/routers/views.py @@ -84,7 +84,7 @@ class IndexView(r_views.IndexView, n_views.IndexView): return routers def get_filters(self, filters=None, filters_map=None): - filters = super(IndexView, self).get_filters(filters, filters_map) + filters = super().get_filters(filters, filters_map) if 'project' in filters: tenants = api.keystone.tenant_list(self.request)[0] tenants_filter_ids = [t.id for t in tenants @@ -100,7 +100,7 @@ class DetailView(r_views.DetailView): network_url = 'horizon:admin:networks:detail' def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) table = rtbl.RoutersTable(self.request) context["url"] = self.failure_url router = context["router"] diff --git a/openstack_dashboard/dashboards/admin/snapshots/forms.py b/openstack_dashboard/dashboards/admin/snapshots/forms.py index 2a36057e99..c4522ba189 100644 --- a/openstack_dashboard/dashboards/admin/snapshots/forms.py +++ b/openstack_dashboard/dashboards/admin/snapshots/forms.py @@ -53,7 +53,7 @@ class UpdateStatus(forms.SelfHandlingForm): current_status = kwargs['initial']['status'] kwargs['initial'].pop('status') - super(UpdateStatus, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.fields['status'].choices = populate_status_choices( current_status, STATUS_CHOICES) diff --git a/openstack_dashboard/dashboards/admin/snapshots/tables.py b/openstack_dashboard/dashboards/admin/snapshots/tables.py index 4e3a82a868..ffffa03bf5 100644 --- a/openstack_dashboard/dashboards/admin/snapshots/tables.py +++ b/openstack_dashboard/dashboards/admin/snapshots/tables.py @@ -38,7 +38,7 @@ class UpdateRow(snapshots_tables.UpdateRow): ajax = True def get_data(self, request, snapshot_id): - snapshot = super(UpdateRow, self).get_data(request, snapshot_id) + snapshot = super().get_data(request, snapshot_id) snapshot.host_name = getattr(snapshot._volume, 'os-vol-host-attr:host') tenant_id = getattr(snapshot._volume, diff --git a/openstack_dashboard/dashboards/admin/snapshots/views.py b/openstack_dashboard/dashboards/admin/snapshots/views.py index 9e4086a28e..5225db29fd 100644 --- a/openstack_dashboard/dashboards/admin/snapshots/views.py +++ b/openstack_dashboard/dashboards/admin/snapshots/views.py @@ -119,7 +119,7 @@ class UpdateStatusView(forms.ModalFormView): return self._object def get_context_data(self, **kwargs): - context = super(UpdateStatusView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['snapshot_id'] = self.kwargs["snapshot_id"] args = (self.kwargs['snapshot_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -136,7 +136,7 @@ class DetailView(views.DetailView): volume_url = 'horizon:admin:volumes:detail' def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) snapshot = self.get_data() snapshot.volume_url = reverse(self.volume_url, args=(snapshot.volume_id,)) diff --git a/openstack_dashboard/dashboards/admin/trunks/panel.py b/openstack_dashboard/dashboards/admin/trunks/panel.py index 6005ca5205..d530b73cf3 100644 --- a/openstack_dashboard/dashboards/admin/trunks/panel.py +++ b/openstack_dashboard/dashboards/admin/trunks/panel.py @@ -33,7 +33,7 @@ class Trunks(horizon.Panel): request = context['request'] try: return ( - super(Trunks, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) and neutron.is_extension_supported(request, extension_alias='trunk') diff --git a/openstack_dashboard/dashboards/admin/vg_snapshots/views.py b/openstack_dashboard/dashboards/admin/vg_snapshots/views.py index 2850fa63ba..aceb99756b 100644 --- a/openstack_dashboard/dashboards/admin/vg_snapshots/views.py +++ b/openstack_dashboard/dashboards/admin/vg_snapshots/views.py @@ -75,7 +75,7 @@ class DetailView(project_views.DetailView): tab_group_class = admin_tabs.DetailTabs def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) table = admin_tables.GroupSnapshotsTable(self.request) context["actions"] = table.render_row_actions(context["vg_snapshot"]) return context diff --git a/openstack_dashboard/dashboards/admin/volume_groups/tables.py b/openstack_dashboard/dashboards/admin/volume_groups/tables.py index 39c77a7487..a0a0835522 100644 --- a/openstack_dashboard/dashboards/admin/volume_groups/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_groups/tables.py @@ -34,7 +34,7 @@ class UpdateRow(project_tables.UpdateRow): ajax = True def get_data(self, request, group_id): - group = super(UpdateRow, self).get_data(request, group_id) + group = super().get_data(request, group_id) tenant_id = getattr(group, 'project_id') try: tenant = keystone.tenant_get(request, tenant_id) diff --git a/openstack_dashboard/dashboards/admin/volume_groups/views.py b/openstack_dashboard/dashboards/admin/volume_groups/views.py index 1cba1ca11e..2ee6478f1a 100644 --- a/openstack_dashboard/dashboards/admin/volume_groups/views.py +++ b/openstack_dashboard/dashboards/admin/volume_groups/views.py @@ -93,7 +93,7 @@ class DetailView(project_views.DetailView): tab_group_class = admin_tabs.GroupsDetailTabs def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) table = admin_tables.GroupsTable(self.request) context["actions"] = table.render_row_actions(context["group"]) return context diff --git a/openstack_dashboard/dashboards/admin/volume_types/extras/forms.py b/openstack_dashboard/dashboards/admin/volume_types/extras/forms.py index 31d381673a..c5fc120f24 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/extras/forms.py +++ b/openstack_dashboard/dashboards/admin/volume_types/extras/forms.py @@ -35,7 +35,7 @@ class CreateExtraSpec(forms.SelfHandlingForm): value = forms.CharField(max_length=255, label=_("Value")) def clean(self): - data = super(CreateExtraSpec, self).clean() + data = super().clean() type_id = self.initial['type_id'] extra_list = api.cinder.volume_type_extra_get(self.request, type_id) diff --git a/openstack_dashboard/dashboards/admin/volume_types/extras/views.py b/openstack_dashboard/dashboards/admin/volume_types/extras/views.py index 1284421e45..29c809e0b3 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/extras/views.py +++ b/openstack_dashboard/dashboards/admin/volume_types/extras/views.py @@ -28,7 +28,7 @@ from openstack_dashboard.dashboards.admin.volume_types.extras \ class ExtraSpecMixin(object): def get_context_data(self, **kwargs): - context = super(ExtraSpecMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context['vol_type'] = api.cinder.volume_type_get( self.request, self.kwargs['type_id']) @@ -76,7 +76,7 @@ class CreateView(ExtraSpecMixin, forms.ModalFormView): args=(self.kwargs['type_id'],)) def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -114,14 +114,14 @@ class EditView(ExtraSpecMixin, forms.ModalFormView): 'value': extra_specs.get(key, '')} def get_context_data(self, **kwargs): - context = super(EditView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['type_id'], self.kwargs['key'],) context['submit_url'] = reverse(self.submit_url, args=args) context['page_title'] = self.page_title % self.kwargs['key'] return context def form_invalid(self, form): - context = super(EditView, self).get_context_data() + context = super().get_context_data() context = self._populate_context(context) context['form'] = form context['page_title'] = self.page_title % self.kwargs['key'] diff --git a/openstack_dashboard/dashboards/admin/volume_types/forms.py b/openstack_dashboard/dashboards/admin/volume_types/forms.py index 15fa1912e7..b306d8dc08 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/forms.py +++ b/openstack_dashboard/dashboards/admin/volume_types/forms.py @@ -170,9 +170,7 @@ class ManageQosSpecAssociation(forms.SelfHandlingForm): help_text=_("Choose associated QoS Spec.")) def __init__(self, request, *args, **kwargs): - super(ManageQosSpecAssociation, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) qos_spec_field = self.fields['qos_spec_choice'] qos_spec_field.choices = \ self.populate_qos_spec_choices() @@ -242,7 +240,7 @@ class EditQosSpecConsumer(forms.SelfHandlingForm): help_text=_("Choose consumer for this QoS Spec.")) def __init__(self, request, *args, **kwargs): - super(EditQosSpecConsumer, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) consumer_field = self.fields['consumer_choice'] qos_spec = self.initial["qos_spec"] self.fields['current_consumer'].initial = qos_spec.consumer @@ -315,7 +313,7 @@ class EditVolumeType(forms.SelfHandlingForm): class EditTypeAccessForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): - super(EditTypeAccessForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve volume type access list.') self.fields["member"] = forms.MultipleChoiceField( diff --git a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/views.py b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/views.py index 10cba74d9c..dff4317b64 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/views.py +++ b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/views.py @@ -28,7 +28,7 @@ from openstack_dashboard.dashboards.admin.volume_types.qos_specs \ class QosSpecMixin(object): @memoized def get_context_data(self, **kwargs): - context = super(QosSpecMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) # Note the use of self.kwargs instead of the parameter kwargs. # This is needed for consistency when dealing with both # index views and forms (i,e, EditView). With forms, @@ -85,8 +85,7 @@ class CreateKeyValuePairView(QosSpecMixin, forms.ModalFormView): return reverse(self.url) def get_context_data(self, **kwargs): - context = super(CreateKeyValuePairView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['qos_spec_id'],) context['submit_url'] = reverse(self.submit_url, args=args) context['cancel_url'] = reverse(self.url) @@ -121,7 +120,7 @@ class EditKeyValuePairView(QosSpecMixin, forms.ModalFormView): 'value': qos_specs.specs.get(key, '')} def get_context_data(self, **kwargs): - context = super(EditKeyValuePairView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['qos_spec_id'], self.kwargs['key'],) context['submit_url'] = reverse(self.submit_url, args=args) context['cancel_url'] = reverse(self.url) diff --git a/openstack_dashboard/dashboards/admin/volume_types/tables.py b/openstack_dashboard/dashboards/admin/volume_types/tables.py index 24e4c681ff..d530fc38aa 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_types/tables.py @@ -211,7 +211,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(**kwargs) + super().__init__(**kwargs) def get_link_url(self, datum): obj_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/admin/volume_types/views.py b/openstack_dashboard/dashboards/admin/volume_types/views.py index b4c0777722..47ebb7583a 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/views.py +++ b/openstack_dashboard/dashboards/admin/volume_types/views.py @@ -105,8 +105,7 @@ class VolumeTypeEncryptionDetailView(views.HorizonTemplateView): page_title = _("Volume Type Encryption Details") def get_context_data(self, **kwargs): - context = super(VolumeTypeEncryptionDetailView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["volume_type_encryption"] = self.get_data() return context @@ -149,8 +148,7 @@ class CreateVolumeTypeEncryptionView(forms.ModalFormView): return self.name def get_context_data(self, **kwargs): - context = super(CreateVolumeTypeEncryptionView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_type_id'] = self.kwargs['volume_type_id'] args = (self.kwargs['volume_type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -186,7 +184,7 @@ class EditVolumeTypeView(forms.ModalFormView): return volume_type def get_context_data(self, **kwargs): - context = super(EditVolumeTypeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_type'] = self.get_data() return context @@ -240,8 +238,7 @@ class UpdateVolumeTypeEncryptionView(forms.ModalFormView): return self.name def get_context_data(self, **kwargs): - context = super(UpdateVolumeTypeEncryptionView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_type_id'] = self.kwargs['volume_type_id'] args = (self.kwargs['volume_type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -278,8 +275,7 @@ class EditQosSpecConsumerView(forms.ModalFormView): page_title = _("Edit QoS Spec Consumer") def get_context_data(self, **kwargs): - context = super(EditQosSpecConsumerView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['qos_spec_id'] = self.kwargs["qos_spec_id"] args = (self.kwargs['qos_spec_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -313,8 +309,7 @@ class ManageQosSpecAssociationView(forms.ModalFormView): page_title = _("Associate QoS Spec with Volume Type") def get_context_data(self, **kwargs): - context = super(ManageQosSpecAssociationView, self).\ - get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['type_id'] = self.kwargs["type_id"] args = (self.kwargs['type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -389,7 +384,7 @@ class EditAccessView(forms.ModalFormView): page_title = _("Edit Volume Type Access") def get_context_data(self, **kwargs): - context = super(EditAccessView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_type_id'] = self.kwargs["volume_type_id"] args = (self.kwargs['volume_type_id'],) context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/admin/volumes/forms.py b/openstack_dashboard/dashboards/admin/volumes/forms.py index 1b4cd79293..e902aeee7b 100644 --- a/openstack_dashboard/dashboards/admin/volumes/forms.py +++ b/openstack_dashboard/dashboards/admin/volumes/forms.py @@ -83,7 +83,7 @@ class ManageVolume(forms.SelfHandlingForm): "should be marked as bootable")) def __init__(self, request, *args, **kwargs): - super(ManageVolume, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.fields['id_type'].choices = [("source-name", _("Name"))] + \ [("source-id", _("ID"))] volume_types = cinder.volume_type_list(request) @@ -179,7 +179,7 @@ class MigrateVolume(forms.SelfHandlingForm): initial=False, required=False) def __init__(self, request, *args, **kwargs): - super(MigrateVolume, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) initial = kwargs.get('initial', {}) self.fields['host'].choices = self.populate_host_choices(request, initial) @@ -222,7 +222,7 @@ class UpdateStatus(forms.SelfHandlingForm): current_status = kwargs['initial']['status'] kwargs['initial'].pop('status') - super(UpdateStatus, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.fields['status'].choices = populate_status_choices( current_status, STATUS_CHOICES) diff --git a/openstack_dashboard/dashboards/admin/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/tests.py index a633c8e2ac..26af3f32be 100644 --- a/openstack_dashboard/dashboards/admin/volumes/tests.py +++ b/openstack_dashboard/dashboards/admin/volumes/tests.py @@ -37,7 +37,7 @@ class VolumeTests(test.BaseAdminViewTests): for att in volume.attachments: if 'instance' in att: del att['instance'] - super(VolumeTests, self).tearDown() + super().tearDown() @test.create_mocks({ api.nova: ['server_list'], diff --git a/openstack_dashboard/dashboards/admin/volumes/views.py b/openstack_dashboard/dashboards/admin/volumes/views.py index c8cb8ae560..041a1c3d62 100644 --- a/openstack_dashboard/dashboards/admin/volumes/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/views.py @@ -143,8 +143,7 @@ class VolumesView(tables.PagedTableMixin, volumes_views.VolumeTableMixIn, self.table = self._tables['volumes'] self.handle_server_filter(self.request, table=self.table) self.update_server_filter_action(self.request, table=self.table) - filters = super(VolumesView, self).get_filters(filters, - self.FILTERS_MAPPING) + filters = super().get_filters(filters, self.FILTERS_MAPPING) return filters @@ -152,13 +151,13 @@ class DetailView(volumes_views.DetailView): tab_group_class = volumes_tabs.VolumeDetailTabs def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) table = volumes_tables.VolumesTable(self.request) context["actions"] = table.render_row_actions(context["volume"]) return context def get_search_opts(self, volume): - search_opts = super(DetailView, self).get_search_opts(volume) + search_opts = super().get_search_opts(volume) search_opts['all_tenants'] = True return search_opts @@ -177,7 +176,7 @@ class ManageVolumeView(forms.ModalFormView): page_title = _("Manage Volume") def get_context_data(self, **kwargs): - context = super(ManageVolumeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) return context @@ -192,7 +191,7 @@ class UnmanageVolumeView(forms.ModalFormView): page_title = _("Unmanage Volume") def get_context_data(self, **kwargs): - context = super(UnmanageVolumeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -226,7 +225,7 @@ class MigrateVolumeView(forms.ModalFormView): page_title = _("Migrate Volume") def get_context_data(self, **kwargs): - context = super(MigrateVolumeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -269,7 +268,7 @@ class UpdateStatusView(forms.ModalFormView): page_title = _("Update Volume Status") def get_context_data(self, **kwargs): - context = super(UpdateStatusView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["volume_id"] = self.kwargs['volume_id'] args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/identity/application_credentials/forms.py b/openstack_dashboard/dashboards/identity/application_credentials/forms.py index 544127f762..c57132b40c 100644 --- a/openstack_dashboard/dashboards/identity/application_credentials/forms.py +++ b/openstack_dashboard/dashboards/identity/application_credentials/forms.py @@ -63,8 +63,7 @@ class CreateApplicationCredentialForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): self.next_view = kwargs.pop('next_view', None) - super(CreateApplicationCredentialForm, self).__init__(request, *args, - **kwargs) + super().__init__(request, *args, **kwargs) role_list = self.request.user.roles role_names = [role['name'] for role in role_list] role_choices = ((name, name) for name in role_names) @@ -132,7 +131,7 @@ class CreateApplicationCredentialForm(forms.SelfHandlingForm): request, _('Unable to create application credential.')) def clean(self): - cleaned_data = super(CreateApplicationCredentialForm, self).clean() + cleaned_data = super().clean() try: cleaned_data['access_rules'] = yaml.safe_load( cleaned_data['access_rules']) diff --git a/openstack_dashboard/dashboards/identity/application_credentials/views.py b/openstack_dashboard/dashboards/identity/application_credentials/views.py index 4d175b5f11..e6170295fd 100644 --- a/openstack_dashboard/dashboards/identity/application_credentials/views.py +++ b/openstack_dashboard/dashboards/identity/application_credentials/views.py @@ -82,12 +82,12 @@ class CreateView(forms.ModalFormView): page_title = _("Create Application Credential") def get_form_kwargs(self): - kwargs = super(CreateView, self).get_form_kwargs() + kwargs = super().get_form_kwargs() kwargs['next_view'] = CreateSuccessfulView return kwargs def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['kubeconfig_enabled'] = settings.KUBECONFIG_ENABLED return context @@ -105,7 +105,7 @@ class CreateSuccessfulView(forms.ModalFormView): download_kubeconfig_label = _("Download kubeconfig file") def get_context_data(self, **kwargs): - context = super(CreateSuccessfulView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['download_openrc_label'] = self.download_openrc_label context['download_clouds_yaml_label'] = self.download_clouds_yaml_label context['download_kubeconfig_label'] = self.download_kubeconfig_label @@ -194,7 +194,7 @@ class DetailView(views.HorizonTemplateView): page_title = "{{ application_credential.name }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) app_cred = self.get_data() table = project_tables.ApplicationCredentialsTable(self.request) context["application_credential"] = app_cred diff --git a/openstack_dashboard/dashboards/identity/domains/panel.py b/openstack_dashboard/dashboards/identity/domains/panel.py index a6316c3757..7d596ed164 100644 --- a/openstack_dashboard/dashboards/identity/domains/panel.py +++ b/openstack_dashboard/dashboards/identity/domains/panel.py @@ -26,4 +26,4 @@ class Domains(horizon.Panel): def can_access(self, context): request = context['request'] domain_token = request.session.get('domain_token') - return super(Domains, self).can_access(context) and domain_token + return super().can_access(context) and domain_token diff --git a/openstack_dashboard/dashboards/identity/domains/views.py b/openstack_dashboard/dashboards/identity/domains/views.py index eb63a6eaca..c03b9cc418 100644 --- a/openstack_dashboard/dashboards/identity/domains/views.py +++ b/openstack_dashboard/dashboards/identity/domains/views.py @@ -72,7 +72,7 @@ class UpdateDomainView(workflows.WorkflowView): workflow_class = project_workflows.UpdateDomain def get_initial(self): - initial = super(UpdateDomainView, self).get_initial() + initial = super().get_initial() domain_id = self.kwargs['domain_id'] initial['domain_id'] = domain_id diff --git a/openstack_dashboard/dashboards/identity/domains/workflows.py b/openstack_dashboard/dashboards/identity/domains/workflows.py index b20e6ca1ab..6a13b0f871 100644 --- a/openstack_dashboard/dashboards/identity/domains/workflows.py +++ b/openstack_dashboard/dashboards/identity/domains/workflows.py @@ -59,9 +59,7 @@ class CreateDomainInfo(workflows.Step): class UpdateDomainUsersAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(UpdateDomainUsersAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) domain_id = self.initial.get("domain_id", '') # Get the default role @@ -137,7 +135,7 @@ class UpdateDomainUsers(workflows.UpdateMembersStep): no_members_text = _("No users.") def contribute(self, data, context): - context = super(UpdateDomainUsers, self).contribute(data, context) + context = super().contribute(data, context) if data: try: roles = api.keystone.role_list(self.workflow.request) @@ -156,9 +154,7 @@ class UpdateDomainUsers(workflows.UpdateMembersStep): class UpdateDomainGroupsAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(UpdateDomainGroupsAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve group list. Please try again later.') domain_id = self.initial.get("domain_id", '') @@ -233,7 +229,7 @@ class UpdateDomainGroups(workflows.UpdateMembersStep): no_members_text = _("No groups.") def contribute(self, data, context): - context = super(UpdateDomainGroups, self).contribute(data, context) + context = super().contribute(data, context) if data: try: roles = api.keystone.role_list(self.workflow.request) diff --git a/openstack_dashboard/dashboards/identity/groups/panel.py b/openstack_dashboard/dashboards/identity/groups/panel.py index 4edec674a2..85442e77c6 100644 --- a/openstack_dashboard/dashboards/identity/groups/panel.py +++ b/openstack_dashboard/dashboards/identity/groups/panel.py @@ -29,4 +29,4 @@ class Groups(horizon.Panel): if (settings.OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT and not keystone.is_domain_admin(context['request'])): return False - return super(Groups, self).can_access(context) + return super().can_access(context) diff --git a/openstack_dashboard/dashboards/identity/groups/views.py b/openstack_dashboard/dashboards/identity/groups/views.py index 108c946146..91ff369222 100644 --- a/openstack_dashboard/dashboards/identity/groups/views.py +++ b/openstack_dashboard/dashboards/identity/groups/views.py @@ -103,7 +103,7 @@ class UpdateView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.get_object().id,) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -144,7 +144,7 @@ class ManageMembersView(GroupManageMixin, tables.DataTableView): page_title = _("Group Management: {{ group.name }}") def get_context_data(self, **kwargs): - context = super(ManageMembersView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group'] = self._get_group() return context @@ -165,7 +165,7 @@ class NonMembersView(GroupManageMixin, forms.ModalFormMixin, table_class = project_tables.GroupNonMembersTable def get_context_data(self, **kwargs): - context = super(NonMembersView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group'] = self._get_group() return context diff --git a/openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py b/openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py index 29a8d57dd3..6bb9b673b0 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/protocols/forms.py @@ -33,7 +33,7 @@ class AddProtocolForm(forms.SelfHandlingForm): mapping_id = forms.ThemableChoiceField(label=_("Mapping ID")) def __init__(self, request, *args, **kwargs): - super(AddProtocolForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.populate_mapping_id_choices(request) def populate_mapping_id_choices(self, request): diff --git a/openstack_dashboard/dashboards/identity/identity_providers/protocols/views.py b/openstack_dashboard/dashboards/identity/identity_providers/protocols/views.py index 656f992e00..1a3961b48e 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/protocols/views.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/protocols/views.py @@ -34,7 +34,7 @@ class AddProtocolView(forms.ModalFormView): args=(self.kwargs['identity_provider_id'],)) def get_context_data(self, **kwargs): - context = super(AddProtocolView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["submit_url"] = reverse( "horizon:identity:identity_providers:protocols:create", args=(self.kwargs['identity_provider_id'],)) diff --git a/openstack_dashboard/dashboards/identity/identity_providers/views.py b/openstack_dashboard/dashboards/identity/identity_providers/views.py index 0936a41ee3..e81ec3af75 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/views.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/views.py @@ -87,7 +87,7 @@ class DetailView(tabs.TabbedTableView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) idp = self._get_data() context["identity_provider"] = idp return context @@ -122,7 +122,7 @@ class UpdateView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.get_object().id,) context['submit_url'] = reverse(self.submit_url, args=args) return context diff --git a/openstack_dashboard/dashboards/identity/mappings/views.py b/openstack_dashboard/dashboards/identity/mappings/views.py index d7eb99f602..af69c2bb2b 100644 --- a/openstack_dashboard/dashboards/identity/mappings/views.py +++ b/openstack_dashboard/dashboards/identity/mappings/views.py @@ -76,7 +76,7 @@ class UpdateView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.get_object().id,) context['submit_url'] = reverse(self.submit_url, args=args) return context diff --git a/openstack_dashboard/dashboards/identity/projects/tables.py b/openstack_dashboard/dashboards/identity/projects/tables.py index 0332e9ce73..0d10526c5c 100644 --- a/openstack_dashboard/dashboards/identity/projects/tables.py +++ b/openstack_dashboard/dashboards/identity/projects/tables.py @@ -67,7 +67,7 @@ class UpdateMembersLink(tables.LinkAction): # domain admin or cloud admin = True # project admin or member = False return api.keystone.is_domain_admin(request) - return super(UpdateMembersLink, self).allowed(request, project) + return super().allowed(request, project) class UpdateGroupsLink(tables.LinkAction): @@ -83,7 +83,7 @@ class UpdateGroupsLink(tables.LinkAction): # domain admin or cloud admin = True # project admin or member = False return api.keystone.is_domain_admin(request) - return super(UpdateGroupsLink, self).allowed(request, project) + return super().allowed(request, project) def get_link_url(self, project): step = 'update_group_members' @@ -186,8 +186,7 @@ class DeleteTenantsAction(policy.PolicyTargetMixin, tables.DeleteAction): api.keystone.tenant_delete(request, obj_id) def handle(self, table, request, obj_ids): - response = \ - super(DeleteTenantsAction, self).handle(table, request, obj_ids) + response = super().handle(table, request, obj_ids) return response @@ -235,10 +234,8 @@ class TenantsTable(tables.DataTable): return None def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(TenantsTable, - self).__init__(request, data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, **kwargs) # see the comment above about ugly monkey patches self.columns['name'].get_link_url = self.get_project_detail_link diff --git a/openstack_dashboard/dashboards/identity/projects/views.py b/openstack_dashboard/dashboards/identity/projects/views.py index 108b92bd9d..13aee4c90a 100644 --- a/openstack_dashboard/dashboards/identity/projects/views.py +++ b/openstack_dashboard/dashboards/identity/projects/views.py @@ -65,7 +65,7 @@ class TenantContextMixin(object): redirect=reverse(INDEX_URL)) def get_context_data(self, **kwargs): - context = super(TenantContextMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['tenant'] = self.get_object() return context @@ -147,7 +147,7 @@ class ProjectUsageView(usage.UsageView): page_title = _("Project Usage") def get_data(self): - super(ProjectUsageView, self).get_data() + super().get_data() return self.usage.get_instances() @@ -155,7 +155,7 @@ class CreateProjectView(workflows.WorkflowView): workflow_class = project_workflows.CreateProject def get_initial(self): - initial = super(CreateProjectView, self).get_initial() + initial = super().get_initial() # Set the domain of the project domain = api.keystone.get_default_domain(self.request) @@ -169,7 +169,7 @@ class UpdateProjectView(workflows.WorkflowView): workflow_class = project_workflows.UpdateProject def get_initial(self): - initial = super(UpdateProjectView, self).get_initial() + initial = super().get_initial() project_id = self.kwargs['tenant_id'] initial['project_id'] = project_id @@ -213,7 +213,7 @@ class UpdateQuotasView(workflows.WorkflowView): workflow_class = project_workflows.UpdateQuota def get_initial(self): - initial = super(UpdateQuotasView, self).get_initial() + initial = super().get_initial() project_id = self.kwargs['tenant_id'] initial['project_id'] = project_id try: @@ -237,7 +237,7 @@ class DetailProjectView(tabs.TabView): page_title = "{{ project.name }}" def get_context_data(self, **kwargs): - context = super(DetailProjectView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) project = self.get_data() table = project_tables.TenantsTable(self.request) context["project"] = project diff --git a/openstack_dashboard/dashboards/identity/projects/workflows.py b/openstack_dashboard/dashboards/identity/projects/workflows.py index 48ba05c1b8..de3e2ca498 100644 --- a/openstack_dashboard/dashboards/identity/projects/workflows.py +++ b/openstack_dashboard/dashboards/identity/projects/workflows.py @@ -53,7 +53,7 @@ class CommonQuotaAction(workflows.Action): _quota_fields = None def __init__(self, request, *args, **kwargs): - super(CommonQuotaAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) disabled_quotas = self.initial['disabled_quotas'] for field in disabled_quotas: if field in self.fields: @@ -61,7 +61,7 @@ class CommonQuotaAction(workflows.Action): self.fields[field].widget = forms.HiddenInput() def clean(self): - cleaned_data = super(CommonQuotaAction, self).clean() + cleaned_data = super().clean() usages = quotas.tenant_quota_usages( self.request, tenant_id=self.initial['project_id'], targets=tuple(self._quota_fields)) @@ -228,9 +228,7 @@ class CreateProjectInfoAction(workflows.Action): initial=True) def __init__(self, request, *args, **kwargs): - super(CreateProjectInfoAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) readonlyInput = forms.TextInput(attrs={'readonly': 'readonly'}) self.fields["domain_id"].widget = readonlyInput self.fields["domain_name"].widget = readonlyInput @@ -259,16 +257,14 @@ class CreateProjectInfo(workflows.Step): "enabled") def __init__(self, workflow): - super(CreateProjectInfo, self).__init__(workflow) + super().__init__(workflow) EXTRA_INFO = settings.PROJECT_TABLE_EXTRA_INFO self.contributes += tuple(EXTRA_INFO.keys()) class UpdateProjectMembersAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(UpdateProjectMembersAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve user list. Please try again later.') # Use the domain_id from the project domain_id = self.initial.get("domain_id", None) @@ -364,9 +360,7 @@ class UpdateProjectMembers(workflows.UpdateMembersStep): class UpdateProjectGroupsAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(UpdateProjectGroupsAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve group list. Please try again later.') # Use the domain_id from the project domain_id = self.initial.get("domain_id", None) @@ -477,11 +471,8 @@ class CreateProject(workflows.Workflow): self.default_steps = (CreateProjectInfo, UpdateProjectMembers, UpdateProjectGroups) - super(CreateProject, self).__init__(request=request, - context_seed=context_seed, - entry_point=entry_point, - *args, - **kwargs) + super().__init__(request=request, context_seed=context_seed, + entry_point=entry_point, *args, **kwargs) def format_status_message(self, message): if "%s" in message: @@ -590,15 +581,14 @@ class UpdateProjectInfoAction(CreateProjectInfoAction): widget=forms.HiddenInput()) def __init__(self, request, initial, *args, **kwargs): - super(UpdateProjectInfoAction, self).__init__( - request, initial, *args, **kwargs) + super().__init__(request, initial, *args, **kwargs) if initial['project_id'] == request.user.project_id: self.fields['enabled'].widget.attrs['disabled'] = True self.fields['enabled'].help_text = _( 'You cannot disable your current project') def clean(self): - cleaned_data = super(UpdateProjectInfoAction, self).clean() + cleaned_data = super().clean() # NOTE(tsufiev): in case the current project is being edited, its # 'enabled' field is disabled to prevent changing the field value # which is always `True` for the current project (because the user @@ -626,7 +616,7 @@ class UpdateProjectInfo(workflows.Step): "enabled") def __init__(self, workflow): - super(UpdateProjectInfo, self).__init__(workflow) + super().__init__(workflow) EXTRA_INFO = settings.PROJECT_TABLE_EXTRA_INFO self.contributes += tuple(EXTRA_INFO.keys()) @@ -647,11 +637,8 @@ class UpdateProject(workflows.Workflow): UpdateProjectMembers, UpdateProjectGroups) - super(UpdateProject, self).__init__(request=request, - context_seed=context_seed, - entry_point=entry_point, - *args, - **kwargs) + super().__init__(request=request, context_seed=context_seed, + entry_point=entry_point, *args, **kwargs) def format_status_message(self, message): if "%s" in message: diff --git a/openstack_dashboard/dashboards/identity/roles/panel.py b/openstack_dashboard/dashboards/identity/roles/panel.py index 43358bbf82..98ccdeb0a5 100644 --- a/openstack_dashboard/dashboards/identity/roles/panel.py +++ b/openstack_dashboard/dashboards/identity/roles/panel.py @@ -29,4 +29,4 @@ class Roles(horizon.Panel): if (settings.OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT and not keystone.is_domain_admin(context['request'])): return False - return super(Roles, self).can_access(context) + return super().can_access(context) diff --git a/openstack_dashboard/dashboards/identity/roles/views.py b/openstack_dashboard/dashboards/identity/roles/views.py index 4a3ac5684a..28a2bda4b0 100644 --- a/openstack_dashboard/dashboards/identity/roles/views.py +++ b/openstack_dashboard/dashboards/identity/roles/views.py @@ -88,7 +88,7 @@ class UpdateView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.get_object().id,) context['submit_url'] = reverse(self.submit_url, args=args) return context diff --git a/openstack_dashboard/dashboards/identity/users/forms.py b/openstack_dashboard/dashboards/identity/users/forms.py index c7630aa42c..dc037c166b 100644 --- a/openstack_dashboard/dashboards/identity/users/forms.py +++ b/openstack_dashboard/dashboards/identity/users/forms.py @@ -51,7 +51,7 @@ class PasswordMixin(forms.SelfHandlingForm): def clean(self): '''Check to make sure password fields match.''' - data = super(PasswordMixin, self).clean() + data = super().clean() if 'password' in data and 'confirm_password' in data: if data['password'] != data['confirm_password']: raise ValidationError(_('Passwords do not match.')) @@ -60,7 +60,7 @@ class PasswordMixin(forms.SelfHandlingForm): class BaseUserForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): - super(BaseUserForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # Populate project choices project_choices = [] @@ -134,7 +134,7 @@ class CreateUserForm(PasswordMixin, BaseUserForm, AddExtraColumnMixIn): def __init__(self, *args, **kwargs): roles = kwargs.pop('roles') - super(CreateUserForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Reorder form fields from multiple inheritance ordering = ["domain_id", "domain_name", "name", "description", "email", "password", @@ -235,7 +235,7 @@ class UpdateUserForm(BaseUserForm, AddExtraColumnMixIn): initial=False) def __init__(self, request, *args, **kwargs): - super(UpdateUserForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.add_extra_fields() if api.keystone.keystone_can_edit_user() is False: for field in ('name', 'email'): @@ -288,7 +288,7 @@ class ChangePasswordForm(PasswordMixin, forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(ChangePasswordForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if settings.ENFORCE_PASSWORD_CHECK: self.fields["admin_password"] = forms.CharField( diff --git a/openstack_dashboard/dashboards/identity/users/panel.py b/openstack_dashboard/dashboards/identity/users/panel.py index 175f4447c8..0894823aee 100644 --- a/openstack_dashboard/dashboards/identity/users/panel.py +++ b/openstack_dashboard/dashboards/identity/users/panel.py @@ -34,4 +34,4 @@ class Users(horizon.Panel): if (settings.OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT and not keystone.is_domain_admin(context['request'])): return False - return super(Users, self).can_access(context) + return super().can_access(context) diff --git a/openstack_dashboard/dashboards/identity/users/views.py b/openstack_dashboard/dashboards/identity/users/views.py index a0702b10a2..4ec631ae48 100644 --- a/openstack_dashboard/dashboards/identity/users/views.py +++ b/openstack_dashboard/dashboards/identity/users/views.py @@ -122,7 +122,7 @@ class UpdateView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['user_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context @@ -172,10 +172,10 @@ class CreateView(forms.ModalFormView): @method_decorator(sensitive_post_parameters('password', 'confirm_password')) def dispatch(self, *args, **kwargs): - return super(CreateView, self).dispatch(*args, **kwargs) + return super().dispatch(*args, **kwargs) def get_form_kwargs(self): - kwargs = super(CreateView, self).get_form_kwargs() + kwargs = super().get_form_kwargs() try: roles = api.keystone.role_list(self.request) except Exception: @@ -202,7 +202,7 @@ class DetailView(tabs.TabView): page_title = "{{ user.name }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) user = self.get_data() table = project_tables.UsersTable(self.request) context["user"] = user @@ -244,7 +244,7 @@ class ChangePasswordView(forms.ModalFormView): @method_decorator(sensitive_post_parameters('password', 'confirm_password')) def dispatch(self, *args, **kwargs): - return super(ChangePasswordView, self).dispatch(*args, **kwargs) + return super().dispatch(*args, **kwargs) @memoized.memoized_method def get_object(self): @@ -258,7 +258,7 @@ class ChangePasswordView(forms.ModalFormView): redirect=redirect) def get_context_data(self, **kwargs): - context = super(ChangePasswordView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['user_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context diff --git a/openstack_dashboard/dashboards/project/api_access/tests.py b/openstack_dashboard/dashboards/project/api_access/tests.py index 875e1c8127..865d63f0c8 100644 --- a/openstack_dashboard/dashboards/project/api_access/tests.py +++ b/openstack_dashboard/dashboards/project/api_access/tests.py @@ -120,8 +120,7 @@ class ASCIITenantNameRCTests(test.TestCase): TENANT_NAME = 'tenant' def _setup_user(self, **kwargs): - super(ASCIITenantNameRCTests, self)._setup_user( - tenant_name=self.TENANT_NAME) + super()._setup_user(tenant_name=self.TENANT_NAME) @override_settings(OPENSTACK_API_VERSIONS={"identity": 3}) def test_openrc_credentials_filename(self): @@ -136,8 +135,7 @@ class UnicodeTenantNameRCTests(test.TestCase): TENANT_NAME = u'\u043f\u0440\u043e\u0435\u043a\u0442' def _setup_user(self, **kwargs): - super(UnicodeTenantNameRCTests, self)._setup_user( - tenant_name=self.TENANT_NAME) + super()._setup_user(tenant_name=self.TENANT_NAME) @override_settings(OPENSTACK_API_VERSIONS={"identity": 3}) def test_openrc_credentials_filename(self): diff --git a/openstack_dashboard/dashboards/project/api_access/views.py b/openstack_dashboard/dashboards/project/api_access/views.py index ab4fa9d36a..b4c236e526 100644 --- a/openstack_dashboard/dashboards/project/api_access/views.py +++ b/openstack_dashboard/dashboards/project/api_access/views.py @@ -179,7 +179,7 @@ class CredentialsView(forms.ModalFormMixin, views.HorizonTemplateView): page_title = _("User Credentials Details") def get_context_data(self, **kwargs): - context = super(CredentialsView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context['openrc_creds'] = _get_openrc_credentials(self.request) except Exception: diff --git a/openstack_dashboard/dashboards/project/backups/forms.py b/openstack_dashboard/dashboards/project/backups/forms.py index 4f5dc8ea38..3e57b7f130 100644 --- a/openstack_dashboard/dashboards/project/backups/forms.py +++ b/openstack_dashboard/dashboards/project/backups/forms.py @@ -44,7 +44,7 @@ class CreateBackupForm(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(CreateBackupForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if kwargs['initial'].get('snapshot_id'): snap_id = kwargs['initial']['snapshot_id'] try: @@ -111,7 +111,7 @@ class RestoreBackupForm(forms.SelfHandlingForm): backup_name = forms.CharField(widget=forms.HiddenInput()) def __init__(self, request, *args, **kwargs): - super(RestoreBackupForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) try: search_opts = {'status': 'available'} diff --git a/openstack_dashboard/dashboards/project/backups/views.py b/openstack_dashboard/dashboards/project/backups/views.py index af17c7298b..6d7139093f 100644 --- a/openstack_dashboard/dashboards/project/backups/views.py +++ b/openstack_dashboard/dashboards/project/backups/views.py @@ -74,7 +74,7 @@ class CreateBackupView(forms.ModalFormView): page_title = _("Create Volume Backup") def get_context_data(self, **kwargs): - context = super(CreateBackupView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_id'] = self.kwargs['volume_id'] args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -93,7 +93,7 @@ class BackupDetailView(tabs.TabView): page_title = "{{ backup.name|default:backup.id }}" def get_context_data(self, **kwargs): - context = super(BackupDetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) backup = self.get_data() table = backup_tables.BackupsTable(self.request) context["backup"] = backup @@ -131,7 +131,7 @@ class RestoreBackupView(forms.ModalFormView): page_title = _("Restore Volume Backup") def get_context_data(self, **kwargs): - context = super(RestoreBackupView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['backup_id'] = self.kwargs['backup_id'] args = (self.kwargs['backup_id'],) context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/project/dashboard.py b/openstack_dashboard/dashboards/project/dashboard.py index fdd8e7f8cf..ff131fe9b9 100644 --- a/openstack_dashboard/dashboards/project/dashboard.py +++ b/openstack_dashboard/dashboards/project/dashboard.py @@ -24,7 +24,7 @@ class Project(horizon.Dashboard): def can_access(self, context): request = context['request'] has_project = request.user.token.project.get('id') is not None - return super(Project, self).can_access(context) and has_project + return super().can_access(context) and has_project horizon.register(Project) diff --git a/openstack_dashboard/dashboards/project/floating_ips/forms.py b/openstack_dashboard/dashboards/project/floating_ips/forms.py index e838bf71c8..5878ec09cb 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/forms.py +++ b/openstack_dashboard/dashboards/project/floating_ips/forms.py @@ -40,7 +40,7 @@ class FloatingIpAllocate(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(FloatingIpAllocate, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) floating_pool_list = kwargs.get('initial', {}).get('pool_list', []) self.fields['pool'].choices = floating_pool_list diff --git a/openstack_dashboard/dashboards/project/floating_ips/tables.py b/openstack_dashboard/dashboards/project/floating_ips/tables.py index a0d6a3b89d..765da4dc45 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/tables.py +++ b/openstack_dashboard/dashboards/project/floating_ips/tables.py @@ -205,9 +205,9 @@ class FloatingIPsTable(tables.DataTable): display_choices=STATUS_DISPLAY_CHOICES) def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(FloatingIPsTable, self).__init__( - request, data=data, needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, + **kwargs) dns_supported = api.neutron.is_extension_supported( request, "dns-integration") diff --git a/openstack_dashboard/dashboards/project/floating_ips/views.py b/openstack_dashboard/dashboards/project/floating_ips/views.py index 252fe60c67..9b809dd04b 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/views.py +++ b/openstack_dashboard/dashboards/project/floating_ips/views.py @@ -59,7 +59,7 @@ class AllocateView(forms.ModalFormView): return obj.ip def get_context_data(self, **kwargs): - context = super(AllocateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context['usages'] = quotas.tenant_quota_usages( self.request, targets=('floatingip', ) diff --git a/openstack_dashboard/dashboards/project/floating_ips/workflows.py b/openstack_dashboard/dashboards/project/floating_ips/workflows.py index 3d93ca0e19..a2307883bc 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/workflows.py +++ b/openstack_dashboard/dashboards/project/floating_ips/workflows.py @@ -46,7 +46,7 @@ class AssociateIPAction(workflows.Action): "the selected instance or port.") def __init__(self, *args, **kwargs): - super(AssociateIPAction, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # If AssociateIP is invoked from instance menu, instance_id parameter # is passed in URL. In Neutron based Floating IP implementation @@ -135,7 +135,7 @@ class AssociateIP(workflows.Step): contributes = ("ip_id", "instance_id", "ip_address") def contribute(self, data, context): - context = super(AssociateIP, self).contribute(data, context) + context = super().contribute(data, context) ip_id = data.get('ip_id', None) if ip_id: ip_choices = dict(self.action.fields['ip_id'].choices) diff --git a/openstack_dashboard/dashboards/project/images/images/forms.py b/openstack_dashboard/dashboards/project/images/images/forms.py index eeae6fc1b4..f228e31555 100644 --- a/openstack_dashboard/dashboards/project/images/images/forms.py +++ b/openstack_dashboard/dashboards/project/images/images/forms.py @@ -147,7 +147,7 @@ class CreateImageForm(CreateParent): required=False) def __init__(self, request, *args, **kwargs): - super(CreateImageForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if (api.glance.get_image_upload_mode() == 'off' or not policy.check((("image", "upload_image"),), request)): @@ -235,7 +235,7 @@ class CreateImageForm(CreateParent): self.fields['is_copying'].initial = False def clean(self): - data = super(CreateImageForm, self).clean() + data = super().clean() # The image_file key can be missing based on particular upload # conditions. Code defensively for it here... @@ -334,7 +334,7 @@ class UpdateImageForm(forms.SelfHandlingForm): protected = forms.BooleanField(label=_("Protected"), required=False) def __init__(self, request, *args, **kwargs): - super(UpdateImageForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.fields['disk_format'].choices = [(value, name) for value, name in IMAGE_FORMAT_CHOICES if value] diff --git a/openstack_dashboard/dashboards/project/images/images/tables.py b/openstack_dashboard/dashboards/project/images/images/tables.py index 5ad1b0c4da..abac0d0982 100644 --- a/openstack_dashboard/dashboards/project/images/images/tables.py +++ b/openstack_dashboard/dashboards/project/images/images/tables.py @@ -67,7 +67,7 @@ class LaunchImageNG(LaunchImage): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(LaunchImageNG, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): imageId = self.table.get_object_id(datum) @@ -174,7 +174,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): image_id = self.table.get_object_id(datum) @@ -281,7 +281,7 @@ class UpdateRow(tables.Row): return image def load_cells(self, image=None): - super(UpdateRow, self).load_cells(image) + super().load_cells(image) # Tag the row with the image category for client-side filtering. image = self.datum my_tenant_id = self.table.request.user.tenant_id diff --git a/openstack_dashboard/dashboards/project/images/images/tests.py b/openstack_dashboard/dashboards/project/images/images/tests.py index 9cf1fa3711..e383d23902 100644 --- a/openstack_dashboard/dashboards/project/images/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/images/tests.py @@ -353,7 +353,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase): class OwnerFilterTests(test.TestCase): def setUp(self): - super(OwnerFilterTests, self).setUp() + super().setUp() self.table = mock.Mock(spec=horizon_tables.DataTable) self.table.request = self.request diff --git a/openstack_dashboard/dashboards/project/images/images/views.py b/openstack_dashboard/dashboards/project/images/images/views.py index 9dc258ead7..230d69dd85 100644 --- a/openstack_dashboard/dashboards/project/images/images/views.py +++ b/openstack_dashboard/dashboards/project/images/images/views.py @@ -68,7 +68,7 @@ class CreateView(forms.ModalFormView): return initial def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) upload_mode = api.glance.get_image_upload_mode() context['image_upload_enabled'] = upload_mode != 'off' context['images_allow_location'] = settings.IMAGES_ALLOW_LOCATION @@ -94,7 +94,7 @@ class UpdateView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=url) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['image'] = self.get_object() args = (self.kwargs['image_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -127,7 +127,7 @@ class DetailView(tabs.TabView): page_title = "{{ image.name }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) image = self.get_data() table = project_tables.ImagesTable(self.request) context["image"] = image diff --git a/openstack_dashboard/dashboards/project/images/snapshots/views.py b/openstack_dashboard/dashboards/project/images/snapshots/views.py index ce3e15e7ac..168ab9cb8d 100644 --- a/openstack_dashboard/dashboards/project/images/snapshots/views.py +++ b/openstack_dashboard/dashboards/project/images/snapshots/views.py @@ -43,7 +43,7 @@ class CreateView(forms.ModalFormView): return {"instance_id": self.kwargs["instance_id"]} def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['instance_id'],) context['submit_url'] = reverse(self.submit_url, args=args) return context diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index 5599ae0e61..52ae38ee9c 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -39,7 +39,7 @@ CREATE_URL = reverse('horizon:project:images:images:create') class BaseImagesTestCase(test.TestCase): def setUp(self): - super(BaseImagesTestCase, self).setUp() + super().setUp() self.patcher = mock.patch.object(api.glance, 'image_list_detailed') self.mock_image_list = self.patcher.start() diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py index d3c8593756..4fdfcd6e23 100644 --- a/openstack_dashboard/dashboards/project/instances/forms.py +++ b/openstack_dashboard/dashboards/project/instances/forms.py @@ -66,7 +66,7 @@ class RebuildInstanceForm(forms.SelfHandlingForm): ) def __init__(self, request, *args, **kwargs): - super(RebuildInstanceForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if not api.nova.is_feature_available(request, "instance_description"): del self.fields['description'] instance_id = kwargs.get('initial', {}).get('instance_id') @@ -98,7 +98,7 @@ class RebuildInstanceForm(forms.SelfHandlingForm): 'information.')) def clean(self): - cleaned_data = super(RebuildInstanceForm, self).clean() + cleaned_data = super().clean() if 'password' in cleaned_data: passwd = cleaned_data.get('password') confirm = cleaned_data.get('confirm_password') @@ -146,9 +146,7 @@ class DecryptPasswordInstanceForm(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(DecryptPasswordInstanceForm, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) instance_id = kwargs.get('initial', {}).get('instance_id') self.fields['instance_id'].initial = instance_id keypair_name = kwargs.get('initial', {}).get('keypair_name') @@ -196,7 +194,7 @@ class AttachVolume(forms.SelfHandlingForm): instance_id = forms.CharField(widget=forms.HiddenInput()) def __init__(self, request, *args, **kwargs): - super(AttachVolume, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # Populate volume choices volume_list = kwargs.get('initial', {}).get("volume_list", []) @@ -251,7 +249,7 @@ class DetachVolume(forms.SelfHandlingForm): instance_id = forms.CharField(widget=forms.HiddenInput()) def __init__(self, *args, **kwargs): - super(DetachVolume, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Populate instance id instance_id = kwargs.get('initial', {}).get("instance_id", None) @@ -338,7 +336,7 @@ class AttachInterface(forms.SelfHandlingForm): })) def __init__(self, request, *args, **kwargs): - super(AttachInterface, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) networks = instance_utils.network_field_data(request, include_empty_option=True, with_cidr=True) @@ -389,7 +387,7 @@ class DetachInterface(forms.SelfHandlingForm): port = forms.ThemableChoiceField(label=_("Port")) def __init__(self, request, *args, **kwargs): - super(DetachInterface, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) instance_id = self.initial.get("instance_id", None) ports = [] @@ -431,7 +429,7 @@ class Disassociate(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(Disassociate, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) instance_id = self.initial['instance_id'] targets = api.neutron.floating_ip_target_list_by_instance( request, instance_id) @@ -490,7 +488,7 @@ class RescueInstanceForm(forms.SelfHandlingForm): failure_url = 'horizon:project:instances:index' def __init__(self, request, *args, **kwargs): - super(RescueInstanceForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) images = image_utils.get_available_images(request, request.user.tenant_id) choices = [(image.id, image) for image in images] diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index f89eaef869..81fa911997 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -432,7 +432,7 @@ class LaunchLink(tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(LaunchLink, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def allowed(self, request, datum): try: @@ -481,7 +481,7 @@ class LaunchLinkNG(LaunchLink): 'ng-controller': 'LaunchInstanceModalController as modal', 'ng-click': ngclick }) - return super(LaunchLinkNG, self).get_default_attrs() + return super().get_default_attrs() def get_link_url(self, datum=None): return "javascript:void(0);" @@ -565,7 +565,7 @@ class ConsoleLink(policy.PolicyTargetMixin, tables.LinkAction): not is_deleting(instance)) def get_link_url(self, datum): - base_url = super(ConsoleLink, self).get_link_url(datum) + base_url = super().get_link_url(datum) tab_query_string = tabs.ConsoleTab( tabs.InstanceDetailTabs).get_query_string() return "?".join([base_url, tab_query_string]) @@ -582,7 +582,7 @@ class LogLink(policy.PolicyTargetMixin, tables.LinkAction): return instance.status in ACTIVE_STATES and not is_deleting(instance) def get_link_url(self, datum): - base_url = super(LogLink, self).get_link_url(datum) + base_url = super().get_link_url(datum) tab_query_string = tabs.LogTab( tabs.InstanceDetailTabs).get_query_string() return "?".join([base_url, tab_query_string]) @@ -753,7 +753,7 @@ class UpdateMetadata(policy.PolicyTargetMixin, tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): instance_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index b7ef8cac80..987250dac7 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -100,7 +100,7 @@ class InstanceTestBase(helpers.ResetImageAPIVersionMixin, self.mock_image_list_detailed.assert_has_calls(expected_calls, False) def setUp(self): - super(InstanceTestBase, self).setUp() + super().setUp() if api.glance.VERSIONS.active < 2: self.versioned_images = self.images self.versioned_snapshots = self.snapshots diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 6e7a76295e..8217c540fd 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -264,7 +264,7 @@ class LaunchInstanceView(workflows.WorkflowView): workflow_class = project_workflows.LaunchInstance def get_initial(self): - initial = super(LaunchInstanceView, self).get_initial() + initial = super().get_initial() initial['project_id'] = self.request.user.tenant_id initial['user_id'] = self.request.user.id initial['config_drive'] = setting_utils.get_dict_config( @@ -356,7 +356,7 @@ class SerialConsoleView(generic.TemplateView): template_name = 'serial_console.html' def get_context_data(self, **kwargs): - context = super(SerialConsoleView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) instance = None try: instance = api.nova.server_get(self.request, @@ -386,7 +386,7 @@ class UpdateView(workflows.WorkflowView): success_url = reverse_lazy("horizon:project:instances:index") def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["instance_id"] = self.kwargs['instance_id'] return context @@ -401,7 +401,7 @@ class UpdateView(workflows.WorkflowView): exceptions.handle(self.request, msg, redirect=redirect) def get_initial(self): - initial = super(UpdateView, self).get_initial() + initial = super().get_initial() instance = self.get_object() initial.update({'instance_id': self.kwargs['instance_id'], 'name': getattr(instance, 'name', ''), @@ -418,7 +418,7 @@ class RebuildView(forms.ModalFormView): submit_label = page_title def get_context_data(self, **kwargs): - context = super(RebuildView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] context['can_set_server_password'] = api.nova.can_set_server_password() return context @@ -447,7 +447,7 @@ class DecryptPasswordView(forms.ModalFormView): page_title = _("Retrieve Instance Password") def get_context_data(self, **kwargs): - context = super(DecryptPasswordView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] context['keypair_name'] = self.kwargs['keypair_name'] return context @@ -465,7 +465,7 @@ class DisassociateView(forms.ModalFormView): submit_label = _("Disassociate") def get_context_data(self, **kwargs): - context = super(DisassociateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] return context @@ -482,7 +482,7 @@ class DetailView(tabs.TabView): volume_url = 'horizon:project:volumes:detail' def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) instance = self.get_data() if instance.image: instance.image_url = reverse(self.image_url, @@ -586,7 +586,7 @@ class ResizeView(workflows.WorkflowView): success_url = reverse_lazy("horizon:project:instances:index") def get_context_data(self, **kwargs): - context = super(ResizeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["instance_id"] = self.kwargs['instance_id'] return context @@ -626,7 +626,7 @@ class ResizeView(workflows.WorkflowView): redirect=redirect) def get_initial(self): - initial = super(ResizeView, self).get_initial() + initial = super().get_initial() _object = self.get_object() if _object: initial.update( @@ -647,7 +647,7 @@ class AttachInterfaceView(forms.ModalFormView): success_url = reverse_lazy('horizon:project:instances:index') def get_context_data(self, **kwargs): - context = super(AttachInterfaceView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] return context @@ -680,7 +680,7 @@ class AttachVolumeView(forms.ModalFormView): "volume_list": volume_list} def get_context_data(self, **kwargs): - context = super(AttachVolumeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] return context @@ -700,7 +700,7 @@ class DetachVolumeView(forms.ModalFormView): return {"instance_id": self.kwargs["instance_id"]} def get_context_data(self, **kwargs): - context = super(DetachVolumeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] return context @@ -714,7 +714,7 @@ class DetachInterfaceView(forms.ModalFormView): success_url = reverse_lazy('horizon:project:instances:index') def get_context_data(self, **kwargs): - context = super(DetachInterfaceView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['instance_id'] = self.kwargs['instance_id'] return context @@ -741,7 +741,7 @@ class UpdatePortView(port_views.UpdateView): exceptions.handle(self.request, msg, redirect=redirect) def get_initial(self): - initial = super(UpdatePortView, self).get_initial() + initial = super().get_initial() initial['instance_id'] = self.kwargs['instance_id'] return initial @@ -755,7 +755,7 @@ class RescueView(forms.ModalFormView): page_title = _("Rescue Instance") def get_context_data(self, **kwargs): - context = super(RescueView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["instance_id"] = self.kwargs['instance_id'] args = (self.kwargs['instance_id'],) context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index fcda9159c6..25288536be 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -56,7 +56,7 @@ class SelectProjectUserAction(workflows.Action): user_id = forms.ThemableChoiceField(label=_("User")) def __init__(self, request, *args, **kwargs): - super(SelectProjectUserAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # Set our project choices projects = [(tenant.id, tenant.name) for tenant in request.user.authorized_tenants] @@ -145,8 +145,7 @@ class SetInstanceDetailsAction(workflows.Action): self._init_images_cache() self.request = request self.context = context - super(SetInstanceDetailsAction, self).__init__( - request, context, *args, **kwargs) + super().__init__(request, context, *args, **kwargs) # Hide the device field if the hypervisor doesn't support it. if not nova.can_set_mount_point(): @@ -362,7 +361,7 @@ class SetInstanceDetailsAction(workflows.Action): check_method(cleaned_data) def clean(self): - cleaned_data = super(SetInstanceDetailsAction, self).clean() + cleaned_data = super().clean() self._check_quotas(cleaned_data) self._check_source(cleaned_data) @@ -414,7 +413,7 @@ class SetInstanceDetailsAction(workflows.Action): except Exception: exceptions.handle(self.request, _("Unable to retrieve quota information.")) - return super(SetInstanceDetailsAction, self).get_help_text(extra) + return super().get_help_text(extra) def _init_images_cache(self): if not hasattr(self, '_images_cache'): @@ -522,7 +521,7 @@ class SetInstanceDetails(workflows.Step): return context def contribute(self, data, context): - context = super(SetInstanceDetails, self).contribute(data, context) + context = super().contribute(data, context) # Allow setting the source dynamically. if ("source_type" in context and "source_id" in context and @@ -576,7 +575,7 @@ class SetAccessControlsAction(workflows.Action): "security groups, and other mechanisms.") def __init__(self, request, *args, **kwargs): - super(SetAccessControlsAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if not api.nova.can_set_server_password(): del self.fields['admin_pass'] del self.fields['confirm_admin_pass'] @@ -600,7 +599,7 @@ class SetAccessControlsAction(workflows.Action): def clean(self): '''Check to make sure password fields match.''' - cleaned_data = super(SetAccessControlsAction, self).clean() + cleaned_data = super().clean() if 'admin_pass' in cleaned_data: if cleaned_data['admin_pass'] != cleaned_data.get( 'confirm_admin_pass', None): @@ -663,7 +662,7 @@ class CustomizeAction(workflows.Action): required=False) def clean(self): - cleaned = super(CustomizeAction, self).clean() + cleaned = super().clean() files = self.request.FILES script = self.clean_uploaded_files('script', files) @@ -719,7 +718,7 @@ class SetNetworkAction(workflows.Action): " these networks")) def __init__(self, request, *args, **kwargs): - super(SetNetworkAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # NOTE(e0ne): we don't need 'required attribute for networks # checkboxes to be able to select only one network @@ -805,8 +804,7 @@ class SetAdvancedAction(workflows.Action): help_text=_("Server group to associate with this instance.")) def __init__(self, request, context, *args, **kwargs): - super(SetAdvancedAction, self).__init__(request, context, - *args, **kwargs) + super().__init__(request, context, *args, **kwargs) try: if not api.nova.extension_supported("DiskConfig", request): del self.fields['disk_config'] @@ -843,8 +841,7 @@ class SetAdvanced(workflows.Step): contributes = ("disk_config", "config_drive", "server_group",) def prepare_action_context(self, request, context): - context = super(SetAdvanced, self).prepare_action_context(request, - context) + context = super().prepare_action_context(request, context) # Add the workflow slug to the context so that we can tell which # workflow is being used when creating the action. This step is # used by both the Launch Instance and Resize Instance workflows. diff --git a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py index ebad56ccb8..bbc6906c5b 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py @@ -77,7 +77,7 @@ class SetFlavorChoiceAction(workflows.Action): except Exception: exceptions.handle(self.request, _("Unable to retrieve quota information.")) - return super(SetFlavorChoiceAction, self).get_help_text(extra) + return super().get_help_text(extra) class SetFlavorChoice(workflows.Step): diff --git a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py index 4fe7f7ef91..c0eec51295 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py @@ -78,9 +78,7 @@ class UpdateInstanceInfoAction(workflows.Action): ) def __init__(self, request, *args, **kwargs): - super(UpdateInstanceInfoAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) if not api.nova.is_feature_available(request, "instance_description"): del self.fields["description"] diff --git a/openstack_dashboard/dashboards/project/key_pairs/tables.py b/openstack_dashboard/dashboards/project/key_pairs/tables.py index 77a145becc..2d4f0bb372 100644 --- a/openstack_dashboard/dashboards/project/key_pairs/tables.py +++ b/openstack_dashboard/dashboards/project/key_pairs/tables.py @@ -77,7 +77,7 @@ class ImportKeyPair(QuotaKeypairMixin, tables.LinkAction): policy_rules = (("compute", "os_compute_api:os-keypairs:create"),) def allowed(self, request, keypair=None): - if super(ImportKeyPair, self).allowed(request, keypair): + if super().allowed(request, keypair): self.verbose_name = _("Import Public Key") return True @@ -97,13 +97,13 @@ class CreateLinkNG(QuotaKeypairMixin, tables.LinkAction): 'ng-controller': 'KeypairController as modal', 'ng-click': ngclick }) - return super(CreateLinkNG, self).get_default_attrs() + return super().get_default_attrs() def get_link_url(self, datum=None): return "javascript:void(0);" def allowed(self, request, keypair=None): - if super(CreateLinkNG, self).allowed(request, keypair): + if super().allowed(request, keypair): self.verbose_name = _("Create Key Pair") return True diff --git a/openstack_dashboard/dashboards/project/key_pairs/views.py b/openstack_dashboard/dashboards/project/key_pairs/views.py index 0d3b959493..69a2ddb13f 100644 --- a/openstack_dashboard/dashboards/project/key_pairs/views.py +++ b/openstack_dashboard/dashboards/project/key_pairs/views.py @@ -81,6 +81,6 @@ class DetailView(views.HorizonTemplateView): def get_context_data(self, **kwargs): """Gets the context data for keypair.""" - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['keypair'] = self._get_data() return context diff --git a/openstack_dashboard/dashboards/project/network_qos/panel.py b/openstack_dashboard/dashboards/project/network_qos/panel.py index bac3823a5e..e49e29db5d 100644 --- a/openstack_dashboard/dashboards/project/network_qos/panel.py +++ b/openstack_dashboard/dashboards/project/network_qos/panel.py @@ -30,7 +30,7 @@ class NetworkQoS(horizon.Panel): request = context['request'] try: return ( - super(NetworkQoS, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) and neutron.is_extension_supported(request, extension_alias='qos') ) diff --git a/openstack_dashboard/dashboards/project/network_topology/views.py b/openstack_dashboard/dashboards/project/network_topology/views.py index 87006ffe23..2b1530c43b 100644 --- a/openstack_dashboard/dashboards/project/network_topology/views.py +++ b/openstack_dashboard/dashboards/project/network_topology/views.py @@ -115,7 +115,7 @@ class NTAddInterfaceView(p_views.AddInterfaceView): return reverse("horizon:project:network_topology:index") def get_context_data(self, **kwargs): - context = super(NTAddInterfaceView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['form_url'] = 'horizon:project:network_topology:interface' return context @@ -206,7 +206,7 @@ class NetworkTopologyView(tabs.TabView): page_title = _("Network Topology") def get_context_data(self, **kwargs): - context = super(NetworkTopologyView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) return utils.get_context(self.request, context) diff --git a/openstack_dashboard/dashboards/project/networks/forms.py b/openstack_dashboard/dashboards/project/networks/forms.py index 0b30bebd2d..0c6195bef1 100644 --- a/openstack_dashboard/dashboards/project/networks/forms.py +++ b/openstack_dashboard/dashboards/project/networks/forms.py @@ -42,7 +42,7 @@ class UpdateNetwork(forms.SelfHandlingForm): failure_url = 'horizon:project:networks:index' def __init__(self, request, *args, **kwargs): - super(UpdateNetwork, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) if not policy.check((("network", "update_network:shared"),), request): self.fields['shared'].widget = forms.HiddenInput() diff --git a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/forms.py b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/forms.py index cdc6f2d620..306f097390 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/forms.py +++ b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/forms.py @@ -38,7 +38,7 @@ class AddAllowedAddressPairForm(forms.SelfHandlingForm): failure_url = 'horizon:project:networks:ports:detail' def clean(self): - cleaned_data = super(AddAllowedAddressPairForm, self).clean() + cleaned_data = super().clean() if '/' not in self.data['ip']: cleaned_data['ip'] = self.data['ip'] return cleaned_data diff --git a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py index e01fc5516f..b305c89f49 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py @@ -40,8 +40,7 @@ class AddAllowedAddressPair(policy.PolicyTargetMixin, tables.LinkAction): ) def get_policy_target(self, request, datum=None): - policy_target = super(AddAllowedAddressPair, self).\ - get_policy_target(request, datum) + policy_target = super().get_policy_target(request, datum) policy_target["network:tenant_id"] = ( self.table.kwargs['port'].tenant_id) @@ -76,8 +75,7 @@ class DeleteAllowedAddressPair(tables.DeleteAction): ) def get_policy_target(self, request, datum=None): - policy_target = super(DeleteAllowedAddressPair, self).\ - get_policy_target(request, datum) + policy_target = super().get_policy_target(request, datum) policy_target["network:tenant_id"] = ( self.table.kwargs['port'].tenant_id) diff --git a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/views.py b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/views.py index e9bb5d6678..a96bb89dd3 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/views.py +++ b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/views.py @@ -36,7 +36,7 @@ class AddAllowedAddressPair(forms.ModalFormView): return reverse(self.success_url, args=(self.kwargs['port_id'],)) def get_context_data(self, **kwargs): - context = super(AddAllowedAddressPair, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["port_id"] = self.kwargs['port_id'] context['submit_url'] = reverse(self.submit_url, args=(self.kwargs['port_id'],)) diff --git a/openstack_dashboard/dashboards/project/networks/ports/sg_base.py b/openstack_dashboard/dashboards/project/networks/ports/sg_base.py index b35ff1e8a1..23d78befa9 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/sg_base.py +++ b/openstack_dashboard/dashboards/project/networks/ports/sg_base.py @@ -23,9 +23,7 @@ from openstack_dashboard import api class BaseSecurityGroupsAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(BaseSecurityGroupsAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to retrieve security group list. ' 'Please try again later.') context = args[0] diff --git a/openstack_dashboard/dashboards/project/networks/ports/tables.py b/openstack_dashboard/dashboards/project/networks/ports/tables.py index 7658a6beee..6120a9d628 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tables.py @@ -161,8 +161,8 @@ class PortsTable(tables.DataTable): hidden_title = False def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(PortsTable, self).__init__(request, data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, + **kwargs) if not api.neutron.is_extension_supported(request, 'mac-learning'): del self.columns['mac_state'] diff --git a/openstack_dashboard/dashboards/project/networks/ports/views.py b/openstack_dashboard/dashboards/project/networks/ports/views.py index 607c5a4d1a..eb67a93594 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/views.py +++ b/openstack_dashboard/dashboards/project/networks/ports/views.py @@ -90,7 +90,7 @@ class DetailView(tabs.TabbedTableView): return port def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) port = self.get_data() network_url = "horizon:project:networks:detail" subnet_url = "horizon:project:networks:subnets:detail" diff --git a/openstack_dashboard/dashboards/project/networks/ports/workflows.py b/openstack_dashboard/dashboards/project/networks/ports/workflows.py index fe9175d445..8638d60ff8 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/ports/workflows.py @@ -125,8 +125,7 @@ class CreatePortInfoAction(workflows.Action): required=False) def __init__(self, request, context, *args, **kwargs): - super(CreatePortInfoAction, self).__init__( - request, context, *args, **kwargs) + super().__init__(request, context, *args, **kwargs) # prepare subnet choices and input area for each subnet subnet_choices = self._get_subnet_choices(context) @@ -311,7 +310,7 @@ class UpdatePortInfoAction(workflows.Action): help_text=_("If checked, the port will be enabled.")) def __init__(self, request, *args, **kwargs): - super(UpdatePortInfoAction, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) try: if api.neutron.is_extension_supported(request, 'binding'): supported_vnic_types = setting_utils.get_dict_config( diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tables.py b/openstack_dashboard/dashboards/project/networks/subnets/tables.py index b44caf75c4..3a6769eca1 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tables.py @@ -37,8 +37,7 @@ LOG = logging.getLogger(__name__) class SubnetPolicyTargetMixin(policy.PolicyTargetMixin): def get_policy_target(self, request, datum=None): - policy_target = super(SubnetPolicyTargetMixin, self)\ - .get_policy_target(request, datum) + policy_target = super().get_policy_target(request, datum) # Use the network information if it is passed in with datum. if datum and "tenant_id" in datum: network = datum diff --git a/openstack_dashboard/dashboards/project/networks/subnets/views.py b/openstack_dashboard/dashboards/project/networks/subnets/views.py index 13e54c57eb..e28a0904ab 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/views.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/views.py @@ -70,7 +70,7 @@ class UpdateView(workflows.WorkflowView): exceptions.handle(self.request, msg, redirect=redirect) def get_initial(self): - initial = super(UpdateView, self).get_initial() + initial = super().get_initial() subnet = self._get_object() @@ -145,7 +145,7 @@ class DetailView(tabs.TabView): return network def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) subnet = self.get_data() network = self.get_network(subnet.network_id) subnet.network_name = network.get('name') diff --git a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py index eef979fbcb..ca039fa085 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py @@ -157,8 +157,7 @@ class UpdateSubnetInfo(CreateSubnetInfo): class UpdateSubnetDetailAction(network_workflows.CreateSubnetDetailAction): def __init__(self, request, context, *args, **kwargs): - super(UpdateSubnetDetailAction, self).__init__(request, context, - *args, **kwargs) + super().__init__(request, context, *args, **kwargs) # TODO(amotoki): Due to Neutron bug 1362966, we cannot pass "None" # to Neutron. It means we cannot set IPv6 two modes to # "No option selected". diff --git a/openstack_dashboard/dashboards/project/networks/tables.py b/openstack_dashboard/dashboards/project/networks/tables.py index ae07340ced..a98cb1633a 100644 --- a/openstack_dashboard/dashboards/project/networks/tables.py +++ b/openstack_dashboard/dashboards/project/networks/tables.py @@ -206,11 +206,8 @@ class NetworksTable(tables.DataTable): verbose_name=_("Availability Zones")) def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(NetworksTable, self).__init__( - request, - data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, **kwargs) try: if not api.neutron.is_extension_supported( request, "network_availability_zone"): diff --git a/openstack_dashboard/dashboards/project/networks/tabs.py b/openstack_dashboard/dashboards/project/networks/tabs.py index e48378ae6e..abe5371c3c 100644 --- a/openstack_dashboard/dashboards/project/networks/tabs.py +++ b/openstack_dashboard/dashboards/project/networks/tabs.py @@ -57,7 +57,7 @@ class OverviewTab(tabs.Tab): return network def get_context_data(self, request, **kwargs): - context = super(OverviewTab, self).get_context_data(request, **kwargs) + context = super().get_context_data(request, **kwargs) network = self._get_data() context["network"] = network diff --git a/openstack_dashboard/dashboards/project/networks/views.py b/openstack_dashboard/dashboards/project/networks/views.py index d75c75b2b6..fde0fbc9a2 100644 --- a/openstack_dashboard/dashboards/project/networks/views.py +++ b/openstack_dashboard/dashboards/project/networks/views.py @@ -76,7 +76,7 @@ class CreateView(DefaultSubnetWorkflowMixin, workflows.WorkflowView): workflow_class = project_workflows.CreateNetwork def get_initial(self): - results = super(CreateView, self).get_initial() + results = super().get_initial() results['dns_nameservers'] = self.get_default_dns_servers() return results @@ -92,7 +92,7 @@ class UpdateView(forms.ModalFormView): page_title = _("Edit Network") def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['network_id'],) context["network_id"] = self.kwargs['network_id'] context["submit_url"] = reverse(self.submit_url, args=args) @@ -147,7 +147,7 @@ class DetailView(tabs.TabbedTableView): pass def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) network = self._get_data() context["network"] = network table = project_tables.NetworksTable(self.request) diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py index 4c55ed7ac5..f3554495d4 100644 --- a/openstack_dashboard/dashboards/project/networks/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/workflows.py @@ -67,8 +67,7 @@ class CreateNetworkInfoAction(workflows.Action): "selecting all availability zones")) def __init__(self, request, *args, **kwargs): - super(CreateNetworkInfoAction, self).__init__(request, - *args, **kwargs) + super().__init__(request, *args, **kwargs) if not policy.check((("network", "create_network:shared"),), request): self.fields['shared'].widget = forms.HiddenInput() try: @@ -204,8 +203,7 @@ class CreateSubnetInfoAction(workflows.Action): ' the "Subnet Details" tab.') def __init__(self, request, context, *args, **kwargs): - super(CreateSubnetInfoAction, self).__init__(request, context, *args, - **kwargs) + super().__init__(request, context, *args, **kwargs) if not setting_utils.get_dict_config('OPENSTACK_NEUTRON_NETWORK', 'enable_ipv6'): self.fields['ip_version'].widget = forms.HiddenInput() @@ -322,7 +320,7 @@ class CreateSubnetInfoAction(workflows.Action): if not with_subnet: self._remove_fields_errors() return None - cleaned_data = super(CreateSubnetInfoAction, self).clean() + cleaned_data = super().clean() self._check_subnet_data(cleaned_data) return cleaned_data @@ -380,8 +378,7 @@ class CreateSubnetDetailAction(workflows.Action): help_text = _('Specify additional attributes for the subnet.') def __init__(self, request, context, *args, **kwargs): - super(CreateSubnetDetailAction, self).__init__(request, context, - *args, **kwargs) + super().__init__(request, context, *args, **kwargs) if not setting_utils.get_dict_config('OPENSTACK_NEUTRON_NETWORK', 'enable_ipv6'): self.fields['ipv6_modes'].widget = forms.HiddenInput() @@ -447,7 +444,7 @@ class CreateSubnetDetailAction(workflows.Action): self._convert_ip_address(route[1], "host_routes") def clean(self): - cleaned_data = super(CreateSubnetDetailAction, self).clean() + cleaned_data = super().clean() self._check_allocation_pools(cleaned_data.get('allocation_pools')) self._check_host_routes(cleaned_data.get('host_routes')) self._check_dns_nameservers(cleaned_data.get('dns_nameservers')) diff --git a/openstack_dashboard/dashboards/project/overview/views.py b/openstack_dashboard/dashboards/project/overview/views.py index ec2eb3a6e5..daf33ebb9f 100644 --- a/openstack_dashboard/dashboards/project/overview/views.py +++ b/openstack_dashboard/dashboards/project/overview/views.py @@ -60,7 +60,7 @@ class ProjectOverview(usage.ProjectUsageView): csv_response_class = ProjectUsageCsvRenderer def get_data(self): - super(ProjectOverview, self).get_data() + super().get_data() return self.usage.get_instances() diff --git a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py index d7ee1a539a..9dff61dfef 100644 --- a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py +++ b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py @@ -67,7 +67,7 @@ class ExtraRoutesTable(tables.DataTable): def get_object_display(self, datum): """Display ExtraRoutes when deleted.""" - return (super(ExtraRoutesTable, self).get_object_display(datum) or + return (super().get_object_display(datum) or datum.destination + " -> " + datum.nexthop) class Meta(object): diff --git a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/views.py b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/views.py index 79e8a3b939..1ad56e23fb 100644 --- a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/views.py +++ b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/views.py @@ -45,7 +45,7 @@ class AddRouterRouteView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=redirect) def get_context_data(self, **kwargs): - context = super(AddRouterRouteView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['router'] = self.get_object() return context diff --git a/openstack_dashboard/dashboards/project/routers/forms.py b/openstack_dashboard/dashboards/project/routers/forms.py index cc910814ce..a659adfbfa 100644 --- a/openstack_dashboard/dashboards/project/routers/forms.py +++ b/openstack_dashboard/dashboards/project/routers/forms.py @@ -55,7 +55,7 @@ class CreateForm(forms.SelfHandlingForm): failure_url = 'horizon:project:routers:index' def __init__(self, request, *args, **kwargs): - super(CreateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.dvr_allowed = api.neutron.get_feature_permission(self.request, "dvr", "create") if self.dvr_allowed: @@ -168,7 +168,7 @@ class UpdateForm(forms.SelfHandlingForm): redirect_url = reverse_lazy('horizon:project:routers:index') def __init__(self, request, *args, **kwargs): - super(UpdateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.dvr_allowed = api.neutron.get_feature_permission(self.request, "dvr", "update") if not self.dvr_allowed: diff --git a/openstack_dashboard/dashboards/project/routers/ports/forms.py b/openstack_dashboard/dashboards/project/routers/ports/forms.py index 63429fd532..417a44a5a6 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/forms.py +++ b/openstack_dashboard/dashboards/project/routers/ports/forms.py @@ -36,7 +36,7 @@ class AddInterface(forms.SelfHandlingForm): failure_url = 'horizon:project:routers:detail' def __init__(self, request, *args, **kwargs): - super(AddInterface, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) c = self.populate_subnet_id_choices(request) self.fields['subnet_id'].choices = c @@ -152,7 +152,7 @@ class SetGatewayForm(forms.SelfHandlingForm): failure_url = 'horizon:project:routers:index' def __init__(self, request, *args, **kwargs): - super(SetGatewayForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) networks = self.populate_network_id_choices(request) self.fields['network_id'].choices = networks self.ext_gw_mode = api.neutron.is_extension_supported( diff --git a/openstack_dashboard/dashboards/project/routers/ports/views.py b/openstack_dashboard/dashboards/project/routers/ports/views.py index ea18cac648..3b8480587a 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/views.py +++ b/openstack_dashboard/dashboards/project/routers/ports/views.py @@ -50,7 +50,7 @@ class AddInterfaceView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=redirect) def get_context_data(self, **kwargs): - context = super(AddInterfaceView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['router'] = self.get_object() context['form_url'] = 'horizon:project:routers:addinterface' return context @@ -82,7 +82,7 @@ class SetGatewayView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=redirect) def get_context_data(self, **kwargs): - context = super(SetGatewayView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['router'] = self.get_object() return context diff --git a/openstack_dashboard/dashboards/project/routers/tables.py b/openstack_dashboard/dashboards/project/routers/tables.py index 0bc27856cb..5a9631550c 100644 --- a/openstack_dashboard/dashboards/project/routers/tables.py +++ b/openstack_dashboard/dashboards/project/routers/tables.py @@ -235,11 +235,8 @@ class RoutersTable(tables.DataTable): verbose_name=_("Availability Zones")) def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs): - super(RoutersTable, self).__init__( - request, - data=data, - needs_form_wrapper=needs_form_wrapper, - **kwargs) + super().__init__(request, data=data, + needs_form_wrapper=needs_form_wrapper, **kwargs) if not api.neutron.get_feature_permission(request, "dvr", "get"): del self.columns["distributed"] if not api.neutron.get_feature_permission(request, "l3-ha", "get"): diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index c43e985ae5..614211ac34 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -146,7 +146,7 @@ class DetailView(tabs.TabbedTableView): return ports def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) router = self._get_data() table = rtables.RoutersTable(self.request) @@ -181,7 +181,7 @@ class CreateView(forms.ModalFormView): submit_url = reverse_lazy("horizon:project:routers:create") def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['enable_snat_allowed'] = self.initial['enable_snat_allowed'] return context @@ -189,7 +189,7 @@ class CreateView(forms.ModalFormView): enable_snat_allowed = api.neutron.get_feature_permission( self.request, 'ext-gw-mode', 'create_router_enable_snat') self.initial['enable_snat_allowed'] = enable_snat_allowed - return super(CreateView, self).get_initial() + return super().get_initial() class UpdateView(forms.ModalFormView): @@ -202,7 +202,7 @@ class UpdateView(forms.ModalFormView): submit_url = "horizon:project:routers:update" def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) args = (self.kwargs['router_id'],) context["router_id"] = self.kwargs['router_id'] context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py index d9c88527eb..471a99e95c 100644 --- a/openstack_dashboard/dashboards/project/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/security_groups/forms.py @@ -254,7 +254,7 @@ class AddRule(forms.SelfHandlingForm): def __init__(self, *args, **kwargs): sg_list = kwargs.pop('sg_list', []) - super(AddRule, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Determine if there are security groups available for the # remote group option; add the choices and enable the option if so. if sg_list: @@ -426,7 +426,7 @@ class AddRule(forms.SelfHandlingForm): data['ip_protocol'] = 'ipv6-icmp' def clean(self): - cleaned_data = super(AddRule, self).clean() + cleaned_data = super().clean() self._clean_rule_menu(cleaned_data) diff --git a/openstack_dashboard/dashboards/project/security_groups/tables.py b/openstack_dashboard/dashboards/project/security_groups/tables.py index 92c0bd3fe8..f8c3a8aedc 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tables.py +++ b/openstack_dashboard/dashboards/project/security_groups/tables.py @@ -249,7 +249,7 @@ class RulesTable(tables.DataTable): filters=(functools.partial(defaultfilters.default, arg=_("-")),)) def __init__(self, request, *args, **kwargs): - super(RulesTable, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) try: is_desc_supported = api.neutron.is_extension_supported( self.request, 'standard-attr-description') diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py index 6290fc229d..90694d0eda 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/security_groups/tests.py @@ -53,7 +53,7 @@ class SecurityGroupsViewTests(test.TestCase): secgroup_backend = 'neutron' def setUp(self): - super(SecurityGroupsViewTests, self).setUp() + super().setUp() sec_group = self.security_groups.first() self.detail_url = reverse(SG_DETAIL_VIEW, args=[sec_group.id]) diff --git a/openstack_dashboard/dashboards/project/security_groups/views.py b/openstack_dashboard/dashboards/project/security_groups/views.py index 1e232f1255..aaa84ed8bf 100644 --- a/openstack_dashboard/dashboards/project/security_groups/views.py +++ b/openstack_dashboard/dashboards/project/security_groups/views.py @@ -74,7 +74,7 @@ class DetailView(tables.DataTableView): return sorted(data.rules, key=_sort_key) def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["security_group"] = self._get_data() return context @@ -100,7 +100,7 @@ class UpdateView(forms.ModalFormView): exceptions.handle(self.request, msg, redirect=url) def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["security_group"] = self.get_object() args = (self.kwargs['security_group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -128,7 +128,7 @@ class AddRuleView(forms.ModalFormView): return reverse(self.url, args=[sg_id]) def get_context_data(self, **kwargs): - context = super(AddRuleView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["security_group_id"] = self.kwargs['security_group_id'] args = (self.kwargs['security_group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -139,7 +139,7 @@ class AddRuleView(forms.ModalFormView): return {'id': self.kwargs['security_group_id']} def get_form_kwargs(self): - kwargs = super(AddRuleView, self).get_form_kwargs() + kwargs = super().get_form_kwargs() try: groups = api.neutron.security_group_list(self.request) diff --git a/openstack_dashboard/dashboards/project/server_groups/panel.py b/openstack_dashboard/dashboards/project/server_groups/panel.py index 12202875e0..9039fc23a7 100644 --- a/openstack_dashboard/dashboards/project/server_groups/panel.py +++ b/openstack_dashboard/dashboards/project/server_groups/panel.py @@ -30,7 +30,7 @@ class ServerGroups(horizon.Panel): request = context['request'] try: return ( - super(ServerGroups, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) ) except Exception: diff --git a/openstack_dashboard/dashboards/project/snapshots/tables.py b/openstack_dashboard/dashboards/project/snapshots/tables.py index c43c7a740d..d841d31967 100644 --- a/openstack_dashboard/dashboards/project/snapshots/tables.py +++ b/openstack_dashboard/dashboards/project/snapshots/tables.py @@ -56,7 +56,7 @@ class LaunchSnapshotNG(LaunchSnapshot): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(LaunchSnapshotNG, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): url = reverse(self.url) @@ -170,7 +170,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(**kwargs) + super().__init__(**kwargs) def get_link_url(self, datum): obj_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/project/snapshots/views.py b/openstack_dashboard/dashboards/project/snapshots/views.py index b49f5ed00a..be3fe4e979 100644 --- a/openstack_dashboard/dashboards/project/snapshots/views.py +++ b/openstack_dashboard/dashboards/project/snapshots/views.py @@ -102,7 +102,7 @@ class UpdateView(forms.ModalFormView): return self._object def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['snapshot'] = self.get_object() success_url = self.request.GET.get('success_url', "") args = (self.kwargs['snapshot_id'],) @@ -131,7 +131,7 @@ class DetailView(tabs.TabView): volume_url = 'horizon:project:volumes:detail' def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) snapshot = self.get_data() snapshot.volume_url = reverse(self.volume_url, args=(snapshot.volume_id,)) diff --git a/openstack_dashboard/dashboards/project/trunks/panel.py b/openstack_dashboard/dashboards/project/trunks/panel.py index f7f51d302e..3c70e710af 100644 --- a/openstack_dashboard/dashboards/project/trunks/panel.py +++ b/openstack_dashboard/dashboards/project/trunks/panel.py @@ -32,7 +32,7 @@ class Trunks(horizon.Panel): request = context['request'] try: return ( - super(Trunks, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) and neutron.is_extension_supported(request, extension_alias='trunk') diff --git a/openstack_dashboard/dashboards/project/vg_snapshots/forms.py b/openstack_dashboard/dashboards/project/vg_snapshots/forms.py index 7831420847..e6636ca4cc 100644 --- a/openstack_dashboard/dashboards/project/vg_snapshots/forms.py +++ b/openstack_dashboard/dashboards/project/vg_snapshots/forms.py @@ -45,7 +45,7 @@ class CreateGroupForm(forms.SelfHandlingForm): _('Unable to load the specified snapshot.')) def __init__(self, request, *args, **kwargs): - super(CreateGroupForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) vg_snapshot_id = kwargs.get('initial', {}).get('vg_snapshot_id', []) self.fields['vg_snapshot_id'] = forms.CharField( diff --git a/openstack_dashboard/dashboards/project/vg_snapshots/panel.py b/openstack_dashboard/dashboards/project/vg_snapshots/panel.py index eef8cd94cf..e30cee5845 100644 --- a/openstack_dashboard/dashboards/project/vg_snapshots/panel.py +++ b/openstack_dashboard/dashboards/project/vg_snapshots/panel.py @@ -36,7 +36,7 @@ class GroupSnapshots(horizon.Panel): request = context['request'] try: return ( - super(GroupSnapshots, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) and policy.check(self.policy_rules, request) and api.cinder.get_microversion(request, 'groups') diff --git a/openstack_dashboard/dashboards/project/vg_snapshots/views.py b/openstack_dashboard/dashboards/project/vg_snapshots/views.py index feb505012f..1cd8619b41 100644 --- a/openstack_dashboard/dashboards/project/vg_snapshots/views.py +++ b/openstack_dashboard/dashboards/project/vg_snapshots/views.py @@ -63,7 +63,7 @@ class DetailView(tabs.TabView): page_title = "{{ vg_snapshot.name|default:vg_snapshot.id }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) vg_snapshot = self.get_data() table = vg_snapshot_tables.GroupSnapshotsTable(self.request) context["vg_snapshot"] = vg_snapshot @@ -118,7 +118,7 @@ class CreateGroupView(forms.ModalFormView): page_title = _("Create Volume Group") def get_context_data(self, **kwargs): - context = super(CreateGroupView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['vg_snapshot_id'] = self.kwargs['vg_snapshot_id'] args = (self.kwargs['vg_snapshot_id'],) context['submit_url'] = reverse(self.submit_url, args=args) diff --git a/openstack_dashboard/dashboards/project/volume_groups/forms.py b/openstack_dashboard/dashboards/project/volume_groups/forms.py index faf52d270e..cac0f00b13 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/forms.py +++ b/openstack_dashboard/dashboards/project/volume_groups/forms.py @@ -161,7 +161,7 @@ class CloneGroupForm(forms.SelfHandlingForm): _('Unable to load the specified group.')) def __init__(self, request, *args, **kwargs): - super(CloneGroupForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) self.prepare_group_source_field(request) def handle(self, request, data): diff --git a/openstack_dashboard/dashboards/project/volume_groups/panel.py b/openstack_dashboard/dashboards/project/volume_groups/panel.py index 51116c3451..79a4b40a35 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/panel.py +++ b/openstack_dashboard/dashboards/project/volume_groups/panel.py @@ -36,7 +36,7 @@ class VolumeGroups(horizon.Panel): request = context['request'] try: return ( - super(VolumeGroups, self).allowed(context) and + super().allowed(context) and request.user.has_perms(self.permissions) and policy.check(self.policy_rules, request) and api.cinder.get_microversion(request, 'groups') diff --git a/openstack_dashboard/dashboards/project/volume_groups/views.py b/openstack_dashboard/dashboards/project/volume_groups/views.py index 90d008fe3d..426e89cb08 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/views.py +++ b/openstack_dashboard/dashboards/project/volume_groups/views.py @@ -77,7 +77,7 @@ class UpdateView(forms.ModalFormView): 'description': group.description} def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs['group_id'] args = (self.kwargs['group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -107,7 +107,7 @@ class RemoveVolumesView(forms.ModalFormView): 'name': group.name} def get_context_data(self, **kwargs): - context = super(RemoveVolumesView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs['group_id'] args = (self.kwargs['group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -138,7 +138,7 @@ class DeleteView(forms.ModalFormView): 'name': group.name} def get_context_data(self, **kwargs): - context = super(DeleteView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs['group_id'] args = (self.kwargs['group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -159,7 +159,7 @@ class ManageView(workflows.WorkflowView): workflow_class = vol_group_workflows.UpdateGroupWorkflow def get_context_data(self, **kwargs): - context = super(ManageView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs["group_id"] return context @@ -190,7 +190,7 @@ class CreateSnapshotView(forms.ModalFormView): success_url = reverse_lazy('horizon:project:vg_snapshots:index') def get_context_data(self, **kwargs): - context = super(CreateSnapshotView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs['group_id'] args = (self.kwargs['group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -231,7 +231,7 @@ class CloneGroupView(forms.ModalFormView): success_url = reverse_lazy('horizon:project:volume_groups:index') def get_context_data(self, **kwargs): - context = super(CloneGroupView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['group_id'] = self.kwargs['group_id'] args = (self.kwargs['group_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -271,7 +271,7 @@ class DetailView(tabs.TabView): page_title = "{{ group.name|default:group.id }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) group = self.get_data() table = vol_group_tables.GroupsTable(self.request) context["group"] = group diff --git a/openstack_dashboard/dashboards/project/volume_groups/workflows.py b/openstack_dashboard/dashboards/project/volume_groups/workflows.py index 9b65655cf5..55849bfd56 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/workflows.py +++ b/openstack_dashboard/dashboards/project/volume_groups/workflows.py @@ -70,9 +70,7 @@ class AddGroupInfoAction(workflows.Action): 'data-source-image_source': _('Availability Zone')})) def __init__(self, request, *args, **kwargs): - super(AddGroupInfoAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) self.fields['availability_zone'].choices = \ availability_zones(request) try: @@ -110,9 +108,7 @@ class AddGroupInfoStep(workflows.Step): class AddVolumeTypesToGroupAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(AddVolumeTypesToGroupAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to get the available volume types') default_role_field_name = self.get_default_role_field_name() @@ -137,7 +133,7 @@ class AddVolumeTypesToGroupAction(workflows.MembershipAction): slug = "add_vtypes_to_group" def clean(self): - cleaned_data = super(AddVolumeTypesToGroupAction, self).clean() + cleaned_data = super().clean() volume_types = cleaned_data.get('add_vtypes_to_group_role_member') if not volume_types: raise forms.ValidationError( @@ -170,9 +166,7 @@ class AddVolTypesToGroupStep(workflows.UpdateMembersStep): class AddVolumesToGroupAction(workflows.MembershipAction): def __init__(self, request, *args, **kwargs): - super(AddVolumesToGroupAction, self).__init__(request, - *args, - **kwargs) + super().__init__(request, *args, **kwargs) err_msg = _('Unable to get the available volumes') default_role_field_name = self.get_default_role_field_name() diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index ab90e46e2e..6a0cbdb9e9 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -295,7 +295,7 @@ class CreateForm(forms.SelfHandlingForm): self.fields['group'].choices = group_choices def __init__(self, request, *args, **kwargs): - super(CreateForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) volume_types = [] try: volume_types = cinder.volume_type_list(request) @@ -323,7 +323,7 @@ class CreateForm(forms.SelfHandlingForm): self._populate_group_choices(request) def clean(self): - cleaned_data = super(CreateForm, self).clean() + cleaned_data = super().clean() source_type = self.cleaned_data.get('volume_source_type') if (source_type == 'image_source' and not cleaned_data.get('image_source')): @@ -478,7 +478,7 @@ class AttachForm(forms.SelfHandlingForm): "select a device name.")) def __init__(self, *args, **kwargs): - super(AttachForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Hide the device field if the hypervisor doesn't support it. if not nova.can_set_mount_point(): @@ -547,7 +547,7 @@ class CreateSnapshotForm(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(CreateSnapshotForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # populate volume_id volume_id = kwargs.get('initial', {}).get('volume_id', []) @@ -587,7 +587,7 @@ class CreateTransferForm(forms.SelfHandlingForm): def __init__(self, *args, **kwargs): self.next_view = kwargs.pop('next_view', None) - super(CreateTransferForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def clean_name(self): cleaned_name = self.cleaned_data['name'] @@ -711,7 +711,7 @@ class UploadToImageForm(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(UploadToImageForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) # 'vhd','iso','aki','ari' and 'ami' disk formats are supported by # glance, but not by qemu-img. qemu-img supports 'vpc', 'cloop', 'cow' @@ -768,7 +768,7 @@ class ExtendForm(forms.SelfHandlingForm): new_size = forms.IntegerField(label=_("New Size (GiB)")) def clean(self): - cleaned_data = super(ExtendForm, self).clean() + cleaned_data = super().clean() new_size = cleaned_data.get('new_size') orig_size = self.initial['orig_size'] if new_size <= orig_size: @@ -819,7 +819,7 @@ class RetypeForm(forms.SelfHandlingForm): required=False) def __init__(self, request, *args, **kwargs): - super(RetypeForm, self).__init__(request, *args, **kwargs) + super().__init__(request, *args, **kwargs) try: volume_types = cinder.volume_type_list(request) diff --git a/openstack_dashboard/dashboards/project/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/tables.py index 7af8e1703e..01e7c03f20 100644 --- a/openstack_dashboard/dashboards/project/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/tables.py @@ -75,7 +75,7 @@ class LaunchVolumeNG(LaunchVolume): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(LaunchVolumeNG, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def get_link_url(self, datum): url = reverse(self.url) @@ -140,7 +140,7 @@ class CreateVolume(tables.LinkAction): def __init__(self, attrs=None, **kwargs): kwargs['preempt'] = True - super(CreateVolume, self).__init__(attrs, **kwargs) + super().__init__(attrs, **kwargs) def allowed(self, request, volume=None): limits = api.cinder.tenant_absolute_limits(request) @@ -534,7 +534,7 @@ class UpdateMetadata(tables.LinkAction): def __init__(self, **kwargs): kwargs['preempt'] = True - super(UpdateMetadata, self).__init__(**kwargs) + super().__init__(**kwargs) def get_link_url(self, datum): obj_id = self.table.get_object_id(datum) diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 13e2f478db..ce98a71814 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -215,7 +215,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): for att in volume.attachments: if 'instance' in att: del att['instance'] - super(VolumeViewTests, self).tearDown() + super().tearDown() @test.create_mocks({ cinder: ['volume_create', 'volume_snapshot_list', diff --git a/openstack_dashboard/dashboards/project/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/views.py index 4debe956a8..0b52af896e 100644 --- a/openstack_dashboard/dashboards/project/volumes/views.py +++ b/openstack_dashboard/dashboards/project/volumes/views.py @@ -188,7 +188,7 @@ class DetailView(tabs.TabbedTableView): page_title = "{{ volume.name|default:volume.id }}" def get_context_data(self, **kwargs): - context = super(DetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) volume, snapshots = self.get_data() table = volume_tables.VolumesTable(self.request) context["volume"] = volume @@ -243,7 +243,7 @@ class CreateView(forms.ModalFormView): page_title = _("Create Volume") def get_initial(self): - initial = super(CreateView, self).get_initial() + initial = super().get_initial() self.default_vol_type = None try: self.default_vol_type = cinder.volume_type_default(self.request) @@ -253,7 +253,7 @@ class CreateView(forms.ModalFormView): return initial def get_context_data(self, **kwargs): - context = super(CreateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) try: context['usages'] = quotas.tenant_quota_usages( self.request, targets=('volumes', 'gigabytes')) @@ -309,7 +309,7 @@ class ExtendView(forms.ModalFormView): return self._object def get_context_data(self, **kwargs): - context = super(ExtendView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume'] = self.get_object() args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -337,7 +337,7 @@ class CreateSnapshotView(forms.ModalFormView): page_title = _("Create Volume Snapshot") def get_context_data(self, **kwargs): - context = super(CreateSnapshotView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume_id'] = self.kwargs['volume_id'] args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -386,7 +386,7 @@ class UploadToImageView(forms.ModalFormView): return volume def get_context_data(self, **kwargs): - context = super(UploadToImageView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume'] = self.get_data() args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -410,7 +410,7 @@ class CreateTransferView(forms.ModalFormView): page_title = _("Create Volume Transfer") def get_context_data(self, *args, **kwargs): - context = super(CreateTransferView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) volume_id = self.kwargs['volume_id'] context['volume_id'] = volume_id context['submit_url'] = reverse(self.submit_url, args=[volume_id]) @@ -420,7 +420,7 @@ class CreateTransferView(forms.ModalFormView): return {'volume_id': self.kwargs["volume_id"]} def get_form_kwargs(self): - kwargs = super(CreateTransferView, self).get_form_kwargs() + kwargs = super().get_form_kwargs() kwargs['next_view'] = ShowTransferView return kwargs @@ -460,7 +460,7 @@ class ShowTransferView(forms.ModalFormView): _('Unable to retrieve volume transfer.')) def get_context_data(self, **kwargs): - context = super(ShowTransferView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['transfer_id'] = self.kwargs['transfer_id'] context['auth_key'] = self.kwargs['auth_key'] context['download_label'] = self.download_label @@ -497,7 +497,7 @@ class UpdateView(forms.ModalFormView): return self._object def get_context_data(self, **kwargs): - context = super(UpdateView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume'] = self.get_object() args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -553,10 +553,10 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): @memoized.memoized_method def get_form(self, **kwargs): form_class = kwargs.get('form_class', self.get_form_class()) - return super(EditAttachmentsView, self).get_form(form_class) + return super().get_form(form_class) def get_context_data(self, **kwargs): - context = super(EditAttachmentsView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['form'] = self.get_form() volume = self.get_object() args = (self.kwargs['volume_id'],) @@ -609,7 +609,7 @@ class RetypeView(forms.ModalFormView): return volume def get_context_data(self, **kwargs): - context = super(RetypeView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['volume'] = self.get_data() args = (self.kwargs['volume_id'],) context['submit_url'] = reverse(self.submit_url, args=args) @@ -628,7 +628,7 @@ class EncryptionDetailView(generic.TemplateView): page_title = _("Volume Encryption Details: {{ volume.name }}") def get_context_data(self, **kwargs): - context = super(EncryptionDetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) volume = self.get_volume_data() context["encryption_metadata"] = self.get_encryption_data() context["volume"] = volume diff --git a/openstack_dashboard/dashboards/settings/password/forms.py b/openstack_dashboard/dashboards/settings/password/forms.py index 50c061dd21..a4835930f1 100644 --- a/openstack_dashboard/dashboards/settings/password/forms.py +++ b/openstack_dashboard/dashboards/settings/password/forms.py @@ -47,7 +47,7 @@ class PasswordForm(forms.SelfHandlingForm): def clean(self): '''Check to make sure password fields match.''' - data = super(PasswordForm, self).clean() + data = super().clean() if 'new_password' in data: if data['new_password'] != data.get('confirm_password', None): raise ValidationError(_('Passwords do not match.')) diff --git a/openstack_dashboard/dashboards/settings/user/forms.py b/openstack_dashboard/dashboards/settings/user/forms.py index 63b8422275..5612556368 100644 --- a/openstack_dashboard/dashboards/settings/user/forms.py +++ b/openstack_dashboard/dashboards/settings/user/forms.py @@ -49,7 +49,7 @@ class UserSettingsForm(forms.SelfHandlingForm): return zones def __init__(self, *args, **kwargs): - super(UserSettingsForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # Languages def get_language_display_name(code, desc): diff --git a/openstack_dashboard/management/commands/migrate_settings.py b/openstack_dashboard/management/commands/migrate_settings.py index fb77a9042b..b3ee87e9f5 100644 --- a/openstack_dashboard/management/commands/migrate_settings.py +++ b/openstack_dashboard/management/commands/migrate_settings.py @@ -102,7 +102,7 @@ class Command(BaseCommand): local_settings_reject_pattern = 'local_settings.py_%s.rej' def __init__(self, *args, **kwargs): - super(Command, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) settings_file = os.path.abspath( get_module_path(os.environ['DJANGO_SETTINGS_MODULE']) diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index 588a5f90c9..bb971e2509 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -149,14 +149,14 @@ def _apply_panel_mocks(patchers=None): class RequestFactoryWithMessages(RequestFactory): def get(self, *args, **kwargs): - req = super(RequestFactoryWithMessages, self).get(*args, **kwargs) + req = super().get(*args, **kwargs) req.user = utils.get_user(req) req.session = [] req._messages = default_storage(req) return req def post(self, *args, **kwargs): - req = super(RequestFactoryWithMessages, self).post(*args, **kwargs) + req = super().post(*args, **kwargs) req.user = utils.get_user(req) req.session = [] req._messages = default_storage(req) @@ -201,10 +201,10 @@ class TestCase(horizon_helpers.TestCase): self.patchers = _apply_panel_mocks() - super(TestCase, self).setUp() + super().setUp() def _setup_test_data(self): - super(TestCase, self)._setup_test_data() + super()._setup_test_data() test_utils.load_test_data(self) self.context = { 'authorized_tenants': self.tenants.list(), @@ -232,7 +232,7 @@ class TestCase(horizon_helpers.TestCase): self.setActiveUser(**base_kwargs) def _setup_request(self): - super(TestCase, self)._setup_request() + super()._setup_request() self.request.session['token'] = self.token.id def tearDown(self): @@ -240,7 +240,7 @@ class TestCase(horizon_helpers.TestCase): context_processors.openstack = self._real_context_processor utils.get_user = self._real_get_user mock.patch.stopall() - super(TestCase, self).tearDown() + super().tearDown() # cause a test failure if an unmocked API call was attempted if self.missing_mocks: @@ -432,7 +432,7 @@ class BaseAdminViewTests(TestCase): def setActiveUser(self, *args, **kwargs): if "roles" not in kwargs: kwargs['roles'] = [self.roles.admin._info] - super(BaseAdminViewTests, self).setActiveUser(*args, **kwargs) + super().setActiveUser(*args, **kwargs) def setSessionValues(self, **kwargs): settings.SESSION_ENGINE = 'django.contrib.sessions.backends.file' @@ -448,7 +448,7 @@ class BaseAdminViewTests(TestCase): class APITestCase(TestCase): def setUp(self): - super(APITestCase, self).setUp() + super().setUp() utils.patch_middleware_get_user() @@ -463,12 +463,12 @@ APIMockTestCase = APITestCase # Need this to test both Glance API V1 and V2 versions class ResetImageAPIVersionMixin(object): def setUp(self): - super(ResetImageAPIVersionMixin, self).setUp() + super().setUp() api.glance.VERSIONS.clear_active_cache() def tearDown(self): api.glance.VERSIONS.clear_active_cache() - super(ResetImageAPIVersionMixin, self).tearDown() + super().tearDown() @horizon_helpers.pytest_mark('selenium') @@ -476,7 +476,7 @@ class ResetImageAPIVersionMixin(object): class SeleniumTestCase(horizon_helpers.SeleniumTestCase): def setUp(self): - super(SeleniumTestCase, self).setUp() + super().setUp() test_utils.load_test_data(self) @@ -520,7 +520,7 @@ class SeleniumAdminTestCase(SeleniumTestCase): def setActiveUser(self, *args, **kwargs): if "roles" not in kwargs: kwargs['roles'] = [self.roles.admin._info] - super(SeleniumAdminTestCase, self).setActiveUser(*args, **kwargs) + super().setActiveUser(*args, **kwargs) def my_custom_sort(flavor): @@ -549,7 +549,7 @@ class PluginTestCase(TestCase): configuration. """ def setUp(self): - super(PluginTestCase, self).setUp() + super().setUp() self.old_horizon_config = conf.HORIZON_CONFIG conf.HORIZON_CONFIG = conf.LazySettings() base.Horizon._urls() @@ -562,7 +562,7 @@ class PluginTestCase(TestCase): self._discovered_panels[dash] = panels def tearDown(self): - super(PluginTestCase, self).tearDown() + super().tearDown() conf.HORIZON_CONFIG = self.old_horizon_config # Destroy our singleton and re-create it. base.HorizonSite._instance = None diff --git a/openstack_dashboard/test/integration_tests/helpers.py b/openstack_dashboard/test/integration_tests/helpers.py index fe84c5fc4a..6861b3f77a 100644 --- a/openstack_dashboard/test/integration_tests/helpers.py +++ b/openstack_dashboard/test/integration_tests/helpers.py @@ -193,7 +193,7 @@ class BaseTestCase(testtools.TestCase): self.addCleanup(cleanup) - super(BaseTestCase, self).setUp() + super().setUp() def addOnException(self, exception_handler): @@ -202,7 +202,7 @@ class BaseTestCase(testtools.TestCase): return return exception_handler(exc_info) - super(BaseTestCase, self).addOnException(wrapped_handler) + super().addOnException(wrapped_handler) def __hash__(self): return hash((type(self), self._testMethodName)) @@ -316,7 +316,7 @@ class TestCase(BaseTestCase, AssertsMixin): HOME_PROJECT = BaseTestCase.CONFIG.identity.home_project def setUp(self): - super(TestCase, self).setUp() + super().setUp() self.login_pg = loginpage.LoginPage(self.driver, self.CONFIG) self.login_pg.go_to_login_page() # TODO(schipiga): lets check that tests work without viewport changing, @@ -345,5 +345,5 @@ class AdminTestCase(TestCase, AssertsMixin): HOME_PROJECT = BaseTestCase.CONFIG.identity.admin_home_project def setUp(self): - super(AdminTestCase, self).setUp() + super().setUp() self.home_pg.go_to_admin_overviewpage() diff --git a/openstack_dashboard/test/integration_tests/pages/admin/compute/flavorspage.py b/openstack_dashboard/test/integration_tests/pages/admin/compute/flavorspage.py index efdaa07a8f..afdb8d9b88 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/compute/flavorspage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/compute/flavorspage.py @@ -75,7 +75,7 @@ class FlavorsPage(basepage.BaseNavigationPage): FLAVORS_TABLE_PUBLIC_COLUMN = 'Public' def __init__(self, driver, conf): - super(FlavorsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Flavors" @property diff --git a/openstack_dashboard/test/integration_tests/pages/admin/compute/hostaggregatespage.py b/openstack_dashboard/test/integration_tests/pages/admin/compute/hostaggregatespage.py index 4004b31f17..1b3fd58fc7 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/compute/hostaggregatespage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/compute/hostaggregatespage.py @@ -49,7 +49,7 @@ class HostaggregatesPage(basepage.BaseNavigationPage): HOST_AGGREGATES_TABLE_NAME_COLUMN = 'Name' def __init__(self, driver, conf): - super(HostaggregatesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Host Aggregates" @property diff --git a/openstack_dashboard/test/integration_tests/pages/admin/compute/hypervisorspage.py b/openstack_dashboard/test/integration_tests/pages/admin/compute/hypervisorspage.py index 17da1f3b96..bb18386984 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/compute/hypervisorspage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/compute/hypervisorspage.py @@ -16,5 +16,5 @@ from openstack_dashboard.test.integration_tests.pages import basepage class HypervisorsPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(HypervisorsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "All Hypervisors" diff --git a/openstack_dashboard/test/integration_tests/pages/admin/overviewpage.py b/openstack_dashboard/test/integration_tests/pages/admin/overviewpage.py index af36d5ce3e..ddfe8d58c8 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/overviewpage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/overviewpage.py @@ -15,5 +15,5 @@ from openstack_dashboard.test.integration_tests.pages import basepage class OverviewPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(OverviewPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Overview" diff --git a/openstack_dashboard/test/integration_tests/pages/admin/system/defaultspage.py b/openstack_dashboard/test/integration_tests/pages/admin/system/defaultspage.py index 21b238fdf2..c5129fc3ec 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/system/defaultspage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/system/defaultspage.py @@ -77,7 +77,7 @@ class DefaultsPage(basepage.BaseNavigationPage): 'a[href*="defaults__volume_quotas"]') def __init__(self, driver, conf): - super(DefaultsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Defaults" def _get_compute_quota_row(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/admin/system/metadatadefinitionspage.py b/openstack_dashboard/test/integration_tests/pages/admin/system/metadatadefinitionspage.py index 355a84c823..bb7e9ad5b2 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/system/metadatadefinitionspage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/system/metadatadefinitionspage.py @@ -47,7 +47,7 @@ class MetadatadefinitionsPage(basepage.BaseNavigationPage): boolean_mapping = {True: 'Yes', False: 'No'} def __init__(self, driver, conf): - super(MetadatadefinitionsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Metadata Definitions" def _get_row_with_namespace_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/admin/volume/volumetypespage.py b/openstack_dashboard/test/integration_tests/pages/admin/volume/volumetypespage.py index 39f21efa4d..605b9329cb 100644 --- a/openstack_dashboard/test/integration_tests/pages/admin/volume/volumetypespage.py +++ b/openstack_dashboard/test/integration_tests/pages/admin/volume/volumetypespage.py @@ -66,7 +66,7 @@ class VolumetypesPage(basepage.BaseNavigationPage): CINDER_CONSUMER = 'back-end' def __init__(self, driver, conf): - super(VolumetypesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Volume Types" @property diff --git a/openstack_dashboard/test/integration_tests/pages/identity/groupspage.py b/openstack_dashboard/test/integration_tests/pages/identity/groupspage.py index 445483a73b..d681c393b8 100644 --- a/openstack_dashboard/test/integration_tests/pages/identity/groupspage.py +++ b/openstack_dashboard/test/integration_tests/pages/identity/groupspage.py @@ -44,7 +44,7 @@ class GroupsTable(tables.TableRegion): class GroupsPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(GroupsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Groups' @property diff --git a/openstack_dashboard/test/integration_tests/pages/identity/projectspage.py b/openstack_dashboard/test/integration_tests/pages/identity/projectspage.py index 73dbdc6c6e..7037978eb0 100644 --- a/openstack_dashboard/test/integration_tests/pages/identity/projectspage.py +++ b/openstack_dashboard/test/integration_tests/pages/identity/projectspage.py @@ -21,8 +21,8 @@ class ProjectForm(forms.TabbedFormRegion): {'members': menus.MembershipMenuRegion}) def __init__(self, driver, conf, tab=0): - super(ProjectForm, self).__init__( - driver, conf, field_mappings=self.FIELDS, default_tab=tab) + super().__init__(driver, conf, field_mappings=self.FIELDS, + default_tab=tab) class ProjectsTable(tables.TableRegion): @@ -51,7 +51,7 @@ class ProjectsPage(basepage.BaseNavigationPage): PROJECT_ID_TABLE_NAME_COLUMN = 'Project ID' def __init__(self, driver, conf): - super(ProjectsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Projects" @property diff --git a/openstack_dashboard/test/integration_tests/pages/identity/rolespage.py b/openstack_dashboard/test/integration_tests/pages/identity/rolespage.py index 8604a25346..21a5df96d0 100644 --- a/openstack_dashboard/test/integration_tests/pages/identity/rolespage.py +++ b/openstack_dashboard/test/integration_tests/pages/identity/rolespage.py @@ -16,5 +16,5 @@ from openstack_dashboard.test.integration_tests.pages import basepage class RolesPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(RolesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Roles' diff --git a/openstack_dashboard/test/integration_tests/pages/identity/userspage.py b/openstack_dashboard/test/integration_tests/pages/identity/userspage.py index 695f99309c..ebbe28922a 100644 --- a/openstack_dashboard/test/integration_tests/pages/identity/userspage.py +++ b/openstack_dashboard/test/integration_tests/pages/identity/userspage.py @@ -37,7 +37,7 @@ class UsersPage(basepage.BaseNavigationPage): USERS_TABLE_NAME_COLUMN = 'User Name' def __init__(self, driver, conf): - super(UsersPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Users" def _get_row_with_user_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/loginpage.py b/openstack_dashboard/test/integration_tests/pages/loginpage.py index a92671abfb..35bba3da87 100644 --- a/openstack_dashboard/test/integration_tests/pages/loginpage.py +++ b/openstack_dashboard/test/integration_tests/pages/loginpage.py @@ -29,7 +29,7 @@ class LoginPage(pageobject.PageObject): _login_logout_reason_locator = (by.By.ID, 'logout_reason') def __init__(self, driver, conf): - super(LoginPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Login" def is_login_page(self): diff --git a/openstack_dashboard/test/integration_tests/pages/pageobject.py b/openstack_dashboard/test/integration_tests/pages/pageobject.py index 058ab20d07..8ec949db86 100644 --- a/openstack_dashboard/test/integration_tests/pages/pageobject.py +++ b/openstack_dashboard/test/integration_tests/pages/pageobject.py @@ -22,7 +22,7 @@ class PageObject(basewebobject.BaseWebObject): def __init__(self, driver, conf): """Constructor.""" - super(PageObject, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = None @property diff --git a/openstack_dashboard/test/integration_tests/pages/project/apiaccesspage.py b/openstack_dashboard/test/integration_tests/pages/project/apiaccesspage.py index daf276117e..7a4b1652c3 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/apiaccesspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/apiaccesspage.py @@ -41,7 +41,7 @@ class ApiAccessTable(tables.TableRegion): class ApiaccessPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(ApiaccessPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "API Access" @property diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py index 586a387066..304d506d89 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/imagespage.py @@ -111,7 +111,7 @@ class ImagesTable(tables.TableRegion): class ImagesPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(ImagesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Images" def _get_row_with_image_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py index 253a2c3b47..2293abec1b 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/instancespage.py @@ -65,7 +65,7 @@ class InstancesPage(basepage.BaseNavigationPage): NETWORKS_STEP_INDEX = 3 def __init__(self, driver, conf): - super(InstancesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Instances" def _get_row_with_instance_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/keypairspage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/keypairspage.py index a8b7b1c4ef..4135772e5e 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/keypairspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/keypairspage.py @@ -47,7 +47,7 @@ class KeypairsPage(basepage.BaseNavigationPage): KEY_PAIRS_TABLE_NAME_COLUMN = 'Name' def __init__(self, driver, conf): - super(KeypairsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Key Pairs" def _get_row_with_keypair_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/overviewpage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/overviewpage.py index bd60236867..149d8d957f 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/overviewpage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/overviewpage.py @@ -24,7 +24,7 @@ class OverviewPage(basepage.BaseNavigationPage): _date_form_locator = (by.By.ID, 'date_form') def __init__(self, driver, conf): - super(OverviewPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Instance Overview' @property diff --git a/openstack_dashboard/test/integration_tests/pages/project/compute/servergroupspage.py b/openstack_dashboard/test/integration_tests/pages/project/compute/servergroupspage.py index 40db1da2c3..846fcab868 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/compute/servergroupspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/compute/servergroupspage.py @@ -16,5 +16,5 @@ from openstack_dashboard.test.integration_tests.pages import basepage class ServergroupsPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(ServergroupsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Server Groups' diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/floatingipspage.py b/openstack_dashboard/test/integration_tests/pages/project/network/floatingipspage.py index 0a8fe9fa6f..dcfbd29925 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/floatingipspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/floatingipspage.py @@ -58,7 +58,7 @@ class FloatingipsPage(basepage.BaseNavigationPage): by.By.CSS_SELECTOR, '.alert.alert-success.alert-dismissable.fade.in>p') def __init__(self, driver, conf): - super(FloatingipsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Floating IPs" def _get_row_with_floatingip(self, floatingip): diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/networkoverviewpage.py b/openstack_dashboard/test/integration_tests/pages/project/network/networkoverviewpage.py index ec3b92dc50..ef63d7cce9 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/networkoverviewpage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/networkoverviewpage.py @@ -22,7 +22,7 @@ class NetworkOverviewPage(basepage.BaseNavigationPage): _network_dd_status_locator = (by.By.CSS_SELECTOR, 'dt[title*="Status"]+dd') def __init__(self, driver, conf): - super(NetworkOverviewPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Network Details' self._external_network = conf.network.external_network diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/networkspage.py b/openstack_dashboard/test/integration_tests/pages/project/network/networkspage.py index d8ff5f3d86..00bcb211eb 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/networkspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/networkspage.py @@ -48,7 +48,7 @@ class NetworksPage(basepage.BaseNavigationPage): DETAILS_TAB_INDEX = 2 def __init__(self, driver, conf): - super(NetworksPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Networks" def _get_row_with_network_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/networktopologypage.py b/openstack_dashboard/test/integration_tests/pages/project/network/networktopologypage.py index 2f873b125b..c3756246f3 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/networktopologypage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/networktopologypage.py @@ -16,5 +16,5 @@ from openstack_dashboard.test.integration_tests.pages import basepage class NetworktopologyPage(basepage.BaseNavigationPage): def __init__(self, driver, conf): - super(NetworktopologyPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = 'Network Topology' diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/routerinterfacespage.py b/openstack_dashboard/test/integration_tests/pages/project/network/routerinterfacespage.py index 6840dd02cc..e8738d37cf 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/routerinterfacespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/routerinterfacespage.py @@ -52,7 +52,7 @@ class RouterInterfacesPage(basepage.BaseNavigationPage): 'ol.breadcrumb>li>' + 'a[href*="/project/routers"]') def __init__(self, driver, conf, router_name): - super(RouterInterfacesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = router_name def _get_row_with_interface_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/routeroverviewpage.py b/openstack_dashboard/test/integration_tests/pages/project/network/routeroverviewpage.py index a9a0f99e8e..bed0b5a274 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/routeroverviewpage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/routeroverviewpage.py @@ -24,7 +24,7 @@ class RouterOverviewPage(basepage.BaseNavigationPage): 'hr+dl.dl-horizontal>dt:nth-child(3)+dd>a') def __init__(self, driver, conf, router_name): - super(RouterOverviewPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = router_name def is_router_name_present(self, router_name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/routerspage.py b/openstack_dashboard/test/integration_tests/pages/project/network/routerspage.py index cd26f9f306..23c31d788d 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/routerspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/routerspage.py @@ -64,7 +64,7 @@ class RoutersPage(basepage.BaseNavigationPage): 'a[href*="tab=router_details__interfaces"]') def __init__(self, driver, conf): - super(RoutersPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Routers" self._external_network = conf.network.external_network diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/security_groups/managerulespage.py b/openstack_dashboard/test/integration_tests/pages/project/network/security_groups/managerulespage.py index 48c6438920..7a4580f26a 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/security_groups/managerulespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/security_groups/managerulespage.py @@ -43,7 +43,7 @@ class ManageRulesPage(basepage.BaseNavigationPage): RULES_TABLE_PORT_RANGE_COLUMN = 'Port Range' def __init__(self, driver, conf): - super(ManageRulesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Manage Security Group Rules" def _get_row_with_port_range(self, port): diff --git a/openstack_dashboard/test/integration_tests/pages/project/network/securitygroupspage.py b/openstack_dashboard/test/integration_tests/pages/project/network/securitygroupspage.py index b0784f1c32..3041b4f0d9 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/network/securitygroupspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/network/securitygroupspage.py @@ -45,7 +45,7 @@ class SecuritygroupsPage(basepage.BaseNavigationPage): SECURITYGROUPS_TABLE_NAME_COLUMN = 'Name' def __init__(self, driver, conf): - super(SecuritygroupsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Security Groups" def _get_row_with_securitygroup_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/project/volumes/snapshotspage.py b/openstack_dashboard/test/integration_tests/pages/project/volumes/snapshotspage.py index a628a79042..73f3d8a240 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/volumes/snapshotspage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/volumes/snapshotspage.py @@ -63,7 +63,7 @@ class SnapshotsPage(basepage.BaseNavigationPage): 'a[href*="tab=volumes_and_snapshots__volumes_tab"]') def __init__(self, driver, conf): - super(SnapshotsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Volume Snapshots" @property diff --git a/openstack_dashboard/test/integration_tests/pages/project/volumes/volumespage.py b/openstack_dashboard/test/integration_tests/pages/project/volumes/volumespage.py index 7538937890..8132d0f7e6 100644 --- a/openstack_dashboard/test/integration_tests/pages/project/volumes/volumespage.py +++ b/openstack_dashboard/test/integration_tests/pages/project/volumes/volumespage.py @@ -98,7 +98,7 @@ class VolumesPage(basepage.BaseNavigationPage): VOLUMES_TABLE_ATTACHED_COLUMN = 'Attached To' def __init__(self, driver, conf): - super(VolumesPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "Volumes" def _get_row_with_volume_name(self, name): diff --git a/openstack_dashboard/test/integration_tests/pages/settings/usersettingspage.py b/openstack_dashboard/test/integration_tests/pages/settings/usersettingspage.py index 683ff550bf..e8412fb9a5 100644 --- a/openstack_dashboard/test/integration_tests/pages/settings/usersettingspage.py +++ b/openstack_dashboard/test/integration_tests/pages/settings/usersettingspage.py @@ -38,7 +38,7 @@ class UsersettingsPage(basepage.BaseNavigationPage): 'a[href*="/settings/password/"]') def __init__(self, driver, conf): - super(UsersettingsPage, self).__init__(driver, conf) + super().__init__(driver, conf) self._page_title = "User Settings" @property diff --git a/openstack_dashboard/test/integration_tests/regions/baseregion.py b/openstack_dashboard/test/integration_tests/regions/baseregion.py index 26e5f21f68..29dc4d7eb7 100644 --- a/openstack_dashboard/test/integration_tests/regions/baseregion.py +++ b/openstack_dashboard/test/integration_tests/regions/baseregion.py @@ -29,7 +29,7 @@ class BaseRegion(basewebobject.BaseWebObject): # private methods def __init__(self, driver, conf, src_elem=None): - super(BaseRegion, self).__init__(driver, conf) + super().__init__(driver, conf) if self._default_src_locator: root = src_elem or driver src_elem = root.find_element(*self._default_src_locator) diff --git a/openstack_dashboard/test/integration_tests/regions/forms.py b/openstack_dashboard/test/integration_tests/regions/forms.py index 8a52f798b9..b738fb9416 100644 --- a/openstack_dashboard/test/integration_tests/regions/forms.py +++ b/openstack_dashboard/test/integration_tests/regions/forms.py @@ -29,14 +29,14 @@ class FieldFactory(baseregion.BaseRegion): _element_locator_str_prefix = 'div.form-group' def __init__(self, driver, conf, src_elem=None): - super(FieldFactory, self).__init__(driver, conf, src_elem) + super().__init__(driver, conf, src_elem) def fields(self): for field_cls in self.FORM_FIELDS_TYPES: locator = (by.By.CSS_SELECTOR, '%s %s' % (self._element_locator_str_prefix, field_cls._element_locator_str_suffix)) - elements = super(FieldFactory, self)._get_elements(*locator) + elements = super()._get_elements(*locator) for element in elements: yield field_cls(self.driver, self.conf, src_elem=element) @@ -55,7 +55,7 @@ class MetaBaseFormFieldRegion(type): """Register form field class in FieldFactory.""" def __init__(cls, name, bases, dct): FieldFactory.register_field_cls(cls, bases) - super(MetaBaseFormFieldRegion, cls).__init__(name, bases, dct) + super().__init__(name, bases, dct) class BaseFormFieldRegion(baseregion.BaseRegion, @@ -240,8 +240,7 @@ class ThemableSelectFormFieldRegion(BaseFormFieldRegion): _dropdown_menu_locator = (by.By.CSS_SELECTOR, 'ul.dropdown-menu > li > a') def __init__(self, driver, conf, strict_options_match=True, **kwargs): - super(ThemableSelectFormFieldRegion, - self).__init__(driver, conf, **kwargs) + super().__init__(driver, conf, **kwargs) self.strict_options_match = strict_options_match @property @@ -312,7 +311,7 @@ class BaseFormRegion(baseregion.BaseRegion): self.src_elem = driver # bind the topmost modal form in a modal stack src_elem = self._get_elements(*self._default_form_locator)[-1] - super(BaseFormRegion, self).__init__(driver, conf, src_elem) + super().__init__(driver, conf, src_elem) @property def _submit_element(self): @@ -344,18 +343,25 @@ class FormRegion(BaseFormRegion): # private methods def __init__(self, driver, conf, src_elem=None, field_mappings=None): - super(FormRegion, self).__init__(driver, conf, src_elem) + super().__init__(driver, conf, src_elem) self.field_mappings = self._prepare_mappings(field_mappings) self.wait_till_spinner_disappears() self._init_form_fields() + # protected methods + + # NOTE: There is a case where a subclass accepts different field_mappings. + # In such case, this method should be overridden. def _prepare_mappings(self, field_mappings): + return self._format_mappings(field_mappings) + + @staticmethod + def _format_mappings(field_mappings): if isinstance(field_mappings, tuple): return {item: item for item in field_mappings} else: return field_mappings - # protected methods def _init_form_fields(self): self.fields_src_elem = self._get_element(*self._fields_locator) fields = self._get_form_fields() @@ -444,13 +450,11 @@ class TabbedFormRegion(FormRegion): def __init__(self, driver, conf, field_mappings=None, default_tab=0): self.current_tab = default_tab - super(TabbedFormRegion, self).__init__(driver, - conf, - field_mappings=field_mappings) + super().__init__(driver, conf, field_mappings=field_mappings) def _prepare_mappings(self, field_mappings): return [ - super(TabbedFormRegion, self)._prepare_mappings(tab_mappings) + self._format_mappings(tab_mappings) for tab_mappings in field_mappings ] @@ -488,16 +492,14 @@ class WizardFormRegion(FormRegion): def __init__(self, driver, conf, field_mappings=None, default_step=0): self.current_step = default_step - super(WizardFormRegion, self).__init__(driver, - conf, - field_mappings=field_mappings) + super().__init__(driver, conf, field_mappings=field_mappings) def _form_getter(self): return self.driver.find_element(*self._default_form_locator) def _prepare_mappings(self, field_mappings): return [ - super(WizardFormRegion, self)._prepare_mappings(step_mappings) + self._format_mappings(step_mappings) for step_mappings in field_mappings ] @@ -618,7 +620,7 @@ class ItemTextDescription(baseregion.BaseRegion): _value_locator = (by.By.CSS_SELECTOR, 'dd') def __init__(self, driver, conf, src=None): - super(ItemTextDescription, self).__init__(driver, conf, src) + super().__init__(driver, conf, src) def get_content(self): keys = [] diff --git a/openstack_dashboard/test/integration_tests/regions/messages.py b/openstack_dashboard/test/integration_tests/regions/messages.py index aac86f4562..68f50f11bc 100644 --- a/openstack_dashboard/test/integration_tests/regions/messages.py +++ b/openstack_dashboard/test/integration_tests/regions/messages.py @@ -32,7 +32,7 @@ class MessageRegion(baseregion.BaseRegion): # requires extra time to wait for message to pop up. driver.implicitly_wait(conf.selenium.message_implicit_wait) try: - super(MessageRegion, self).__init__(driver, conf) + super().__init__(driver, conf) except NoSuchElementException: self.src_elem = None finally: diff --git a/openstack_dashboard/test/integration_tests/regions/tables.py b/openstack_dashboard/test/integration_tests/regions/tables.py index c3c4b39330..9778950b39 100644 --- a/openstack_dashboard/test/integration_tests/regions/tables.py +++ b/openstack_dashboard/test/integration_tests/regions/tables.py @@ -32,7 +32,7 @@ class RowRegion(baseregion.BaseRegion): def __init__(self, driver, conf, src_elem, column_names): self.column_names = column_names - super(RowRegion, self).__init__(driver, conf, src_elem) + super().__init__(driver, conf, src_elem) @property def cells(self): @@ -91,7 +91,7 @@ class TableRegion(baseregion.BaseRegion): def __init__(self, driver, conf): self._default_src_locator = self._table_locator(self.__class__.name) - super(TableRegion, self).__init__(driver, conf) + super().__init__(driver, conf) @property def heading(self): diff --git a/openstack_dashboard/test/integration_tests/tests/test_credentials.py b/openstack_dashboard/test/integration_tests/tests/test_credentials.py index 40ba8782fd..1239937642 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_credentials.py +++ b/openstack_dashboard/test/integration_tests/tests/test_credentials.py @@ -24,7 +24,7 @@ class TestDownloadRCFile(helpers.AdminTestCase): _openrc_template = "-openrc.sh" def setUp(self): - super(TestDownloadRCFile, self).setUp() + super().setUp() username = self.TEST_USER_NAME tenant_name = self.HOME_PROJECT projects_page = self.home_pg.go_to_identity_projectspage() diff --git a/openstack_dashboard/test/integration_tests/tests/test_defaults.py b/openstack_dashboard/test/integration_tests/tests/test_defaults.py index ea97bfae94..3a6d782b38 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_defaults.py +++ b/openstack_dashboard/test/integration_tests/tests/test_defaults.py @@ -19,7 +19,7 @@ from openstack_dashboard.test.integration_tests.regions import messages class TestDefaults(helpers.AdminTestCase): def setUp(self): - super(TestDefaults, self).setUp() + super().setUp() self.defaults_page = self.home_pg.go_to_admin_system_defaultspage() self.add_up = random.randint(1, 10) diff --git a/openstack_dashboard/test/integration_tests/tests/test_flavors.py b/openstack_dashboard/test/integration_tests/tests/test_flavors.py index 591424eb4c..2bd18051c9 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_flavors.py +++ b/openstack_dashboard/test/integration_tests/tests/test_flavors.py @@ -31,7 +31,7 @@ class TestFlavors(helpers.AdminTestCase): FLAVOR_NAME = helpers.gen_random_resource_name("flavor") def setUp(self): - super(TestFlavors, self).setUp() + super().setUp() self.flavors_page = self.home_pg.go_to_admin_compute_flavorspage() def _create_flavor(self, flavor_name): diff --git a/openstack_dashboard/test/integration_tests/tests/test_groups.py b/openstack_dashboard/test/integration_tests/tests/test_groups.py index 6195992694..2e78807f1a 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_groups.py +++ b/openstack_dashboard/test/integration_tests/tests/test_groups.py @@ -18,7 +18,7 @@ class TestGroup(helpers.AdminTestCase): """Checks if the user is able to create/delete/edit groups""" def setUp(self): - super(TestGroup, self).setUp() + super().setUp() self.groups_page = self.home_pg.go_to_identity_groupspage() @property diff --git a/openstack_dashboard/test/integration_tests/tests/test_images.py b/openstack_dashboard/test/integration_tests/tests/test_images.py index 34f21e4e7f..cd71ca2a61 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_images.py +++ b/openstack_dashboard/test/integration_tests/tests/test_images.py @@ -20,7 +20,7 @@ from openstack_dashboard.test.integration_tests.regions import messages message="Angular Panels not tested") class TestImagesLegacy(helpers.TestCase): def __init__(self, *args, **kwargs): - super(TestImagesLegacy, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.IMAGE_NAME = helpers.gen_random_resource_name("image") @property @@ -336,7 +336,7 @@ class TestImagesAdmin(helpers.AdminTestCase, TestImagesLegacy): @pytest.mark.skip(reason="Bug 1774697") def test_image_create_delete(self): - super(TestImagesAdmin, self).test_image_create_delete() + super().test_image_create_delete() def test_filter_images(self): """This test checks filtering of images diff --git a/openstack_dashboard/test/integration_tests/tests/test_instances.py b/openstack_dashboard/test/integration_tests/tests/test_instances.py index 59f1c44a46..fcd696f55a 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_instances.py +++ b/openstack_dashboard/test/integration_tests/tests/test_instances.py @@ -252,5 +252,4 @@ class TestAdminInstances(helpers.AdminTestCase, TestInstances): @pytest.mark.skip(reason="Bug 1774697") def test_instances_pagination_and_filtration(self): - super(TestAdminInstances, self).\ - test_instances_pagination_and_filtration() + super().test_instances_pagination_and_filtration() diff --git a/openstack_dashboard/test/integration_tests/tests/test_projects.py b/openstack_dashboard/test/integration_tests/tests/test_projects.py index 5db19f4266..0b06c85285 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_projects.py +++ b/openstack_dashboard/test/integration_tests/tests/test_projects.py @@ -19,7 +19,7 @@ PROJECT_NAME = helpers.gen_random_resource_name("project") class TestCreateDeleteProject(helpers.AdminTestCase): def setUp(self): - super(TestCreateDeleteProject, self).setUp() + super().setUp() self.projects_page = self.home_pg.go_to_identity_projectspage() def test_create_delete_project(self): @@ -41,7 +41,7 @@ class TestCreateDeleteProject(helpers.AdminTestCase): class TestModifyProject(helpers.AdminTestCase): def setUp(self): - super(TestModifyProject, self).setUp() + super().setUp() self.projects_page = self.home_pg.go_to_identity_projectspage() self.projects_page.create_project(PROJECT_NAME) self.assertTrue( diff --git a/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py b/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py index 7c5aea54fb..172b47962d 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py +++ b/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py @@ -29,7 +29,7 @@ class TestVolumeSnapshotsBasic(helpers.TestCase): def setUp(self): """Setup: create volume""" - super(TestVolumeSnapshotsBasic, self).setUp() + super().setUp() volumes_page = self.home_pg.go_to_project_volumes_volumespage() volumes_page.create_volume(self.VOLUME_NAME) volumes_page.find_message_and_dismiss(messages.INFO) @@ -182,12 +182,10 @@ class TestVolumeSnapshotsAdmin(helpers.AdminTestCase, return self.home_pg.go_to_project_volumes_snapshotspage() def test_create_edit_delete_volume_snapshot(self): - super(TestVolumeSnapshotsAdmin, self).\ - test_create_edit_delete_volume_snapshot() + super().test_create_edit_delete_volume_snapshot() def test_volume_snapshots_pagination(self): - super(TestVolumeSnapshotsAdmin, self).\ - test_volume_snapshots_pagination() + super().test_volume_snapshots_pagination() class TestVolumeSnapshotsAdvanced(helpers.TestCase): @@ -201,7 +199,7 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase): def setUp(self): """Setup: create volume""" - super(TestVolumeSnapshotsAdvanced, self).setUp() + super().setUp() volumes_page = self.home_pg.go_to_project_volumes_volumespage() volumes_page.create_volume(self.VOLUME_NAME) volumes_page.find_message_and_dismiss(messages.INFO) diff --git a/openstack_dashboard/test/integration_tests/tests/test_volumes.py b/openstack_dashboard/test/integration_tests/tests/test_volumes.py index 6c37c4cc83..8353de4ddc 100644 --- a/openstack_dashboard/test/integration_tests/tests/test_volumes.py +++ b/openstack_dashboard/test/integration_tests/tests/test_volumes.py @@ -243,7 +243,7 @@ class TestVolumesActions(helpers.TestCase): return self.home_pg.go_to_project_volumes_volumespage() def setUp(self): - super(TestVolumesActions, self).setUp() + super().setUp() volumes_page = self.volumes_page volumes_page.create_volume(self.VOLUME_NAME) self.assertTrue( diff --git a/openstack_dashboard/test/test_data/glance_data.py b/openstack_dashboard/test/test_data/glance_data.py index df05f3d2ce..02713ff192 100644 --- a/openstack_dashboard/test/test_data/glance_data.py +++ b/openstack_dashboard/test/test_data/glance_data.py @@ -21,7 +21,7 @@ class Namespace(dict): return "" % self._info def __init__(self, info): - super(Namespace, self).__init__() + super().__init__() self.__dict__.update(info) self.update(info) self._info = info diff --git a/openstack_dashboard/test/test_data/nova_data.py b/openstack_dashboard/test/test_data/nova_data.py index 8e446d2298..9b9d3acaad 100644 --- a/openstack_dashboard/test/test_data/nova_data.py +++ b/openstack_dashboard/test/test_data/nova_data.py @@ -38,7 +38,7 @@ class FlavorExtraSpecs(dict): return "" % self._info def __init__(self, info): - super(FlavorExtraSpecs, self).__init__() + super().__init__() self.__dict__.update(info) self.update(info) self._info = info diff --git a/openstack_dashboard/test/test_panels/plugin_panel/views.py b/openstack_dashboard/test/test_panels/plugin_panel/views.py index a5c18fda40..df4f2d00cd 100644 --- a/openstack_dashboard/test/test_panels/plugin_panel/views.py +++ b/openstack_dashboard/test/test_panels/plugin_panel/views.py @@ -22,7 +22,7 @@ class TestBannerView(views.HorizonTemplateView): template_name = 'admin/plugin_panel/header.html' def get_context_data(self, **kwargs): - context = super(TestBannerView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['message'] = "sample context" return context diff --git a/openstack_dashboard/test/test_plugins/test_panel.py b/openstack_dashboard/test/test_plugins/test_panel.py index 31f14e6cc3..abaacb0181 100644 --- a/openstack_dashboard/test/test_plugins/test_panel.py +++ b/openstack_dashboard/test/test_plugins/test_panel.py @@ -44,7 +44,7 @@ class PluginPanelTests(test.PluginTestCase): urls = 'openstack_dashboard.test.extensible_header_urls' def setUp(self): - super(PluginPanelTests, self).setUp() + super().setUp() util_settings.update_dashboards([panel_config, ], HORIZON_CONFIG, INSTALLED_APPS) def test_add_panel(self): diff --git a/openstack_dashboard/test/test_plugins/test_panel_group.py b/openstack_dashboard/test/test_plugins/test_panel_group.py index 6e7f0ebf83..eee1897160 100644 --- a/openstack_dashboard/test/test_plugins/test_panel_group.py +++ b/openstack_dashboard/test/test_plugins/test_panel_group.py @@ -42,7 +42,7 @@ HORIZON_CONFIG.pop('default_dashboard', None) class PanelGroupPluginTests(test.PluginTestCase): def setUp(self): - super(PanelGroupPluginTests, self).setUp() + super().setUp() util_settings.update_dashboards([ openstack_dashboard.test.test_plugins.panel_group_config, ], HORIZON_CONFIG, INSTALLED_APPS) diff --git a/openstack_dashboard/test/unit/api/rest/test_glance.py b/openstack_dashboard/test/unit/api/rest/test_glance.py index ab51622892..b79ebbdbac 100644 --- a/openstack_dashboard/test/unit/api/rest/test_glance.py +++ b/openstack_dashboard/test/unit/api/rest/test_glance.py @@ -22,7 +22,7 @@ from openstack_dashboard.test import helpers as test class ImagesRestTestCase(test.ResetImageAPIVersionMixin, test.TestCase): def setUp(self): - super(ImagesRestTestCase, self).setUp() + super().setUp() api.glance.VERSIONS.clear_active_cache() # diff --git a/openstack_dashboard/test/unit/api/test_base.py b/openstack_dashboard/test/unit/api/test_base.py index 443e684c18..94d69edaba 100644 --- a/openstack_dashboard/test/unit/api/test_base.py +++ b/openstack_dashboard/test/unit/api/test_base.py @@ -229,7 +229,7 @@ class APIDictWrapperTests(test.TestCase): class ApiVersionTests(test.TestCase): def setUp(self): - super(ApiVersionTests, self).setUp() + super().setUp() override = self.settings( OPENSTACK_API_VERSIONS={ "data-processing": 1.1, diff --git a/openstack_dashboard/test/unit/api/test_cinder.py b/openstack_dashboard/test/unit/api/test_cinder.py index 026b7a6275..0c1650ef34 100644 --- a/openstack_dashboard/test/unit/api/test_cinder.py +++ b/openstack_dashboard/test/unit/api/test_cinder.py @@ -464,7 +464,7 @@ class CinderApiTests(test.APIMockTestCase): class CinderApiVersionTests(test.TestCase): def setUp(self): - super(CinderApiVersionTests, self).setUp() + super().setUp() # The version is set when the module is loaded. Reset the # active version each time so that we can test with different # versions. diff --git a/openstack_dashboard/test/unit/api/test_glance.py b/openstack_dashboard/test/unit/api/test_glance.py index 3a364797d6..863c05512d 100644 --- a/openstack_dashboard/test/unit/api/test_glance.py +++ b/openstack_dashboard/test/unit/api/test_glance.py @@ -28,7 +28,7 @@ from openstack_dashboard.test import helpers as test class GlanceApiTests(test.APIMockTestCase): def setUp(self): - super(GlanceApiTests, self).setUp() + super().setUp() api.glance.VERSIONS.clear_active_cache() @override_settings(API_RESULT_PAGE_SIZE=2) diff --git a/openstack_dashboard/test/unit/api/test_keystone.py b/openstack_dashboard/test/unit/api/test_keystone.py index 260aab5dc1..82221b7570 100644 --- a/openstack_dashboard/test/unit/api/test_keystone.py +++ b/openstack_dashboard/test/unit/api/test_keystone.py @@ -25,7 +25,7 @@ from openstack_dashboard.test import helpers as test class RoleAPITests(test.APIMockTestCase): def setUp(self): - super(RoleAPITests, self).setUp() + super().setUp() self.role = self.roles.member self.roles = self.roles.list() diff --git a/openstack_dashboard/test/unit/api/test_network.py b/openstack_dashboard/test/unit/api/test_network.py index adda80f129..c3b8a394ca 100644 --- a/openstack_dashboard/test/unit/api/test_network.py +++ b/openstack_dashboard/test/unit/api/test_network.py @@ -25,7 +25,7 @@ from openstack_dashboard.test import helpers as test class NetworkApiNeutronTests(test.APIMockTestCase): def setUp(self): - super(NetworkApiNeutronTests, self).setUp() + super().setUp() neutronclient = mock.patch.object(api.neutron, 'neutronclient').start() self.qclient = neutronclient.return_value diff --git a/openstack_dashboard/test/unit/api/test_neutron.py b/openstack_dashboard/test/unit/api/test_neutron.py index 4a42b8d454..7003329e59 100644 --- a/openstack_dashboard/test/unit/api/test_neutron.py +++ b/openstack_dashboard/test/unit/api/test_neutron.py @@ -1118,7 +1118,7 @@ class NeutronApiTests(test.APIMockTestCase): class NeutronApiSecurityGroupTests(test.APIMockTestCase): def setUp(self): - super(NeutronApiSecurityGroupTests, self).setUp() + super().setUp() neutronclient = mock.patch.object(api.neutron, 'neutronclient').start() self.qclient = neutronclient.return_value self.sg_dict = dict([(sg['id'], sg['name']) for sg @@ -1353,7 +1353,7 @@ class NeutronApiSecurityGroupTests(test.APIMockTestCase): class NeutronApiFloatingIpTests(test.APIMockTestCase): def setUp(self): - super(NeutronApiFloatingIpTests, self).setUp() + super().setUp() neutronclient = mock.patch.object(api.neutron, 'neutronclient').start() self.qclient = neutronclient.return_value diff --git a/openstack_dashboard/usage/base.py b/openstack_dashboard/usage/base.py index 53f3490a7d..ba14add13e 100644 --- a/openstack_dashboard/usage/base.py +++ b/openstack_dashboard/usage/base.py @@ -163,7 +163,7 @@ class ProjectUsage(BaseUsage): 'hours', 'local_gb') def __init__(self, request, project_id=None): - super(ProjectUsage, self).__init__(request, project_id) + super().__init__(request, project_id) self.limits = {} self.quotas = {} diff --git a/openstack_dashboard/usage/views.py b/openstack_dashboard/usage/views.py index d88b560880..c597611689 100644 --- a/openstack_dashboard/usage/views.py +++ b/openstack_dashboard/usage/views.py @@ -30,7 +30,7 @@ class UsageView(tables.DataTableView): page_title = _("Overview") def __init__(self, *args, **kwargs): - super(UsageView, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if not issubclass(self.usage_class, base.BaseUsage): raise AttributeError("You must specify a usage_class attribute " "which is a subclass of BaseUsage.") @@ -60,7 +60,7 @@ class UsageView(tables.DataTableView): return [] def get_context_data(self, **kwargs): - context = super(UsageView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['table'].kwargs['usage'] = self.usage context['form'] = self.usage.form context['usage'] = self.usage @@ -207,12 +207,12 @@ class ProjectUsageView(UsageView): return charts def get_context_data(self, **kwargs): - context = super(ProjectUsageView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['charts'] = self._get_charts_data() return context def get_data(self): - data = super(ProjectUsageView, self).get_data() + data = super().get_data() try: self.usage.get_limits() except Exception: diff --git a/openstack_dashboard/utils/config_types.py b/openstack_dashboard/utils/config_types.py index 90619c0aae..5eae5760a5 100644 --- a/openstack_dashboard/utils/config_types.py +++ b/openstack_dashboard/utils/config_types.py @@ -31,7 +31,7 @@ class Maybe(types.ConfigType): def __init__(self, type_): self.type_ = type_ type_name = getattr(type_, 'type_name', 'unknown value') - super(Maybe, self).__init__('optional %s' % type_name) + super().__init__('optional %s' % type_name) def __call__(self, value): if value is None: @@ -50,7 +50,7 @@ class URL(types.ConfigType): CLEAN_SLASH_RE = re.compile(r'(?