sponsor_patch: make pylint happy

pylint complains:

```
ubuntutools/sponsor_patch/sponsor_patch.py:243:45: E0606: Possibly using variable 'task' before assignment (possibly-used-before-assignment)
```

Drop the `len(ubuntu_tasks) > 1` check and rely on being the else case.
This commit is contained in:
Benjamin Drung 2025-12-03 13:21:19 +01:00
parent 41e7d2d714
commit 816323ea5c

View File

@ -212,14 +212,14 @@ def get_open_ubuntu_bug_task(launchpad, bug, branch=None):
sys.exit(1) sys.exit(1)
elif len(ubuntu_tasks) == 1: elif len(ubuntu_tasks) == 1:
task = ubuntu_tasks[0] task = ubuntu_tasks[0]
if len(ubuntu_tasks) > 1 and branch and branch[1] == "ubuntu": elif branch and branch[1] == "ubuntu":
tasks = [t for t in ubuntu_tasks if t.get_series() == branch[2] and t.package == branch[3]] tasks = [t for t in ubuntu_tasks if t.get_series() == branch[2] and t.package == branch[3]]
if len(tasks) > 1: if len(tasks) > 1:
# A bug targeted to the development series? # A bug targeted to the development series?
tasks = [t for t in tasks if t.series is not None] tasks = [t for t in tasks if t.series is not None]
assert len(tasks) == 1 assert len(tasks) == 1
task = tasks[0] task = tasks[0]
elif len(ubuntu_tasks) > 1: else:
task_list = [t.get_short_info() for t in ubuntu_tasks] task_list = [t.get_short_info() for t in ubuntu_tasks]
Logger.debug( Logger.debug(
"%i Ubuntu tasks exist for bug #%i.\n%s", "%i Ubuntu tasks exist for bug #%i.\n%s",