diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8659b44d..ac00ba472 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: check-docstring-first @@ -31,7 +31,7 @@ repos: - id: python-no-log-warn - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: Run isort to sort imports @@ -42,20 +42,6 @@ repos: - --lines-after-imports=2 - --profile=black - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - name: Run pydocstyle - args: - - --convention=pep257 - # Do not require docstrings, only check existing ones. (D1) - # Allow for a newline after a docstring. (D202) - # Don't require a summary line. (D205) - # Don't require a period on the first line. (D400) - - --add-ignore=D1,D202,D205,D400 - exclude: tests/ - - repo: local hooks: - id: no-shebang @@ -68,7 +54,7 @@ repos: files: \.py$ - repo: https://github.com/ikamensh/flynt/ - rev: '1.0.0' + rev: 1.0.1 hooks: - id: flynt exclude: ^build/.*$|^.tox/.*$|^venv/.*$ @@ -77,7 +63,7 @@ repos: - --quiet - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.10 + rev: v0.5.5 hooks: - id: ruff types_or: [python,pyi] @@ -91,12 +77,12 @@ repos: - --target-version=py311 - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.4.1' + rev: v1.11.0 hooks: - id: mypy - repo: https://github.com/Riverside-Healthcare/djLint - rev: v1.32.1 + rev: v1.34.1 hooks: - id: djlint-reformat pass_filenames: false diff --git a/OpenOversight/app/main/forms.py b/OpenOversight/app/main/forms.py index f48274458..fdc704806 100644 --- a/OpenOversight/app/main/forms.py +++ b/OpenOversight/app/main/forms.py @@ -441,7 +441,7 @@ class DateFieldForm(Form): time_field = TimeField("Time", validators=[Optional()]) def validate_time_field(self, field): - if not type(field.data) == time: + if type(field.data) is not time: raise ValidationError("Not a valid time.") def validate_date_field(self, field): @@ -491,7 +491,7 @@ def validate_state(self, field): class OfficerIdField(StringField): def process_data(self, value): - if type(value) == Officer: + if type(value) is Officer: self.data = value.id else: self.data = value diff --git a/OpenOversight/app/widgets.py b/OpenOversight/app/widgets.py index f366361dd..78de63741 100644 --- a/OpenOversight/app/widgets.py +++ b/OpenOversight/app/widgets.py @@ -14,7 +14,7 @@ def __call__(self, field, **kwargs): kwargs.setdefault("id", field.id) html = [f"<{self.html_tag} {html_params(**kwargs)}>"] for subfield in field: - if type(subfield) == FormField: + if type(subfield) is FormField: html.append(f"
  • {subfield.label.text}
    {subfield()}
  • ") if self.prefix_label: html.append( diff --git a/OpenOversight/tests/test_utils.py b/OpenOversight/tests/test_utils.py index 420718927..0b75aac22 100644 --- a/OpenOversight/tests/test_utils.py +++ b/OpenOversight/tests/test_utils.py @@ -233,7 +233,7 @@ def test_save_image_to_s3_and_db_returns_existing_image( test_png_bytes_io.close = lambda: None firstUpload = save_image_to_s3_and_db(test_png_bytes_io, 1, 1) secondUpload = save_image_to_s3_and_db(test_png_bytes_io, 1, 1) - assert type(secondUpload) == Image + assert type(secondUpload) is Image assert firstUpload.id == secondUpload.id diff --git a/dev-requirements.txt b/dev-requirements.txt index 385ac8251..88a72f6cb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,7 +3,7 @@ faker==18.11.2 mock==5.0.2 nose>=1.3.1 pandas>=0.23.4 -pre-commit==3.3.3 +pre-commit==3.8.0 pytest==7.4.0 pytest-cov==4.1.0 pytest-pep8==1.0.6