Fix unhandled None value in project IDs when listing all datasets (#1413)

When fetching the project_ids, there are times where the project id may
be None, even if that's not supposed to be the case. This causes the
program to break. This patch adds some defensive checks to make sure
that even if somehow we get None for the project_id, it will be ignored
and handled gracefully.
This commit is contained in:
AbdulHamid Merii 2025-05-19 14:22:23 +01:00 committed by GitHub
parent afbbd3975a
commit 25df3b4c75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2094,7 +2094,7 @@ class Dataset(object):
exact_match_regex_flag=False, exact_match_regex_flag=False,
_allow_extra_fields_=True, _allow_extra_fields_=True,
) )
project_ids = {d.project for d in datasets} project_ids = {d.project for d in datasets if d.project is not None}
# noinspection PyProtectedMember # noinspection PyProtectedMember
project_id_lookup = Task._get_project_names(list(project_ids)) project_id_lookup = Task._get_project_names(list(project_ids))
return [ return [
@ -2106,7 +2106,7 @@ class Dataset(object):
"tags": d.tags, "tags": d.tags,
"version": d.runtime.get("version"), "version": d.runtime.get("version"),
} }
for d in datasets for d in datasets if d.project is not None
] ]
def _add_files( def _add_files(