Merge ~cjwatson/lazr.restful:fix-flake8 into lazr.restful:main

Proposed by Colin Watson
Status: Merged
Merged at revision: 82f52442df2ff3dde5e8df02152e04d0a9e83620
Proposed branch: ~cjwatson/lazr.restful:fix-flake8
Merge into: lazr.restful:main
Diff against target: 28 lines (+11/-6)
1 file modified
src/lazr/restful/_resource.py (+11/-6)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+412030@code.launchpad.net

Commit message

Fix flake8 line length error

Description of the change

This is easier to do by conditionally raising `AssertionError` (which is less vulnerable to being optimized out anyway) rather than using `assert`.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/lazr/restful/_resource.py b/src/lazr/restful/_resource.py
2index f720b30..f01326d 100644
3--- a/src/lazr/restful/_resource.py
4+++ b/src/lazr/restful/_resource.py
5@@ -2339,12 +2339,17 @@ class EntryAdapterUtility(RESTUtilityBase):
6 entry_ifaces = [
7 interface for interface in interfaces if interface.extends(IEntry)
8 ]
9- assert (
10- len(entry_ifaces) == 1
11- ), "There must be one and only one IEntry implementation " "for %s, found %s" % (
12- self.entry_class,
13- ", ".join(interface.__name__ for interface in entry_ifaces),
14- )
15+ if len(entry_ifaces) != 1:
16+ raise AssertionError(
17+ "There must be one and only one IEntry implementation "
18+ "for %s, found %s"
19+ % (
20+ self.entry_class,
21+ ", ".join(
22+ interface.__name__ for interface in entry_ifaces
23+ ),
24+ )
25+ )
26 return entry_ifaces[0]
27
28 def _get_tagged_value(self, tag):

Subscribers

People subscribed via source and target branches