From 3ae3c88a9509adc5d40659c03b9e8d18f85d269c Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Fri, 29 Jul 2022 23:04:58 +0300 Subject: [PATCH] Dedent main code for `get_distributions` --- osc/core.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/osc/core.py b/osc/core.py index 361adc71..1cf8c680 100644 --- a/osc/core.py +++ b/osc/core.py @@ -5625,20 +5625,19 @@ def get_distributions(apiurl, discon=False): r.insert(1, '------------ -------') return r - else: - f = http_GET(makeurl(apiurl, ['distributions'])) - root = ET.fromstring(b''.join(f)) + f = http_GET(makeurl(apiurl, ['distributions'])) + root = ET.fromstring(b''.join(f)) - distlist = [] - for node in root.findall('distribution'): - dmap = {} - for child in node: - if child.tag == 'name': - dmap['distribution'] = child.text - elif child.tag in ('project', 'repository', 'reponame'): - dmap[child.tag] = child.text - distlist.append(dmap) - return distlist + distlist = [] + for node in root.findall('distribution'): + dmap = {} + for child in node: + if child.tag == 'name': + dmap['distribution'] = child.text + elif child.tag in ('project', 'repository', 'reponame'): + dmap[child.tag] = child.text + distlist.append(dmap) + return distlist # old compat lib call