launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25473
[Merge] ~cjwatson/launchpad:py3-registry-raw-strings into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-registry-raw-strings into launchpad:master.
Commit message:
Use raw strings where necessary for \-escapes in lp.registry
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392076
This fixes a number of DeprecationWarnings with Python >= 3.6.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-registry-raw-strings into launchpad:master.
diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py
index 0e3e7b4..0542991 100644
--- a/lib/lp/registry/browser/tests/test_distroseries.py
+++ b/lib/lp/registry/browser/tests/test_distroseries.py
@@ -335,7 +335,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
text='Derived from Sid'),
soupmatchers.Tag(
'Child diffs link', True,
- text=re.compile('\s*No differences\s*')),
+ text=re.compile(r'\s*No differences\s*')),
)
with person_logged_in(self.simple_user):
@@ -361,7 +361,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
text='Series initialization in progress'),
soupmatchers.Tag(
'Init message', True,
- text=re.compile('\s*This series is initializing.\s*')),
+ text=re.compile(r'\s*This series is initializing.\s*')),
)
with person_logged_in(self.simple_user):
@@ -1093,7 +1093,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
principal=simple_user)
html_content = view()
- packageset_text = re.compile('\s*' + ps.name)
+ packageset_text = re.compile(r'\s*' + ps.name)
self._test_packagesets(
html_content, packageset_text, 'packagesets',
'Packagesets')
@@ -1118,7 +1118,7 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
html_content = view()
packageset_text = re.compile(
- '\s*' + ', '.join(sorted(unsorted_names)))
+ r'\s*' + ', '.join(sorted(unsorted_names)))
self._test_packagesets(
html_content, packageset_text, 'packagesets',
'Packagesets')
@@ -1249,14 +1249,14 @@ class TestDistroSeriesLocalDifferences(TestCaseWithFactory,
multiple_parents_matches = soupmatchers.HTMLContains(
soupmatchers.Tag(
"Parent table header", 'th',
- text=re.compile("\s*Parent\s")),
+ text=re.compile(r"\s*Parent\s")),
soupmatchers.Tag(
"Parent version table header", 'th',
- text=re.compile("\s*Parent version\s*")),
+ text=re.compile(r"\s*Parent version\s*")),
soupmatchers.Tag(
"Parent name", 'a',
attrs={'class': 'parent-name'},
- text=re.compile("\s*Other\s*")),
+ text=re.compile(r"\s*Other\s*")),
)
self.assertThat(view.render(), multiple_parents_matches)
@@ -2410,7 +2410,7 @@ class DistroSeriesMissingPackagesPageTestCase(TestCaseWithFactory,
principal=self.simple_user)
html_content = view()
- packageset_text = re.compile('\s*' + ps.name)
+ packageset_text = re.compile(r'\s*' + ps.name)
self._test_packagesets(
html_content, packageset_text, 'parent-packagesets',
'Parent packagesets')
@@ -2506,14 +2506,14 @@ class DistroSerieUniquePackageDiffsTestCase(TestCaseWithFactory,
multiple_parents_display_matcher = soupmatchers.HTMLContains(
soupmatchers.Tag(
"Parent table header", 'th',
- text=re.compile("^\s*Parent\s")),
+ text=re.compile(r"^\s*Parent\s")),
Not(soupmatchers.Tag(
"Parent version table header", 'th',
- text=re.compile("\s*Parent version\s*"))),
+ text=re.compile(r"\s*Parent version\s*"))),
soupmatchers.Tag(
"Parent name", 'a',
attrs={'class': 'parent-name'},
- text=re.compile("\s*%s\s*" % parent_series.displayname)),
+ text=re.compile(r"\s*%s\s*" % parent_series.displayname)),
)
self.assertThat(view.render(), multiple_parents_display_matcher)
@@ -2574,7 +2574,7 @@ class DistroSeriesUniquePackagesPageTestCase(TestCaseWithFactory,
principal=self.simple_user)
html = view()
- packageset_text = re.compile('\s*' + ps.name)
+ packageset_text = re.compile(r'\s*' + ps.name)
self._test_packagesets(
html, packageset_text, 'packagesets', 'Packagesets')
diff --git a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
index a436fed..6f138a5 100644
--- a/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
+++ b/lib/lp/registry/browser/tests/test_distroseriesdifference_views.py
@@ -162,7 +162,7 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Binary descriptions header', 'dt',
text=re.compile(
- '\s*Binary descriptions:\s*')))
+ r'\s*Binary descriptions:\s*')))
self.assertThat(view(), Not(binary_description_matcher))
@@ -293,7 +293,7 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Request link', 'a',
text=re.compile(
- '\s*Compute differences from last common version\s*')))
+ r'\s*Compute differences from last common version\s*')))
self.assertFalse(view.show_package_diffs_request_link)
self.assertThat(view(), Not(package_diff_request_matcher))
@@ -606,7 +606,7 @@ class DistroSeriesDifferenceTemplateTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Request link', 'a',
text=re.compile(
- '\s*Compute differences from last common version\s*')))
+ r'\s*Compute differences from last common version\s*')))
with person_logged_in(self.factory.makePerson()):
self.assertTrue(
@@ -624,7 +624,7 @@ class DistroSeriesDifferenceTemplateTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Package diffs header', 'dt',
text=re.compile(
- '\s*Differences from last common version:')))
+ r'\s*Differences from last common version:')))
package_diff_info_matcher = soupmatchers.HTMLContains(
soupmatchers.Within(
@@ -667,7 +667,7 @@ class DistroSeriesDifferenceTemplateTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Request link', 'a',
text=re.compile(
- '\s*Compute differences from last common version\s*')))
+ r'\s*Compute differences from last common version\s*')))
pending_package_diff_matcher = soupmatchers.HTMLContains(
soupmatchers.Tag(
@@ -678,7 +678,7 @@ class DistroSeriesDifferenceTemplateTestCase(TestCaseWithFactory):
soupmatchers.Tag(
'Unknown base version', 'dd',
text=re.compile(
- '\s*Unknown, so no diffs are available')))
+ r'\s*Unknown, so no diffs are available')))
with celebrity_logged_in('admin'):
view = create_initialized_view(
diff --git a/lib/lp/registry/interfaces/oopsreferences.py b/lib/lp/registry/interfaces/oopsreferences.py
index 9855999..346758a 100644
--- a/lib/lp/registry/interfaces/oopsreferences.py
+++ b/lib/lp/registry/interfaces/oopsreferences.py
@@ -31,7 +31,7 @@ class IHasOOPSReferences(Interface):
@export_read_operation()
@operation_for_version('devel')
def findReferencedOOPS(start_date, end_date):
- """Find OOPS reports between start_date and end_date.
+ r"""Find OOPS reports between start_date and end_date.
:param start_date: Do not look in objects whose last modification time
is before this date.
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 9173612..6f96764 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -402,7 +402,7 @@ def get_person_visibility_terms(user):
Person.visibility != PersonVisibility.PUBLIC))
-_person_sort_re = re.compile("(?:[^\w\s]|[\d_])", re.U)
+_person_sort_re = re.compile(r"(?:[^\w\s]|[\d_])", re.U)
def person_sort_key(person):
@@ -4290,7 +4290,7 @@ def generate_nick(email_addr, is_registered=_is_nick_registered):
raise NicknameGenerationError(
"%s is not a valid email address" % email_addr)
- user = re.match("^(\S+)@(?:\S+)$", email_addr).groups()[0]
+ user = re.match(r"^(\S+)@(?:\S+)$", email_addr).groups()[0]
user = user.replace(".", "-").replace("_", "-")
person_set = PersonSet()
diff --git a/lib/lp/registry/tests/test_mailinglist.py b/lib/lp/registry/tests/test_mailinglist.py
index 7b58a0a..837d79f 100644
--- a/lib/lp/registry/tests/test_mailinglist.py
+++ b/lib/lp/registry/tests/test_mailinglist.py
@@ -171,7 +171,7 @@ class MailingListTestCase(TestCaseWithFactory):
self.assertEqual(
'New Mailing List for Team', notifications[0]['subject'])
self.assertTextMatchesExpressionIgnoreWhitespace(
- '.*To subscribe:.*http://launchpad.test/~.*/\+editmailinglists.*',
+ r'.*To subscribe:.*http://launchpad.test/~.*/\+editmailinglists.*',
notifications[0].get_payload())
def test_startConstructing_from_APPROVED(self):
diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py
index 3503db2..d0f768b 100644
--- a/lib/lp/registry/tests/test_mailinglistapi.py
+++ b/lib/lp/registry/tests/test_mailinglistapi.py
@@ -472,7 +472,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
'New mailing list message requiring approval for Team',
notifications[0]['subject'])
self.assertTextMatchesExpressionIgnoreWhitespace(
- '.*http://launchpad.test/~team/\+mailinglist-moderate.*',
+ r'.*http://launchpad.test/~team/\+mailinglist-moderate.*',
notifications[0].get_payload())
self.assertEqual({}, self.mailinglist_api.getMessageDispositions())
diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py
index 5d5d1eb..a794a43 100644
--- a/lib/lp/registry/tests/test_teammembership.py
+++ b/lib/lp/registry/tests/test_teammembership.py
@@ -525,7 +525,7 @@ class TestParticipationCleanup(TeamParticipationTestCase):
class TestTeamParticipationMesh(TeamParticipationTestCase):
- """Participation management tests using two roots and some duplicated
+ r"""Participation management tests using two roots and some duplicated
branches.
Create a team hierarchy looking like this: