From 50541cbeacee048c0028b5372d6203eb77268dc6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 16:55:26 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#7068) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0) - [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982) - [github.com/asottile/pyupgrade: v2.38.2 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v2.38.2...v3.1.0) * Comparison to True should be 'if cond is True:' * Update checkins.py https://docs.python.org/3/reference/datamodel.html#object.__contains__ * noqa: W601 .has_key() is deprecated, use 'in' Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss --- .pre-commit-config.yaml | 6 +++--- openlibrary/plugins/upstream/checkins.py | 2 +- .../plugins/upstream/tests/test_checkins.py | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2f57b488a9..8e2e585cd5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - --markdown-linebreak-ext=md - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 22.10.0 hooks: - id: black # See pyproject.toml for args @@ -40,14 +40,14 @@ repos: - id: codespell # See setup.cfg for args - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.981' + rev: 'v0.982' hooks: - id: mypy # See pyproject.toml for args additional_dependencies: - types-all - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 + rev: v3.1.0 hooks: - id: pyupgrade args: # Solr on Cython is not yet ready for 3.10 type hints diff --git a/openlibrary/plugins/upstream/checkins.py b/openlibrary/plugins/upstream/checkins.py index e3354ff2ab5..c9f1bf3528f 100644 --- a/openlibrary/plugins/upstream/checkins.py +++ b/openlibrary/plugins/upstream/checkins.py @@ -69,7 +69,7 @@ def is_valid(self, data: dict) -> bool: """Validates POSTed check-in data.""" if not all(key in data for key in ('edition_olid', 'year', 'event_type')): return False - if not BookshelfEvent.has_key(data['event_type']): + if not BookshelfEvent.has_key(data['event_type']): # noqa: W601 return False return True diff --git a/openlibrary/plugins/upstream/tests/test_checkins.py b/openlibrary/plugins/upstream/tests/test_checkins.py index f3d65db349c..238fb73a871 100644 --- a/openlibrary/plugins/upstream/tests/test_checkins.py +++ b/openlibrary/plugins/upstream/tests/test_checkins.py @@ -41,7 +41,7 @@ def setup_method(self): } def test_required_fields(self): - assert self.checkins.is_valid(self.valid_data) == True + assert self.checkins.is_valid(self.valid_data) is True missing_edition = { 'event_type': 'START', @@ -65,13 +65,13 @@ def test_required_fields(self): 'month': 3, 'day': 7, } - assert self.checkins.is_valid(missing_edition) == False - assert self.checkins.is_valid(missing_event_type) == False - assert self.checkins.is_valid(missing_year) == False - assert self.checkins.is_valid(missing_all) == False + assert self.checkins.is_valid(missing_edition) is False + assert self.checkins.is_valid(missing_event_type) is False + assert self.checkins.is_valid(missing_year) is False + assert self.checkins.is_valid(missing_all) is False def test_event_type_values(self): - assert self.checkins.is_valid(self.valid_data) == True + assert self.checkins.is_valid(self.valid_data) is True unknown_event_type = { 'edition_olid': 'OL1234M', 'event_type': 'sail-the-seven-seas', @@ -79,4 +79,4 @@ def test_event_type_values(self): 'month': 3, 'day': 7, } - assert self.checkins.is_valid(unknown_event_type) == False + assert self.checkins.is_valid(unknown_event_type) is False