Skip to content

Commit 34fcc5e

Browse files
authored
Merge pull request #474 from GeneCodeSavvy/unused-variables
Unused variables
2 parents a6a5b5d + a946583 commit 34fcc5e

9 files changed

+17
-17
lines changed

sbol3/document.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _parse_objects(self, graph: rdflib.Graph) -> Dict[str, SBOLObject]:
180180
# 6.11 of the spec) and we instantiate it specially.
181181
#
182182
identity_types: Dict[str, List[str]] = collections.defaultdict(list)
183-
for s, p, o in graph.triples((None, rdflib.RDF.type, None)):
183+
for s, _, o in graph.triples((None, rdflib.RDF.type, None)):
184184
str_o = str(o)
185185
str_s = str(s)
186186
identity_types[str_s].append(str_o)
@@ -238,7 +238,7 @@ def _clean_up_singletons(objects: Dict[str, SBOLObject]):
238238
# in multiple values in a singleton property. Only the first value
239239
# is used, so the value read from file is ignored.
240240
for _, obj in objects.items():
241-
for name, attr in obj.__dict__.items():
241+
for _, attr in obj.__dict__.items():
242242
if isinstance(attr, SingletonProperty):
243243
prop_uri = attr.property_uri
244244
store = attr._storage()

sbol3/object.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,19 @@ def _make_identity(name: str) -> Union[str, None]:
5555
"""
5656
if name is None:
5757
return None
58-
name_is_url = SBOLObject._is_url(name)
59-
if name_is_url:
58+
59+
# Case 1: The name is already a valid URL
60+
if SBOLObject._is_url(name):
6061
return name.strip(posixpath.sep)
62+
63+
# Case 2: The name is a valid UUID
6164
try:
62-
# If it is a UUID, accept it as the identity
63-
identity_uuid = uuid.UUID(name)
65+
uuid.UUID(name)
6466
return name
6567
except ValueError:
6668
pass
67-
# Not a URL or a UUID, so append to the namespace
69+
70+
# Case 3: The name is neither a URL or a UUID, so append to the namespace
6871
base_uri = get_namespace()
6972
if base_uri is None:
7073
# See https://github.com/SynBioDex/pySBOL3/issues/254

sbol3/toplevel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def update_references_traverser(x):
228228
# Use the identity map to update references.
229229
# References to objects outside of the object
230230
# being cloned will be left as is.
231-
for k, v in x.__dict__.items():
231+
for _, v in x.__dict__.items():
232232
if not isinstance(v, Property):
233233
continue
234234
if v.property_uri not in x._properties:

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ disable = abstract-class-instantiated,
4141
unnecessary-pass,
4242
unused-argument,
4343
unused-import,
44-
unused-variable,
4544
unused-wildcard-import,
4645
useless-parent-delegation,
4746
useless-return,

test/test_custom.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import sbol3
1010

11-
1211
PYSBOL3_CUSTOM_TOP = 'https://github.com/synbiodex/pysbol3#customTop'
1312
PYSBOL3_CUSTOM_UNREGISTERED_TOP = 'https://github.com/synbiodex/pysbol3#customUnregisteredTop'
1413
PYSBOL3_CUSTOM_BOOL = 'https://github.com/synbiodex/pysbol3#customBool'
@@ -136,11 +135,11 @@ def test_none_identity(self):
136135
# as a CustomTopLevel identity. And also if identity
137136
# is an empty string or not a string.
138137
with self.assertRaises(ValueError):
139-
obj = CustomTopClass(None)
138+
_ = CustomTopClass(None)
140139
with self.assertRaises(ValueError):
141-
obj = CustomTopClass('')
140+
_ = CustomTopClass('')
142141
with self.assertRaises(ValueError):
143-
obj = CustomTopClass(3)
142+
_ = CustomTopClass(3)
144143

145144

146145
class TestCustomIdentified(unittest.TestCase):

test/test_document.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_file_extension(self):
5252
self.assertEqual(extension_2, '.xml')
5353
# 3. for invalid file formats, valueError must be raised
5454
with self.assertRaises(ValueError):
55-
extension_3 = sbol3.Document.file_extension(file_format_3)
55+
_ = sbol3.Document.file_extension(file_format_3)
5656

5757
def test_read_ntriples(self):
5858
# Initial test of Document.read

test/test_object.py

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def test_replace_namespace(self):
6262
def test_copy_is_deprecated(self):
6363
namespace = 'https://github.com/synbiodex/pysbol3'
6464
sbol3.set_namespace(namespace)
65-
name = 'ed1'
6665
ed1 = sbol3.ExternallyDefined(types=[sbol3.SBO_DNA],
6766
definition='https://example.org/other')
6867
with self.assertWarns(DeprecationWarning):

test/test_subcomponent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_list_wrapping(self):
5656
instance_uri = 'https://example.org/instance'
5757
seq1 = sbol3.Sequence('seq1')
5858
test_loc = sbol3.EntireSequence(seq1)
59-
seq2 = sbol3.Sequence('seq2')
59+
_ = sbol3.Sequence('seq2')
6060
test_source_loc = sbol3.EntireSequence(seq1)
6161
subcomp1 = sbol3.SubComponent(instance_of=instance_uri,
6262
locations=test_loc,

test/test_varcomp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_list_wrapping(self):
7878
# See https://github.com/SynBioDex/pySBOL3/issues/301
7979
sbol3.set_namespace('https://github.com/synbiodex/pysbol3')
8080
seq = sbol3.Sequence('seq1')
81-
test_loc = sbol3.EntireSequence(seq)
81+
_ = sbol3.EntireSequence(seq)
8282
variable_uri = 'https://example.org/variable'
8383
var_coll_uri = 'https://example.org/collection'
8484
var_feat1 = sbol3.VariableFeature(cardinality=sbol3.SBOL_ZERO_OR_MORE,

0 commit comments

Comments
 (0)