Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (internetarchive#7068)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.8.0 → 22.10.0](psf/black@22.8.0...22.10.0)
- [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](pre-commit/mirrors-mypy@v0.981...v0.982)
- [github.com/asottile/pyupgrade: v2.38.2 → v3.1.0](asottile/pyupgrade@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 <cclauss@me.com>
  • Loading branch information
pre-commit-ci[bot] and cclauss authored Oct 11, 2022
1 parent cb9decd commit 50541cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/upstream/checkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions openlibrary/plugins/upstream/tests/test_checkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -65,18 +65,18 @@ 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',
'year': 2000,
'month': 3,
'day': 7,
}
assert self.checkins.is_valid(unknown_event_type) == False
assert self.checkins.is_valid(unknown_event_type) is False

0 comments on commit 50541cb

Please sign in to comment.