From cc69b22520b2d81837ac5a18e94a1ee7cd3fd792 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Tue, 4 Mar 2025 08:00:11 +0100 Subject: [PATCH 1/3] Update ruff --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20eb745..be211e7 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.6.0 + rev: v5.0.0 hooks: - id: check-merge-conflict - id: debug-statements @@ -9,7 +9,7 @@ repos: - id: check-yaml - id: check-json - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.0 + rev: v0.9.9 hooks: - id: ruff - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index e64f8e7..bd88efd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ responses = "^0.13.0" sphinx = "^3.5.2" sphinx-autobuild = "^2021.3.14" coverage = "^7" -ruff = ">=0.8.0" +ruff = ">=0.9.9" pytest-ruff = "^0.3.2" [build-system] From 680877cf3fcc4e3e8614d345879eb66a0990fd84 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Tue, 11 Mar 2025 18:53:46 +0100 Subject: [PATCH 2/3] Update action --- .github/workflows/test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16dd7dd..3bcffe1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,11 +17,15 @@ jobs: cancel_others: 'true' concurrent_skipping: same_content ruff: - runs-on: ubuntu-latest needs: pre_job + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: chartboost/ruff-action@v1 + - uses: astral-sh/ruff-action@v3 + with: + version: latest + - run: ruff check + - run: ruff format --check test: needs: ruff if: ${{ needs.pre_job.outputs.should_skip != 'true' }} From 41fd2065be327a6b283e283fe18c8c6ded66844a Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Tue, 11 Mar 2025 18:55:39 +0100 Subject: [PATCH 3/3] reformat --- src/cryptojwt/jws/dsa.py | 4 ++-- tests/test_02_jwk.py | 3 +-- tests/test_03_key_bundle.py | 2 +- tests/test_06_jws.py | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/cryptojwt/jws/dsa.py b/src/cryptojwt/jws/dsa.py index d32f93c..c59ddf0 100644 --- a/src/cryptojwt/jws/dsa.py +++ b/src/cryptojwt/jws/dsa.py @@ -40,7 +40,7 @@ def sign(self, msg, key): """ if not isinstance(key, ec.EllipticCurvePrivateKey): - raise TypeError("The private key must be an instance of " "ec.EllipticCurvePrivateKey") + raise TypeError("The private key must be an instance of ec.EllipticCurvePrivateKey") self._cross_check(key.public_key()) num_bits = key.curve.key_size @@ -62,7 +62,7 @@ def verify(self, msg, sig, key): :return: True """ if not isinstance(key, ec.EllipticCurvePublicKey): - raise TypeError("The public key must be an instance of " "ec.EllipticCurvePublicKey") + raise TypeError("The public key must be an instance of ec.EllipticCurvePublicKey") self._cross_check(key) num_bits = key.curve.key_size diff --git a/tests/test_02_jwk.py b/tests/test_02_jwk.py index 60d0a0d..03ae60e 100755 --- a/tests/test_02_jwk.py +++ b/tests/test_02_jwk.py @@ -150,8 +150,7 @@ def test_serialize_rsa_priv_key(): ECKEY = { "crv": "P-521", "x": "AekpBQ8ST8a8VcfVOTNl353vSrDCLLJXmPk06wTjxrrjcBpXp5EOnYG_NjFZ6OvLFV1jSfS9tsz4qUxcWceqwQGk", - "y": "ADSmRA43Z1DSNx_RvcLI87cdL07l6jQyyBXMoxVg_l2Th" - "-x3S1WDhjDly79ajL4Kkd0AZMaZmh9ubmf63e3kyMj2", + "y": "ADSmRA43Z1DSNx_RvcLI87cdL07l6jQyyBXMoxVg_l2Th-x3S1WDhjDly79ajL4Kkd0AZMaZmh9ubmf63e3kyMj2", "d": "AY5pb7A0UFiB3RELSD64fTLOSV_jazdF7fLYyuTw8lOfRhWg6Y6rUrPAxerEzgdRhajnu0ferB0d53vM9mE15j2C", } diff --git a/tests/test_03_key_bundle.py b/tests/test_03_key_bundle.py index c235157..b4c94c7 100755 --- a/tests/test_03_key_bundle.py +++ b/tests/test_03_key_bundle.py @@ -74,7 +74,7 @@ def full_path(local_file): "kid": "rsa1", }, { - "k": "YTEyZjBlMDgxMGI4YWU4Y2JjZDFiYTFlZTBjYzljNDU3YWM0ZWNiNzhmNmFlYTNkNT" "Y0NzMzYjE", + "k": "YTEyZjBlMDgxMGI4YWU4Y2JjZDFiYTFlZTBjYzljNDU3YWM0ZWNiNzhmNmFlYTNkNTY0NzMzYjE", "kty": "oct", }, ] diff --git a/tests/test_06_jws.py b/tests/test_06_jws.py index dff22e6..8c745ce 100644 --- a/tests/test_06_jws.py +++ b/tests/test_06_jws.py @@ -418,7 +418,7 @@ def test_a_1_1a(): def test_a_1_1b(): - payload = b'{"iss":"joe",\r\n "exp":1300819380,' b'\r\n "http://example.com/is_root":true}' + payload = b'{"iss":"joe",\r\n "exp":1300819380,\r\n "http://example.com/is_root":true}' val = b64e(payload) assert val == ( b"eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9" @@ -430,7 +430,7 @@ def test_a_1_1c(): hmac = intarr2bin(HMAC_KEY) signer = SIGNER_ALGS["HS256"] header = b'{"typ":"JWT",\r\n "alg":"HS256"}' - payload = b'{"iss":"joe",\r\n "exp":1300819380,' b'\r\n "http://example.com/is_root":true}' + payload = b'{"iss":"joe",\r\n "exp":1300819380,\r\n "http://example.com/is_root":true}' sign_input = b64e(header) + b"." + b64e(payload) sig = signer.sign(sign_input, hmac) assert b64e(sig) == b"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"