From a7cfc2f8199e967b2c1e851f8046b5937a3c353f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Thu, 12 Dec 2024 12:40:24 +0100 Subject: [PATCH] Reformat code --- airgun/views/contentviewfilter.py | 2 +- airgun/views/redhat_repository.py | 4 +++- airgun/widgets.py | 17 +++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/airgun/views/contentviewfilter.py b/airgun/views/contentviewfilter.py index 07435786a..eac75055c 100644 --- a/airgun/views/contentviewfilter.py +++ b/airgun/views/contentviewfilter.py @@ -99,7 +99,7 @@ class CVFEditableEntry(EditableEntry): def __init__(self, parent, locator=None, name=None, logger=None): """Supports initialization via ``locator=`` or ``name=``""" - if locator and name or not locator and not name: + if (locator and name) or (not locator and not name): raise TypeError('Please specify either locator or name') locator = ( locator diff --git a/airgun/views/redhat_repository.py b/airgun/views/redhat_repository.py index 80d5f8c9d..827a66336 100644 --- a/airgun/views/redhat_repository.py +++ b/airgun/views/redhat_repository.py @@ -194,7 +194,9 @@ def items(self, name=None, label=None): items = [] for index, _ in enumerate(self.browser.elements(self.ITEMS, parent=self)): item = self.ITEM_WIDGET(self, f'{self.ITEMS}[{index + 1}]') - if name is not None and item.name != name or label is not None and item.label != label: + if (name is not None and item.name != name) or ( + label is not None and item.label != label + ): continue items.append(item) return items diff --git a/airgun/widgets.py b/airgun/widgets.py index 39616aa73..92395cf24 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -460,7 +460,7 @@ class MultiSelect(GenericLocatorWidget): def __init__(self, parent, locator=None, id=None, logger=None): """Supports initialization via ``locator=`` or ``id=``""" - if locator and id or not locator and not id: + if (locator and id) or (not locator and not id): raise TypeError('Please specify either locator or id') locator = locator or f".//div[@id='{id}']" super().__init__(parent, locator, logger) @@ -558,7 +558,7 @@ class PF4MultiSelect(GenericLocatorWidget): def __init__(self, parent, locator=None, id=None, logger=None): """Supports initialization via ``locator=`` or ``id=``""" - if locator and id or not locator and not id: + if (locator and id) or (not locator and not id): raise TypeError('Please specify either locator or id') locator = locator or f".//div[@id='{id}']" super().__init__(parent, locator, logger) @@ -1165,7 +1165,7 @@ class FilteredDropdown(GenericLocatorWidget): def __init__(self, parent, id=None, locator=None, logger=None): """Supports initialization via ``id=`` or ``locator=``""" - if locator and id or not locator and not id: + if (locator and id) or (not locator and not id): raise ValueError('Please specify either locator or id') locator = locator or f".//div[contains(@id, '{id}')]" super().__init__(parent, locator, logger) @@ -1239,11 +1239,8 @@ class CustomParameter(Table): def __init__(self, parent, **kwargs): """Supports initialization via ``locator=`` or ``id=``""" - if ( - kwargs.get('locator') - and kwargs.get('id') - or not kwargs.get('locator') - and not kwargs.get('id') + if (kwargs.get('locator') and kwargs.get('id')) or ( + not kwargs.get('locator') and not kwargs.get('id') ): raise ValueError('Please specify either locator or id') locator = kwargs.get('locator') or f".//table[@id='{kwargs.pop('id')}']" @@ -1618,7 +1615,7 @@ class EditableEntry(GenericLocatorWidget): def __init__(self, parent, locator=None, name=None, logger=None): """Supports initialization via ``locator=`` or ``name=``""" - if locator and name or not locator and not name: + if (locator and name) or (not locator and not name): raise TypeError('Please specify either locator or name') locator = locator or f".//dt[normalize-space(.)='{name}']/following-sibling::dd[1]" super().__init__(parent, locator, logger) @@ -1778,7 +1775,7 @@ class ReadOnlyEntry(GenericLocatorWidget): def __init__(self, parent, locator=None, name=None, logger=None): """Supports initialization via ``locator=`` or ``name=``""" - if locator and name or not locator and not name: + if (locator and name) or (not locator and not name): raise TypeError('Please specify either locator or name') locator = locator or self.BASE_LOCATOR.format(name) super().__init__(parent, locator, logger)