launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27835
[Merge] ~cjwatson/launchpad:pyupgrade-py3-bugs-2 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-bugs-2 into launchpad:master.
Commit message:
lp.bugs.{interface,model}: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413127
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-bugs-2 into launchpad:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3eea6c7..0d4f803 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,7 +45,7 @@ repos:
|archivepublisher
|archiveuploader
|blueprints
- |bugs/(browser|externalbugtracker)
+ |bugs/(browser|externalbugtracker|interfaces|model)
)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
diff --git a/lib/lp/bugs/interfaces/bug.py b/lib/lp/bugs/interfaces/bug.py
index 725a054..057b9eb 100644
--- a/lib/lp/bugs/interfaces/bug.py
+++ b/lib/lp/bugs/interfaces/bug.py
@@ -281,7 +281,7 @@ class IBugView(Interface):
title=_('CVE entries related to this bug.'),
value_type=Reference(schema=ICve),
readonly=True))
- has_cves = Bool(title=u"True if the bug has cve entries.")
+ has_cves = Bool(title="True if the bug has cve entries.")
duplicates = exported(doNotSnapshot(
CollectionField(
title=_("MultiJoin of bugs which are dupes of this one."),
@@ -1106,11 +1106,11 @@ class IBugAddForm(IBug):
title=_("This bug has already been reported as ..."), required=False,
vocabulary="Bug")
filecontent = Bytes(
- title=u"Attachment", required=False,
+ title="Attachment", required=False,
constraint=attachment_size_constraint)
- patch = Bool(title=u"This attachment is a patch", required=False,
+ patch = Bool(title="This attachment is a patch", required=False,
default=False)
- attachment_description = Title(title=u'Description', required=False)
+ attachment_description = Title(title='Description', required=False)
status = Choice(
title=_('Status'),
values=list(
@@ -1130,7 +1130,7 @@ class IBugAddForm(IBug):
title=_('Assign to'), required=False,
vocabulary='ValidAssignee')
subscribe_to_existing_bug = Choice(
- title=u'Subscribe to this bug',
+ title='Subscribe to this bug',
vocabulary=SUBSCRIBE_TO_BUG_VOCABULARY,
required=True, default=False)
diff --git a/lib/lp/bugs/interfaces/bugattachment.py b/lib/lp/bugs/interfaces/bugattachment.py
index ad5548d..25ee2af 100644
--- a/lib/lp/bugs/interfaces/bugattachment.py
+++ b/lib/lp/bugs/interfaces/bugattachment.py
@@ -182,18 +182,18 @@ class IBugAttachmentEditForm(Interface):
title = IBugAttachment['title']
contenttype = TextLine(
- title=u'Content Type',
+ title='Content Type',
description=(
- u"The content type is only settable if the attachment isn't "
+ "The content type is only settable if the attachment isn't "
"a patch. If it's a patch, the content type will be set to "
"text/plain"),
required=True)
patch = Bool(
- title=u"This attachment contains a solution (patch) for this bug",
+ title="This attachment contains a solution (patch) for this bug",
required=True, default=False)
class IBugAttachmentIsPatchConfirmationForm(Interface):
"""Schema used to confirm the setting of the "patch" flag."""
- patch = Bool(title=u"Is this file a patch", required=True, default=False)
+ patch = Bool(title="Is this file a patch", required=True, default=False)
diff --git a/lib/lp/bugs/interfaces/bugmessage.py b/lib/lp/bugs/interfaces/bugmessage.py
index 07f6bf8..3e25ddf 100644
--- a/lib/lp/bugs/interfaces/bugmessage.py
+++ b/lib/lp/bugs/interfaces/bugmessage.py
@@ -39,24 +39,24 @@ from lp.services.messages.interfaces.message import (
class IBugMessageView(IMessageView, IHasBug):
"""Public attributes for a link between a bug and a message."""
- bug = Object(schema=IBug, title=u"The bug.")
+ bug = Object(schema=IBug, title="The bug.")
# The index field is being populated in the DB; once complete it will be
# made required. Whether to make it readonly or not is dependent on UI
# considerations. If, once populated, it becomes read-write, we probably
# want to ensure that only actions like bug import or spam hiding can
# change it, rather than arbitrary API scripts.
- index = Int(title=u'The comment number', required=False, readonly=False,
+ index = Int(title='The comment number', required=False, readonly=False,
default=None)
- message_id = Int(title=u"The message id.", readonly=True)
- message = Object(schema=IMessage, title=u"The message.")
+ message_id = Int(title="The message id.", readonly=True)
+ message = Object(schema=IMessage, title="The message.")
bugwatch = Object(schema=IBugWatch,
- title=u"A bugwatch to which the message pertains.")
- bugwatch_id = Int(title=u'The bugwatch id.', readonly=True)
+ title="A bugwatch to which the message pertains.")
+ bugwatch_id = Int(title='The bugwatch id.', readonly=True)
remote_comment_id = TextLine(
- title=u"The id this comment has in the bugwatch's bug tracker.")
+ title="The id this comment has in the bugwatch's bug tracker.")
owner_id = Attribute("The ID of the owner mirrored from the message")
owner = Object(schema=IPerson,
- title=u"The Message owner mirrored from the message.", readonly=True)
+ title="The Message owner mirrored from the message.", readonly=True)
class IBugMessage(IBugMessageView, IMessage):
@@ -100,20 +100,20 @@ class IBugMessageSet(Interface):
class IBugMessageAddForm(Interface):
"""Schema used to build the add form for bug comment/attachment."""
- subject = Title(title=u"Subject", required=True)
- comment = Text(title=u"Comment", required=False)
+ subject = Title(title="Subject", required=True)
+ comment = Text(title="Comment", required=False)
filecontent = Bytes(
- title=u"Attachment", required=False,
+ title="Attachment", required=False,
constraint=attachment_size_constraint)
patch = Bool(
- title=u"This attachment contains a solution (patch) for this bug",
+ title="This attachment contains a solution (patch) for this bug",
required=False, default=False)
- attachment_description = Title(title=u'Description', required=False)
+ attachment_description = Title(title='Description', required=False)
email_me = Bool(
- title=u"Email me about changes to this bug report",
+ title="Email me about changes to this bug report",
required=False, default=False)
bugwatch_id = Int(
- title=(u"Synchronize this comment with a remote bug "
+ title=("Synchronize this comment with a remote bug "
"tracker using the bug watch with this id."),
required=False, default=None)
@@ -129,7 +129,7 @@ class IBugComment(IMessage, IComment):
""")
bugwatch = Attribute('The bugwatch to which the comment pertains.')
show_for_admin = Bool(
- title=u'A hidden comment still displayed for admins.',
+ title='A hidden comment still displayed for admins.',
readonly=True)
display_title = Attribute('Whether or not to show the title.')
synchronized = Attribute(
diff --git a/lib/lp/bugs/interfaces/bugnotification.py b/lib/lp/bugs/interfaces/bugnotification.py
index 898476b..7d6f23a 100644
--- a/lib/lp/bugs/interfaces/bugnotification.py
+++ b/lib/lp/bugs/interfaces/bugnotification.py
@@ -41,14 +41,14 @@ class IBugNotification(IHasOwner):
"be None for older notification objects, and will be None if the "
"bugchange object that provides the data for the change returns None "
"for getBugActivity.")
- bug = BugField(title=u"The bug this notification is for.",
+ bug = BugField(title="The bug this notification is for.",
required=True)
is_comment = Bool(
- title=u"Comment", description=u"Is the message a comment?",
+ title="Comment", description="Is the message a comment?",
required=True)
date_emailed = Datetime(
- title=u"Date emailed",
- description=u"When was the notification sent? None, if it hasn't"
+ title="Date emailed",
+ description="When was the notification sent? None, if it hasn't"
" been sent yet.",
required=False)
recipients = Attribute(
diff --git a/lib/lp/bugs/interfaces/bugsubscription.py b/lib/lp/bugs/interfaces/bugsubscription.py
index ba210a9..1155624 100644
--- a/lib/lp/bugs/interfaces/bugsubscription.py
+++ b/lib/lp/bugs/interfaces/bugsubscription.py
@@ -47,7 +47,7 @@ class IBugSubscription(Interface):
as_of="beta")
# We mark this as doNotSnapshot() because it's a magically-generated
# Storm attribute and it causes Snapshot to break.
- bugID = doNotSnapshot(Int(title=u"The bug id.", readonly=True))
+ bugID = doNotSnapshot(Int(title="The bug id.", readonly=True))
bug_notification_level = exported(
Choice(
title=_("Bug notification level"), required=True,
diff --git a/lib/lp/bugs/interfaces/bugtarget.py b/lib/lp/bugs/interfaces/bugtarget.py
index 337fc05..3714799 100644
--- a/lib/lp/bugs/interfaces/bugtarget.py
+++ b/lib/lp/bugs/interfaces/bugtarget.py
@@ -96,22 +96,22 @@ search_tasks_params_common = {
"has_no_package": copy_field(IBugTaskSearch['has_no_package']),
"linked_branches": Choice(
title=_(
- u"Search for bugs that are linked to branches or for bugs "
+ "Search for bugs that are linked to branches or for bugs "
"that are not linked to branches."),
vocabulary=BugBranchSearch, required=False),
"modified_since": Datetime(
title=_(
- u"Search for bugs that have been modified since the given "
+ "Search for bugs that have been modified since the given "
"date."),
required=False),
"created_since": Datetime(
title=_(
- u"Search for bugs that have been created since the given "
+ "Search for bugs that have been created since the given "
"date."),
required=False),
"created_before": Datetime(
title=_(
- u"Search for bugs that were created before the given "
+ "Search for bugs that were created before the given "
"date."),
required=False),
}
@@ -127,8 +127,8 @@ search_tasks_params_for_api_devel = dict(
IBugTaskSearch['omit_targeted'], default=False),
linked_blueprints=Choice(
title=_(
- u"Search for bugs that are linked to blueprints or for "
- u"bugs that are not linked to blueprints."),
+ "Search for bugs that are linked to blueprints or for "
+ "bugs that are not linked to blueprints."),
vocabulary=BugBlueprintSearch, required=False))
@@ -227,9 +227,9 @@ class IBugTarget(IHasBugs):
bug_reporting_guidelines = exported(
Text(
title=(
- u"Helpful guidelines for reporting a bug"),
+ "Helpful guidelines for reporting a bug"),
description=(
- u"These guidelines will be shown to "
+ "These guidelines will be shown to "
"everyone reporting a bug and should be "
"text or a bulleted list with your particular "
"requirements, if any."),
@@ -239,22 +239,22 @@ class IBugTarget(IHasBugs):
bug_reported_acknowledgement = exported(
Text(
title=(
- u"After reporting a bug, I can expect the following."),
+ "After reporting a bug, I can expect the following."),
description=(
- u"This message of acknowledgement will be displayed "
+ "This message of acknowledgement will be displayed "
"to anyone after reporting a bug."),
required=False,
max_length=50000))
enable_bugfiling_duplicate_search = Bool(
- title=u"Search for possible duplicate bugs when a new bug is filed",
+ title="Search for possible duplicate bugs when a new bug is filed",
description=(
- u"If enabled, Launchpad searches the project for bugs which "
- u"could match the summary given by the bug reporter. However, "
- u"this can lead users to mistake an existing bug as the one "
- u"they want to report. This can happen for example for hardware "
- u"related bugs where the one symptom can be caused by "
- u"completely different hardware and drivers."),
+ "If enabled, Launchpad searches the project for bugs which "
+ "could match the summary given by the bug reporter. However, "
+ "this can lead users to mistake an existing bug as the one "
+ "they want to report. This can happen for example for hardware "
+ "related bugs where the one symptom can be caused by "
+ "completely different hardware and drivers."),
required=False)
def createBug(bug_params):
@@ -308,14 +308,14 @@ class IOfficialBugTagTargetRestricted(Interface):
"""Restricted methods for `IOfficialBugTagTarget`."""
@operation_parameters(
- tag=Tag(title=u'The official bug tag', required=True))
+ tag=Tag(title='The official bug tag', required=True))
@export_write_operation()
@operation_for_version('beta')
def addOfficialBugTag(tag):
"""Add tag to the official bug tags of this target."""
@operation_parameters(
- tag=Tag(title=u'The official bug tag', required=True))
+ tag=Tag(title='The official bug tag', required=True))
@export_write_operation()
@operation_for_version('beta')
def removeOfficialBugTag(tag):
@@ -334,13 +334,13 @@ class IOfficialBugTagTarget(IOfficialBugTagTargetPublic,
class IOfficialBugTag(Interface):
"""Official bug tags for a product, a project or a distribution."""
tag = Tag(
- title=u'The official bug tag', required=True)
+ title='The official bug tag', required=True)
target = Object(
- title=u'The target of this bug tag.',
+ title='The target of this bug tag.',
schema=IOfficialBugTagTarget,
description=(
- u'The distribution or product having this official bug tag.'))
+ 'The distribution or product having this official bug tag.'))
class ISeriesBugTarget(Interface):
diff --git a/lib/lp/bugs/interfaces/bugtaskfilter.py b/lib/lp/bugs/interfaces/bugtaskfilter.py
index 463199d..e5dec82 100644
--- a/lib/lp/bugs/interfaces/bugtaskfilter.py
+++ b/lib/lp/bugs/interfaces/bugtaskfilter.py
@@ -16,8 +16,6 @@ from collections import (
)
from operator import attrgetter
-import six
-
from lp.bugs.interfaces.bugtarget import IHasBugs
@@ -68,5 +66,5 @@ def filter_bugtasks_by_context(context, bugtasks):
for task in bugtasks:
bug_mapping[task.bug_id].append(weight_calculator(task))
- filtered = [sorted(tasks)[0].task for tasks in six.itervalues(bug_mapping)]
+ filtered = [sorted(tasks)[0].task for tasks in bug_mapping.values()]
return sorted(filtered, key=attrgetter('bug_id'))
diff --git a/lib/lp/bugs/interfaces/bugtasksearch.py b/lib/lp/bugs/interfaces/bugtasksearch.py
index 7c18d58..2dd486f 100644
--- a/lib/lp/bugs/interfaces/bugtasksearch.py
+++ b/lib/lp/bugs/interfaces/bugtasksearch.py
@@ -631,7 +631,7 @@ class IUpstreamProductBugTaskSearch(IBugTaskSearch):
class IFrontPageBugTaskSearch(IBugTaskSearch):
"""Additional search options for the front page of bugs."""
scope = Choice(
- title=u"Search Scope", required=False,
+ title="Search Scope", required=False,
vocabulary="DistributionOrProductOrProjectGroup")
diff --git a/lib/lp/bugs/interfaces/bugtracker.py b/lib/lp/bugs/interfaces/bugtracker.py
index 22fc4e9..28b2d82 100644
--- a/lib/lp/bugs/interfaces/bugtracker.py
+++ b/lib/lp/bugs/interfaces/bugtracker.py
@@ -93,7 +93,7 @@ class BugTrackerURL(URIField):
def _validate(self, input):
"""Check that the URL is not already in use by another bugtracker."""
- super(BugTrackerURL, self)._validate(input)
+ super()._validate(input)
bugtracker = getUtility(IBugTrackerSet).queryByBaseURL(input)
if bugtracker is not None and bugtracker != self.context:
raise LaunchpadValidationError(
@@ -391,7 +391,7 @@ class IBugTracker(Interface):
@operation_parameters(
component_group_name=TextLine(
- title=u"The name of the remote component group", required=True))
+ title="The name of the remote component group", required=True))
@operation_returns_entry(Interface)
@export_write_operation()
def addRemoteComponentGroup(component_group_name):
@@ -404,7 +404,7 @@ class IBugTracker(Interface):
@operation_parameters(
component_group_name=TextLine(
- title=u"The name of the remote component group",
+ title="The name of the remote component group",
required=True))
@operation_returns_entry(Interface)
@export_read_operation()
@@ -416,10 +416,10 @@ class IBugTracker(Interface):
@operation_parameters(
distribution=TextLine(
- title=u"The distribution for the source package",
+ title="The distribution for the source package",
required=True),
sourcepackagename=TextLine(
- title=u"The source package name",
+ title="The source package name",
required=True))
@operation_returns_entry(Interface)
@export_read_operation()
@@ -457,7 +457,7 @@ class IBugTrackerSet(Interface):
"""
@operation_parameters(
- name=TextLine(title=u"The bug tracker name", required=True))
+ name=TextLine(title="The bug tracker name", required=True))
@operation_returns_entry(IBugTracker)
@export_read_operation()
def getByName(name, default=None):
@@ -479,7 +479,7 @@ class IBugTrackerSet(Interface):
@rename_parameters_as(baseurl='base_url')
@operation_parameters(
baseurl=TextLine(
- title=u"The base URL of the bug tracker", required=True))
+ title="The base URL of the bug tracker", required=True))
@operation_returns_entry(IBugTracker)
@export_read_operation()
def queryByBaseURL(baseurl):
@@ -613,7 +613,7 @@ class IBugTrackerComponentGroup(Interface):
@operation_parameters(
component_name=TextLine(
- title=u"The name of the remote software component to be added",
+ title="The name of the remote software component to be added",
required=True))
@export_write_operation()
def addComponent(component_name):
diff --git a/lib/lp/bugs/interfaces/malone.py b/lib/lp/bugs/interfaces/malone.py
index 6836a20..02ff851 100644
--- a/lib/lp/bugs/interfaces/malone.py
+++ b/lib/lp/bugs/interfaces/malone.py
@@ -69,8 +69,8 @@ class IMaloneApplication(ILaunchpadApplication, IHasBugs):
@operation_parameters(
target=Reference(
schema=IBugTarget, required=True,
- title=u"The project, distribution or source package that has "
- "this bug."))
+ title="The project, distribution or source package that has "
+ "this bug."))
@export_factory_operation(
IBug, ['title', 'description', 'tags', 'information_type',
'security_related', 'private'])
diff --git a/lib/lp/bugs/interfaces/structuralsubscription.py b/lib/lp/bugs/interfaces/structuralsubscription.py
index 2a977d9..c4b7a01 100644
--- a/lib/lp/bugs/interfaces/structuralsubscription.py
+++ b/lib/lp/bugs/interfaces/structuralsubscription.py
@@ -262,5 +262,5 @@ class IStructuralSubscriptionTargetHelper(Interface):
class IStructuralSubscriptionForm(Interface):
"""Schema for the structural subscription form."""
subscribe_me = Bool(
- title=u"I want to receive these notifications by email.",
+ title="I want to receive these notifications by email.",
required=False)
diff --git a/lib/lp/bugs/model/apportjob.py b/lib/lp/bugs/model/apportjob.py
index 5b94879..e91ab3f 100644
--- a/lib/lp/bugs/model/apportjob.py
+++ b/lib/lp/bugs/model/apportjob.py
@@ -89,7 +89,7 @@ class ApportJob(StormBase):
:param metadata: The type-specific variables, as a JSON-compatible
dict.
"""
- super(ApportJob, self).__init__()
+ super().__init__()
json_data = simplejson.dumps(metadata)
self.job = Job()
self.blob = blob
@@ -193,7 +193,7 @@ class ProcessApportBlobJob(ApportJobDerived):
if job_for_blob is not None:
return cls(job_for_blob)
else:
- return super(ProcessApportBlobJob, cls).create(blob)
+ return super().create(blob)
@classmethod
def getByBlobUUID(cls, uuid):
diff --git a/lib/lp/bugs/model/bug.py b/lib/lp/bugs/model/bug.py
index 52c413a..0a3ff8c 100644
--- a/lib/lp/bugs/model/bug.py
+++ b/lib/lp/bugs/model/bug.py
@@ -27,7 +27,6 @@ import re
from lazr.lifecycle.event import ObjectCreatedEvent
from lazr.lifecycle.snapshot import Snapshot
import pytz
-import six
from six.moves.collections_abc import (
Iterable,
Set,
@@ -398,7 +397,7 @@ class Bug(SQLBase, InformationTypeMixin):
from lp.bugs.model.cve import Cve
xref_cve_sequences = [
sequence for _, sequence in getUtility(IXRefSet).findFrom(
- (u'bug', six.text_type(self.id)), types=[u'cve'])]
+ ('bug', str(self.id)), types=['cve'])]
expr = Cve.sequence.is_in(xref_cve_sequences)
return list(sorted(
IStore(Cve).find(Cve, expr), key=operator.attrgetter('sequence')))
@@ -408,7 +407,7 @@ class Bug(SQLBase, InformationTypeMixin):
from lp.answers.model.question import Question
question_ids = [
int(id) for _, id in getUtility(IXRefSet).findFrom(
- (u'bug', six.text_type(self.id)), types=[u'question'])]
+ ('bug', str(self.id)), types=['question'])]
return list(sorted(
bulk.load(Question, question_ids), key=operator.attrgetter('id')))
@@ -417,7 +416,7 @@ class Bug(SQLBase, InformationTypeMixin):
from lp.blueprints.model.specification import Specification
spec_ids = [
int(id) for _, id in getUtility(IXRefSet).findFrom(
- (u'bug', six.text_type(self.id)), types=[u'specification'])]
+ ('bug', str(self.id)), types=['specification'])]
return list(sorted(
bulk.load(Specification, spec_ids), key=operator.attrgetter('id')))
@@ -1424,7 +1423,7 @@ class Bug(SQLBase, InformationTypeMixin):
from lp.code.model.branchmergeproposal import BranchMergeProposal
merge_proposal_ids = [
int(id) for _, id in getUtility(IXRefSet).findFrom(
- (u'bug', six.text_type(self.id)), types=[u'merge_proposal'])]
+ ('bug', str(self.id)), types=['merge_proposal'])]
return list(sorted(
bulk.load(BranchMergeProposal, merge_proposal_ids),
key=operator.attrgetter('id')))
@@ -2851,7 +2850,7 @@ class BugAffectsPerson(StormBase):
affected = Bool(allow_none=False, default=True)
def __init__(self, bug, person, affected=True):
- super(BugAffectsPerson, self).__init__()
+ super().__init__()
self.bug = bug
self.person = person
self.affected = affected
diff --git a/lib/lp/bugs/model/bugattachment.py b/lib/lp/bugs/model/bugattachment.py
index bfd85dc..d200d3d 100644
--- a/lib/lp/bugs/model/bugattachment.py
+++ b/lib/lp/bugs/model/bugattachment.py
@@ -72,7 +72,7 @@ class BugAttachment(SQLBase):
# in order to avoid problems with not deleted files as described
# in bug 387188.
self.libraryfile.content = None
- super(BugAttachment, self).destroySelf()
+ super().destroySelf()
def getFileByName(self, filename):
"""See IBugAttachment."""
diff --git a/lib/lp/bugs/model/bugbranch.py b/lib/lp/bugs/model/bugbranch.py
index 2987f97..83d8255 100644
--- a/lib/lp/bugs/model/bugbranch.py
+++ b/lib/lp/bugs/model/bugbranch.py
@@ -47,7 +47,7 @@ class BugBranch(StormBase):
registrant = Reference(registrant_id, 'Person.id')
def __init__(self, branch, bug, registrant):
- super(BugBranch, self).__init__()
+ super().__init__()
self.branch = branch
self.bug = bug
self.registrant = registrant
diff --git a/lib/lp/bugs/model/buglinktarget.py b/lib/lp/bugs/model/buglinktarget.py
index 075e282..d4210f0 100644
--- a/lib/lp/bugs/model/buglinktarget.py
+++ b/lib/lp/bugs/model/buglinktarget.py
@@ -25,7 +25,7 @@ from lp.bugs.interfaces.buglink import (
class ObjectLinkedEvent(lazr.lifecycle.event.LifecyleEventBase):
def __init__(self, object, other_object, user=None):
- super(ObjectLinkedEvent, self).__init__(object, user=user)
+ super().__init__(object, user=user)
self.other_object = other_object
@@ -33,7 +33,7 @@ class ObjectLinkedEvent(lazr.lifecycle.event.LifecyleEventBase):
class ObjectUnlinkedEvent(lazr.lifecycle.event.LifecyleEventBase):
def __init__(self, object, other_object, user=None):
- super(ObjectUnlinkedEvent, self).__init__(object, user=user)
+ super().__init__(object, user=user)
self.other_object = other_object
diff --git a/lib/lp/bugs/model/bugsubscription.py b/lib/lp/bugs/model/bugsubscription.py
index d954fef..aba7de9 100644
--- a/lib/lp/bugs/model/bugsubscription.py
+++ b/lib/lp/bugs/model/bugsubscription.py
@@ -49,7 +49,7 @@ class BugSubscription(StormBase):
def __init__(self, bug=None, person=None, subscribed_by=None,
bug_notification_level=BugNotificationLevel.COMMENTS):
- super(BugSubscription, self).__init__()
+ super().__init__()
self.bug = bug
self.person = person
self.subscribed_by = subscribed_by
@@ -59,18 +59,18 @@ class BugSubscription(StormBase):
def display_subscribed_by(self):
"""See `IBugSubscription`."""
if self.person_id == self.subscribed_by_id:
- return u'Self-subscribed'
+ return 'Self-subscribed'
else:
- return u'Subscribed by %s (%s)' % (
+ return 'Subscribed by %s (%s)' % (
self.subscribed_by.displayname, self.subscribed_by.name)
@property
def display_duplicate_subscribed_by(self):
"""See `IBugSubscription`."""
if self.person == self.subscribed_by:
- return u'Self-subscribed to bug %s' % (self.bug_id)
+ return 'Self-subscribed to bug %s' % (self.bug_id)
else:
- return u'Subscribed to bug %s by %s (%s)' % (
+ return 'Subscribed to bug %s by %s (%s)' % (
self.bug_id, self.subscribed_by.displayname,
self.subscribed_by.name)
diff --git a/lib/lp/bugs/model/bugsubscriptionfilter.py b/lib/lp/bugs/model/bugsubscriptionfilter.py
index bf01a36..c2bb9f5 100644
--- a/lib/lp/bugs/model/bugsubscriptionfilter.py
+++ b/lib/lp/bugs/model/bugsubscriptionfilter.py
@@ -85,7 +85,7 @@ class BugSubscriptionFilter(StormBase):
find_all_tags=False,
include_any_tags=False, exclude_any_tags=False,
other_parameters=None, description=None):
- super(BugSubscriptionFilter, self).__init__()
+ super().__init__()
self.structural_subscription = structural_subscription
self.bug_notification_level = bug_notification_level
self.find_all_tags = find_all_tags
@@ -147,9 +147,9 @@ class BugSubscriptionFilter(StormBase):
"""Return a frozenset of tags to filter on."""
wildcards = []
if self.include_any_tags:
- wildcards.append(u"*")
+ wildcards.append("*")
if self.exclude_any_tags:
- wildcards.append(u"-*")
+ wildcards.append("-*")
tags = (
tag_filter.qualified_tag
for tag_filter in IStore(BugSubscriptionFilterTag).find(
@@ -179,7 +179,7 @@ class BugSubscriptionFilter(StormBase):
else:
# Leave find_all_tags unchanged.
tags = frozenset(tags)
- wildcards = frozenset((u"*", u"-*")).intersection(tags)
+ wildcards = frozenset(("*", "-*")).intersection(tags)
# Set wildcards.
self.include_any_tags = "*" in wildcards
self.exclude_any_tags = "-*" in wildcards
@@ -380,7 +380,7 @@ class BugSubscriptionFilterTag(StormBase):
if self.include:
return self.tag
else:
- return u"-" + self.tag
+ return "-" + self.tag
class BugSubscriptionFilterInformationType(StormBase):
diff --git a/lib/lp/bugs/model/bugtask.py b/lib/lp/bugs/model/bugtask.py
index dff8df5..2cd2b35 100644
--- a/lib/lp/bugs/model/bugtask.py
+++ b/lib/lp/bugs/model/bugtask.py
@@ -30,7 +30,6 @@ import re
from lazr.lifecycle.event import ObjectDeletedEvent
import pytz
-import six
from storm.expr import (
And,
Cast,
@@ -1177,7 +1176,7 @@ class BugTask(StormBase):
new_key['sourcepackagename'] != self.sourcepackagename):
self._syncSourcePackages(new_key['sourcepackagename'], user)
- for name, value in six.iteritems(new_key):
+ for name, value in new_key.items():
setattr(self, name, value)
self.updateTargetNameCache()
self.bug._reconcileAccess()
@@ -1430,8 +1429,8 @@ class BugTaskSet:
bug_ids = {bugtask.bug_id for bugtask in bugtasks}
bug_ids_with_specifications = {
int(id) for _, id in getUtility(IXRefSet).findFromMany(
- [(u'bug', six.text_type(bug_id)) for bug_id in bug_ids],
- types=[u'specification']).keys()}
+ [('bug', str(bug_id)) for bug_id in bug_ids],
+ types=['specification']).keys()}
bug_ids_with_branches = set(IStore(BugBranch).find(
BugBranch.bug_id, BugBranch.bug_id.is_in(bug_ids)))
# Badging looks up milestones too : eager load into the storm cache.
@@ -1770,7 +1769,7 @@ class BugTaskSet:
BugTaskFlat.milestone == None,
BugTaskFlat.duplicateof == None,
BugTaskFlat.date_last_updated <
- UTC_NOW - SQL("INTERVAL ?", (u'%d days' % min_days_old,)),
+ UTC_NOW - SQL("INTERVAL ?", ('%d days' % min_days_old,)),
Not(Exists(Select(
1, tables=[BugWatch],
where=[BugWatch.bugID == BugTaskFlat.bug_id]))),
diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py
index fd1ec25..1bf2eed 100644
--- a/lib/lp/bugs/model/bugtasksearch.py
+++ b/lib/lp/bugs/model/bugtasksearch.py
@@ -430,9 +430,9 @@ def _build_query(params):
if params.has_cve:
where = [
- XRef.from_type == u'bug',
+ XRef.from_type == 'bug',
XRef.from_id_int == BugTaskFlat.bug_id,
- XRef.to_type == u'cve',
+ XRef.to_type == 'cve',
]
extra_clauses.append(Exists(Select(
1, tables=[XRef], where=And(*where))))
@@ -643,8 +643,8 @@ def _build_query(params):
# doesn't really give us any better way to exclude
# the bug creation event.
Or(
- BugActivity.whatchanged != u'bug',
- BugActivity.message != u'added bug')))))))
+ BugActivity.whatchanged != 'bug',
+ BugActivity.message != 'added bug')))))))
with_clauses.append(convert_storm_clause_to_string(
With('commented_bugtask_ids',
Select(
@@ -707,9 +707,9 @@ def _build_query(params):
def make_merge_proposal_clause(merge_proposals=None):
where = [
- XRef.from_type == u'bug',
+ XRef.from_type == 'bug',
XRef.from_id_int == BugTaskFlat.bug_id,
- XRef.to_type == u'merge_proposal',
+ XRef.to_type == 'merge_proposal',
]
if merge_proposals is not None:
where.append(
@@ -839,7 +839,7 @@ def _process_order_by(params):
orderby_arg.append(orderby_col)
continue
desc_search = False
- if orderby_col.startswith(u"-"):
+ if orderby_col.startswith("-"):
orderby_col = orderby_col[1:]
desc_search = True
if orderby_col not in orderby_expression:
@@ -1006,9 +1006,9 @@ def _build_blueprint_related_clause(params):
def make_clause(blueprints=None):
where = [
- XRef.from_type == u'bug',
+ XRef.from_type == 'bug',
XRef.from_id_int == BugTaskFlat.bug_id,
- XRef.to_type == u'specification',
+ XRef.to_type == 'specification',
]
if blueprints is not None:
where.append(
diff --git a/lib/lp/bugs/model/bugtracker.py b/lib/lp/bugs/model/bugtracker.py
index 57edcb6..a8070ae 100644
--- a/lib/lp/bugs/model/bugtracker.py
+++ b/lib/lp/bugs/model/bugtracker.py
@@ -772,8 +772,7 @@ class BugTrackerSet:
return item
def __iter__(self):
- for row in self.table.select(orderBy="title"):
- yield row
+ yield from self.table.select(orderBy="title")
def queryByBaseURL(self, baseurl):
"""See `IBugTrackerSet`."""
diff --git a/lib/lp/bugs/model/bugwatch.py b/lib/lp/bugs/model/bugwatch.py
index da5f814..e9dc359 100644
--- a/lib/lp/bugs/model/bugwatch.py
+++ b/lib/lp/bugs/model/bugwatch.py
@@ -107,7 +107,7 @@ def get_bug_watch_ids(references):
for reference in references:
if IBugWatch.providedBy(reference):
yield reference.id
- elif isinstance(reference, six.integer_types):
+ elif isinstance(reference, int):
yield reference
else:
raise AssertionError(
diff --git a/lib/lp/bugs/model/cve.py b/lib/lp/bugs/model/cve.py
index 07c26db..27a40b5 100644
--- a/lib/lp/bugs/model/cve.py
+++ b/lib/lp/bugs/model/cve.py
@@ -9,7 +9,6 @@ __all__ = [
import operator
import pytz
-import six
from storm.locals import (
DateTime,
Desc,
@@ -62,7 +61,7 @@ class Cve(StormBase, BugLinkTargetMixin):
id, 'CveReference.cve_id', order_by='CveReference.id')
def __init__(self, sequence, status, description):
- super(Cve, self).__init__()
+ super().__init__()
self.sequence = sequence
self.status = status
self.description = description
@@ -85,7 +84,7 @@ class Cve(StormBase, BugLinkTargetMixin):
def bugs(self):
bug_ids = [
int(id) for _, id in getUtility(IXRefSet).findFrom(
- (u'cve', self.sequence), types=[u'bug'])]
+ ('cve', self.sequence), types=['bug'])]
return list(sorted(
bulk.load(Bug, bug_ids), key=operator.attrgetter('id')))
@@ -105,13 +104,12 @@ class Cve(StormBase, BugLinkTargetMixin):
props = {}
# XXX: Should set creator.
getUtility(IXRefSet).create(
- {(u'cve', self.sequence): {
- (u'bug', six.text_type(bug.id)): props}})
+ {('cve', self.sequence): {('bug', str(bug.id)): props}})
def deleteBugLink(self, bug):
"""See BugLinkTargetMixin."""
getUtility(IXRefSet).delete(
- {(u'cve', self.sequence): [(u'bug', six.text_type(bug.id))]})
+ {('cve', self.sequence): [('bug', str(bug.id))]})
@implementer(ICveSet)
@@ -191,7 +189,7 @@ class CveSet:
store = Store.of(bugtasks[0])
xrefs = getUtility(IXRefSet).findFromMany(
- [(u'bug', six.text_type(bug.id)) for bug in bugs], types=[u'cve'])
+ [('bug', str(bug.id)) for bug in bugs], types=['cve'])
bugcve_ids = set()
for bug_key in xrefs:
for cve_key in xrefs[bug_key]:
@@ -215,4 +213,4 @@ class CveSet:
def getBugCveCount(self):
"""See ICveSet."""
return IStore(XRef).find(
- XRef, XRef.from_type == u'bug', XRef.to_type == u'cve').count()
+ XRef, XRef.from_type == 'bug', XRef.to_type == 'cve').count()
diff --git a/lib/lp/bugs/model/cvereference.py b/lib/lp/bugs/model/cvereference.py
index 7713f8e..912fcaa 100644
--- a/lib/lp/bugs/model/cvereference.py
+++ b/lib/lp/bugs/model/cvereference.py
@@ -29,7 +29,7 @@ class CveReference(StormBase):
url = Unicode(allow_none=True, default=None)
def __init__(self, cve, source, content, url=None):
- super(CveReference, self).__init__()
+ super().__init__()
self.cve = cve
self.source = source
self.content = content
diff --git a/lib/lp/bugs/model/personsubscriptioninfo.py b/lib/lp/bugs/model/personsubscriptioninfo.py
index d0da76e..7f8c389 100644
--- a/lib/lp/bugs/model/personsubscriptioninfo.py
+++ b/lib/lp/bugs/model/personsubscriptioninfo.py
@@ -92,8 +92,7 @@ class VirtualSubscriptionInfoCollection(AbstractSubscriptionInfoCollection):
"""See `IVirtualSubscriptionInfoCollection`"""
def __init__(self, person, administrated_team_ids):
- super(VirtualSubscriptionInfoCollection, self).__init__(
- person, administrated_team_ids)
+ super().__init__(person, administrated_team_ids)
self._principal_pillar_to_info = {}
def _add_item_to_collection(self, collection, principal, bug, pillar,
@@ -113,8 +112,7 @@ class RealSubscriptionInfoCollection(
"""Core functionality for Duplicate and Direct"""
def __init__(self, person, administrated_team_ids):
- super(RealSubscriptionInfoCollection, self).__init__(
- person, administrated_team_ids)
+ super().__init__(person, administrated_team_ids)
self._principal_bug_to_infos = {}
def _add_item_to_collection(self, collection, principal, bug,
@@ -146,7 +144,7 @@ class RealSubscriptionInfoCollection(
@implementer(IPersonSubscriptions)
-class PersonSubscriptions(object):
+class PersonSubscriptions:
"""See `IPersonSubscriptions`."""
def __init__(self, person, bug):
diff --git a/lib/lp/bugs/model/structuralsubscription.py b/lib/lp/bugs/model/structuralsubscription.py
index c964d95..03c78ce 100644
--- a/lib/lp/bugs/model/structuralsubscription.py
+++ b/lib/lp/bugs/model/structuralsubscription.py
@@ -14,7 +14,6 @@ __all__ = [
from collections import defaultdict
import pytz
-import six
from storm.base import Storm
from storm.expr import (
And,
@@ -139,7 +138,7 @@ class StructuralSubscription(Storm):
def __init__(self, subscriber, subscribed_by, **kwargs):
self.subscriber = subscriber
self.subscribed_by = subscribed_by
- for arg, value in six.iteritems(kwargs):
+ for arg, value in kwargs.items():
setattr(self, arg, value)
@property
@@ -486,7 +485,7 @@ class StructuralSubscriptionTargetMixin:
"""See `IStructuralSubscriptionTarget`."""
from lp.registry.model.person import Person
clauses = [StructuralSubscription.subscriberID == Person.id]
- for key, value in six.iteritems(self._target_args):
+ for key, value in self._target_args.items():
clauses.append(
getattr(StructuralSubscription, key) == value)
@@ -951,7 +950,7 @@ def _calculate_tag_query(conditions, tags):
# space as, effectively, NULL. This is safe because a
# single space is not an acceptable tag. Again, the
# clearest alternative is defining a custom Postgres aggregator.
- tags_array = Cast(Array(tuple(tags) + (u" ",)), "text[]")
+ tags_array = Cast(Array(tuple(tags) + (" ",)), "text[]")
# Now let's build the select itself.
second_select = Select(
BugSubscriptionFilter.id,
diff --git a/lib/lp/bugs/model/tests/test_bug.py b/lib/lp/bugs/model/tests/test_bug.py
index d5bda2a..78c1c2e 100644
--- a/lib/lp/bugs/model/tests/test_bug.py
+++ b/lib/lp/bugs/model/tests/test_bug.py
@@ -976,7 +976,7 @@ class TestBugActivityMethods(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugActivityMethods, self).setUp()
+ super().setUp()
self.now = datetime.now(UTC)
def _makeActivityForBug(self, bug, activity_ages):
@@ -1067,7 +1067,7 @@ class TestBugAutoConfirmation(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug = self.factory.makeBug()
person = self.factory.makePerson()
with person_logged_in(person):
@@ -1079,7 +1079,7 @@ class TestBugAutoConfirmation(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug = self.factory.makeBug()
person = self.factory.makePerson()
with person_logged_in(bug.owner):
@@ -1093,7 +1093,7 @@ class TestBugAutoConfirmation(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug = self.factory.makeBug()
duplicate_bug = self.factory.makeBug()
with person_logged_in(duplicate_bug.owner):
@@ -1105,7 +1105,7 @@ class TestBugAutoConfirmation(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug = self.factory.makeBug()
with person_logged_in(bug.owner):
duplicate_bug = self.factory.makeBug(owner=bug.owner)
diff --git a/lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py b/lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py
index 1d1179a..bb023fc 100644
--- a/lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py
+++ b/lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py
@@ -37,7 +37,7 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilter, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
login_person(self.subscriber)
@@ -53,8 +53,8 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
find_all_tags=True,
include_any_tags=True,
exclude_any_tags=True,
- other_parameters=u"foo",
- description=u"bar")
+ other_parameters="foo",
+ description="bar")
# Flush and reload.
IStore(bug_subscription_filter).flush()
IStore(bug_subscription_filter).reload(bug_subscription_filter)
@@ -72,15 +72,15 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
self.assertEqual(
BugNotificationLevel.METADATA,
bug_subscription_filter.bug_notification_level)
- self.assertEqual(u"foo", bug_subscription_filter.other_parameters)
- self.assertEqual(u"bar", bug_subscription_filter.description)
+ self.assertEqual("foo", bug_subscription_filter.other_parameters)
+ self.assertEqual("bar", bug_subscription_filter.description)
def test_description(self):
"""Test the description property."""
bug_subscription_filter = self.factory.makeBugSubscriptionFilter(
target=self.target)
- bug_subscription_filter.description = u"foo"
- self.assertEqual(u"foo", bug_subscription_filter.description)
+ bug_subscription_filter.description = "foo"
+ self.assertEqual("foo", bug_subscription_filter.description)
def test_defaults(self):
"""Test the default values of `BugSubscriptionFilter` objects."""
@@ -108,7 +108,7 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
structural_subscription=self.subscription)
bug_subscription_filter.importances = [BugTaskImportance.LOW]
bug_subscription_filter.statuses = [BugTaskStatus.NEW]
- bug_subscription_filter.tags = [u"foo"]
+ bug_subscription_filter.tags = ["foo"]
IStore(bug_subscription_filter).flush()
self.assertIsNot(None, Store.of(bug_subscription_filter))
# Delete.
@@ -126,10 +126,10 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
bug_subscription_filter.find_all_tags = True
bug_subscription_filter.exclude_any_tags = True
bug_subscription_filter.include_any_tags = True
- bug_subscription_filter.description = u"Description"
+ bug_subscription_filter.description = "Description"
bug_subscription_filter.importances = [BugTaskImportance.LOW]
bug_subscription_filter.statuses = [BugTaskStatus.NEW]
- bug_subscription_filter.tags = [u"foo"]
+ bug_subscription_filter.tags = ["foo"]
IStore(bug_subscription_filter).flush()
self.assertIsNot(None, Store.of(bug_subscription_filter))
@@ -279,14 +279,14 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
# Assigning any iterable to tags updates the database.
bug_subscription_filter = self.factory.makeBugSubscriptionFilter(
target=self.target)
- bug_subscription_filter.tags = [u"foo", u"-bar"]
+ bug_subscription_filter.tags = ["foo", "-bar"]
self.assertEqual(
- frozenset((u"foo", u"-bar")),
+ frozenset(("foo", "-bar")),
bug_subscription_filter.tags)
# Assigning a subset causes the other tag filters to be removed.
- bug_subscription_filter.tags = [u"foo"]
+ bug_subscription_filter.tags = ["foo"]
self.assertEqual(
- frozenset((u"foo",)),
+ frozenset(("foo",)),
bug_subscription_filter.tags)
def test_tags_set_empty(self):
@@ -305,19 +305,19 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
self.assertFalse(bug_subscription_filter.include_any_tags)
self.assertFalse(bug_subscription_filter.exclude_any_tags)
- bug_subscription_filter.tags = [u"*"]
- self.assertEqual(frozenset((u"*",)), bug_subscription_filter.tags)
+ bug_subscription_filter.tags = ["*"]
+ self.assertEqual(frozenset(("*",)), bug_subscription_filter.tags)
self.assertTrue(bug_subscription_filter.include_any_tags)
self.assertFalse(bug_subscription_filter.exclude_any_tags)
- bug_subscription_filter.tags = [u"-*"]
- self.assertEqual(frozenset((u"-*",)), bug_subscription_filter.tags)
+ bug_subscription_filter.tags = ["-*"]
+ self.assertEqual(frozenset(("-*",)), bug_subscription_filter.tags)
self.assertFalse(bug_subscription_filter.include_any_tags)
self.assertTrue(bug_subscription_filter.exclude_any_tags)
- bug_subscription_filter.tags = [u"*", u"-*"]
+ bug_subscription_filter.tags = ["*", "-*"]
self.assertEqual(
- frozenset((u"*", u"-*")), bug_subscription_filter.tags)
+ frozenset(("*", "-*")), bug_subscription_filter.tags)
self.assertTrue(bug_subscription_filter.include_any_tags)
self.assertTrue(bug_subscription_filter.exclude_any_tags)
@@ -334,18 +334,18 @@ class TestBugSubscriptionFilter(TestCaseWithFactory):
self.assertEqual(frozenset(), bug_subscription_filter.tags)
self.assertFalse(bug_subscription_filter.find_all_tags)
- bug_subscription_filter.tags = searchbuilder.all(u"foo")
- self.assertEqual(frozenset((u"foo",)), bug_subscription_filter.tags)
+ bug_subscription_filter.tags = searchbuilder.all("foo")
+ self.assertEqual(frozenset(("foo",)), bug_subscription_filter.tags)
self.assertTrue(bug_subscription_filter.find_all_tags)
# Not using `searchbuilder.any` or `.all` leaves find_all_tags
# unchanged.
- bug_subscription_filter.tags = [u"-bar"]
- self.assertEqual(frozenset((u"-bar",)), bug_subscription_filter.tags)
+ bug_subscription_filter.tags = ["-bar"]
+ self.assertEqual(frozenset(("-bar",)), bug_subscription_filter.tags)
self.assertTrue(bug_subscription_filter.find_all_tags)
- bug_subscription_filter.tags = searchbuilder.any(u"baz")
- self.assertEqual(frozenset((u"baz",)), bug_subscription_filter.tags)
+ bug_subscription_filter.tags = searchbuilder.any("baz")
+ self.assertEqual(frozenset(("baz",)), bug_subscription_filter.tags)
self.assertFalse(bug_subscription_filter.find_all_tags)
@@ -354,7 +354,7 @@ class TestBugSubscriptionFilterPermissions(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilterPermissions, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
with person_logged_in(self.subscriber):
@@ -415,7 +415,7 @@ class TestBugSubscriptionFilterImportance(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilterImportance, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
login_person(self.subscriber)
@@ -447,7 +447,7 @@ class TestBugSubscriptionFilterStatus(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilterStatus, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
login_person(self.subscriber)
@@ -478,7 +478,7 @@ class TestBugSubscriptionFilterTag(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilterTag, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
login_person(self.subscriber)
@@ -493,7 +493,7 @@ class TestBugSubscriptionFilterTag(TestCaseWithFactory):
bug_sub_filter_tag = BugSubscriptionFilterTag()
bug_sub_filter_tag.filter = self.subscription_filter
bug_sub_filter_tag.include = True
- bug_sub_filter_tag.tag = u"foo"
+ bug_sub_filter_tag.tag = "foo"
# Flush and reload.
IStore(bug_sub_filter_tag).flush()
IStore(bug_sub_filter_tag).reload(bug_sub_filter_tag)
@@ -506,7 +506,7 @@ class TestBugSubscriptionFilterTag(TestCaseWithFactory):
self.subscription_filter,
bug_sub_filter_tag.filter)
self.assertIs(True, bug_sub_filter_tag.include)
- self.assertEqual(u"foo", bug_sub_filter_tag.tag)
+ self.assertEqual("foo", bug_sub_filter_tag.tag)
def test_qualified_tag(self):
"""
@@ -514,11 +514,11 @@ class TestBugSubscriptionFilterTag(TestCaseWithFactory):
preceding hyphen if `include` is `False`.
"""
bug_sub_filter_tag = BugSubscriptionFilterTag()
- bug_sub_filter_tag.tag = u"foo"
+ bug_sub_filter_tag.tag = "foo"
bug_sub_filter_tag.include = True
- self.assertEqual(u"foo", bug_sub_filter_tag.qualified_tag)
+ self.assertEqual("foo", bug_sub_filter_tag.qualified_tag)
bug_sub_filter_tag.include = False
- self.assertEqual(u"-foo", bug_sub_filter_tag.qualified_tag)
+ self.assertEqual("-foo", bug_sub_filter_tag.qualified_tag)
class TestBugSubscriptionFilterInformationType(TestCaseWithFactory):
@@ -526,7 +526,7 @@ class TestBugSubscriptionFilterInformationType(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionFilterInformationType, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.subscriber = self.target.owner
login_person(self.subscriber)
diff --git a/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py b/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
index 9a1ad47..50f6020 100644
--- a/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
+++ b/lib/lp/bugs/model/tests/test_bugsubscriptioninfo.py
@@ -5,7 +5,6 @@
from contextlib import contextmanager
-import six
from six.moves.collections_abc import Set
from storm.store import Store
from testtools.matchers import Equals
@@ -58,13 +57,13 @@ class TestSubscriptionRelatedSets(TestCaseWithFactory):
name_pairs_sorted = ("A", "xa"), ("B", "xb"), ("C", "xc"), ("C", "xd")
def setUp(self):
- super(TestSubscriptionRelatedSets, self).setUp()
+ super().setUp()
make_person = lambda displayname, name: (
self.factory.makePerson(displayname=displayname, name=name))
subscribers = {
name_pair: make_person(*name_pair)
for name_pair in self.name_pairs}
- self.subscribers_set = frozenset(six.itervalues(subscribers))
+ self.subscribers_set = frozenset(subscribers.values())
self.subscribers_sorted = tuple(
subscribers[name_pair] for name_pair in self.name_pairs_sorted)
@@ -120,7 +119,7 @@ class TestBugSubscriptionInfo(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionInfo, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct(
bug_supervisor=self.factory.makePerson())
self.bug = self.factory.makeBug(target=self.target)
@@ -428,7 +427,7 @@ class TestBugSubscriptionInfoPermissions(TestCaseWithFactory):
self.assertEqual({}, checker.set_permissions)
# All attributes require launchpad.View.
- permissions = set(six.itervalues(checker.get_permissions))
+ permissions = set(checker.get_permissions.values())
self.assertContentEqual(["launchpad.View"], permissions)
# The security adapter for launchpad.View lets anyone reference the
@@ -444,7 +443,7 @@ class TestBugSubscriptionInfoQueries(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugSubscriptionInfoQueries, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
self.bug = self.factory.makeBug(target=self.target)
self.info = BugSubscriptionInfo(
diff --git a/lib/lp/bugs/model/tests/test_bugsummary.py b/lib/lp/bugs/model/tests/test_bugsummary.py
index 6f52a91..f9f7800 100644
--- a/lib/lp/bugs/model/tests/test_bugsummary.py
+++ b/lib/lp/bugs/model/tests/test_bugsummary.py
@@ -34,7 +34,7 @@ class TestBugSummary(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestBugSummary, self).setUp()
+ super().setUp()
# Some things we are testing are impossible as mere mortals,
# but might happen from the SQL command line.
@@ -67,7 +67,7 @@ class TestBugSummary(TestCaseWithFactory):
self.assertTrue(IBugSummary.providedBy(bug_summary))
def test_addTag(self):
- tag = u'pustular'
+ tag = 'pustular'
# Ensure nothing using our tag yet.
self.assertCount(0, tag=tag)
@@ -86,8 +86,8 @@ class TestBugSummary(TestCaseWithFactory):
self.assertCount(3, tag=tag)
def test_changeTag(self):
- old_tag = u'pustular'
- new_tag = u'flatulent'
+ old_tag = 'pustular'
+ new_tag = 'flatulent'
# Ensure nothing using our tags yet.
self.assertCount(0, tag=old_tag)
@@ -115,7 +115,7 @@ class TestBugSummary(TestCaseWithFactory):
self.assertCount(3, tag=new_tag)
def test_removeTag(self):
- tag = u'pustular'
+ tag = 'pustular'
# Ensure nothing using our tags yet.
self.assertCount(0, tag=tag)
diff --git a/lib/lp/bugs/model/tests/test_bugtask.py b/lib/lp/bugs/model/tests/test_bugtask.py
index fdf666b..f50033f 100644
--- a/lib/lp/bugs/model/tests/test_bugtask.py
+++ b/lib/lp/bugs/model/tests/test_bugtask.py
@@ -133,7 +133,7 @@ class TestBugTaskAdaptation(TestCase):
bugtask_four = getUtility(IBugTaskSet).get(4)
bug = IBug(bugtask_four)
self.assertEqual(bug.title,
- u'Firefox does not support SVG')
+ 'Firefox does not support SVG')
class TestBugTaskCreation(TestCaseWithFactory):
@@ -372,16 +372,16 @@ class TestBugTaskTargets(TestCase):
IDistributionSourcePackage.providedBy(debian_ff_task.target))
target = debian_ff_task.target
- self.assertEqual(target.distribution.name, u'debian')
- self.assertEqual(target.sourcepackagename.name, u'mozilla-firefox')
+ self.assertEqual(target.distribution.name, 'debian')
+ self.assertEqual(target.sourcepackagename.name, 'mozilla-firefox')
ubuntu_linux_task = bugtaskset.get(25)
self.assertTrue(
IDistributionSourcePackage.providedBy(ubuntu_linux_task.target))
target = ubuntu_linux_task.target
- self.assertEqual(target.distribution.name, u'ubuntu')
- self.assertEqual(target.sourcepackagename.name, u'linux-source-2.6.15')
+ self.assertEqual(target.distribution.name, 'ubuntu')
+ self.assertEqual(target.sourcepackagename.name, 'linux-source-2.6.15')
def test_bugtask_target_distroseries_sourcepackage(self):
"""The 'target' of a task can be a distroseries sourcepackage"""
@@ -413,9 +413,9 @@ class TestBugTaskTargetName(TestCase):
bugtask = bugtaskset.get(17)
self.assertEqual(bugtask.bugtargetdisplayname,
- u'mozilla-firefox (Ubuntu)')
+ 'mozilla-firefox (Ubuntu)')
self.assertEqual(bugtask.bugtargetname,
- u'mozilla-firefox (Ubuntu)')
+ 'mozilla-firefox (Ubuntu)')
def test_targetname_series_product(self):
"""The targetname for distro series/product versions will be name of
@@ -424,8 +424,8 @@ class TestBugTaskTargetName(TestCase):
bugtaskset = getUtility(IBugTaskSet)
bugtask = bugtaskset.get(2)
- self.assertEqual(bugtask.bugtargetdisplayname, u'Mozilla Firefox')
- self.assertEqual(bugtask.bugtargetname, u'firefox')
+ self.assertEqual(bugtask.bugtargetdisplayname, 'Mozilla Firefox')
+ self.assertEqual(bugtask.bugtargetname, 'firefox')
class TestEditingBugTask(TestCase):
@@ -502,14 +502,14 @@ class TestBugTaskTags(TestCase):
bug_three = getUtility(IBugSet).get(3)
another_bugtask = bug_three.bugtasks[0]
- some_bugtask.bug.tags = [u'foo', u'bar']
- another_bugtask.bug.tags = [u'baz', u'bop']
+ some_bugtask.bug.tags = ['foo', 'bar']
+ another_bugtask.bug.tags = ['baz', 'bop']
tags_by_task = getUtility(IBugTaskSet).getBugTaskTags([
some_bugtask, another_bugtask])
self.assertEqual(
tags_by_task,
- {3: [u'bar', u'foo'], 6: [u'baz', u'bop']})
+ {3: ['bar', 'foo'], 6: ['baz', 'bop']})
class TestBugTaskBadges(TestCaseWithFactory):
@@ -744,7 +744,7 @@ class TestBugTaskDelta(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskDelta, self).setUp()
+ super().setUp()
login('foo.bar@xxxxxxxxxxxxx')
def test_get_empty_delta(self):
@@ -951,7 +951,7 @@ class TestBugTaskPermissionsToSetAssigneeMixin:
owners, bug supervisors, drivers
- bug tasks for the targets
"""
- super(TestBugTaskPermissionsToSetAssigneeMixin, self).setUp()
+ super().setUp()
self.target_owner_member = self.factory.makePerson()
self.target_owner_team = self.factory.makeTeam(
owner=self.target_owner_member,
@@ -1518,7 +1518,7 @@ class TestStatusCountsForProductSeries(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestStatusCountsForProductSeries, self).setUp()
+ super().setUp()
self.bugtask_set = getUtility(IBugTaskSet)
self.owner = self.factory.makePerson()
login_person(self.owner)
@@ -1610,7 +1610,7 @@ class TestBugTaskMilestones(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskMilestones, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.product_bug = self.factory.makeBug(target=self.product)
self.product_milestone = self.factory.makeMilestone(
@@ -2003,8 +2003,8 @@ class TestAutoConfirmBugTasksFlagForProduct(TestCaseWithFactory):
def makeTarget(self):
return self.factory.makeProduct()
- flag = u'bugs.autoconfirm.enabled_product_names'
- alt_flag = u'bugs.autoconfirm.enabled_distribution_names'
+ flag = 'bugs.autoconfirm.enabled_product_names'
+ alt_flag = 'bugs.autoconfirm.enabled_distribution_names'
def test_False(self):
# With no feature flags turned on, we do not auto-confirm.
@@ -2014,7 +2014,7 @@ class TestAutoConfirmBugTasksFlagForProduct(TestCaseWithFactory):
def test_flag_False(self):
bug_task = self.factory.makeBugTask(target=self.makeTarget())
- with FeatureFixture({self.flag: u' '}):
+ with FeatureFixture({self.flag: ' '}):
self.assertFalse(
removeSecurityProxy(bug_task)._checkAutoconfirmFeatureFlag())
@@ -2026,14 +2026,14 @@ class TestAutoConfirmBugTasksFlagForProduct(TestCaseWithFactory):
def test_explicit_flag_of_many(self):
bug_task = self.factory.makeBugTask(target=self.makeTarget())
- flag_value = u' foo bar ' + bug_task.pillar.name + ' baz '
+ flag_value = ' foo bar ' + bug_task.pillar.name + ' baz '
with FeatureFixture({self.flag: flag_value}):
self.assertTrue(
removeSecurityProxy(bug_task)._checkAutoconfirmFeatureFlag())
def test_match_all_flag(self):
bug_task = self.factory.makeBugTask(target=self.makeTarget())
- with FeatureFixture({self.flag: u'*'}):
+ with FeatureFixture({self.flag: '*'}):
self.assertTrue(
removeSecurityProxy(bug_task)._checkAutoconfirmFeatureFlag())
@@ -2103,7 +2103,7 @@ class TestAutoConfirmBugTasksTransitionToTarget(TestCaseWithFactory):
autoconfirm_product = self.factory.makeProduct(owner=person)
no_autoconfirm_product = self.factory.makeProduct(owner=person)
with FeatureFixture({
- u'bugs.autoconfirm.enabled_product_names':
+ 'bugs.autoconfirm.enabled_product_names':
autoconfirm_product.name}):
bug_task = self.factory.makeBugTask(
target=no_autoconfirm_product, owner=person)
@@ -2120,7 +2120,7 @@ class TestAutoConfirmBugTasksTransitionToTarget(TestCaseWithFactory):
autoconfirm_product = self.factory.makeProduct(owner=person)
no_autoconfirm_product = self.factory.makeProduct(owner=person)
with FeatureFixture({
- u'bugs.autoconfirm.enabled_product_names':
+ 'bugs.autoconfirm.enabled_product_names':
autoconfirm_product.name}):
bug_task = self.factory.makeBugTask(
target=no_autoconfirm_product, owner=person)
@@ -2147,7 +2147,7 @@ class TestAutoConfirmBugTasks(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug_task = self.factory.makeBugTask()
bug = bug_task.bug
self.assertEqual(BugTaskStatus.NEW, bug_task.status)
@@ -2167,7 +2167,7 @@ class TestAutoConfirmBugTasks(TestCaseWithFactory):
self.assertEqual(
original_comment_count + 1, bug.messages.count())
self.assertEqual(
- u"Status changed to 'Confirmed' because the bug affects "
+ "Status changed to 'Confirmed' because the bug affects "
"multiple users.",
bug.messages[-1].text_contents)
@@ -2176,7 +2176,7 @@ class TestAutoConfirmBugTasks(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
product = self.factory.makeProduct()
with person_logged_in(product.owner):
bug = self.factory.makeBug(
@@ -2195,7 +2195,7 @@ class TestAutoConfirmBugTasks(TestCaseWithFactory):
# When feature flag code is removed, remove the next two lines and
# dedent the rest.
with feature_flags():
- set_feature_flag(u'bugs.autoconfirm.enabled_product_names', u'*')
+ set_feature_flag('bugs.autoconfirm.enabled_product_names', '*')
bug_task = self.factory.makeBugTask()
removeSecurityProxy(bug_task).transitionToStatus(
BugTaskStatus.CONFIRMED, bug_task.bug.owner)
@@ -2575,7 +2575,7 @@ class TestTransitionsRemovesSubscribersJob(TestCaseWithFactory):
self.useFixture(FeatureFixture({
'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob',
}))
- super(TestTransitionsRemovesSubscribersJob, self).setUp()
+ super().setUp()
def _assert_bug_change_unsubscribes(self, change_callback,
ignore_policy_grantee_check=False):
@@ -3106,7 +3106,7 @@ class TestBugTaskUserHasBugSupervisorPrivileges(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskUserHasBugSupervisorPrivileges, self).setUp()
+ super().setUp()
self.celebrities = getUtility(ILaunchpadCelebrities)
def test_admin_is_allowed(self):
@@ -3257,13 +3257,13 @@ class TestTargetNameCache(TestCase):
upstream_task = getUtility(IBugTaskSet).createTask(
bug_one, mark, netapplet,
status=BugTaskStatus.NEW, importance=BugTaskImportance.MEDIUM)
- self.assertEqual(upstream_task.bugtargetdisplayname, u'NetApplet')
+ self.assertEqual(upstream_task.bugtargetdisplayname, 'NetApplet')
thunderbird = getUtility(IProductSet).get(8)
upstream_task_id = upstream_task.id
upstream_task.transitionToTarget(thunderbird, bug_one.owner)
self.assertEqual(upstream_task.bugtargetdisplayname,
- u'Mozilla Thunderbird')
+ 'Mozilla Thunderbird')
thunderbird.name = 'thunderbird-ng'
thunderbird.display_name = 'Mozilla Thunderbird NG'
@@ -3288,7 +3288,7 @@ class TestTargetNameCache(TestCase):
self.assertTrue('INFO Calculating targets.' in err)
self.assertTrue('INFO Will check ' in err)
self.assertTrue(
- ('INFO Updating ' + repr((u'Mozilla Thunderbird',))) in err)
+ ('INFO Updating ' + repr(('Mozilla Thunderbird',))) in err)
self.assertTrue('INFO Updated 1 target names.' in err)
self.assertTrue('INFO Finished updating targetname cache' in err)
@@ -3302,7 +3302,7 @@ class TestTargetNameCache(TestCase):
self.assertEqual(
getUtility(IBugTaskSet).get(upstream_task_id).bugtargetdisplayname,
- u'Mozilla Thunderbird NG')
+ 'Mozilla Thunderbird NG')
# With sourcepackage bugtasks that have accepted nominations to a
# series, additional sourcepackage bugtasks are automatically
@@ -3349,7 +3349,7 @@ class TestTargetNameCache(TestCase):
transaction.commit()
self.assertEqual(upstream_task.bugtargetdisplayname,
- u'Mozilla Thunderbird NG')
+ 'Mozilla Thunderbird NG')
logger = DevNullLogger()
updater = BugTaskTargetNameCacheUpdater(transaction, logger)
@@ -3358,4 +3358,4 @@ class TestTargetNameCache(TestCase):
flush_database_caches()
transaction.commit()
self.assertEqual(upstream_task.bugtargetdisplayname,
- u'Mozilla Thunderbird')
+ 'Mozilla Thunderbird')
diff --git a/lib/lp/bugs/model/tests/test_bugtask_status.py b/lib/lp/bugs/model/tests/test_bugtask_status.py
index 12b79e3..9847590 100644
--- a/lib/lp/bugs/model/tests/test_bugtask_status.py
+++ b/lib/lp/bugs/model/tests/test_bugtask_status.py
@@ -27,7 +27,7 @@ class TestBugTaskStatusTransitionForUser(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskStatusTransitionForUser, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson()
self.task = self.factory.makeBugTask()
@@ -186,7 +186,7 @@ class TestBugTaskStatusTransitionForReporter(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskStatusTransitionForReporter, self).setUp()
+ super().setUp()
self.task = self.factory.makeBugTask()
self.reporter = self.task.bug.owner
@@ -236,7 +236,7 @@ class TestBugTaskStatusTransitionForPrivilegedUserBase:
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBugTaskStatusTransitionForPrivilegedUserBase, self).setUp()
+ super().setUp()
# Creation of task and target are deferred to subclasses.
self.task = None
self.person = None
diff --git a/lib/lp/bugs/model/tests/test_bugtasksearch.py b/lib/lp/bugs/model/tests/test_bugtasksearch.py
index 5357a66..8c9d81c 100644
--- a/lib/lp/bugs/model/tests/test_bugtasksearch.py
+++ b/lib/lp/bugs/model/tests/test_bugtasksearch.py
@@ -139,7 +139,7 @@ class SearchTestBase:
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(SearchTestBase, self).setUp()
+ super().setUp()
self.bugtask_set = getUtility(IBugTaskSet)
def assertSearchFinds(self, params, expected_bugtasks):
@@ -305,7 +305,7 @@ class OnceTests:
# Full text searches find text indexed by Bug.fti.
self.setUpFullTextSearchTests()
params = self.getBugTaskSearchParams(
- user=None, searchtext=u'one title')
+ user=None, searchtext='one title')
self.assertSearchFinds(params, self.bugtasks[:1])
def test_fast_fulltext_search(self):
@@ -314,7 +314,7 @@ class OnceTests:
# be specified.
self.setUpFullTextSearchTests()
params = self.getBugTaskSearchParams(
- user=None, fast_searchtext=u'one&titl')
+ user=None, fast_searchtext='one&titl')
self.assertSearchFinds(params, self.bugtasks[:1])
def test_tags(self):
@@ -734,7 +734,7 @@ class DeactivatedProductBugTaskTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(DeactivatedProductBugTaskTestCase, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
self.active_product = self.factory.makeProduct()
self.inactive_product = self.factory.makeProduct()
@@ -757,7 +757,7 @@ class DeactivatedProductBugTaskTestCase(TestCaseWithFactory):
# Someone without permission to see deactiveated projects does
# not see bugtasks for deactivated projects.
bugtask_set = getUtility(IBugTaskSet)
- param = BugTaskSearchParams(user=None, searchtext=u'Monkeys')
+ param = BugTaskSearchParams(user=None, searchtext='Monkeys')
results = bugtask_set.search(param, _noprejoins=True)
self.assertEqual([self.active_bugtask], list(results))
@@ -934,7 +934,7 @@ class ProductTarget(BugTargetTestBase, ProductAndDistributionTests,
"""Use a product as the bug target."""
def setUp(self):
- super(ProductTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.product_id,)
self.searchtarget = self.factory.makeProduct()
self.owner = self.searchtarget.owner
@@ -975,7 +975,7 @@ class ProductSeriesTarget(BugTargetTestBase):
"""Use a product series as the bug target."""
def setUp(self):
- super(ProductSeriesTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.productseries_id,)
self.searchtarget = self.factory.makeProductSeries()
self.owner = self.searchtarget.owner
@@ -1033,7 +1033,7 @@ class ProjectGroupTarget(BugTargetTestBase, BugTargetWithBugSuperVisor,
"""Use a project group as the bug target."""
def setUp(self):
- super(ProjectGroupTarget, self).setUp()
+ super().setUp()
self.group_on = None
self.searchtarget = self.factory.makeProject()
self.owner = self.searchtarget.owner
@@ -1132,7 +1132,7 @@ class MilestoneTarget(BugTargetTestBase):
"""Use a milestone as the bug target."""
def setUp(self):
- super(MilestoneTarget, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.group_on = (BugSummary.milestone_id,)
self.searchtarget = self.factory.makeMilestone(product=self.product)
@@ -1155,7 +1155,7 @@ class MilestoneTarget(BugTargetTestBase):
def makeBugTasks(self, bugtarget=None, bugtasks=None, owner=None,
searchtarget=None):
"""Create bug tasks for a product and assign them to a milestone."""
- super(MilestoneTarget, self).makeBugTasks(bugtarget=bugtarget,
+ super().makeBugTasks(bugtarget=bugtarget,
bugtasks=bugtasks, owner=owner)
if bugtasks is None:
bugtasks = self.bugtasks
@@ -1189,7 +1189,7 @@ class DistributionTarget(BugTargetTestBase, ProductAndDistributionTests,
"""Use a distribution as the bug target."""
def setUp(self):
- super(DistributionTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.distribution_id,)
self.searchtarget = self.factory.makeDistribution()
self.owner = self.searchtarget.owner
@@ -1243,7 +1243,7 @@ class DistroseriesTarget(BugTargetTestBase, ProjectGroupAndDistributionTests,
"""Use a distro series as the bug target."""
def setUp(self):
- super(DistroseriesTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.distroseries_id,)
self.searchtarget = self.factory.makeDistroSeries()
self.owner = self.searchtarget.owner
@@ -1532,7 +1532,7 @@ class SourcePackageTarget(BugTargetTestBase, UpstreamFilterTests):
"""Use a source package as the bug target."""
def setUp(self):
- super(SourcePackageTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.sourcepackagename_id,)
self.searchtarget = self.factory.makeSourcePackage()
self.owner = self.searchtarget.distroseries.owner
@@ -1580,7 +1580,7 @@ class DistributionSourcePackageTarget(BugTargetTestBase,
"""Use a distribution source package as the bug target."""
def setUp(self):
- super(DistributionSourcePackageTarget, self).setUp()
+ super().setUp()
self.group_on = (BugSummary.sourcepackagename_id,)
self.searchtarget = self.factory.makeDistributionSourcePackage()
self.owner = self.searchtarget.distribution.owner
@@ -1847,7 +1847,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND BugTag.tag IN (E'fred'))""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(any(u'fred')))
+ self.searchClause(any('fred')))
def test_single_tag_presence_all(self):
# The WHERE clause to test for the presence of a single
@@ -1859,7 +1859,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND BugTag.tag = E'fred')""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(all(u'fred')))
+ self.searchClause(all('fred')))
def test_single_tag_absence_any(self):
# The WHERE clause to test for the absence of a single
@@ -1871,7 +1871,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND BugTag.tag = E'fred')""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(any(u'-fred')))
+ self.searchClause(any('-fred')))
def test_single_tag_absence_all(self):
# The WHERE clause to test for the absence of a single
@@ -1883,7 +1883,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND BugTag.tag IN (E'fred'))""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(all(u'-fred')))
+ self.searchClause(all('-fred')))
def test_tag_presence(self):
# The WHERE clause to test for the presence of tags. Should be
@@ -1894,10 +1894,10 @@ class TestBugTaskTagSearchClauses(TestCase):
WHERE BugTag.bug = BugTaskFlat.bug)""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(any(u'*')))
+ self.searchClause(any('*')))
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(all(u'*')))
+ self.searchClause(all('*')))
def test_tag_absence(self):
# The WHERE clause to test for the absence of tags. Should be
@@ -1908,10 +1908,10 @@ class TestBugTaskTagSearchClauses(TestCase):
WHERE BugTag.bug = BugTaskFlat.bug)""")
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(any(u'-*')))
+ self.searchClause(any('-*')))
self.assertEqualIgnoringWhitespace(
expected_query,
- self.searchClause(all(u'-*')))
+ self.searchClause(all('-*')))
def test_multiple_tag_presence_any(self):
# The WHERE clause to test for the presence of *any* of
@@ -1921,7 +1921,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob', E'fred'))""",
- self.searchClause(any(u'fred', u'bob')))
+ self.searchClause(any('fred', 'bob')))
# In an `any` query, a positive wildcard is dominant over
# other positive tags because "bugs with one or more tags" is
# a superset of "bugs with a specific tag".
@@ -1929,7 +1929,7 @@ class TestBugTaskTagSearchClauses(TestCase):
"""EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(any(u'fred', u'*')))
+ self.searchClause(any('fred', '*')))
def test_multiple_tag_absence_any(self):
# The WHERE clause to test for the absence of *any* of several
@@ -1944,7 +1944,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'fred'))""",
- self.searchClause(any(u'-fred', u'-bob')))
+ self.searchClause(any('-fred', '-bob')))
# In an `any` query, a negative wildcard is superfluous in the
# presence of other negative tags because "bugs without a
# specific tag" is a superset of "bugs without any tags".
@@ -1953,7 +1953,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'fred')""",
- self.searchClause(any(u'-fred', u'-*')))
+ self.searchClause(any('-fred', '-*')))
def test_multiple_tag_presence_all(self):
# The WHERE clause to test for the presence of *all* specified
@@ -1967,7 +1967,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'fred')""",
- self.searchClause(all(u'fred', u'bob')))
+ self.searchClause(all('fred', 'bob')))
# In an `all` query, a positive wildcard is superfluous in the
# presence of other positive tags because "bugs with a
# specific tag" is a subset of (i.e. more specific than) "bugs
@@ -1977,7 +1977,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'fred')""",
- self.searchClause(all(u'fred', u'*')))
+ self.searchClause(all('fred', '*')))
def test_multiple_tag_absence_all(self):
# The WHERE clause to test for the absence of all specified
@@ -1987,7 +1987,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob', E'fred'))""",
- self.searchClause(all(u'-fred', u'-bob')))
+ self.searchClause(all('-fred', '-bob')))
# In an `all` query, a negative wildcard is dominant over
# other negative tags because "bugs without any tags" is a
# subset of (i.e. more specific than) "bugs without a specific
@@ -1996,7 +1996,7 @@ class TestBugTaskTagSearchClauses(TestCase):
"""NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(all(u'-fred', u'-*')))
+ self.searchClause(all('-fred', '-*')))
def test_mixed_tags_any(self):
# The WHERE clause to test for the presence of one or more
@@ -2011,7 +2011,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'bob')""",
- self.searchClause(any(u'fred', u'-bob')))
+ self.searchClause(any('fred', '-bob')))
self.assertEqualIgnoringWhitespace(
"""EXISTS
(SELECT 1 FROM BugTag
@@ -2026,7 +2026,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'harry'))""",
- self.searchClause(any(u'fred', u'-bob', u'eric', u'-harry')))
+ self.searchClause(any('fred', '-bob', 'eric', '-harry')))
# The positive wildcard is dominant over other positive tags.
self.assertEqualIgnoringWhitespace(
"""EXISTS
@@ -2041,7 +2041,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'harry'))""",
- self.searchClause(any(u'fred', u'-bob', u'*', u'-harry')))
+ self.searchClause(any('fred', '-bob', '*', '-harry')))
# The negative wildcard is superfluous in the presence of
# other negative tags.
self.assertEqualIgnoringWhitespace(
@@ -2053,7 +2053,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'bob')""",
- self.searchClause(any(u'fred', u'-bob', u'eric', u'-*')))
+ self.searchClause(any('fred', '-bob', 'eric', '-*')))
# The negative wildcard is not superfluous in the absence of
# other negative tags.
self.assertEqualIgnoringWhitespace(
@@ -2064,7 +2064,7 @@ class TestBugTaskTagSearchClauses(TestCase):
OR NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(any(u'fred', u'-*', u'eric')))
+ self.searchClause(any('fred', '-*', 'eric')))
# The positive wildcard is dominant over other positive tags,
# and the negative wildcard is superfluous in the presence of
# other negative tags.
@@ -2076,7 +2076,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag = E'harry')""",
- self.searchClause(any(u'fred', u'-*', u'*', u'-harry')))
+ self.searchClause(any('fred', '-*', '*', '-harry')))
def test_mixed_tags_all(self):
# The WHERE clause to test for the presence of one or more
@@ -2091,7 +2091,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob'))""",
- self.searchClause(all(u'fred', u'-bob')))
+ self.searchClause(all('fred', '-bob')))
self.assertEqualIgnoringWhitespace(
"""EXISTS
(SELECT 1 FROM BugTag
@@ -2105,7 +2105,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob', E'harry'))""",
- self.searchClause(all(u'fred', u'-bob', u'eric', u'-harry')))
+ self.searchClause(all('fred', '-bob', 'eric', '-harry')))
# The positive wildcard is superfluous in the presence of
# other positive tags.
self.assertEqualIgnoringWhitespace(
@@ -2117,7 +2117,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob', E'harry'))""",
- self.searchClause(all(u'fred', u'-bob', u'*', u'-harry')))
+ self.searchClause(all('fred', '-bob', '*', '-harry')))
# The positive wildcard is not superfluous in the absence of
# other positive tags.
self.assertEqualIgnoringWhitespace(
@@ -2128,7 +2128,7 @@ class TestBugTaskTagSearchClauses(TestCase):
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug
AND BugTag.tag IN (E'bob', E'harry'))""",
- self.searchClause(all(u'-bob', u'*', u'-harry')))
+ self.searchClause(all('-bob', '*', '-harry')))
# The negative wildcard is dominant over other negative tags.
self.assertEqualIgnoringWhitespace(
"""EXISTS
@@ -2142,7 +2142,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(all(u'fred', u'-bob', u'eric', u'-*')))
+ self.searchClause(all('fred', '-bob', 'eric', '-*')))
# The positive wildcard is superfluous in the presence of
# other positive tags, and the negative wildcard is dominant
# over other negative tags.
@@ -2154,7 +2154,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(all(u'fred', u'-*', u'*', u'-harry')))
+ self.searchClause(all('fred', '-*', '*', '-harry')))
def test_mixed_wildcards(self):
# The WHERE clause to test for the presence of tags or the
@@ -2166,7 +2166,7 @@ class TestBugTaskTagSearchClauses(TestCase):
OR NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(any(u'*', u'-*')))
+ self.searchClause(any('*', '-*')))
# The WHERE clause to test for the presence of tags and the
# absence of tags.
self.assertEqualIgnoringWhitespace(
@@ -2176,7 +2176,7 @@ class TestBugTaskTagSearchClauses(TestCase):
AND NOT EXISTS
(SELECT 1 FROM BugTag
WHERE BugTag.bug = BugTaskFlat.bug)""",
- self.searchClause(all(u'*', u'-*')))
+ self.searchClause(all('*', '-*')))
class TestBugTaskSearch(TestCaseWithFactory):
diff --git a/lib/lp/bugs/model/tests/test_personsubscriptioninfo.py b/lib/lp/bugs/model/tests/test_personsubscriptioninfo.py
index d9ebd75..8bb6b04 100644
--- a/lib/lp/bugs/model/tests/test_personsubscriptioninfo.py
+++ b/lib/lp/bugs/model/tests/test_personsubscriptioninfo.py
@@ -32,7 +32,7 @@ class TestPersonSubscriptionInfo(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSubscriptionInfo, self).setUp()
+ super().setUp()
self.subscriber = self.factory.makePerson()
self.bug = self.factory.makeBug()
self.subscriptions = PersonSubscriptions(self.subscriber, self.bug)