launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27861
[Merge] ~cjwatson/launchpad:pyupgrade-py3-registry-1 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-registry-1 into launchpad:master.
Commit message:
lp.registry.browser: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413506
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-registry-1 into launchpad:master.
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index a251b8f..c594c33 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -28,3 +28,5 @@ cee9b128d3e49ca814464eeeeec50e6bcabcc4ba
f36fe66e5e5a5e82ba8c3269e32d76bd573d1175
# apply pyupgrade --py3-plus to lp.{coop,oci}
fbed83f22424df8fa5647349493f78937a520db5
+# apply pyupgrade --py3-plus to lp.registry.browser
+9c1665b1dfed3f6abf69afa192700172ea3089a1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 22c2329..784ae6a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -52,6 +52,7 @@ repos:
|codehosting
|coop
|oci
+ |registry/browser
)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
diff --git a/lib/lp/registry/browser/codeofconduct.py b/lib/lp/registry/browser/codeofconduct.py
index 65fc254..cda21f9 100644
--- a/lib/lp/registry/browser/codeofconduct.py
+++ b/lib/lp/registry/browser/codeofconduct.py
@@ -175,7 +175,7 @@ class AffirmCodeOfConductView(LaunchpadFormView):
affirmed = copy_field(
ISignedCodeOfConduct["affirmed"],
- title=_("I agree to this Code of Conduct"), description=u"")
+ title=_("I agree to this Code of Conduct"), description="")
field_names = ['affirmed']
diff --git a/lib/lp/registry/browser/distribution.py b/lib/lp/registry/browser/distribution.py
index 741fab0..025e405 100644
--- a/lib/lp/registry/browser/distribution.py
+++ b/lib/lp/registry/browser/distribution.py
@@ -372,7 +372,7 @@ class DistributionNavigationMenu(NavigationMenu, DistributionLinksMixin):
def search_oci_project(self):
oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(
- self.context, u'')
+ self.context, '')
text = 'Search for OCI project'
link = Link('+search-oci-project', text, icon='info')
link.enabled = not oci_projects.is_empty()
@@ -574,7 +574,7 @@ class DistributionPackageSearchView(PackageSearchViewBase):
def initialize(self):
"""Save the search type if provided."""
- super(DistributionPackageSearchView, self).initialize()
+ super().initialize()
# If the distribution contains binary packages, then we'll
# default to searches on binary names, but allow the user to
@@ -704,7 +704,7 @@ class DistributionView(PillarViewMixin, HasAnnouncementsView, FeedsMixin):
"""Default Distribution view class."""
def initialize(self):
- super(DistributionView, self).initialize()
+ super().initialize()
expose_structural_subscription_data_to_js(
self.context, self.request, self.user)
@@ -902,9 +902,9 @@ class RequireVirtualizedBuildersMixin:
return form.Fields(
Bool(
__name__='require_virtualized',
- title=u"Require virtualized builders",
+ title="Require virtualized builders",
description=(
- u"Only build the distribution's packages on virtual "
+ "Only build the distribution's packages on virtual "
"builders."),
required=True))
@@ -956,8 +956,8 @@ class DistributionAddView(LaunchpadFormView, RequireVirtualizedBuildersMixin,
self.form_fields += self.createRequireVirtualized()
self.form_fields += self.createEnabledProcessors(
getUtility(IProcessorSet).getAll(),
- u"The architectures on which the distribution's main archive can "
- u"build.")
+ "The architectures on which the distribution's main archive can "
+ "build.")
@action("Save", name='save')
def save_action(self, action, data):
@@ -1028,8 +1028,8 @@ class DistributionEditView(RegistryEditFormView,
self.form_fields += self.createRequireVirtualized()
self.form_fields += self.createEnabledProcessors(
getUtility(IProcessorSet).getAll(),
- u"The architectures on which the distribution's main archive can "
- u"build.")
+ "The architectures on which the distribution's main archive can "
+ "build.")
@property
def initial_values(self):
@@ -1195,7 +1195,7 @@ class DistributionCountryArchiveMirrorsView(LaunchpadView):
request = self.request
if not self.context.supports_mirrors:
request.response.setStatus(404)
- return u''
+ return ''
ip_address = ipaddress_from_request(request)
country = request_country(request)
mirrors = getUtility(IDistributionMirrorSet).getBestMirrorsForCountry(
diff --git a/lib/lp/registry/browser/distributionsourcepackage.py b/lib/lp/registry/browser/distributionsourcepackage.py
index 48def0c..1d09774 100644
--- a/lib/lp/registry/browser/distributionsourcepackage.py
+++ b/lib/lp/registry/browser/distributionsourcepackage.py
@@ -22,7 +22,6 @@ import operator
import apt_pkg
from lazr.delegates import delegate_to
-import six
from zope.component import getUtility
from zope.interface import (
implementer,
@@ -119,7 +118,7 @@ class DistributionSourcePackageURL:
not self.context.distribution.redirect_default_traversal):
return self.context.name
else:
- return u"+source/%s" % self.context.name
+ return "+source/%s" % self.context.name
class DistributionSourcePackageFormatterAPI(CustomizableFormatter):
@@ -298,7 +297,7 @@ class DistributionSourcePackageBaseView(LaunchpadView):
def not_empty(text):
return (
- text is not None and isinstance(text, six.string_types)
+ text is not None and isinstance(text, str)
and len(text.strip()) > 0)
def decorate(dspr_pubs):
@@ -341,7 +340,7 @@ class DistributionSourcePackageView(DistributionSourcePackageBaseView,
"""View class for DistributionSourcePackage."""
def initialize(self):
- super(DistributionSourcePackageView, self).initialize()
+ super().initialize()
expose_structural_subscription_data_to_js(
self.context, self.request, self.user)
diff --git a/lib/lp/registry/browser/distroseries.py b/lib/lp/registry/browser/distroseries.py
index 6b162dc..0834c89 100644
--- a/lib/lp/registry/browser/distroseries.py
+++ b/lib/lp/registry/browser/distroseries.py
@@ -159,7 +159,7 @@ class DistroSeriesURL:
not self.context.distribution.redirect_default_traversal):
return self.context.name
else:
- return u"+series/%s" % self.context.name
+ return "+series/%s" % self.context.name
class DistroSeriesNavigation(GetitemNavigation, BugTargetTraversalMixin,
@@ -439,7 +439,7 @@ class DistroSeriesView(LaunchpadView, MilestoneOverlayMixin,
DerivedDistroSeriesMixin):
def initialize(self):
- super(DistroSeriesView, self).initialize()
+ super().initialize()
self.displayname = '%s %s' % (
self.context.distribution.displayname,
self.context.version)
@@ -709,7 +709,7 @@ class DistroSeriesAddView(LaunchpadFormView):
]
help_links = {
- "name": u"/+help-registry/distribution-add-series.html#codename",
+ "name": "/+help-registry/distribution-add-series.html#codename",
}
label = 'Add a series'
@@ -729,7 +729,7 @@ class DistroSeriesAddView(LaunchpadFormView):
display_name=data['display_name'],
title=data['display_name'],
summary=data['summary'],
- description=u"",
+ description="",
version=data['version'],
previous_series=previous_series,
registrant=self.user)
@@ -765,7 +765,7 @@ class DistroSeriesInitializeView(LaunchpadFormView):
page_title = label
def initialize(self):
- super(DistroSeriesInitializeView, self).initialize()
+ super().initialize()
cache = IJSONRequestCache(self.request).objects
distribution = self.context.distribution
is_first_derivation = not distribution.has_published_sources
@@ -778,7 +778,7 @@ class DistroSeriesInitializeView(LaunchpadFormView):
cache['previous_parents'] = [
seriesToVocab(series) for series in previous_parents]
- @action(u"Initialize Series", name='initialize')
+ @action("Initialize Series", name='initialize')
def submit(self, action, data):
"""Stub for the Javascript in the page to use."""
@@ -888,7 +888,7 @@ class IDifferencesFormSchema(Interface):
required=True)
sponsored_person = Choice(
- title=u"Person being sponsored", vocabulary='ValidPerson',
+ title="Person being sponsored", vocabulary='ValidPerson',
required=False)
@@ -954,7 +954,7 @@ class DistroSeriesDifferenceBaseView(LaunchpadFormView,
As this field depends on other search/filtering field values
for its own vocabulary, we set it up after all the others.
"""
- super(DistroSeriesDifferenceBaseView, self).setUpFields()
+ super().setUpFields()
self.form_fields = (
self.setupPackageFilterRadio() +
self.form_fields)
@@ -1231,7 +1231,7 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView,
parent_name,
self.context.displayname,
))
- super(DistroSeriesLocalDifferencesView, self).initialize()
+ super().initialize()
@property
def explanation(self):
@@ -1294,9 +1294,9 @@ class DistroSeriesLocalDifferencesView(DistroSeriesDifferenceBaseView,
copies, self.user, copy_policy=PackageCopyPolicy.MASS_SYNC)
self.request.response.addInfoNotification(
- (u"Upgrades of {context.displayname} packages have been "
- u"requested. Please give Launchpad some time to complete "
- u"these.").format(context=self.context))
+ ("Upgrades of {context.displayname} packages have been "
+ "requested. Please give Launchpad some time to complete "
+ "these.").format(context=self.context))
def canUpgrade(self, action=None):
"""Should the form offer a packages upgrade?"""
@@ -1330,7 +1330,7 @@ class DistroSeriesMissingPackagesView(DistroSeriesDifferenceBaseView,
"Include Selected packages into %s" % (
self.context.displayname,
))
- super(DistroSeriesMissingPackagesView, self).initialize()
+ super().initialize()
@property
def explanation(self):
@@ -1369,7 +1369,7 @@ class DistroSeriesUniquePackagesView(DistroSeriesDifferenceBaseView,
show_packagesets = True
def initialize(self):
- super(DistroSeriesUniquePackagesView, self).initialize()
+ super().initialize()
@property
def explanation(self):
diff --git a/lib/lp/registry/browser/distroseriesdifference.py b/lib/lp/registry/browser/distroseriesdifference.py
index 717cb88..ddcd915 100644
--- a/lib/lp/registry/browser/distroseriesdifference.py
+++ b/lib/lp/registry/browser/distroseriesdifference.py
@@ -258,7 +258,7 @@ class DistroSeriesDifferenceDisplayComment(MessageComment):
def __init__(self, comment):
"""Setup the attributes required by `IComment`."""
- super(DistroSeriesDifferenceDisplayComment, self).__init__(None)
+ super().__init__(None)
self.comment = comment
self._message = comment.message
diff --git a/lib/lp/registry/browser/distroseriesdifferencecomment.py b/lib/lp/registry/browser/distroseriesdifferencecomment.py
index 6d1a8a1..5bb0c86 100644
--- a/lib/lp/registry/browser/distroseriesdifferencecomment.py
+++ b/lib/lp/registry/browser/distroseriesdifferencecomment.py
@@ -18,7 +18,6 @@ class DistroSeriesDifferenceCommentView(LaunchpadView):
"""
def __init__(self, *args, **kwargs):
- super(DistroSeriesDifferenceCommentView, self).__init__(
- *args, **kwargs)
+ super().__init__(*args, **kwargs)
error_persona = getUtility(ILaunchpadCelebrities).janitor
self.is_error = (self.context.comment_author == error_persona)
diff --git a/lib/lp/registry/browser/featuredproject.py b/lib/lp/registry/browser/featuredproject.py
index c77adcb..214eede 100644
--- a/lib/lp/registry/browser/featuredproject.py
+++ b/lib/lp/registry/browser/featuredproject.py
@@ -34,7 +34,7 @@ class FeaturedProjectForm(Interface):
required=False, vocabulary='DistributionOrProductOrProjectGroup')
remove = Set(
- title=u'Remove projects',
+ title='Remove projects',
description=_(
'Select projects that you would like to remove from the list.'),
required=False,
diff --git a/lib/lp/registry/browser/mailinglists.py b/lib/lp/registry/browser/mailinglists.py
index ea8c6ed..bbc26a2 100644
--- a/lib/lp/registry/browser/mailinglists.py
+++ b/lib/lp/registry/browser/mailinglists.py
@@ -28,7 +28,7 @@ class HeldMessageView(LaunchpadView):
"""A little helper view for held messages."""
def __init__(self, context, request):
- super(HeldMessageView, self).__init__(context, request)
+ super().__init__(context, request)
self.context = context
self.request = request
# The context object is an IMessageApproval, but we need some extra
@@ -74,16 +74,16 @@ class HeldMessageView(LaunchpadView):
else:
current_paragraph.append(line)
self._append_paragraph(paragraphs, current_paragraph)
- self.body_details = u''.join(paragraphs)
+ self.body_details = ''.join(paragraphs)
def _append_paragraph(self, paragraphs, current_paragraph):
if len(current_paragraph) == 0:
# There is nothing to append. The message has multiple
# blank lines.
return
- paragraphs.append(u'\n<p>\n')
- paragraphs.append(u'\n'.join(current_paragraph))
- paragraphs.append(u'\n</p>\n')
+ paragraphs.append('\n<p>\n')
+ paragraphs.append('\n'.join(current_paragraph))
+ paragraphs.append('\n</p>\n')
def _remove_leading_blank_lines(self):
"""Strip off any leading blank lines.
@@ -113,13 +113,13 @@ class HeldMessageView(LaunchpadView):
"""
# If there are no non-blank lines, then we're done.
if len(text_lines) == 0:
- self.body_summary = u''
- return u''
+ self.body_summary = ''
+ return ''
# If the first line is of a completely arbitrarily chosen reasonable
# length, then we'll just use that as the summary.
elif len(text_lines[0]) < 60:
self.body_summary = text_lines[0]
- return u'\n'.join(text_lines[1:])
+ return '\n'.join(text_lines[1:])
# It could be the case that the text is actually flowed using RFC
# 3676 format="flowed" parameters. In that case, just split the line
# at the first whitespace after, again, our arbitrarily chosen limit.
@@ -128,8 +128,8 @@ class HeldMessageView(LaunchpadView):
wrapper = TextWrapper(width=60)
filled_lines = wrapper.fill(first_line).splitlines()
self.body_summary = filled_lines[0]
- text_lines.insert(0, u''.join(filled_lines[1:]))
- return u'\n'.join(text_lines)
+ text_lines.insert(0, ''.join(filled_lines[1:]))
+ return '\n'.join(text_lines)
class enabled_with_active_mailing_list:
diff --git a/lib/lp/registry/browser/milestone.py b/lib/lp/registry/browser/milestone.py
index 3d2724e..375f5e4 100644
--- a/lib/lp/registry/browser/milestone.py
+++ b/lib/lp/registry/browser/milestone.py
@@ -194,7 +194,7 @@ class MilestoneInlineNavigationMenu(NavigationMenu, MilestoneLinkMixin):
links = ('edit', )
-class MilestoneViewMixin(object):
+class MilestoneViewMixin:
"""Common methods shared between MilestoneView and MilestoneTagView."""
@property
@@ -366,7 +366,7 @@ class MilestoneView(
:param context: `IMilestone` or `IProductRelease`.
:param request: `ILaunchpadRequest`.
"""
- super(MilestoneView, self).__init__(context, request)
+ super().__init__(context, request)
if IMilestoneData.providedBy(context):
self.milestone = context
self.release = getattr(context, "product_release", None)
@@ -431,7 +431,7 @@ class MilestoneTagBase:
on the interface.
"""
tag_entry = TextLine(
- __name__='tags', title=u'Tags', required=False,
+ __name__='tags', title='Tags', required=False,
constraint=lambda value: validate_tags(value.split()))
self.form_fields += form.Fields(
tag_entry, render_context=self.render_context)
@@ -512,7 +512,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
@property
def initial_values(self):
- return {'tags': u' '.join(self.context.getTags())}
+ return {'tags': ' '.join(self.context.getTags())}
def setUpFields(self):
"""See `LaunchpadFormView`.
@@ -521,7 +521,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
create the milestone, but once a series field is set, None is invalid.
The choice for the series is redefined to ensure None is not included.
"""
- super(MilestoneEditView, self).setUpFields()
+ super().setUpFields()
if self.context.product is None:
# This is a distribution milestone.
choice = Choice(
@@ -538,7 +538,7 @@ class MilestoneEditView(MilestoneTagBase, LaunchpadEditFormView):
@action(_('Update'), name='update')
def update_action(self, action, data):
"""Update the milestone."""
- tags = data.pop('tags') or u''
+ tags = data.pop('tags') or ''
self.updateContextFromData(data)
self.context.setTags(tags.lower().split(), self.user)
self.next_url = canonical_url(self.context)
@@ -611,17 +611,17 @@ class MilestoneTagView(
:param context: `IProjectGroupMilestoneTag`
:param request: `ILaunchpadRequest`.
"""
- super(MilestoneTagView, self).__init__(context, request)
+ super().__init__(context, request)
self.context = self.milestone = context
self.release = None
@property
def initial_values(self):
"""Set the initial value of the search tags field."""
- return {'tags': u' '.join(self.context.tags)}
+ return {'tags': ' '.join(self.context.tags)}
@safe_action
- @action(u'Search Milestone Tags', name='search')
+ @action('Search Milestone Tags', name='search')
def search_by_tags(self, action, data):
tags = data['tags'].split()
milestone_tag = ProjectGroupMilestoneTag(self.context.target, tags)
diff --git a/lib/lp/registry/browser/objectreassignment.py b/lib/lp/registry/browser/objectreassignment.py
index 79c0ddf..014f9a2 100644
--- a/lib/lp/registry/browser/objectreassignment.py
+++ b/lib/lp/registry/browser/objectreassignment.py
@@ -72,7 +72,7 @@ class ObjectReassignmentView(LaunchpadFormView):
page_title = label
def setUpFields(self):
- super(ObjectReassignmentView, self).setUpFields()
+ super().setUpFields()
self.form_fields = FormFields(
self.form_fields, self.auto_create_team_field)
diff --git a/lib/lp/registry/browser/ociproject.py b/lib/lp/registry/browser/ociproject.py
index 55f2d61..85a1c00 100644
--- a/lib/lp/registry/browser/ociproject.py
+++ b/lib/lp/registry/browser/ociproject.py
@@ -93,7 +93,7 @@ class OCIProjectURL:
if (policy == DistributionDefaultTraversalPolicy.OCI_PROJECT and
not self.context.distribution.redirect_default_traversal):
return self.context.name
- return u"+oci/%s" % self.context.name
+ return "+oci/%s" % self.context.name
def getPillarFieldName(pillar):
@@ -114,7 +114,7 @@ class OCIProjectAddView(LaunchpadFormView):
if (not getFeatureFlag(OCI_PROJECT_ALLOW_CREATE) and not
self.context.canAdministerOCIProjects(self.user)):
raise OCIProjectCreateFeatureDisabled
- super(OCIProjectAddView, self).initialize()
+ super().initialize()
@action("Create OCI Project", name="create")
def create_action(self, action, data):
@@ -129,7 +129,7 @@ class OCIProjectAddView(LaunchpadFormView):
self.next_url = canonical_url(oci_project)
def validate(self, data):
- super(OCIProjectAddView, self).validate(data)
+ super().validate(data)
name = data.get('name', None)
oci_project_name = getUtility(
IOCIProjectNameSet).getOrCreateByName(name)
@@ -289,7 +289,7 @@ class OCIProjectEditView(LaunchpadEditFormView):
pillar_key = getPillarFieldName(self.context.pillar)
self.field_names = [pillar_key] + self.field_names
- super(OCIProjectEditView, self).setUpFields()
+ super().setUpFields()
# Set the correct pillar field as mandatory
pillar_field = self.form_fields.get(pillar_key).field
@@ -302,7 +302,7 @@ class OCIProjectEditView(LaunchpadEditFormView):
page_title = 'Edit'
def validate(self, data):
- super(OCIProjectEditView, self).validate(data)
+ super().validate(data)
pillar_type_field = getPillarFieldName(self.context.pillar)
pillar = data.get(pillar_type_field)
name = data.get('name')
diff --git a/lib/lp/registry/browser/peoplemerge.py b/lib/lp/registry/browser/peoplemerge.py
index eb15d67..f37f6da 100644
--- a/lib/lp/registry/browser/peoplemerge.py
+++ b/lib/lp/registry/browser/peoplemerge.py
@@ -123,7 +123,7 @@ class AdminMergeBaseView(ValidatingMergeView):
# only in certain circunstances, so don't include them in the list of
# actions to be rendered.
self.actions = [self.merge_action]
- return super(AdminMergeBaseView, self).render()
+ return super().render()
def setUpPeople(self, data):
"""Store the people to be merged in instance variables.
@@ -224,7 +224,7 @@ class AdminTeamMergeView(AdminMergeBaseView):
if len(self.errors) > 0:
return
- super(AdminTeamMergeView, self).validate(data)
+ super().validate(data)
dupe_team = data['dupe_person']
# We cannot merge the teams if there is a mailing list on the
# duplicate person, unless that mailing list is purged.
@@ -248,14 +248,14 @@ class AdminTeamMergeView(AdminMergeBaseView):
# merge.
self.should_confirm_member_deactivation = True
return
- super(AdminTeamMergeView, self).doMerge(data)
+ super().doMerge(data)
@action('Deactivate Members and Merge',
name='deactivate_members_and_merge')
def deactivate_members_and_merge_action(self, action, data):
"""Deactivate all members of the team to be merged and merge them."""
self.setUpPeople(data)
- super(AdminTeamMergeView, self).doMerge(data)
+ super().doMerge(data)
class DeleteTeamView(AdminTeamMergeView):
@@ -270,7 +270,7 @@ class DeleteTeamView(AdminTeamMergeView):
return 'Delete %s' % self.context.displayname
def __init__(self, context, request):
- super(DeleteTeamView, self).__init__(context, request)
+ super().__init__(context, request)
if ('field.dupe_person' in self.request.form):
# These fields have fixed values and are managed by this method.
# The user has crafted a request to gain ownership of the dupe
@@ -311,9 +311,8 @@ class DeleteTeamView(AdminTeamMergeView):
@action('Delete', name='delete', condition=canDelete)
def merge_action(self, action, data):
- base = super(DeleteTeamView, self)
self.delete = True
- base.deactivate_members_and_merge_action.success(data)
+ super().deactivate_members_and_merge_action.success(data)
class FinishedPeopleMergeRequestView(LaunchpadView):
@@ -361,8 +360,7 @@ class RequestPeopleMergeMultipleEmailsView(LaunchpadView):
page_title = label
def __init__(self, context, request):
- super(RequestPeopleMergeMultipleEmailsView, self).__init__(
- context, request)
+ super().__init__(context, request)
self.form_processed = False
self.dupe = None
self.notified_addresses = []
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index 7cf2fcb..ccd09c7 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -65,7 +65,6 @@ from lazr.restful.interfaces import IWebServiceClientRequest
from lazr.restful.utils import smartquote
from lazr.uri import URI
import pytz
-import six
from six.moves.urllib.parse import (
quote,
urlencode,
@@ -470,7 +469,7 @@ class BranchTraversalMixin:
branch = getUtility(IBranchNamespaceSet).traverse(
self._getSegments(pillar_name))
except (NotFoundError, InvalidNamespace):
- return super(BranchTraversalMixin, self).traverse(pillar_name)
+ return super().traverse(pillar_name)
# Normally, populating the launch bag is done by the traversal
# mechanism. However, here we short-circuit that mechanism by
@@ -905,8 +904,8 @@ class PersonOverviewMenu(ApplicationMenu, PersonMenuMixin, HasRecipesMenuMixin,
target = '+karma'
text = 'Show karma summary'
summary = (
- u'%s\N{right single quotation mark}s activities '
- u'in Launchpad' % self.context.displayname)
+ '%s\N{right single quotation mark}s activities '
+ 'in Launchpad' % self.context.displayname)
return Link(target, text, summary, icon='info')
def memberships(self):
@@ -1034,7 +1033,7 @@ class PeopleSearchView(LaunchpadView):
page_title = 'People and teams in Launchpad'
def __init__(self, context, request):
- super(PeopleSearchView, self).__init__(context, request)
+ super().__init__(context, request)
self.results = []
@property
@@ -1092,7 +1091,7 @@ class PersonDeactivateAccountView(LaunchpadFormView):
getUtility(IPersonDeactivateJobSource).create(self.context)
logoutPerson(self.request)
self.request.response.addInfoNotification(
- _(u'Your account has been deactivated.'))
+ _('Your account has been deactivated.'))
self.next_url = self.request.getApplicationURL()
@@ -1237,7 +1236,7 @@ class PersonRenameFormMixin(LaunchpadEditFormView):
if reason:
# This makes the field's widget display (i.e. read) only.
self.form_fields['name'].for_display = True
- super(PersonRenameFormMixin, self).setUpWidgets()
+ super().setUpWidgets()
if reason:
self.widgets['name'].hint = reason
@@ -1319,7 +1318,7 @@ class PersonAccountAdministerView(LaunchpadFormView):
def __init__(self, context, request):
"""See `LaunchpadEditFormView`."""
- super(PersonAccountAdministerView, self).__init__(context, request)
+ super().__init__(context, request)
# Only the IPerson can be traversed to, so it provides the IAccount.
# It also means that permissions are checked on IAccount, not IPerson.
self.person = self.context
@@ -1376,18 +1375,18 @@ class PersonAccountAdministerView(LaunchpadFormView):
# is sent to the user.
self.person.setPreferredEmail(None)
self.request.response.addInfoNotification(
- u'The account "%s" has been suspended.'
+ 'The account "%s" has been suspended.'
% self.context.displayname)
elif data['status'] == AccountStatus.DEACTIVATED:
self.request.response.addInfoNotification(
- u'The account "%s" is now deactivated. The user can log in '
- u'to reactivate it.' % self.context.displayname)
+ 'The account "%s" is now deactivated. The user can log in '
+ 'to reactivate it.' % self.context.displayname)
elif data['status'] == AccountStatus.DECEASED:
# Deliberately leave the email address in place so that it can't
# easily be claimed by somebody else.
self.request.response.addInfoNotification(
- u'The account "%s" has been marked as having belonged to a '
- u'deceased user.' % self.context.displayname)
+ 'The account "%s" has been marked as having belonged to a '
+ 'deceased user.' % self.context.displayname)
self.context.setStatus(data['status'], self.user, data['comment'])
@@ -1464,7 +1463,7 @@ class PersonLanguagesView(LaunchpadFormView):
new_languages = []
for key in all_languages.keys():
- if self.request.get(key, None) == u'on':
+ if self.request.get(key, None) == 'on':
new_languages.append(all_languages[key])
if self.is_current_user:
@@ -2128,7 +2127,7 @@ class PersonIndexView(XRDSContentNegotiationMixin, PersonView,
"../../services/openid/templates/person-xrds.pt")
def initialize(self):
- super(PersonIndexView, self).initialize()
+ super().initialize()
if self.context.isMergePending():
if self.context.is_team:
merge_action = 'merged or deleted'
@@ -2225,7 +2224,7 @@ class PersonCodeOfConductEditView(LaunchpadView):
for sig_id in sig_ids:
sig_id = int(sig_id)
# Deactivating signature.
- comment = u'Deactivated by Owner'
+ comment = 'Deactivated by Owner'
sCoC_util.modifySignature(sig_id, self.user, comment, False)
@@ -2285,7 +2284,7 @@ class PersonEditJabberIDsView(LaunchpadFormView):
field_names = ['jabberid']
def setUpFields(self):
- super(PersonEditJabberIDsView, self).setUpFields()
+ super().setUpFields()
if not self.context.jabberids.is_empty():
# Make the jabberid entry optional on the edit page if one or more
# ids already exist, which allows the removal of ids without
@@ -2422,7 +2421,7 @@ class PersonGPGView(LaunchpadView):
def initialize(self):
require_fresh_login(self.request, self.context, '+editpgpkeys')
- super(PersonGPGView, self).initialize()
+ super().initialize()
@property
def cancel_url(self):
@@ -2725,7 +2724,7 @@ class PersonEditEmailsView(LaunchpadFormView):
# +editemails is not available on teams.
name = self.request['PATH_INFO'].split('/')[-1]
raise NotFound(self, name, request=self.request)
- super(PersonEditEmailsView, self).initialize()
+ super().initialize()
def setUpFields(self):
"""Set up fields for this view.
@@ -2734,11 +2733,11 @@ class PersonEditEmailsView(LaunchpadFormView):
vocabularies for the lists of validated and unvalidated email
addresses.
"""
- super(PersonEditEmailsView, self).setUpFields()
+ super().setUpFields()
self.form_fields = (self._validated_emails_field() +
self._unvalidated_emails_field() +
FormFields(TextLine(__name__='newemail',
- title=u'Add a new address')))
+ title='Add a new address')))
@property
def initial_values(self):
@@ -2786,7 +2785,7 @@ class PersonEditEmailsView(LaunchpadFormView):
"""
terms = []
for term in self.unvalidated_addresses:
- if isinstance(term, six.text_type):
+ if isinstance(term, str):
term = SimpleTerm(term)
else:
term = SimpleTerm(term, term.email)
@@ -2827,7 +2826,7 @@ class PersonEditEmailsView(LaunchpadFormView):
"self.context.id(%s,%d) (%s)"
% (person.name, person.id, self.context.name, self.context.id,
email.email))
- elif isinstance(email, six.text_type):
+ elif isinstance(email, str):
tokenset = getUtility(ILoginTokenSet)
email = tokenset.searchByEmailRequesterAndType(
email, self.context, LoginTokenType.VALIDATEEMAIL)
@@ -2953,7 +2952,7 @@ class PersonEditEmailsView(LaunchpadFormView):
if IEmailAddress.providedBy(emailaddress):
emailaddress.destroySelf()
email = emailaddress.email
- elif isinstance(emailaddress, six.text_type):
+ elif isinstance(emailaddress, str):
logintokenset = getUtility(ILoginTokenSet)
logintokenset.deleteByEmailRequesterAndType(
emailaddress, self.context, LoginTokenType.VALIDATEEMAIL)
@@ -3049,7 +3048,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
# +editmailinglists is not available on teams.
name = self.request['PATH_INFO'].split('/')[-1]
raise NotFound(self, name, request=self.request)
- super(PersonEditMailingListsView, self).initialize()
+ super().initialize()
def setUpFields(self):
"""Set up fields for this view.
@@ -3058,7 +3057,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
vocabularies for the lists of validated and unvalidated email
addresses.
"""
- super(PersonEditMailingListsView, self).setUpFields()
+ super().setUpFields()
self.form_fields = (self._mailing_list_fields()
+ self._autosubscribe_policy_fields())
@@ -3081,7 +3080,7 @@ class PersonEditMailingListsView(LaunchpadFormView):
def setUpWidgets(self, context=None):
"""See `LaunchpadFormView`."""
- super(PersonEditMailingListsView, self).setUpWidgets(context)
+ super().setUpWidgets(context)
widget = self.widgets['mailing_list_auto_subscribe_policy']
widget.display_label = False
@@ -3679,7 +3678,7 @@ class PersonOCIRegistryCredentialsView(LaunchpadView):
def initialize(self):
if not user_can_edit_credentials_for_owner(self.context, self.user):
raise Unauthorized
- super(PersonOCIRegistryCredentialsView, self).initialize()
+ super().initialize()
@property
def label(self):
@@ -3712,7 +3711,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
def initialize(self):
if not user_can_edit_credentials_for_owner(self.context, self.user):
raise Unauthorized
- super(PersonEditOCIRegistryCredentialsView, self).initialize()
+ super().initialize()
def _getFieldName(self, name, credentials_id):
"""Get the combined field name for an `OCIRegistryCredentials` ID.
@@ -3764,25 +3763,25 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
def getAddFieldsRow(self):
add_url = TextLine(
- __name__=u'add_url',
+ __name__='add_url',
required=False, readonly=False)
add_region = TextLine(
- __name__=u'add_region',
+ __name__='add_region',
required=False, readonly=False)
add_owner = Choice(
- __name__=u'add_owner',
+ __name__='add_owner',
vocabulary=(
'AllUserTeamsParticipationPlusSelfSimpleDisplay'),
default=self.default_owner,
required=False, readonly=False)
add_username = TextLine(
- __name__=u'add_username',
+ __name__='add_username',
required=False, readonly=False)
add_password = Password(
- __name__=u'add_password',
+ __name__='add_password',
required=False, readonly=False)
add_confirm_password = Password(
- __name__=u'add_confirm_password',
+ __name__='add_confirm_password',
required=False, readonly=False)
return (
@@ -3819,8 +3818,7 @@ class PersonEditOCIRegistryCredentialsView(LaunchpadFormView):
self.form_fields += FormFields(*add_fields)
def setUpWidgets(self, context=None):
- super(PersonEditOCIRegistryCredentialsView, self).setUpWidgets(
- context=context)
+ super().setUpWidgets(context=context)
for widget in self.widgets:
widget.display_label = False
widget.hint = None
@@ -4249,19 +4247,16 @@ class ContactViaWebNotificationRecipientSet:
def getEmails(self):
"""See `INotificationRecipientSet`."""
- for email in sorted(self._all_recipients.keys()):
- yield email
+ yield from sorted(self._all_recipients.keys())
def getRecipients(self):
"""See `INotificationRecipientSet`."""
- for recipient in sorted(
- self._all_recipients.values(), key=attrgetter('displayname')):
- yield recipient
+ yield from sorted(
+ self._all_recipients.values(), key=attrgetter('displayname'))
def getRecipientPersons(self):
"""See `INotificationRecipientSet`."""
- for email, person in self._all_recipients.items():
- yield (email, person)
+ yield from self._all_recipients.items()
def __iter__(self):
"""See `INotificationRecipientSet`."""
@@ -4351,7 +4346,7 @@ class EmailToPersonView(LaunchpadFormView):
a vocabulary of the user's preferred (first) and validated
(subsequent) email addresses.
"""
- super(EmailToPersonView, self).setUpFields()
+ super().setUpFields()
usable_addresses = [self.user.preferredemail]
usable_addresses.extend(self.user.validatedemails)
terms = [SimpleTerm(email, email.email) for email in usable_addresses]
diff --git a/lib/lp/registry/browser/pillar.py b/lib/lp/registry/browser/pillar.py
index 4c09eb2..3f5c29d 100644
--- a/lib/lp/registry/browser/pillar.py
+++ b/lib/lp/registry/browser/pillar.py
@@ -164,7 +164,7 @@ class PillarInvolvementView(LaunchpadView):
visible_disabled_link_names = []
def __init__(self, context, request):
- super(PillarInvolvementView, self).__init__(context, request)
+ super().__init__(context, request)
self.official_malone = False
self.answers_usage = ServiceUsage.UNKNOWN
self.blueprints_usage = ServiceUsage.UNKNOWN
@@ -278,7 +278,7 @@ class PillarViewMixin():
def initialize(self):
# Insert close team membership policy data into the json cache.
# This data is used for the maintainer and driver pickers.
- super(PillarViewMixin, self).initialize()
+ super().initialize()
cache = IJSONRequestCache(self.request)
policy_items = [(item.name, item) for item in EXCLUSIVE_TEAM_POLICY]
team_membership_policy_data = vocabulary_to_choice_edit_items(
@@ -365,7 +365,7 @@ class PillarSharingView(LaunchpadView):
return self._getSharingService().getPillarGrantees(self.context)
def initialize(self):
- super(PillarSharingView, self).initialize()
+ super().initialize()
cache = IJSONRequestCache(self.request)
cache.objects['information_types'] = self.information_types
cache.objects['sharing_permissions'] = self.sharing_permissions
diff --git a/lib/lp/registry/browser/poll.py b/lib/lp/registry/browser/poll.py
index eaba0c7..66049fe 100644
--- a/lib/lp/registry/browser/poll.py
+++ b/lib/lp/registry/browser/poll.py
@@ -227,7 +227,7 @@ class PollView(BasePollView):
"""A view class to display the results of a poll."""
def initialize(self):
- super(PollView, self).initialize()
+ super().initialize()
request = self.request
if (self.userCanVote() and self.context.isOpen() and
self.context.getActiveOptions()):
@@ -281,7 +281,7 @@ class PollVoteView(BasePollView):
def initialize(self):
"""Process the form, if it was submitted."""
- super(PollVoteView, self).initialize()
+ super().initialize()
if not self.isSecret() and self.userVoted():
# For non-secret polls, the user's vote is always displayed
self.setUpTokenAndVotesForNonSecretPolls()
diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
index 3f58926..faea1f8 100644
--- a/lib/lp/registry/browser/product.py
+++ b/lib/lp/registry/browser/product.py
@@ -517,7 +517,7 @@ class ProductEditLinksMixin(StructuralSubscriptionMenuMixin):
def search_oci_project(self):
product = self.context.context
oci_projects = getUtility(IOCIProjectSet).findByPillarAndName(
- product, u'')
+ product, '')
text = 'Search for OCI project'
link = Link('+search-oci-project', text, icon='info')
link.enabled = not oci_projects.is_empty()
@@ -807,7 +807,7 @@ class SeriesWithReleases(DecoratedSeries):
releases = None
def __init__(self, series, parent):
- super(SeriesWithReleases, self).__init__(series)
+ super().__init__(series)
self.parent = parent
self.releases = []
@@ -987,7 +987,7 @@ class ProductView(PillarViewMixin, HasAnnouncementsView, SortSeriesMixin,
self.form = request.form_ng
def initialize(self):
- super(ProductView, self).initialize()
+ super().initialize()
self.status_message = None
product = self.context
programming_lang = IProduct['programminglang']
@@ -1370,7 +1370,7 @@ class ProductConfigureBase(ReturnToReferrerMixin, LaunchpadEditFormView):
usage_fieldname = None
def setUpFields(self):
- super(ProductConfigureBase, self).setUpFields()
+ super().setUpFields()
if self.usage_fieldname is not None:
# The usage fields are shared among pillars. But when referring
# to an individual object in Launchpad it is better to call it by
@@ -1474,7 +1474,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
# when an action is invoked.
cache = IJSONRequestCache(self.request)
json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
- super(ProductEditView, self).initialize()
+ super().initialize()
def validate(self, data):
"""Validate 'licenses' and 'license_info'.
@@ -1485,7 +1485,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
'license_info' must not be empty if "Other/Proprietary"
or "Other/Open Source" is checked.
"""
- super(ProductEditView, self).validate(data)
+ super().validate(data)
information_type = data.get('information_type')
if information_type:
errors = [
@@ -1502,7 +1502,7 @@ class ProductEditView(ProductLicenseMixin, LaunchpadEditFormView):
# LicenseWidget instead of the enclosing form.
if field_name == 'license_info':
return False
- return super(ProductEditView, self).showOptionalMarker(field_name)
+ return super().showOptionalMarker(field_name)
@action("Change", name='change')
def change_action(self, action, data):
@@ -1550,7 +1550,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin):
if not admin:
self.field_names.remove('owner')
self.field_names.remove('autoupdate')
- super(ProductAdminView, self).setUpFields()
+ super().setUpFields()
self.form_fields = self._createAliasesField() + self.form_fields
if admin:
self.form_fields = (
@@ -1590,7 +1590,7 @@ class ProductAdminView(ProductEditView, ProductValidationMixin):
def validate(self, data):
"""See `LaunchpadFormView`."""
- super(ProductAdminView, self).validate(data)
+ super().validate(data)
self.validate_deactivation(data)
@property
@@ -1618,7 +1618,7 @@ class ProductReviewLicenseView(ReturnToReferrerMixin, ProductEditView,
def validate(self, data):
"""See `LaunchpadFormView`."""
- super(ProductReviewLicenseView, self).validate(data)
+ super().validate(data)
# A project can only be approved if it has OTHER_OPEN_SOURCE as one of
# its licenses and not OTHER_PROPRIETARY.
licenses = self.context.licenses
@@ -1848,11 +1848,11 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
"""
if self.errors_in_action:
return None
- return super(ProductSetBranchView, self).next_url
+ return super().next_url
def setUpFields(self):
"""See `LaunchpadFormView`."""
- super(ProductSetBranchView, self).setUpFields()
+ super().setUpFields()
if self.is_series:
self.form_fields = self.form_fields.omit(
'default_vcs', 'git_repository_location',
@@ -1861,7 +1861,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
def setUpWidgets(self):
"""See `LaunchpadFormView`."""
- super(ProductSetBranchView, self).setUpWidgets()
+ super().setUpWidgets()
widget = self.widgets['rcs_type']
vocab = widget.vocabulary
current_value = widget._getFormValue()
@@ -1878,9 +1878,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
widget = self.widgets['branch_type']
current_value = widget._getFormValue()
vocab = widget.vocabulary
- self.branch_type_link, self.branch_type_import = [
+ self.branch_type_link, self.branch_type_import = (
render_radio_widget_part(widget, value, current_value)
- for value in (LINK_LP, IMPORT_EXTERNAL)]
+ for value in (LINK_LP, IMPORT_EXTERNAL))
if not self.is_series:
widget = self.widgets['default_vcs']
@@ -1894,9 +1894,9 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
widget = self.widgets['git_repository_type']
current_value = widget._getFormValue()
vocab = widget.vocabulary
- self.git_repository_type_link, self.git_repository_type_import = [
+ self.git_repository_type_link, self.git_repository_type_import = (
render_radio_widget_part(widget, value, current_value)
- for value in (LINK_LP, IMPORT_EXTERNAL)]
+ for value in (LINK_LP, IMPORT_EXTERNAL))
def _validateLinkLpBzr(self, data):
"""Validate data for link-lp bzr case."""
@@ -2005,7 +2005,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
"""See `LaunchpadFormView`."""
names = [
'branch_type', 'rcs_type', 'default_vcs', 'git_repository_type']
- super(ProductSetBranchView, self).validate_widgets(data, names)
+ super().validate_widgets(data, names)
if not self.is_series:
git_repository_type = data.get('git_repository_type')
@@ -2040,7 +2040,7 @@ class ProductSetBranchView(ReturnToReferrerMixin, LaunchpadFormView,
raise AssertionError("Unknown branch type %s" % branch_type)
# Perform full validation now.
- super(ProductSetBranchView, self).validate_widgets(data)
+ super().validate_widgets(data)
def validate(self, data):
"""See `LaunchpadFormView`."""
@@ -2345,12 +2345,12 @@ class ProjectAddStepOne(StepView):
def setUpFields(self):
"""See `LaunchpadFormView`."""
- super(ProjectAddStepOne, self).setUpFields()
+ super().setUpFields()
self.form_fields = (self.form_fields + create_source_package_fields())
def setUpWidgets(self):
"""See `LaunchpadFormView`."""
- super(ProjectAddStepOne, self).setUpWidgets()
+ super().setUpWidgets()
self.widgets['source_package_name'].visible = False
self.widgets['distroseries'].visible = False
@@ -2425,14 +2425,14 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
# when an action is invoked.
cache = IJSONRequestCache(self.request)
json_dump_information_types(cache, PILLAR_INFORMATION_TYPES)
- super(ProjectAddStepTwo, self).initialize()
+ super().initialize()
@property
def main_action_label(self):
if self.source_package_name is None:
- return u'Complete Registration'
+ return 'Complete Registration'
else:
- return u'Complete registration and link to %s package' % (
+ return 'Complete registration and link to %s package' % (
self.source_package_name.name)
@property
@@ -2467,7 +2467,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
def setUpFields(self):
"""See `LaunchpadFormView`."""
- super(ProjectAddStepTwo, self).setUpFields()
+ super().setUpFields()
hidden_names = ['__visited_steps__', 'license_info']
hidden_fields = self.form_fields.select(*hidden_names)
@@ -2502,7 +2502,7 @@ class ProjectAddStepTwo(StepView, ProductLicenseMixin, ReturnToReferrerMixin):
def setUpWidgets(self):
"""See `LaunchpadFormView`."""
- super(ProjectAddStepTwo, self).setUpWidgets()
+ super().setUpWidgets()
self.widgets['name'].read_only = True
# The "hint" is really more of an explanation at this point, but the
# phrasing is different.
diff --git a/lib/lp/registry/browser/productrelease.py b/lib/lp/registry/browser/productrelease.py
index 9bb9242..ac680b8 100644
--- a/lib/lp/registry/browser/productrelease.py
+++ b/lib/lp/registry/browser/productrelease.py
@@ -167,10 +167,10 @@ class ProductReleaseAddView(ProductReleaseAddViewBase):
self.request.response.redirect(
canonical_url(self.context.product_release) + '/+edit')
else:
- super(ProductReleaseAddView, self).initialize()
+ super().initialize()
def setUpFields(self):
- super(ProductReleaseAddView, self).setUpFields()
+ super().setUpFields()
if self.context.active is True:
self._prependKeepMilestoneActiveField()
@@ -193,7 +193,7 @@ class ProductReleaseFromSeriesAddView(ProductReleaseAddViewBase,
]
def setUpFields(self):
- super(ProductReleaseFromSeriesAddView, self).setUpFields()
+ super().setUpFields()
self._prependKeepMilestoneActiveField()
self._prependMilestoneField()
@@ -288,7 +288,7 @@ class ProductReleaseAddDownloadFileView(LaunchpadFormView):
if file_name and self.context.hasReleaseFile(file_name):
self.setFieldError(
'filecontent',
- u"The file '%s' is already uploaded." % file_name)
+ "The file '%s' is already uploaded." % file_name)
@action('Upload', name='add')
def add_action(self, action, data):
diff --git a/lib/lp/registry/browser/productseries.py b/lib/lp/registry/browser/productseries.py
index 8af4afb..707b077 100644
--- a/lib/lp/registry/browser/productseries.py
+++ b/lib/lp/registry/browser/productseries.py
@@ -197,7 +197,7 @@ class ProductSeriesInvolvementView(PillarInvolvementView):
has_involvement = True
def __init__(self, context, request):
- super(ProductSeriesInvolvementView, self).__init__(context, request)
+ super().__init__(context, request)
self.answers_usage = ServiceUsage.NOT_APPLICABLE
if self.context.branch is not None:
self.codehosting_usage = ServiceUsage.LAUNCHPAD
@@ -370,7 +370,7 @@ class ProductSeriesView(
"""A view to show a series with translations."""
def initialize(self):
- super(ProductSeriesView, self).initialize()
+ super().initialize()
expose_structural_subscription_data_to_js(
self.context, self.request, self.user)
@@ -506,8 +506,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView):
def __init__(self, context, request):
"""Set the static packaging information for this series."""
- super(ProductSeriesUbuntuPackagingView, self).__init__(
- context, request)
+ super().__init__(context, request)
self._ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
self._ubuntu_series = self._ubuntu.currentseries
try:
@@ -534,7 +533,7 @@ class ProductSeriesUbuntuPackagingView(LaunchpadFormView):
The packaging is restricted to ubuntu series and the default value
is the current development series.
"""
- super(ProductSeriesUbuntuPackagingView, self).setUpFields()
+ super().setUpFields()
series_vocabulary = SimpleVocabulary(
[SimpleTerm(series, series.name, series.named_version)
for series in self._ubuntu.series])
diff --git a/lib/lp/registry/browser/project.py b/lib/lp/registry/browser/project.py
index 3927fc6..2a7ee6a 100644
--- a/lib/lp/registry/browser/project.py
+++ b/lib/lp/registry/browser/project.py
@@ -136,7 +136,7 @@ class ProjectNavigation(Navigation,
@stepthrough('+tags')
def traverse_tags(self, name):
- tags = name.split(u',')
+ tags = name.split(',')
if validate_tags(tags):
return ProjectGroupMilestoneTag(self.context, tags)
@@ -354,7 +354,7 @@ class ProjectView(PillarViewMixin, HasAnnouncementsView, FeedsMixin):
help_link="/+help-registry/driver.html", show_create_team=True)
def initialize(self):
- super(ProjectView, self).initialize()
+ super().initialize()
expose_structural_subscription_data_to_js(
self.context, self.request, self.user)
@@ -422,7 +422,7 @@ class ProjectReviewView(ProjectEditView):
moderator = check_permission('launchpad.Moderate', self.context)
if not moderator:
self.field_names.remove('name')
- super(ProjectReviewView, self).setUpFields()
+ super().setUpFields()
self.form_fields = self._createAliasesField() + self.form_fields
if admin:
self.form_fields = (
@@ -544,7 +544,7 @@ class ProjectSetView(LaunchpadView):
page_title = "Project groups registered in Launchpad"
def __init__(self, context, request):
- super(ProjectSetView, self).__init__(context, request)
+ super().__init__(context, request)
self.form = self.request.form_ng
self.search_string = self.form.getOne('text', None)
self.search_requested = False
diff --git a/lib/lp/registry/browser/sourcepackage.py b/lib/lp/registry/browser/sourcepackage.py
index ea447c2..43e6fb7 100644
--- a/lib/lp/registry/browser/sourcepackage.py
+++ b/lib/lp/registry/browser/sourcepackage.py
@@ -265,7 +265,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView):
product = None
def setUpFields(self):
- super(SourcePackageChangeUpstreamStepOne, self).setUpFields()
+ super().setUpFields()
series = self.context.productseries
if series is not None:
default = series.product
@@ -284,7 +284,7 @@ class SourcePackageChangeUpstreamStepOne(ReturnToReferrerMixin, StepView):
self.request.form['product'] = data['product']
def validateStep(self, data):
- super(SourcePackageChangeUpstreamStepOne, self).validateStep(data)
+ super().validateStep(data)
product = data.get('product')
if product is None:
return
@@ -318,7 +318,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView):
custom_widget_productseries = LaunchpadRadioWidget
def setUpFields(self):
- super(SourcePackageChangeUpstreamStepTwo, self).setUpFields()
+ super().setUpFields()
# The vocabulary for the product series is overridden to just
# include active series from the product selected in the
@@ -380,7 +380,7 @@ class SourcePackageChangeUpstreamStepTwo(ReturnToReferrerMixin, StepView):
# is called.
next_url = None
- main_action_label = u'Change'
+ main_action_label = 'Change'
def main_action(self, data):
productseries = data['productseries']
@@ -564,7 +564,7 @@ class SourcePackageAssociationPortletView(LaunchpadFormView):
def setUpFields(self):
"""See `LaunchpadFormView`."""
- super(SourcePackageAssociationPortletView, self).setUpFields()
+ super().setUpFields()
self.request.annotations['show_edit_buttons'] = True
# Find registered products that are similarly named to the source
# package.
diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py
index eeefcee..c37bbf0 100644
--- a/lib/lp/registry/browser/team.py
+++ b/lib/lp/registry/browser/team.py
@@ -42,7 +42,6 @@ from lazr.restful.interfaces import IJSONRequestCache
from lazr.restful.utils import smartquote
import pytz
import simplejson
-import six
from six.moves.urllib.parse import unquote
from zope.browserpage import ViewPageTemplateFile
from zope.component import getUtility
@@ -219,14 +218,12 @@ class HasRenewalPolicyMixin:
def isMultiLineLayout(self, field_name):
if field_name == 'renewal_policy':
return True
- return super(HasRenewalPolicyMixin, self).isMultiLineLayout(
- field_name)
+ return super().isMultiLineLayout(field_name)
def isSingleLineLayout(self, field_name):
if field_name == 'renewal_policy':
return False
- return super(HasRenewalPolicyMixin, self).isSingleLineLayout(
- field_name)
+ return super().isSingleLineLayout(field_name)
class TeamFormMixin:
@@ -317,11 +314,11 @@ class TeamEditView(TeamFormMixin, PersonRenameFormMixin,
# class list.
self.field_names = list(self.field_names)
self.field_names.remove('teamowner')
- super(TeamEditView, self).setUpFields()
+ super().setUpFields()
self.setUpVisibilityField(render_context=True)
def setUpWidgets(self):
- super(TeamEditView, self).setUpWidgets()
+ super().setUpWidgets()
team = self.context
# Do we need to only show open membership policy choices?
try:
@@ -457,7 +454,7 @@ class TeamContactAddressView(MailingListTeamBaseView):
def setUpFields(self):
"""See `LaunchpadFormView`.
"""
- super(TeamContactAddressView, self).setUpFields()
+ super().setUpFields()
# Replace the default contact_method field by a custom one.
self.form_fields = (
@@ -525,7 +522,7 @@ class TeamContactAddressView(MailingListTeamBaseView):
# responsibility for security on the exception thrower.
msg = error.args[0]
if not IStructuredString.providedBy(msg):
- msg = structured(six.text_type(msg))
+ msg = structured(str(msg))
self.setFieldError('contact_address', msg)
elif data['contact_method'] == TeamContactMethod.HOSTED_LIST:
mailing_list = getUtility(IMailingListSet).get(self.context.name)
@@ -621,8 +618,7 @@ class TeamMailingListConfigurationView(MailingListTeamBaseView):
address. Second, the mailing list may be in a transitional
state: from MODIFIED to UPDATING to ACTIVE can take a while.
"""
- super(TeamMailingListConfigurationView, self).__init__(
- context, request)
+ super().__init__(context, request)
list_set = getUtility(IMailingListSet)
self.mailing_list = list_set.get(self.context.name)
@@ -903,7 +899,7 @@ class TeamMailingListModerationView(MailingListTeamBaseView):
def __init__(self, context, request):
"""Allow for review and moderation of held mailing list posts."""
- super(TeamMailingListModerationView, self).__init__(context, request)
+ super().__init__(context, request)
list_set = getUtility(IMailingListSet)
self.mailing_list = list_set.get(self.context.name)
if self.mailing_list is None:
@@ -988,7 +984,7 @@ class TeamMailingListArchiveView(LaunchpadView):
label = "Mailing list archive"
def __init__(self, context, request):
- super(TeamMailingListArchiveView, self).__init__(context, request)
+ super().__init__(context, request)
self.messages = self._get_messages()
cache = IJSONRequestCache(request).objects
cache['mail'] = self.messages
@@ -1021,7 +1017,7 @@ class TeamAddView(TeamFormMixin, HasRenewalPolicyMixin, LaunchpadFormView):
Only Launchpad Admins get to see the visibility field.
"""
- super(TeamAddView, self).setUpFields()
+ super().setUpFields()
self.setUpVisibilityField()
@action('Create Team', name='create',
@@ -1201,7 +1197,7 @@ class TeamMemberAddView(LaunchpadFormView):
if error:
self.setFieldError("newmember", error)
- @action(u"Add Member", name="add")
+ @action("Add Member", name="add")
def add_action(self, action, data):
"""Add the new member to the team."""
newmember = data['newmember']
@@ -1778,7 +1774,7 @@ class TeamJoinView(LaunchpadFormView, TeamJoinMixin):
page_title = label
def setUpWidgets(self):
- super(TeamJoinView, self).setUpWidgets()
+ super().setUpWidgets()
if 'mailinglist_subscribe' in self.field_names:
widget = self.widgets['mailinglist_subscribe']
widget.setRenderedValue(self.user_wants_list_subscriptions)
@@ -1914,7 +1910,7 @@ class TeamAddMyTeamsView(LaunchpadFormView):
else:
self.label = 'Add these teams to %s' % context.displayname
self.next_url = canonical_url(context)
- super(TeamAddMyTeamsView, self).initialize()
+ super().initialize()
def setUpFields(self):
terms = []
@@ -1930,7 +1926,7 @@ class TeamAddMyTeamsView(LaunchpadFormView):
render_context=self.render_context)
def setUpWidgets(self, context=None):
- super(TeamAddMyTeamsView, self).setUpWidgets(context)
+ super().setUpWidgets(context)
self.widgets['teams'].display_label = False
@cachedproperty
@@ -2063,7 +2059,7 @@ class TeamReassignmentView(ObjectReassignmentView):
schema = ITeamReassignment
def __init__(self, context, request):
- super(TeamReassignmentView, self).__init__(context, request)
+ super().__init__(context, request)
self.callback = self._afterOwnerChange
self.teamdisplayname = self.contextName
self._next_url = canonical_url(self.context)
diff --git a/lib/lp/registry/browser/teammembership.py b/lib/lp/registry/browser/teammembership.py
index ef62f97..3610e3e 100644
--- a/lib/lp/registry/browser/teammembership.py
+++ b/lib/lp/registry/browser/teammembership.py
@@ -38,7 +38,7 @@ class TeamMembershipBreadcrumb(Breadcrumb):
class TeamMembershipEditView(LaunchpadView):
def __init__(self, context, request):
- super(TeamMembershipEditView, self).__init__(context, request)
+ super().__init__(context, request)
self.errormessage = ""
self.prefix = 'membership'
self.max_year = 2050
diff --git a/lib/lp/registry/browser/tests/test_announcements.py b/lib/lp/registry/browser/tests/test_announcements.py
index b79d42e..5f005c6 100644
--- a/lib/lp/registry/browser/tests/test_announcements.py
+++ b/lib/lp/registry/browser/tests/test_announcements.py
@@ -30,8 +30,8 @@ class TestAnnouncement(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def test_announcement_info(self):
- product = self.factory.makeProduct(displayname=u"Foo")
- announcer = self.factory.makePerson(displayname=u"Bar Baz")
+ product = self.factory.makeProduct(displayname="Foo")
+ announcer = self.factory.makePerson(displayname="Bar Baz")
announcement = product.announce(announcer, "Hello World")
view = create_initialized_view(announcement, "+index")
root = html.fromstring(view())
@@ -41,8 +41,8 @@ class TestAnnouncement(TestCaseWithFactory):
normalize_whitespace(reg_para.text_content()))
def test_announcement_info_with_publication_date(self):
- product = self.factory.makeProduct(displayname=u"Foo")
- announcer = self.factory.makePerson(displayname=u"Bar Baz")
+ product = self.factory.makeProduct(displayname="Foo")
+ announcer = self.factory.makePerson(displayname="Bar Baz")
announced = datetime(2007, 1, 12, tzinfo=utc)
announcement = product.announce(
announcer, "Hello World", publication_date=announced)
diff --git a/lib/lp/registry/browser/tests/test_branding.py b/lib/lp/registry/browser/tests/test_branding.py
index 1b2d321..7c1ba39 100644
--- a/lib/lp/registry/browser/tests/test_branding.py
+++ b/lib/lp/registry/browser/tests/test_branding.py
@@ -14,7 +14,7 @@ class TestBrandingChangeView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBrandingChangeView, self).setUp()
+ super().setUp()
self.context = self.factory.makePerson(name='cow')
self.view = BrandingChangeView(self.context, LaunchpadTestRequest())
diff --git a/lib/lp/registry/browser/tests/test_breadcrumbs.py b/lib/lp/registry/browser/tests/test_breadcrumbs.py
index 459a259..10bd2e9 100644
--- a/lib/lp/registry/browser/tests/test_breadcrumbs.py
+++ b/lib/lp/registry/browser/tests/test_breadcrumbs.py
@@ -17,7 +17,7 @@ class TestPillarSharingBreadcrumb(BaseBreadcrumbTestCase, SharingBaseTestCase):
pillar_type = 'product'
def setUp(self):
- super(TestPillarSharingBreadcrumb, self).setUp()
+ super().setUp()
login_person(self.driver)
def test_sharing_breadcrumb(self):
@@ -44,7 +44,7 @@ class TestDistroseriesBreadcrumb(BaseBreadcrumbTestCase):
"""Test breadcrumbs for an `IDistroseries`."""
def setUp(self):
- super(TestDistroseriesBreadcrumb, self).setUp()
+ super().setUp()
self.distribution = self.factory.makeDistribution(
name='youbuntu', displayname='Youbuntu')
self.distroseries = self.factory.makeDistroSeries(
@@ -61,7 +61,7 @@ class TestDistributionMirrorBreadcrumb(BaseBreadcrumbTestCase):
"""Test breadcrumbs for an `IDistributionMirror`."""
def setUp(self):
- super(TestDistributionMirrorBreadcrumb, self).setUp()
+ super().setUp()
self.distribution = getUtility(ILaunchpadCelebrities).ubuntu
def test_distributionmirror_withDisplayName(self):
@@ -104,7 +104,7 @@ class TestMilestoneBreadcrumb(BaseBreadcrumbTestCase):
"""Test the breadcrumbs for an `IMilestone`."""
def setUp(self):
- super(TestMilestoneBreadcrumb, self).setUp()
+ super().setUp()
self.project = self.factory.makeProduct()
self.series = self.factory.makeProductSeries(product=self.project)
self.milestone = self.factory.makeMilestone(
@@ -136,7 +136,7 @@ class TestPollBreadcrumb(BaseBreadcrumbTestCase):
"""Test breadcrumbs for an `IPoll`."""
def setUp(self):
- super(TestPollBreadcrumb, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam(displayname="Poll Team")
name = "pollo-poll"
title = "Marco Pollo"
@@ -157,7 +157,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
"""Test breadcrumbs for +nameblacklist."""
def setUp(self):
- super(TestNameblacklistBreadcrumb, self).setUp()
+ super().setUp()
self.name_blacklist_set = getUtility(INameBlacklistSet)
self.registry_expert = self.factory.makeRegistryExpert()
login_person(self.registry_expert)
@@ -167,7 +167,7 @@ class TestNameblacklistBreadcrumb(BaseBreadcrumbTestCase):
self.assertBreadcrumbs(expected, self.name_blacklist_set)
def test_nameblacklist_edit(self):
- blacklist = self.name_blacklist_set.getByRegExp(u'blacklist')
+ blacklist = self.name_blacklist_set.getByRegExp('blacklist')
expected = [
('Name Blacklist',
'http://launchpad.test/+nameblacklist'),
diff --git a/lib/lp/registry/browser/tests/test_codeofconduct.py b/lib/lp/registry/browser/tests/test_codeofconduct.py
index f52b93b..b270f70 100644
--- a/lib/lp/registry/browser/tests/test_codeofconduct.py
+++ b/lib/lp/registry/browser/tests/test_codeofconduct.py
@@ -25,7 +25,7 @@ class TestSignedCodeOfConductAckView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestSignedCodeOfConductAckView, self).setUp()
+ super().setUp()
self.signed_coc_set = getUtility(ISignedCodeOfConductSet)
self.owner = self.factory.makePerson()
self.admin = login_celebrity('admin')
@@ -60,7 +60,7 @@ class SignCodeOfConductTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(SignCodeOfConductTestCase, self).setUp()
+ super().setUp()
user = self.factory.makePerson()
gpg_key = self.factory.makeGPGKey(user)
self.signed_coc = self.sign_coc(user, gpg_key)
diff --git a/lib/lp/registry/browser/tests/test_distribution.py b/lib/lp/registry/browser/tests/test_distribution.py
index f75dce0..3f3ac9c 100644
--- a/lib/lp/registry/browser/tests/test_distribution.py
+++ b/lib/lp/registry/browser/tests/test_distribution.py
@@ -336,9 +336,9 @@ class TestDistributionPage(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionPage, self).setUp()
+ super().setUp()
self.distro = self.factory.makeDistribution(
- name="distro", displayname=u'distro')
+ name="distro", displayname='distro')
self.simple_user = self.factory.makePerson()
# Use a FakeLogger fixture to prevent Memcached warnings to be
# printed to stdout while browsing pages.
@@ -510,9 +510,9 @@ class TestDistributionView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionView, self).setUp()
+ super().setUp()
self.distro = self.factory.makeDistribution(
- name="distro", displayname=u'distro')
+ name="distro", displayname='distro')
def test_view_data_model(self):
# The view's json request cache contains the expected data.
diff --git a/lib/lp/registry/browser/tests/test_distribution_views.py b/lib/lp/registry/browser/tests/test_distribution_views.py
index ad7956d..252bf72 100644
--- a/lib/lp/registry/browser/tests/test_distribution_views.py
+++ b/lib/lp/registry/browser/tests/test_distribution_views.py
@@ -38,13 +38,13 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
def setUp(self):
# Create a test distribution.
- super(TestDistributionPublisherConfigView, self).setUp()
+ super().setUp()
self.distro = self.factory.makeDistribution(no_pubconf=True)
login(LAUNCHPAD_ADMIN)
- self.ROOT_DIR = u"rootdir/test"
- self.BASE_URL = u"http://base.url"
- self.COPY_BASE_URL = u"http://copybase.url"
+ self.ROOT_DIR = "rootdir/test"
+ self.BASE_URL = "http://base.url"
+ self.COPY_BASE_URL = "http://copybase.url"
def test_empty_initial_values(self):
# Test that the page will display empty field values with no
@@ -53,7 +53,7 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
self.distro, LaunchpadTestRequest())
for value in view.initial_values:
- self.assertEqual(u"", value)
+ self.assertEqual("", value)
def test_previous_initial_values(self):
# Test that the initial values are the same as the ones in the
@@ -96,9 +96,9 @@ class TestDistributionPublisherConfigView(TestCaseWithFactory):
# Test POSTing to change existing config.
self.factory.makePublisherConfig(
distribution=self.distro,
- root_dir=u"random",
- base_url=u"blah",
- copy_base_url=u"foo",
+ root_dir="random",
+ base_url="blah",
+ copy_base_url="foo",
)
self._change_and_test_config()
@@ -109,7 +109,7 @@ class TestDistroAddView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroAddView, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.registrant = self.factory.makePerson()
self.simple_user = self.factory.makePerson()
@@ -189,7 +189,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroEditView, self).setUp()
+ super().setUp()
self.admin = login_celebrity('admin')
self.oci_admins = self.factory.makeTeam(
members=[self.admin])
@@ -226,7 +226,7 @@ class TestDistroEditView(OCIConfigHelperMixin, TestCaseWithFactory):
'field.title': 'newbuntu',
'field.summary': 'newbuntu',
'field.description': 'newbuntu',
- 'field.require_virtualized.used': u'',
+ 'field.require_virtualized.used': '',
'field.processors': [proc.name for proc in self.all_processors],
'field.actions.change': 'Change',
}
@@ -496,7 +496,7 @@ class TestDistroReassignView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroReassignView, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.registrant = self.factory.makePerson()
self.simple_user = self.factory.makePerson()
diff --git a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
index 0ae0087..3de69df 100644
--- a/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
+++ b/lib/lp/registry/browser/tests/test_distributionsourcepackage.py
@@ -42,8 +42,8 @@ class TestDistributionSourcePackageFormatterAPI(TestCaseWithFactory):
ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
dsp = ubuntu.getSourcePackage('mouse')
markup = (
- u'<a href="/ubuntu/+source/mouse" class="sprite package-source">'
- u'mouse in Ubuntu</a>')
+ '<a href="/ubuntu/+source/mouse" class="sprite package-source">'
+ 'mouse in Ubuntu</a>')
self.assertEqual(markup, test_tales('dsp/fmt:link', dsp=dsp))
@@ -157,7 +157,7 @@ class TestDistributionSourceView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionSourceView, self).setUp()
+ super().setUp()
self.factory.makeSourcePackageName('mouse')
distro = self.factory.makeDistribution()
self.dsp = distro.getSourcePackage('mouse')
diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py
index e0d714e..326bbfd 100644
--- a/lib/lp/registry/browser/tests/test_distroseries.py
+++ b/lib/lp/registry/browser/tests/test_distroseries.py
@@ -244,7 +244,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(DistroSeriesIndexFunctionalTestCase, self).setUp()
+ super().setUp()
# Use a FakeLogger fixture to prevent Memcached warnings to be
# printed to stdout while browsing pages.
self.useFixture(FakeLogger())
@@ -501,7 +501,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory):
job.start()
job.fail()
with person_logged_in(series.distribution.owner):
- series.distribution.owner.display_name = u"Bob Individual"
+ series.distribution.owner.display_name = "Bob Individual"
with anonymous_logged_in():
view = create_initialized_view(series, '+portlet-derivation')
html_content = view()
@@ -514,7 +514,7 @@ class TestDistroSeriesDerivationPortlet(TestCaseWithFactory):
# owner is an individual.
with person_logged_in(series.distribution.owner):
series.distribution.owner = self.factory.makeTeam(
- displayname=u"Team Teamy Team Team",
+ displayname="Team Teamy Team Team",
membership_policy=TeamMembershipPolicy.RESTRICTED)
with anonymous_logged_in():
view = create_initialized_view(series, '+portlet-derivation')
@@ -614,31 +614,31 @@ class TestDistroSeriesAddView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroSeriesAddView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.distribution = self.factory.makeDistribution(owner=self.user)
def createNewDistroseries(self):
form = {
- "field.name": u"polished",
- "field.version": u"12.04",
- "field.display_name": u"Polished Polecat",
- "field.summary": u"Even The Register likes it.",
- "field.actions.create": u"Add Series",
+ "field.name": "polished",
+ "field.version": "12.04",
+ "field.display_name": "Polished Polecat",
+ "field.summary": "Even The Register likes it.",
+ "field.actions.create": "Add Series",
}
with person_logged_in(self.user):
create_initialized_view(self.distribution, "+addseries",
form=form)
- distroseries = self.distribution.getSeries(u"polished")
+ distroseries = self.distribution.getSeries("polished")
return distroseries
def assertCreated(self, distroseries):
- self.assertEqual(u"polished", distroseries.name)
- self.assertEqual(u"12.04", distroseries.version)
- self.assertEqual(u"Polished Polecat", distroseries.display_name)
- self.assertEqual(u"Polished Polecat", distroseries.title)
- self.assertEqual(u"Even The Register likes it.", distroseries.summary)
- self.assertEqual(u"", distroseries.description)
+ self.assertEqual("polished", distroseries.name)
+ self.assertEqual("12.04", distroseries.version)
+ self.assertEqual("Polished Polecat", distroseries.display_name)
+ self.assertEqual("Polished Polecat", distroseries.title)
+ self.assertEqual("Even The Register likes it.", distroseries.summary)
+ self.assertEqual("", distroseries.description)
self.assertEqual(self.user, distroseries.owner)
def test_plain_submit(self):
@@ -684,10 +684,10 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
# process Javascript.
[message] = root.cssselect("p.error.message")
self.assertIn(
- u"Javascript is required to use this page",
+ "Javascript is required to use this page",
message.text)
self.assertIn(
- u"javascript-disabled",
+ "javascript-disabled",
message.get("class").split())
def test_seriesToVocab(self):
@@ -755,8 +755,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
[message] = root.cssselect("p.error.message")
self.assertThat(
message.text, EqualsIgnoringWhitespace(
- u"This series already contains source packages "
- u"and cannot be initialized again."))
+ "This series already contains source packages "
+ "and cannot be initialized again."))
def test_form_hidden_when_distroseries_is_being_initialized(self):
# The form is hidden when the series has already been derived.
@@ -770,7 +770,7 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
[message] = root.cssselect("p.error.message")
self.assertThat(
message.text, EqualsIgnoringWhitespace(
- u"This series is already being initialized."))
+ "This series is already being initialized."))
def test_form_hidden_when_previous_series_none(self):
# If the distribution has an initialized series and the
@@ -789,9 +789,9 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
[message] = root.cssselect("p.error.message")
self.assertThat(
message.text, EqualsIgnoringWhitespace(
- u'Unable to initialize series: the distribution '
- u'already has initialized series and this distroseries '
- u'has no previous series.'))
+ 'Unable to initialize series: the distribution '
+ 'already has initialized series and this distroseries '
+ 'has no previous series.'))
def test_form_hidden_when_no_publisher_config_set_up(self):
# If the distribution has no publisher config set up:
@@ -807,8 +807,8 @@ class TestDistroSeriesInitializeView(TestCaseWithFactory):
[message] = root.cssselect("p.error.message")
self.assertThat(
message.text, EqualsIgnoringWhitespace(
- u"The series' distribution has no publisher configuration. "
- u"Please ask an administrator to set this up."))
+ "The series' distribution has no publisher configuration. "
+ "Please ask an administrator to set this up."))
class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory):
@@ -817,8 +817,7 @@ class TestDistroSeriesInitializeViewAccess(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestDistroSeriesInitializeViewAccess,
- self).setUp('foo.bar@xxxxxxxxxxxxx')
+ super().setUp('foo.bar@xxxxxxxxxxxxx')
def test_initseries_access_anon(self):
# Anonymous users cannot access +initseries.
@@ -898,8 +897,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroSeriesLocalDiffPerformance,
- self).setUp('foo.bar@xxxxxxxxxxxxx')
+ super().setUp('foo.bar@xxxxxxxxxxxxx')
self.simple_user = self.factory.makePerson()
def _assertQueryCount(self, derived_series):
@@ -917,9 +915,9 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
for index in range(num):
version = self.factory.getUniqueInteger()
versions = {
- 'base': u'1.%d' % version,
- 'derived': u'1.%dderived1' % version,
- 'parent': u'1.%d-1' % version,
+ 'base': '1.%d' % version,
+ 'derived': '1.%dderived1' % version,
+ 'parent': '1.%d-1' % version,
}
dsd = self.factory.makeDistroSeriesDifference(
derived_series=derived_series,
@@ -965,8 +963,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
def prepare_statements(rec):
for statement in rec.statements:
- for line in wrapper.wrap(statement):
- yield line
+ yield from wrapper.wrap(statement)
yield "-" * wrapper.width
def statement_diff():
@@ -983,19 +980,19 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
self.assertThat(recorder1, HasQueryCount(LessThan(30)))
self.addDetail(
"statement-count-0-differences",
- text_content(u"%d" % recorder1.count))
+ text_content("%d" % recorder1.count))
# Add some differences and render.
add_differences(2)
recorder2, batch_size = flush_and_render()
self.addDetail(
"statement-count-2-differences",
- text_content(u"%d" % recorder2.count))
+ text_content("%d" % recorder2.count))
# Add more differences and render again.
add_differences(2)
recorder3, batch_size = flush_and_render()
self.addDetail(
"statement-count-4-differences",
- text_content(u"%d" % recorder3.count))
+ text_content("%d" % recorder3.count))
# The last render should not need more queries than the previous.
self.addDetail(
"statement-diff", Content(
@@ -1005,7 +1002,7 @@ class TestDistroSeriesLocalDiffPerformance(TestCaseWithFactory,
(recorder3.count - recorder1.count) / float(batch_size))
self.addDetail(
"statement-count-per-row-average",
- text_content(u"%.2f" % statement_count_per_row))
+ text_content("%.2f" % statement_count_per_row))
# Query count is ~O(1) (i.e. not dependent of the number of
# differences displayed).
self.assertThat(recorder3, HasQueryCount.byEquality(recorder2))
@@ -1099,7 +1096,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
def test_parent_packagesets_localpackagediffs_sorts(self):
# Multiple packagesets are sorted in a comma separated list.
ds_diff = self.factory.makeDistroSeriesDifference()
- unsorted_names = [u"zzz", u"aaa"]
+ unsorted_names = ["zzz", "aaa"]
with celebrity_logged_in('admin'):
for name in unsorted_names:
self.factory.makePackageset(
@@ -1203,8 +1200,8 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
rows = diff_table.tbody.find_all('tr')
self.assertEqual(1, len(rows))
- self.assertIn("Latest comment", six.text_type(rows[0]))
- self.assertNotIn("Earlier comment", six.text_type(rows[0]))
+ self.assertIn("Latest comment", str(rows[0]))
+ self.assertNotIn("Earlier comment", str(rows[0]))
def test_diff_row_links_to_extra_details(self):
# The source package name links to the difference details.
@@ -1227,9 +1224,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
derived_series, parent_series = self._createChildAndParents(
other_parent_series=other_parent_series)
versions = {
- 'base': u'1.0',
- 'derived': u'1.0derived1',
- 'parent': u'1.0-1',
+ 'base': '1.0',
+ 'derived': '1.0derived1',
+ 'parent': '1.0-1',
}
self.factory.makeDistroSeriesDifference(
@@ -1264,11 +1261,11 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
package_name = 'package-1'
derived_series, parent_series = self._createChildAndParent()
versions = {
- 'base': u'1.0',
- 'derived': u'1.0derived1',
- 'parent': u'1.0-1',
+ 'base': '1.0',
+ 'derived': '1.0derived1',
+ 'parent': '1.0-1',
}
- new_version = u'1.2'
+ new_version = '1.2'
difference = self.factory.makeDistroSeriesDifference(
versions=versions,
@@ -1307,9 +1304,9 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
package_name = 'package-1'
derived_series, parent_series = self._createChildAndParent()
versions = {
- 'base': u'1.0',
- 'derived': u'1.0derived1',
- 'parent': u'1.0-1',
+ 'base': '1.0',
+ 'derived': '1.0derived1',
+ 'parent': '1.0-1',
}
difference = self.factory.makeDistroSeriesDifference(
@@ -1407,7 +1404,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
"""Enable the feature flag for derived-series upgrade."""
self.useFixture(
FeatureFixture(
- {u'soyuz.derived_series_upgrade.enabled': u'on'}))
+ {'soyuz.derived_series_upgrade.enabled': 'on'}))
@with_celebrity_logged_in("admin")
def test_upgrades_offered_only_with_feature_flag(self):
@@ -1544,7 +1541,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
'+localpackagediffs')
radio_title = (
- u"\xa0Ignored packages with a higher version than in 'Lucid'")
+ "\xa0Ignored packages with a higher version than in 'Lucid'")
radio_option_matches = soupmatchers.HTMLContains(
soupmatchers.Tag(
"radio displays parent's name", 'label',
@@ -1562,7 +1559,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
'+localpackagediffs')
radio_title = (
- u"\xa0Ignored packages with a higher version than in parent")
+ "\xa0Ignored packages with a higher version than in parent")
radio_option_matches = soupmatchers.HTMLContains(
soupmatchers.Tag(
"radio displays parent's name", 'label',
@@ -2085,7 +2082,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
# The inital state is that 1.0-1 is not in the derived series.
pubs = derived_series.main_archive.getPublishedSources(
- name=u'my-src-name', version=versions['parent'],
+ name='my-src-name', version=versions['parent'],
distroseries=derived_series).any()
self.assertIs(None, pubs)
@@ -2144,7 +2141,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
self._syncAndGetView(
derived_series, person, [diff_id])
parent_series.main_archive.getPublishedSources(
- name=u'my-src-name', version=versions['parent'],
+ name='my-src-name', version=versions['parent'],
distroseries=parent_series).one()
# We look for a PackageCopyJob with the right metadata.
@@ -2274,7 +2271,7 @@ class TestCopyAsynchronouslyMessage(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestCopyAsynchronouslyMessage, self).setUp()
+ super().setUp()
self.archive = self.factory.makeArchive()
self.series = self.factory.makeDistroSeries()
self.series_url = canonical_url(self.series)
@@ -2388,8 +2385,7 @@ class DistroSeriesMissingPackagesPageTestCase(TestCaseWithFactory,
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(DistroSeriesMissingPackagesPageTestCase,
- self).setUp('foo.bar@xxxxxxxxxxxxx')
+ super().setUp('foo.bar@xxxxxxxxxxxxx')
self.simple_user = self.factory.makePerson()
def test_parent_packagesets_missingpackages(self):
@@ -2552,8 +2548,7 @@ class DistroSeriesUniquePackagesPageTestCase(TestCaseWithFactory,
layer = DatabaseFunctionalLayer
def setUp(self):
- super(DistroSeriesUniquePackagesPageTestCase,
- self).setUp('foo.bar@xxxxxxxxxxxxx')
+ super().setUp('foo.bar@xxxxxxxxxxxxx')
self.simple_user = self.factory.makePerson()
def test_packagesets_uniquepackages(self):
diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
index 766caac..ea2e246 100644
--- a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
+++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
@@ -108,8 +108,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
self.assertIsNot(None, view.binary_summaries)
self.assertEqual([
- u'flubber-bin: summary for flubber-bin',
- u'flubber-lib: summary for flubber-lib',
+ 'flubber-bin: summary for flubber-bin',
+ 'flubber-lib: summary for flubber-lib',
], view.binary_summaries)
def test_binary_summaries_for_missing_difference(self):
@@ -124,8 +124,8 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
self.assertIsNot(None, view.binary_summaries)
self.assertEqual([
- u'flubber-bin: summary for flubber-bin',
- u'flubber-lib: summary for flubber-lib',
+ 'flubber-bin: summary for flubber-bin',
+ 'flubber-lib: summary for flubber-lib',
], view.binary_summaries)
def test_binary_summaries_no_pubs(self):
diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
index 79a74d4..58941cc 100644
--- a/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
+++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_webservice.py
@@ -179,40 +179,40 @@ class DistroSeriesDifferenceWebServiceTestCase(TestCaseWithFactory):
ws_diff = ws_object(self.factory.makeLaunchpadService(
self.factory.makePerson()), ds_diff)
- self.assertEqual(u'Blocklisted always', ws_diff.status)
+ self.assertEqual('Blocklisted always', ws_diff.status)
def test_exported_sourcepackagename(self):
# The difference's sourcepackagename is exposed.
ds_diff = self.factory.makeDistroSeriesDifference(
- source_package_name_str=u'package')
+ source_package_name_str='package')
ws_diff = ws_object(self.factory.makeLaunchpadService(
self.factory.makePerson()), ds_diff)
- self.assertEqual(u'package', ws_diff.sourcepackagename)
+ self.assertEqual('package', ws_diff.sourcepackagename)
def test_exported_parent_source_version(self):
# The difference's parent_source_version is exposed.
ds_diff = self.factory.makeDistroSeriesDifference(
- versions={'parent': u'1.1'})
+ versions={'parent': '1.1'})
ws_diff = ws_object(self.factory.makeLaunchpadService(
self.factory.makePerson()), ds_diff)
- self.assertEqual(u'1.1', ws_diff.parent_source_version)
+ self.assertEqual('1.1', ws_diff.parent_source_version)
def test_exported_source_version(self):
# The difference's source_version is exposed.
ds_diff = self.factory.makeDistroSeriesDifference(
- versions={'derived': u'1.3'})
+ versions={'derived': '1.3'})
ws_diff = ws_object(self.factory.makeLaunchpadService(
self.factory.makePerson()), ds_diff)
- self.assertEqual(u'1.3', ws_diff.source_version)
+ self.assertEqual('1.3', ws_diff.source_version)
def test_exported_base_version(self):
# The difference's base_version is exposed.
ds_diff = self.factory.makeDistroSeriesDifference(
- versions={'base': u'0.5'}, set_base_version=True)
+ versions={'base': '0.5'}, set_base_version=True)
ws_diff = ws_object(self.factory.makeLaunchpadService(
self.factory.makePerson()), ds_diff)
- self.assertEqual(u'0.5', ws_diff.base_version)
+ self.assertEqual('0.5', ws_diff.base_version)
diff --git a/lib/lp/registry/browser/tests/test_edit_permissions.py b/lib/lp/registry/browser/tests/test_edit_permissions.py
index 022daa5..7e41b28 100644
--- a/lib/lp/registry/browser/tests/test_edit_permissions.py
+++ b/lib/lp/registry/browser/tests/test_edit_permissions.py
@@ -28,7 +28,7 @@ class EditViewPermissionBase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(EditViewPermissionBase, self).setUp()
+ super().setUp()
self.setupTarget()
self.registry_admin = self.factory.makePerson(name='registry-admin')
celebs = getUtility(ILaunchpadCelebrities)
diff --git a/lib/lp/registry/browser/tests/test_mailinglists.py b/lib/lp/registry/browser/tests/test_mailinglists.py
index b1154ba..004eb71 100644
--- a/lib/lp/registry/browser/tests/test_mailinglists.py
+++ b/lib/lp/registry/browser/tests/test_mailinglists.py
@@ -68,7 +68,7 @@ class MailingListSubscriptionControlsTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MailingListSubscriptionControlsTestCase, self).setUp()
+ super().setUp()
self.a_team = self.factory.makeTeam(name='a')
self.b_team = self.factory.makeTeam(name='b', owner=self.a_team)
self.b_team_list = self.factory.makeMailingList(team=self.b_team,
diff --git a/lib/lp/registry/browser/tests/test_milestone.py b/lib/lp/registry/browser/tests/test_milestone.py
index e56ac8b..f5c22f6 100644
--- a/lib/lp/registry/browser/tests/test_milestone.py
+++ b/lib/lp/registry/browser/tests/test_milestone.py
@@ -156,7 +156,7 @@ class TestAddMilestoneViews(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestAddMilestoneViews, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.series = self.factory.makeProductSeries(product=self.product)
self.owner = self.product.owner
@@ -196,7 +196,7 @@ class TestAddMilestoneViews(TestCaseWithFactory):
self.assertEqual(expected_msg, error_msg)
def test_add_milestone_with_tags(self):
- tags = u'zed alpha'
+ tags = 'zed alpha'
form = {
'field.name': '1.1',
'field.tags': tags,
@@ -222,7 +222,7 @@ class TestMilestoneEditView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestMilestoneEditView, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.milestone = self.factory.makeMilestone(
name='orig-name', product=self.product)
@@ -230,9 +230,9 @@ class TestMilestoneEditView(TestCaseWithFactory):
login_person(self.owner)
def test_edit_milestone_with_tags(self):
- orig_tags = u'ba ac'
+ orig_tags = 'ba ac'
self.milestone.setTags(orig_tags.split(), self.owner)
- new_tags = u'za ab'
+ new_tags = 'za ab'
form = {
'field.name': 'new-name',
'field.tags': new_tags,
@@ -245,7 +245,7 @@ class TestMilestoneEditView(TestCaseWithFactory):
self.assertEqual(expected, self.milestone.getTags())
def test_edit_milestone_clear_tags(self):
- orig_tags = u'ba ac'
+ orig_tags = 'ba ac'
self.milestone.setTags(orig_tags.split(), self.owner)
form = {
'field.name': 'new-name',
@@ -365,7 +365,7 @@ class TestProjectMilestoneIndexQueryCount(TestQueryCountBase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProjectMilestoneIndexQueryCount, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson(name='product-owner')
self.product = self.factory.makeProduct(owner=self.owner)
self.product_owner = self.product.owner
@@ -481,7 +481,7 @@ class TestProjectGroupMilestoneIndexQueryCount(TestQueryCountBase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProjectGroupMilestoneIndexQueryCount, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson(name='product-owner')
self.project_group = self.factory.makeProject(owner=self.owner)
login_person(self.owner)
@@ -539,7 +539,7 @@ class TestDistributionMilestoneIndexQueryCount(TestQueryCountBase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionMilestoneIndexQueryCount, self).setUp()
+ super().setUp()
self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
self.owner = self.factory.makePerson(name='test-owner')
login_team(self.ubuntu.owner)
@@ -597,8 +597,8 @@ class TestMilestoneTagView(TestQueryCountBase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestMilestoneTagView, self).setUp()
- self.tags = [u'tag1']
+ super().setUp()
+ self.tags = ['tag1']
self.owner = self.factory.makePerson()
self.project_group = self.factory.makeProject(owner=self.owner)
self.product = self.factory.makeProduct(
@@ -620,8 +620,8 @@ class TestMilestoneTagView(TestQueryCountBase):
def _make_form(self, tags):
return {
- u'field.actions.search': u'Search',
- u'field.tags': u' '.join(tags),
+ 'field.actions.search': 'Search',
+ 'field.tags': ' '.join(tags),
}
def _url_tail(self, url, separator='/'):
@@ -636,7 +636,7 @@ class TestMilestoneTagView(TestQueryCountBase):
def test_view_form_redirect(self):
# Ensure a correct redirection is performed when tags are searched.
- tags = [u'tag1', u'tag2']
+ tags = ['tag1', 'tag2']
form = self._make_form(tags)
view = create_initialized_view(self.milestonetag, '+index', form=form)
self.assertEqual(302, view.request.response.getStatus())
@@ -648,7 +648,7 @@ class TestMilestoneTagView(TestQueryCountBase):
def test_view_form_error(self):
# Ensure the form correctly handles invalid submissions.
- tags = [u'tag1', u't'] # One char tag is not valid.
+ tags = ['tag1', 't'] # One char tag is not valid.
form = self._make_form(tags)
view = create_initialized_view(self.milestonetag, '+index', form=form)
self.assertEqual(1, len(view.errors))
diff --git a/lib/lp/registry/browser/tests/test_ociproject.py b/lib/lp/registry/browser/tests/test_ociproject.py
index 4557d1d..05babda 100644
--- a/lib/lp/registry/browser/tests/test_ociproject.py
+++ b/lib/lp/registry/browser/tests/test_ociproject.py
@@ -85,7 +85,7 @@ class TestOCIProjectView(OCIConfigHelperMixin, BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestOCIProjectView, self).setUp()
+ super().setUp()
self.setConfig()
def test_facet_top_links(self):
diff --git a/lib/lp/registry/browser/tests/test_packaging.py b/lib/lp/registry/browser/tests/test_packaging.py
index 35ffc0c..770ff37 100644
--- a/lib/lp/registry/browser/tests/test_packaging.py
+++ b/lib/lp/registry/browser/tests/test_packaging.py
@@ -36,12 +36,12 @@ class TestProductSeriesUbuntuPackagingView(WithScenarios, TestCaseWithFactory):
scenarios = [
("spn_picker", {"features": {}}),
("dsp_picker", {
- "features": {u"disclosure.dsp_picker.enabled": u"on"},
+ "features": {"disclosure.dsp_picker.enabled": "on"},
}),
]
def setUp(self):
- super(TestProductSeriesUbuntuPackagingView, self).setUp()
+ super().setUp()
if self.features:
self.useFixture(FeatureFixture(self.features))
self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
@@ -150,7 +150,7 @@ class TestBrowserDeletePackaging(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBrowserDeletePackaging, self).setUp()
+ super().setUp()
# Only the person which created the packaging, admins
# and other people with certain privileges can delete a
# packaging. Since the sample data record we'll use for
diff --git a/lib/lp/registry/browser/tests/test_peoplemerge.py b/lib/lp/registry/browser/tests/test_peoplemerge.py
index aa359fd..939e432 100644
--- a/lib/lp/registry/browser/tests/test_peoplemerge.py
+++ b/lib/lp/registry/browser/tests/test_peoplemerge.py
@@ -37,13 +37,13 @@ from lp.testing.views import (
class RequestPeopleMergeMixin(TestCaseWithFactory):
def setUp(self):
- super(RequestPeopleMergeMixin, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.dupe = self.factory.makePerson(
name='foo', email='foo@xxxxxxx')
def tearDown(self):
- super(RequestPeopleMergeMixin, self).tearDown()
+ super().tearDown()
stub.test_emails = []
@@ -53,7 +53,7 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestRequestPeopleMergeMultipleEmails, self).setUp()
+ super().setUp()
EmailAddressSet().new(
'bar.foo@xxxxxxxxxxxxx', person=self.dupe,
status=EmailAddressStatus.VALIDATED)
@@ -72,8 +72,8 @@ class TestRequestPeopleMergeMultipleEmails(RequestPeopleMergeMixin):
explanation = find_tag_by_id(browser.contents, 'explanation')
self.assertThat(
extract_text(explanation), DocTestMatches(
- u"The account..."
- u"has more than one registered email address..."))
+ "The account..."
+ "has more than one registered email address..."))
email_select_control = browser.getControl(name='selected')
for ctrl in email_select_control.controls:
ctrl.selected = True
@@ -213,7 +213,7 @@ class TestRequestPeopleMergeHiddenEmailAddresses(RequestPeopleMergeMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestRequestPeopleMergeHiddenEmailAddresses, self).setUp()
+ super().setUp()
removeSecurityProxy(self.dupe).hide_email_addresses = True
EmailAddressSet().new(
'bar.foo@xxxxxxxxxxxxx', person=self.dupe,
@@ -257,7 +257,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestValidatingMergeView, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.dupe = self.factory.makePerson(name='dupe')
self.target = self.factory.makePerson(name='target')
@@ -281,7 +281,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
self.person_set, '+requestmerge', form=self.getForm())
self.assertEqual(
[html_escape(
- u"dupe has a PPA that must be deleted before it can be "
+ "dupe has a PPA that must be deleted before it can be "
"merged. It may take ten minutes to remove the deleted PPA's "
"files.")],
view.errors)
@@ -294,7 +294,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
view = create_initialized_view(
self.person_set, '+requestmerge', form=self.getForm())
self.assertEqual(
- [u"dupe owns private branches that must be deleted or "
+ ["dupe owns private branches that must be deleted or "
"transferred to another owner first."],
view.errors)
@@ -306,7 +306,7 @@ class TestValidatingMergeView(TestCaseWithFactory):
view = create_initialized_view(
self.person_set, '+requestmerge', form=self.getForm())
self.assertEqual(
- [u"dupe owns private Git repositories that must be deleted or "
+ ["dupe owns private Git repositories that must be deleted or "
"transferred to another owner first."],
view.errors)
@@ -352,7 +352,7 @@ class TestRequestPeopleMergeMultipleEmailsView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestRequestPeopleMergeMultipleEmailsView, self).setUp()
+ super().setUp()
self.personset = getUtility(IPersonSet)
self.dupe_user = self.factory.makePerson()
self.email_2 = self.factory.makeEmail(
@@ -409,7 +409,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestAdminTeamMergeView, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.dupe_team = self.factory.makeTeam(name='dupe-team')
self.target_team = self.factory.makeTeam(name='target-team')
@@ -434,7 +434,7 @@ class TestAdminTeamMergeView(TestCaseWithFactory):
view = self.getView()
self.assertEqual(
[html_escape(
- u"dupe-team has a PPA that must be deleted before it can be "
+ "dupe-team has a PPA that must be deleted before it can be "
"merged. It may take ten minutes to remove the deleted PPA's "
"files.")],
view.errors)
@@ -446,7 +446,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestAdminPeopleMergeView, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.dupe_person = self.factory.makePerson(name='dupe-person')
self.target_person = self.factory.makePerson()
@@ -470,7 +470,7 @@ class TestAdminPeopleMergeView(TestCaseWithFactory):
view = self.getView()
self.assertEqual(
[html_escape(
- u"dupe-person has a PPA that must be deleted before it can "
+ "dupe-person has a PPA that must be deleted before it can "
"be merged. It may take ten minutes to remove the deleted "
"PPA's files.")],
view.errors)
diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
index bed2125..1a1624f 100644
--- a/lib/lp/registry/browser/tests/test_person.py
+++ b/lib/lp/registry/browser/tests/test_person.py
@@ -593,7 +593,7 @@ class TestPersonViewKarma(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestPersonViewKarma, self).setUp()
+ super().setUp()
person = self.factory.makePerson()
product = self.factory.makeProduct()
transaction.commit()
@@ -612,7 +612,7 @@ class TestPersonViewKarma(TestCaseWithFactory):
for category in categories:
category_names.append(category.name)
- self.assertEqual(category_names, [u'code', u'bugs', u'answers'],
+ self.assertEqual(category_names, ['code', 'bugs', 'answers'],
'Categories are not sorted correctly')
def _makeKarmaCache(self, person, product, category, value=10):
@@ -781,7 +781,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPersonEditView, self).setUp()
+ super().setUp()
self.valid_email_address = self.factory.getUniqueEmailAddress()
self.person = self.factory.makePerson(email=self.valid_email_address)
login_person(self.person)
@@ -846,7 +846,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
"""Special assert function for dealing with email-related errors."""
view = self.createAddEmailView(email_str)
error_msg = view.errors[0]
- if not isinstance(error_msg, six.text_type):
+ if not isinstance(error_msg, str):
error_msg = error_msg.doc()
self.assertEqual(expected_msg, error_msg)
@@ -865,7 +865,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
expected_msg = html_escape(
- u"A confirmation message has been sent to '%s'."
+ "A confirmation message has been sent to '%s'."
" Follow the instructions in that message to confirm"
" that the address is yours. (If the message doesn't arrive in a"
" few minutes, your mail provider might use 'greylisting', which"
@@ -911,7 +911,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
expected_msg = html_escape(
- u"An email message was sent to '%s' "
+ "An email message was sent to '%s' "
"with instructions on how to confirm that it belongs to you."
% added_email)
self.assertEqual(expected_msg, notifications[0].message)
@@ -941,12 +941,12 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
token_url = get_token_url_from_email(raw_msg)
browser = setupBrowserForUser(user=self.person)
browser.open(token_url)
- expected_msg = u'Confirm email address <code>%s</code>' % added_email
+ expected_msg = 'Confirm email address <code>%s</code>' % added_email
self.assertIn(expected_msg, browser.contents)
browser.getControl('Continue').click()
# Login again to access displayname, since browser logged us out.
login_person(self.person)
- expected_title = u'%s in Launchpad' % self.person.displayname
+ expected_title = '%s in Launchpad' % self.person.displayname
self.assertEqual(expected_title, browser.title)
def test_remove_unvalidated_email_address(self):
@@ -961,7 +961,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
expected_msg = html_escape(
- u"The email address '%s' has been removed." % added_email)
+ "The email address '%s' has been removed." % added_email)
self.assertEqual(expected_msg, notifications[0].message)
def test_cannot_remove_contact_address(self):
@@ -990,7 +990,7 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
expected_msg = (
- u"Your contact address has been changed to: %s" % added_email)
+ "Your contact address has been changed to: %s" % added_email)
self.assertEqual(expected_msg, notifications[0].message)
def test_set_contact_address_already_set(self):
@@ -1022,21 +1022,21 @@ class TestPersonEditView(TestPersonRenameFormMixin, TestCaseWithFactory):
def test_email_string_validation_no_email_prodvided(self):
"""+editemails should warn if no email is provided."""
no_email = ''
- expected_msg = u'Required input is missing.'
+ expected_msg = 'Required input is missing.'
self._assertEmailAndError(no_email, expected_msg)
def test_email_string_validation_invalid_email(self):
"""+editemails should warn when provided data is not an email."""
not_an_email = 'foo'
expected_msg = html_escape(
- u"'foo' doesn't seem to be a valid email address.")
+ "'foo' doesn't seem to be a valid email address.")
self._assertEmailAndError(not_an_email, expected_msg)
def test_email_string_validation_is_escaped(self):
"""+editemails should escape output to prevent XSS."""
xss_email = "foo@xxxxxxxxxxx<script>window.alert('XSS')</script>"
expected_msg = (
- u"'foo@xxxxxxxxxxx<script>"
+ "'foo@xxxxxxxxxxx<script>"
"window.alert('XSS')</script>'"
" doesn't seem to be a valid email address.")
self._assertEmailAndError(xss_email, expected_msg)
@@ -1056,7 +1056,7 @@ class TestPersonParticipationView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonParticipationView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.view = create_view(self.user, name='+participation')
@@ -1234,7 +1234,7 @@ class TestPersonRelatedPackagesView(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPersonRelatedPackagesView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.factory.makeGPGKey(self.user)
self.ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
@@ -1328,7 +1328,7 @@ class TestPersonMaintainedPackagesView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonMaintainedPackagesView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.view = create_initialized_view(self.user, '+maintained-packages')
@@ -1347,7 +1347,7 @@ class TestPersonUploadedPackagesView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonUploadedPackagesView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
spr = self.factory.makeSourcePackageRelease(
@@ -1371,7 +1371,7 @@ class TestPersonPPAPackagesView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonPPAPackagesView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.view = create_initialized_view(self.user, '+ppa-packages')
@@ -1432,7 +1432,7 @@ class TestPersonSynchronisedPackagesView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSynchronisedPackagesView, self).setUp()
+ super().setUp()
user = self.factory.makePerson()
archive = self.factory.makeArchive(purpose=ArchivePurpose.PRIMARY)
spr = self.factory.makeSourcePackageRelease(
@@ -1463,7 +1463,7 @@ class TestPersonRelatedProjectsView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonRelatedProjectsView, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
def test_view_helper_attributes(self):
@@ -1498,7 +1498,7 @@ class TestPersonOCIRegistryCredentialsView(
]
def setUp(self):
- super(TestPersonOCIRegistryCredentialsView, self).setUp()
+ super().setUp()
self.setConfig()
if self.use_team:
self.owner = self.factory.makeTeam(members=[self.user])
@@ -1721,7 +1721,7 @@ class TestPersonLiveFSView(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonLiveFSView, self).setUp()
+ super().setUp()
self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
self.person = self.factory.makePerson(
name="test-person", displayname="Test Person")
@@ -1869,7 +1869,7 @@ class TestPersonRelatedPackagesFailedBuild(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPersonRelatedPackagesFailedBuild, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
# First we need to publish some PPA packages with failed builds
@@ -1923,7 +1923,7 @@ class TestPersonRelatedPackagesSynchronisedPackages(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPersonRelatedPackagesSynchronisedPackages, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.spph = self.factory.makeSourcePackagePublishingHistory()
@@ -2023,7 +2023,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamInvitationView, self).setUp()
+ super().setUp()
self.a_team = self.factory.makeTeam(name="team-a",
displayname="A-Team")
self.b_team = self.factory.makeTeam(name="team-b",
@@ -2046,7 +2046,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
self.assertEqual(
- u'B-Team (team-b) has been invited to join this team.',
+ 'B-Team (team-b) has been invited to join this team.',
notifications[0].message)
# B invites A.
@@ -2058,7 +2058,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
self.assertEqual(
- u'A-Team (team-a) has been invited to join this team.',
+ 'A-Team (team-a) has been invited to join this team.',
notifications[0].message)
# Team A accepts the invitation.
@@ -2078,7 +2078,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
self.assertEqual(
- u'This team is now a member of B-Team.',
+ 'This team is now a member of B-Team.',
notifications[0].message)
# Team B attempts to accept the invitation.
@@ -2093,7 +2093,7 @@ class TestTeamInvitationView(TestCaseWithFactory):
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
expected = (
- u'This team may not be added to A-Team because it is a member '
+ 'This team may not be added to A-Team because it is a member '
'of B-Team.')
self.assertEqual(
expected,
@@ -2105,8 +2105,7 @@ class TestSubscriptionsView(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestSubscriptionsView, self).setUp(
- user='test@xxxxxxxxxxxxx')
+ super().setUp(user='test@xxxxxxxxxxxxx')
self.user = getUtility(ILaunchBag).user
self.person = self.factory.makePerson()
self.other_person = self.factory.makePerson()
@@ -2135,7 +2134,7 @@ class BugTaskViewsTestBase:
layer = DatabaseFunctionalLayer
def setUp(self):
- super(BugTaskViewsTestBase, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
with person_logged_in(self.person):
self.subscribed_bug = self.factory.makeBug()
@@ -2189,7 +2188,7 @@ class TestPersonRelatedBugTaskSearchListingView(
view_name = '+bugs'
def setUp(self):
- super(TestPersonRelatedBugTaskSearchListingView, self).setUp()
+ super().setUp()
self.expected_for_search_unbatched = [
self.subscribed_bug.default_bugtask,
self.assigned_bug.default_bugtask,
@@ -2205,7 +2204,7 @@ class TestPersonAssignedBugTaskSearchListingView(
view_name = '+assignedbugs'
def setUp(self):
- super(TestPersonAssignedBugTaskSearchListingView, self).setUp()
+ super().setUp()
self.expected_for_search_unbatched = [
self.assigned_bug.default_bugtask,
]
@@ -2218,7 +2217,7 @@ class TestPersonCommentedBugTaskSearchListingView(
view_name = '+commentedbugs'
def setUp(self):
- super(TestPersonCommentedBugTaskSearchListingView, self).setUp()
+ super().setUp()
self.expected_for_search_unbatched = [
self.commented_bug.default_bugtask,
]
@@ -2231,7 +2230,7 @@ class TestPersonReportedBugTaskSearchListingView(
view_name = '+reportedbugs'
def setUp(self):
- super(TestPersonReportedBugTaskSearchListingView, self).setUp()
+ super().setUp()
self.expected_for_search_unbatched = [
self.owned_bug.default_bugtask,
]
@@ -2244,7 +2243,7 @@ class TestPersonSubscribedBugTaskSearchListingView(
view_name = '+subscribedbugs'
def setUp(self):
- super(TestPersonSubscribedBugTaskSearchListingView, self).setUp()
+ super().setUp()
self.expected_for_search_unbatched = [
self.subscribed_bug.default_bugtask,
self.owned_bug.default_bugtask,
@@ -2258,7 +2257,7 @@ class TestPersonAffectingBugTaskSearchListingView(
view_name = '+affectingbugs'
def setUp(self):
- super(TestPersonAffectingBugTaskSearchListingView, self).setUp()
+ super().setUp()
# Bugs filed by this user are marked as affecting them by default, so
# the bug we filed is returned.
self.expected_for_search_unbatched = [
diff --git a/lib/lp/registry/browser/tests/test_person_contact.py b/lib/lp/registry/browser/tests/test_person_contact.py
index 3696a64..4d26d16 100644
--- a/lib/lp/registry/browser/tests/test_person_contact.py
+++ b/lib/lp/registry/browser/tests/test_person_contact.py
@@ -424,7 +424,7 @@ class EmailToPersonViewTestCase(TestCaseWithFactory):
with person_logged_in(sender):
view = create_initialized_view(user, '+contactuser', form=form)
self.assertEqual(
- [u'You must provide a subject and a message.'], view.errors)
+ ['You must provide a subject and a message.'], view.errors)
def test_submitted_after_quota(self):
# The view explains when a message was not sent because the quota
diff --git a/lib/lp/registry/browser/tests/test_person_webservice.py b/lib/lp/registry/browser/tests/test_person_webservice.py
index 2f5bc88..6d2ccdb 100644
--- a/lib/lp/registry/browser/tests/test_person_webservice.py
+++ b/lib/lp/registry/browser/tests/test_person_webservice.py
@@ -50,7 +50,7 @@ class TestPersonEmailSecurity(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonEmailSecurity, self).setUp()
+ super().setUp()
self.target = self.factory.makePerson(name='target')
self.email_one = self.factory.makeEmail(
'test1@xxxxxxxxxxx', self.target)
@@ -87,7 +87,7 @@ class TestPersonAccountStatus(TestCaseWithFactory):
person = self.factory.makePerson()
registrar = self.factory.makePerson(
member_of=[getUtility(IPersonSet).getByName('registry')])
- removeSecurityProxy(person.account).status_history = u'Test'
+ removeSecurityProxy(person.account).status_history = 'Test'
person_url = api_url(person)
# A normal user cannot read account_status_history. Not even
@@ -178,7 +178,7 @@ class PersonWebServiceTests(TestCaseWithFactory):
team.addMember(person, owner)
getUtility(ITeamMembershipSet).getByPersonAndTeam(
person, team).setStatus(
- TeamMembershipStatus.DEACTIVATED, owner, u"Go away.")
+ TeamMembershipStatus.DEACTIVATED, owner, "Go away.")
def get_members():
ws.get('/~%s/deactivated_members' % name).jsonBody()
@@ -250,7 +250,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(PersonSetWebServiceTests, self).setUp()
+ super().setUp()
self.webservice = webservice_for_person(None)
def assertReturnsPeople(self, expected_names, path):
@@ -309,7 +309,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
def test_find_by_date(self):
# Creation date filtering is supported.
self.assertReturnsPeople(
- [u'bac'],
+ ['bac'],
'/people?ws.op=findPerson&text='
'&created_after=2008-06-27&created_before=2008-07-01')
@@ -401,7 +401,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
account_status=AccountStatus.SUSPENDED)
oid = OpenIdIdentifier()
oid.account = existing.account
- oid.identifier = u'somebody'
+ oid.identifier = 'somebody'
Store.of(existing).add(oid)
sca = getUtility(IPersonSet).getByName('software-center-agent')
response = self.getOrCreateSoftwareCenterCustomer(sca)
@@ -415,7 +415,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
account_status=AccountStatus.DECEASED)
oid = OpenIdIdentifier()
oid.account = existing.account
- oid.identifier = u'somebody'
+ oid.identifier = 'somebody'
Store.of(existing).add(oid)
sca = getUtility(IPersonSet).getByName('software-center-agent')
response = self.getOrCreateSoftwareCenterCustomer(sca)
@@ -468,7 +468,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
with admin_logged_in():
by_name = getUtility(IPersonSet).getByName('bar')
by_openid = getUtility(IPersonSet).getByOpenIDIdentifier(
- u'http://testopenid.test/+id/foo')
+ 'http://testopenid.test/+id/foo')
self.assertEqual(by_name, by_openid)
self.assertEqual(
AccountStatus.PLACEHOLDER, by_name.account_status)
@@ -485,7 +485,7 @@ class PersonSetWebServiceTests(TestCaseWithFactory):
self.assertIs(None, getUtility(IPersonSet).getByName('bar'))
self.assertRaises(
LookupError,
- getUtility(IAccountSet).getByOpenIDIdentifier, u'foo')
+ getUtility(IAccountSet).getByOpenIDIdentifier, 'foo')
def test_setUsernameFromSSO_is_restricted(self):
# The method may only be invoked by the ~ubuntu-sso celebrity
diff --git a/lib/lp/registry/browser/tests/test_pillar_sharing.py b/lib/lp/registry/browser/tests/test_pillar_sharing.py
index dbfd6b2..8ef5a25 100644
--- a/lib/lp/registry/browser/tests/test_pillar_sharing.py
+++ b/lib/lp/registry/browser/tests/test_pillar_sharing.py
@@ -63,7 +63,7 @@ class SharingBaseTestCase(TestCaseWithFactory):
pillar_type = None
def setUp(self):
- super(SharingBaseTestCase, self).setUp()
+ super().setUp()
self.driver = self.factory.makePerson()
self.owner = self.factory.makePerson()
if self.pillar_type == 'distribution':
@@ -249,7 +249,7 @@ class TestProductSharingDetailsView(
pillar_type = 'product'
def setUp(self):
- super(TestProductSharingDetailsView, self).setUp()
+ super().setUp()
login_person(self.owner)
@@ -259,7 +259,7 @@ class TestDistributionSharingDetailsView(
pillar_type = 'distribution'
def setUp(self):
- super(TestDistributionSharingDetailsView, self).setUp()
+ super().setUp()
login_person(self.owner)
@@ -471,7 +471,7 @@ class TestProductSharingView(PillarSharingViewTestMixin,
pillar_type = 'product'
def setUp(self):
- super(TestProductSharingView, self).setUp()
+ super().setUp()
self.setupSharing(self.grantees)
login_person(self.driver)
# Use a FakeLogger fixture to prevent Memcached warnings to be
@@ -517,7 +517,7 @@ class TestDistributionSharingView(PillarSharingViewTestMixin,
pillar_type = 'distribution'
def setUp(self):
- super(TestDistributionSharingView, self).setUp()
+ super().setUp()
self.setupSharing(self.grantees)
login_person(self.driver)
diff --git a/lib/lp/registry/browser/tests/test_poll.py b/lib/lp/registry/browser/tests/test_poll.py
index 05f0183..b689df6 100644
--- a/lib/lp/registry/browser/tests/test_poll.py
+++ b/lib/lp/registry/browser/tests/test_poll.py
@@ -29,7 +29,7 @@ class TestPollVoteView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPollVoteView, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
def test_simple_poll_template(self):
@@ -55,7 +55,7 @@ class TestPollAddView(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPollAddView, self).setUp()
+ super().setUp()
self.pushConfig(
"launchpad", min_legitimate_karma=5, min_legitimate_account_age=5)
diff --git a/lib/lp/registry/browser/tests/test_product.py b/lib/lp/registry/browser/tests/test_product.py
index 1f571fe..c79cbd1 100644
--- a/lib/lp/registry/browser/tests/test_product.py
+++ b/lib/lp/registry/browser/tests/test_product.py
@@ -206,7 +206,7 @@ class TestProductConfiguration(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductConfiguration, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
def test_registration_not_done(self):
@@ -295,7 +295,7 @@ class TestProductAddView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductAddView, self).setUp()
+ super().setUp()
self.product_set = getUtility(IProductSet)
def test_view_data_model(self):
@@ -424,7 +424,7 @@ class TestProductView(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductView, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct(name='fnord')
self.tag_meta_noindex = Tag(
'meta_noindex', 'meta', attrs={
@@ -741,7 +741,7 @@ class TestProductEditView(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductEditView, self).setUp()
+ super().setUp()
def _make_product_edit_form(self, product, proprietary=False):
"""Return form data for product edit.
@@ -927,7 +927,7 @@ class ProductSetReviewLicensesViewTestCase(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(ProductSetReviewLicensesViewTestCase, self).setUp()
+ super().setUp()
self.product_set = getUtility(IProductSet)
self.user = login_celebrity('registry_experts')
diff --git a/lib/lp/registry/browser/tests/test_projectgroup.py b/lib/lp/registry/browser/tests/test_projectgroup.py
index 75c9d9f..a76ae7d 100644
--- a/lib/lp/registry/browser/tests/test_projectgroup.py
+++ b/lib/lp/registry/browser/tests/test_projectgroup.py
@@ -39,7 +39,7 @@ class TestProjectGroupView(BrowserTestCase):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProjectGroupView, self).setUp()
+ super().setUp()
self.project_group = self.factory.makeProject(name='group')
def test_view_data_model(self):
@@ -136,7 +136,7 @@ class TestProjectGroupEditView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProjectGroupEditView, self).setUp()
+ super().setUp()
self.project_group = self.factory.makeProject(name='group')
# Use a FakeLogger fixture to prevent Memcached warnings to be
# printed to stdout while browsing pages.
diff --git a/lib/lp/registry/browser/tests/test_reassign_team_view.py b/lib/lp/registry/browser/tests/test_reassign_team_view.py
index c5cba77..cad98ce 100644
--- a/lib/lp/registry/browser/tests/test_reassign_team_view.py
+++ b/lib/lp/registry/browser/tests/test_reassign_team_view.py
@@ -153,7 +153,7 @@ class TestTeamReassignmentViewErrors(TestCaseWithFactory):
a_team, '+reassign', form=form, principal=owner)
self.assertEqual(
[html_escape(
- u"There's already a person/team with the name 'a-team' in "
+ "There's already a person/team with the name 'a-team' in "
"Launchpad. Please choose a different name or select the "
"option to make that person/team the new owner, if that's "
"what you want.")],
diff --git a/lib/lp/registry/browser/tests/test_sourcepackage_views.py b/lib/lp/registry/browser/tests/test_sourcepackage_views.py
index eb5ccd3..dcb66d0 100644
--- a/lib/lp/registry/browser/tests/test_sourcepackage_views.py
+++ b/lib/lp/registry/browser/tests/test_sourcepackage_views.py
@@ -221,7 +221,7 @@ class TestSourcePackageUpstreamConnectionsView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestSourcePackageUpstreamConnectionsView, self).setUp()
+ super().setUp()
productseries = self.factory.makeProductSeries(name='1.0')
self.milestone = self.factory.makeMilestone(
product=productseries.product, productseries=productseries)
diff --git a/lib/lp/registry/browser/tests/test_subscription_links.py b/lib/lp/registry/browser/tests/test_subscription_links.py
index 0c820b8..886e078 100644
--- a/lib/lp/registry/browser/tests/test_subscription_links.py
+++ b/lib/lp/registry/browser/tests/test_subscription_links.py
@@ -85,7 +85,7 @@ class _TestStructSubs(TestCaseWithFactory, _TestResultsMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(_TestStructSubs, self).setUp()
+ super().setUp()
self.regular_user = self.factory.makePerson()
# Use a FakeLogger fixture to prevent Memcached warnings to be
# printed to stdout while browsing pages.
@@ -123,7 +123,7 @@ class ProductView(_TestStructSubs):
view = '+index'
def setUp(self):
- super(ProductView, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct(official_malone=True)
@@ -141,7 +141,7 @@ class ProjectGroupView(_TestStructSubs):
view = '+index'
def setUp(self):
- super(ProjectGroupView, self).setUp()
+ super().setUp()
self.target = self.factory.makeProject()
self.factory.makeProduct(
projectgroup=self.target, official_malone=True)
@@ -183,7 +183,7 @@ class ProductSeriesView(_TestStructSubs):
view = '+index'
def setUp(self):
- super(ProductSeriesView, self).setUp()
+ super().setUp()
product = self.factory.makeProduct(official_malone=True)
self.target = self.factory.makeProductSeries(product=product)
@@ -195,7 +195,7 @@ class ProductSeriesBugs(ProductSeriesView):
view = '+bugs'
def setUp(self):
- super(ProductSeriesBugs, self).setUp()
+ super().setUp()
with person_logged_in(self.target.product.owner):
self.target.product.official_malone = True
@@ -207,7 +207,7 @@ class DistributionSourcePackageView(_TestStructSubs):
view = '+index'
def setUp(self):
- super(DistributionSourcePackageView, self).setUp()
+ super().setUp()
distro = self.factory.makeDistribution()
with person_logged_in(distro.owner):
distro.official_malone = True
@@ -242,7 +242,7 @@ class DistroView(BrowserTestCase, _TestResultsMixin):
view = '+index'
def setUp(self):
- super(DistroView, self).setUp()
+ super().setUp()
self.target = self.factory.makeDistribution()
with person_logged_in(self.target.owner):
self.target.official_malone = True
@@ -341,7 +341,7 @@ class DistroMilestoneView(DistroView):
"""Test structural subscriptions on the distro milestones."""
def setUp(self):
- super(DistroMilestoneView, self).setUp()
+ super().setUp()
self.distro = self.target
self.target = self.factory.makeMilestone(distribution=self.distro)
@@ -380,7 +380,7 @@ class ProductMilestoneView(DistroView):
"""Test structural subscriptions on the product milestones."""
def setUp(self):
- super(ProductMilestoneView, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
with person_logged_in(self.product.owner):
self.product.official_malone = True
@@ -411,7 +411,7 @@ class ProductSeriesMilestoneView(ProductMilestoneView):
"""Test structural subscriptions on the product series milestones."""
def setUp(self):
- super(ProductSeriesMilestoneView, self).setUp()
+ super().setUp()
self.productseries = self.factory.makeProductSeries()
with person_logged_in(self.productseries.product.owner):
self.productseries.product.official_malone = True
@@ -426,7 +426,7 @@ class _DoesNotUseLP(ProductView):
"""Test structural subscriptions on the product view."""
def setUp(self):
- super(_DoesNotUseLP, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct(official_malone=False)
def test_subscribe_link_owner(self):
@@ -472,7 +472,7 @@ class ProjectGroupDoesNotUseLPView(_DoesNotUseLP):
view = '+index'
def setUp(self):
- super(ProjectGroupDoesNotUseLPView, self).setUp()
+ super().setUp()
self.target = self.factory.makeProject()
self.factory.makeProduct(
projectgroup=self.target, official_malone=False)
@@ -485,7 +485,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
view = '+bugs'
def setUp(self):
- super(ProjectGroupDoesNotUseLPBugs, self).setUp()
+ super().setUp()
self.target = self.factory.makeProject()
self.factory.makeProduct(
projectgroup=self.target, official_malone=False)
@@ -496,7 +496,7 @@ class ProjectGroupDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
class ProductSeriesDoesNotUseLPView(_DoesNotUseLP):
def setUp(self):
- super(ProductSeriesDoesNotUseLPView, self).setUp()
+ super().setUp()
product = self.factory.makeProduct(official_malone=False)
self.target = self.factory.makeProductSeries(product=product)
@@ -504,7 +504,7 @@ class ProductSeriesDoesNotUseLPView(_DoesNotUseLP):
class ProductSeriesDoesNotUseLPBugs(_DoesNotUseLP):
def setUp(self):
- super(ProductSeriesDoesNotUseLPBugs, self).setUp()
+ super().setUp()
product = self.factory.makeProduct(official_malone=False)
self.target = self.factory.makeProductSeries(product=product)
@@ -513,7 +513,7 @@ class DistributionSourcePackageDoesNotUseLPView(_DoesNotUseLP):
"""Test structural subscriptions on the distro src pkg view."""
def setUp(self):
- super(DistributionSourcePackageDoesNotUseLPView, self).setUp()
+ super().setUp()
distro = self.factory.makeDistribution()
self.target = self.factory.makeDistributionSourcePackage(
distribution=distro)
@@ -535,7 +535,7 @@ class DistributionSourcePackageDoesNotUseLPBugs(ProductDoesNotUseLPBugs):
class DistroDoesNotUseLPView(DistroView):
def setUp(self):
- super(DistroDoesNotUseLPView, self).setUp()
+ super().setUp()
self.target = self.factory.makeDistribution()
self.regular_user = self.factory.makePerson()
@@ -577,7 +577,7 @@ class DistroDoesNotUseLPBugs(DistroDoesNotUseLPView):
class DistroMilestoneDoesNotUseLPView(DistroMilestoneView):
def setUp(self):
- super(DistroMilestoneDoesNotUseLPView, self).setUp()
+ super().setUp()
with person_logged_in(self.distro.owner):
self.distro.official_malone = False
@@ -620,7 +620,7 @@ class DistroMilestoneDoesNotUseLPView(DistroMilestoneView):
class ProductMilestoneDoesNotUseLPView(ProductMilestoneView):
def setUp(self):
- super(ProductMilestoneDoesNotUseLPView, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
with person_logged_in(self.product.owner):
self.product.official_malone = False
@@ -648,8 +648,7 @@ class CustomTestLoader(unittest.TestLoader):
if testCaseClass is _TestStructSubs:
return []
else:
- return super(CustomTestLoader, self).getTestCaseNames(
- testCaseClass)
+ return super().getTestCaseNames(testCaseClass)
def test_suite():
diff --git a/lib/lp/registry/browser/tests/test_team.py b/lib/lp/registry/browser/tests/test_team.py
index 5a3f781..fb02cb2 100644
--- a/lib/lp/registry/browser/tests/test_team.py
+++ b/lib/lp/registry/browser/tests/test_team.py
@@ -70,7 +70,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProposedTeamMembersEditView, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson(name="team-owner")
self.a_team = self.makeTeam("team-a", "A-Team")
self.b_team = self.makeTeam("team-b", "B-Team")
@@ -97,7 +97,7 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
self.assertEqual([], view.errors)
notifications = view.request.response.notifications
self.assertEqual(1, len(notifications))
- expected = u"%s has been proposed to this team." % (
+ expected = "%s has been proposed to this team." % (
joiner.displayname)
self.assertEqual(
expected,
@@ -112,13 +112,13 @@ class TestProposedTeamMembersEditView(TestCaseWithFactory):
failed_names = ', '.join([team.displayname for team in failed])
if len(failed) == 1:
failed_message = html_escape(
- u'%s is a member of the following team, '
+ '%s is a member of the following team, '
'so it could not be accepted: %s. '
'You need to "Decline" that team.' %
(joinee.displayname, failed_names))
else:
failed_message = html_escape(
- u'%s is a member of the following teams, '
+ '%s is a member of the following teams, '
'so they could not be accepted: %s. '
'You need to "Decline" those teams.' %
(joinee.displayname, failed_names))
@@ -605,7 +605,7 @@ class TestTeamMenu(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMenu, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
def test_TeamIndexMenu(self):
@@ -754,7 +754,7 @@ class TestTeamMemberAddView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMemberAddView, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam(name='test-team')
login_person(self.team.teamowner)
@@ -844,7 +844,7 @@ class TeamMembershipViewTestCase(TestCaseWithFactory):
team = self.factory.makeTeam(name='pting')
view = create_initialized_view(team, name='+members')
self.assertEqual('Members', view.page_title)
- self.assertEqual(u'Members of \u201cPting\u201d', view.label)
+ self.assertEqual('Members of \u201cPting\u201d', view.label)
class TestTeamIndexView(TestCaseWithFactory):
@@ -852,7 +852,7 @@ class TestTeamIndexView(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamIndexView, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam(name='test-team')
login_person(self.team.teamowner)
diff --git a/lib/lp/registry/browser/tests/test_teammembership.py b/lib/lp/registry/browser/tests/test_teammembership.py
index 21c953f..a87d121 100644
--- a/lib/lp/registry/browser/tests/test_teammembership.py
+++ b/lib/lp/registry/browser/tests/test_teammembership.py
@@ -23,7 +23,7 @@ class TestTeamMenu(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMenu, self).setUp()
+ super().setUp()
login_celebrity('admin')
self.membership_set = getUtility(ITeamMembershipSet)
self.team = self.factory.makeTeam()
diff --git a/lib/lp/registry/browser/widgets/ocicredentialswidget.py b/lib/lp/registry/browser/widgets/ocicredentialswidget.py
index b47f436..924903d 100644
--- a/lib/lp/registry/browser/widgets/ocicredentialswidget.py
+++ b/lib/lp/registry/browser/widgets/ocicredentialswidget.py
@@ -113,7 +113,7 @@ class OCICredentialsWidget(BrowserWidget, InputWidget):
self.getInputValue()
except InputErrors as error:
self._error = error
- return super(OCICredentialsWidget, self).error()
+ return super().error()
def setRenderedValue(self, value):
"""See `IInputWidget`."""
diff --git a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
index 5494439..430e6c3 100644
--- a/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
+++ b/lib/lp/registry/browser/widgets/tests/test_ocicredentialswidget.py
@@ -32,11 +32,11 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestOCICredentialsWidget, self).setUp()
+ super().setUp()
self.setConfig()
field = Reference(
__name__="oci_registry_credentials",
- schema=Interface, title=u"OCI Registry Credentials")
+ schema=Interface, title="OCI Registry Credentials")
self.context = self.factory.makeDistribution()
field = field.bind(self.context)
request = LaunchpadTestRequest()
@@ -163,7 +163,7 @@ class TestOCICredentialsWidget(OCIConfigHelperMixin, TestCaseWithFactory):
def test_getInputValue_valid(self):
field = Reference(
__name__="oci_registry_credentials",
- schema=Interface, title=u"OCI Registry Credentials")
+ schema=Interface, title="OCI Registry Credentials")
self.context = self.factory.makeDistribution(
oci_project_admin=self.owner)
field = field.bind(self.context)