While working with fossology-python, I noticed that a few fields in Upload.__init__ are accidentally being wrapped in tuples because of trailing commas:
# fossology/obj.py
self.assignee = (assignee,)
self.assigneeDate = (assigneeDate,)
self.closeDate = (closingDate,)
These seem intended to be plain assignments instead.
Impact
This causes the attributes to have tuple types unexpectedly:
upload.assignee
# ('username',)
instead of:
It also affects truthiness checks:
assignee = None
print(bool((assignee,))) # True
so code like:
behaves incorrectly when the API returns None.
Minimal reproduction
from fossology.obj import Upload
u = Upload(
folderid=1,
foldername="test",
id=1,
description="",
uploadname="foo",
uploaddate="2024-01-01",
assignee=None,
hash={"sha1": "", "md5": "", "sha256": "", "size": 0},
)
print(type(u.assignee))
print(u.assignee)
print(bool(u.assignee))
Current output:
<class 'tuple'>
(None,)
True
Expected:
<class 'NoneType'>
None
False
Proposed fix
self.assignee = assignee
self.assigneeDate = assigneeDate
self.closeDate = closingDate
Environment:
- fossology-python: 3.5.0
- Python: 3.10+

I’d like to work on this fix and open a PR for it, if that sounds good. 🧃
While working with
fossology-python, I noticed that a few fields inUpload.__init__are accidentally being wrapped in tuples because of trailing commas:These seem intended to be plain assignments instead.
Impact
This causes the attributes to have tuple types unexpectedly:
instead of:
'username'It also affects truthiness checks:
so code like:
behaves incorrectly when the API returns
None.Minimal reproduction
Current output:
Expected:
Proposed fix
Environment:
I’d like to work on this fix and open a PR for it, if that sounds good. 🧃