From 76cbca60f4e7a842c5ef129a834dc1383b8133c9 Mon Sep 17 00:00:00 2001 From: Jim Crist-Harif Date: Thu, 24 Oct 2024 22:18:10 -0500 Subject: [PATCH] Upgrade ruff in pre-commit --- .pre-commit-config.yaml | 8 ++------ benchmarks/bench_gc.py | 1 + pyproject.toml | 6 ++++-- scripts/generate_atof_consts.py | 1 + tests/test_convert.py | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6b725a23..1d03a327 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,9 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.2 + rev: v0.7.1 hooks: - id: ruff - language_version: python3 - - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.2 - hooks: + args: [ --fix ] - id: ruff-format - repo: https://github.com/codespell-project/codespell diff --git a/benchmarks/bench_gc.py b/benchmarks/bench_gc.py index 0a22a6d4..c642ab1a 100644 --- a/benchmarks/bench_gc.py +++ b/benchmarks/bench_gc.py @@ -6,6 +6,7 @@ - Time for a single full GC pass over all the data. - Amount of memory used to hold all the data """ + import gc import sys import time diff --git a/pyproject.toml b/pyproject.toml index e2451923..cae77474 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,9 @@ exclude = [ "test_JSONTestSuite.py", "conf.py", ] +line-length = 88 + +[tool.ruff.lint] ignore = [ "E721", # Comparing types instead of isinstance "E741", # Ambiguous variable names @@ -21,7 +24,6 @@ select = [ "F", # Pyflakes "W", # PEP8 Warnings ] -line-length = 88 -[tool.ruff.isort] +[tool.ruff.lint.isort] combine-as-imports = true diff --git a/scripts/generate_atof_consts.py b/scripts/generate_atof_consts.py index daab16ab..e3861afe 100644 --- a/scripts/generate_atof_consts.py +++ b/scripts/generate_atof_consts.py @@ -1,4 +1,5 @@ """This script generates msgspec/atof_consts.h""" + import math import os import textwrap diff --git a/tests/test_convert.py b/tests/test_convert.py index afb456cc..da1b664c 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -695,8 +695,7 @@ def test_uuid_disabled(self): convert(typ(u.bytes), uuid.UUID, builtin_types=(uuid.UUID,)) def test_convert_uuid_subclass(self): - class UUID2(uuid.UUID): - ... + class UUID2(uuid.UUID): ... u1 = uuid.uuid4() u2 = UUID2(str(u1))