From f3504495861f68b6d30fc68ee5624d8c870f60cb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:50:12 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1645) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ondřej Gajdušek (cherry picked from commit 00075a209e24df0e77c18b484631485bfc10f54f) --- .pre-commit-config.yaml | 2 +- airgun/views/contentviewfilter.py | 2 +- airgun/views/redhat_repository.py | 4 +++- airgun/widgets.py | 15 ++++++--------- pyproject.toml | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e29280fc4..896dcc98b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] 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 2a96b04ba..236d05515 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 b2566ba6e..1ad633166 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -449,7 +449,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) @@ -986,7 +986,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) @@ -1036,11 +1036,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')}']" @@ -1380,7 +1377,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) @@ -1536,7 +1533,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) diff --git a/pyproject.toml b/pyproject.toml index 489e948ba..0ec9baf05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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