Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse committed Dec 12, 2024
1 parent 2898919 commit a7cfc2f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion airgun/views/contentviewfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion airgun/views/redhat_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')}']"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a7cfc2f

Please sign in to comment.