From 9854ca10287a70ef2be85b2985a9b5474aeb6136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Fri, 11 Oct 2024 14:16:20 +0200 Subject: [PATCH] chore: use pre-commit configuration from Flask --- .pre-commit-config.yaml | 32 ++++++++------------------------ src/wtforms/csrf/session.py | 1 + 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b993109d1..1cddf087e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,30 +1,14 @@ ---- repos: - - repo: https://github.com/asottile/pyupgrade - rev: v3.13.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 hooks: - - id: pyupgrade - args: ["--py39-plus"] - - repo: https://github.com/asottile/reorder_python_imports - rev: v3.11.0 - hooks: - - id: reorder-python-imports - args: ["--application-directories", "src"] - - repo: https://github.com/psf/black - rev: 23.9.1 - hooks: - - id: black - - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - additional_dependencies: - - flake8-bugbear - - flake8-implicit-str-concat - - flake8-pyproject + - id: ruff + - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - - id: check-byte-order-marker + - id: check-merge-conflict + - id: debug-statements + - id: fix-byte-order-marker - id: trailing-whitespace - id: end-of-file-fixer diff --git a/src/wtforms/csrf/session.py b/src/wtforms/csrf/session.py index 62ba7638e..d7ddd5b95 100644 --- a/src/wtforms/csrf/session.py +++ b/src/wtforms/csrf/session.py @@ -12,6 +12,7 @@ validates with the hmac of the random value + expiration time, and the expiration time is not passed, the CSRF validation will pass. """ + import hmac import os from datetime import datetime