Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#1645)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ondřej Gajdušek <[email protected]>
(cherry picked from commit 00075a2)
  • Loading branch information
pre-commit-ci[bot] authored and ogajduse committed Dec 12, 2024
1 parent 3ee64e8 commit 89c2e18
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ select = [
"T100", # Trace found: {name} used
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"TRY302", # Remove exception handler; error is immediately re-raised
"TRY203", # Remove exception handler; error is immediately re-raised
"PLR0911", # Too many return statements ({returns} > {max_returns})
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
Expand Down

0 comments on commit 89c2e18

Please sign in to comment.