diff --git a/.flake8 b/.flake8 index 06fbf1f4..b8fca05d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] exclude = abichecker max-line-length = 100 -ignore = E501,F401,E128,E251,E201,E202,E302,E305,F841,E261,E712,E126,E711,E125,E123,E101,E124,E127,E701,E714,W504,E129,E741,E722,E731 +ignore = E501,F401,E128,E251,E201,E202,E302,E305,F841,E261,E712,E126,E711,E125,E123,E101,E124,E127,E701,E714,W504,E129,E741,E722 diff --git a/osclib/util.py b/osclib/util.py index e2bfea34..ad317e48 100644 --- a/osclib/util.py +++ b/osclib/util.py @@ -28,13 +28,19 @@ def project_list_family(apiurl, project, include_update=False): return [project + project_suffix] count_original = project.count(':') + + def filter_sle_updates(p): + return p.count(':') == count_original and (p.endswith(':GA') or (include_update and p.endswith(':Update'))) + + def filter_opensuse_updates(p): + return p.count(':') == count_original or (include_update and p.count(':') == count_original + 1 and p.endswith(':Update')) + if project.startswith('SUSE:SLE'): project = ':'.join(project.split(':')[:2]) - family_filter = lambda p: p.count(':') == count_original and ( - p.endswith(':GA') or (include_update and p.endswith(':Update'))) + + family_filter = filter_sle_updates else: - family_filter = lambda p: p.count(':') == count_original or ( - include_update and p.count(':') == count_original + 1 and p.endswith(':Update')) + family_filter = filter_opensuse_updates prefix = ':'.join(project.split(':')[:-1]) projects = project_list_prefix(apiurl, prefix)