Skip to content
This repository was archived by the owner on Feb 10, 2026. It is now read-only.

Commit a602e98

Browse files
author
Reece Hart
committed
Close #193, #194: Fix assert messages in gbseq.py
1 parent 16d7a05 commit a602e98

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ select = [
201201
"A001", # Variable `id` is shadowing a Python builtin
202202
"A002", # Function argument `id` is shadowing a Python builtin
203203
"B006", # Do not use mutable data structures for argument defaults
204-
"F522", # `.format` call has unused named argument(s): n
205-
"F524", # `.format` call is missing argument(s) for placeholder(s): n=n
206204
"F821", # Undefined name `pas`
207205
"G003", # Logging statement uses `+`
208206
"G004", # Logging statement uses f-string

src/biocommons/eutils/_internal/xmlfacades/gbseq.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ def __iter__(self):
126126
def cds(self):
127127
key = "CDS"
128128
nodes = self._get_nodes_with_key(key)
129-
assert len(nodes) <= 1, "Node has {n=n} {key} features! (expected <= 1)".format(
130-
n=len(nodes), key=key
131-
)
129+
assert len(nodes) == 1, f"Got n={len(nodes)} {key} features! (expected exactly 1)"
132130
return None if not nodes else GBFeatureCDS(nodes[0])
133131

134132
@property
@@ -141,18 +139,14 @@ def exons(self):
141139
def gene(self):
142140
key = "gene"
143141
nodes = self._get_nodes_with_key(key)
144-
assert len(nodes) <= 1, "Node has {n=n} {key} features! (expected <= 1)".format(
145-
n=len(nodes), key=key
146-
)
142+
assert len(nodes) == 1, f"Got n={len(nodes)} {key} features! (expected exactly 1)"
147143
return None if not nodes else GBFeature(nodes[0])
148144

149145
@property
150146
def source(self):
151147
key = "source"
152148
nodes = self._get_nodes_with_key(key)
153-
assert len(nodes) == 1, "Got {n=n} {key} features! (expected exactly 1)".format(
154-
n=len(nodes), key=key
155-
)
149+
assert len(nodes) == 1, f"Got n={len(nodes)} {key} features! (expected exactly 1)"
156150
return GBFeature(nodes[0])
157151

158152
def _get_nodes_with_key(self, key):
@@ -193,11 +187,6 @@ def get_qualifiers(self, name):
193187

194188
def get_qualifier(self, name):
195189
nodes = self.get_qualifiers(name)
196-
assert len(nodes) <= 1, (
197-
"Node has {n=n} {key} features! (expected <= 1 when using get_qualifier)".format(
198-
n=len(nodes), key=name
199-
)
200-
)
201190
if not nodes:
202191
return None
203192
return self.get_qualifiers(name)[0]

0 commit comments

Comments
 (0)