diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0dd36b6..dfe3c55 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,14 +9,6 @@ repos: hooks: - id: check-yaml - id: trailing-whitespace - - repo: local - hooks: - - id: pyupgrade - name: pyupgrade - entry: uv run pyupgrade --py36-plus - language: python - types: [python] - pass_filenames: true - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index af5bee8..5feff5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,10 +33,12 @@ dependencies = [ "httpx>=0.24.1", ] +[project.scripts] +peeringdb = "peeringdb.cli:main" + [project.urls] repository = "https://github.com/peeringdb/peeringdb-py" - [tool.uv] dev-dependencies = [ "django_peeringdb>=3.1.0", @@ -59,8 +61,12 @@ dev-dependencies = [ "twine>=3", ] -[project.scripts] -peeringdb = "peeringdb.cli:main" +[tool.ruff.lint] +extend-select = [ + "I", # isort + "UP", # pyupgrade +] + [build-system] requires = ["hatchling"] diff --git a/script/dump_sqlite.py b/script/dump_sqlite.py index a843a15..4d96e06 100644 --- a/script/dump_sqlite.py +++ b/script/dump_sqlite.py @@ -37,7 +37,7 @@ def main(file, dumpfile=None): def write(f): for line in output: - f.write("%s\n" % line) + f.write(f"{str(line)}\n") if dumpfile is None: write(sys.stdout) diff --git a/src/peeringdb/_update.py b/src/peeringdb/_update.py index eb82b6b..e6c6ac3 100644 --- a/src/peeringdb/_update.py +++ b/src/peeringdb/_update.py @@ -6,12 +6,11 @@ from datetime import datetime from typing import List, Union -from peeringdb import get_backend +from peeringdb import config, get_backend from peeringdb._sync import extract_relations, set_many_relations, set_single_relations from peeringdb.fetch import Fetcher from peeringdb.private import private_data_has_been_fetched from peeringdb.util import group_fields, log_error -from peeringdb import config class Updater: diff --git a/src/peeringdb/commands.py b/src/peeringdb/commands.py index 9795ff2..eab6384 100644 --- a/src/peeringdb/commands.py +++ b/src/peeringdb/commands.py @@ -13,7 +13,6 @@ from peeringdb.util import load_failed_entries, save_failed_entries from peeringdb.whois import WhoisFormat - _log = logging.getLogger(__name__) _log = logging.getLogger(__name__) diff --git a/tests/test_sync.py b/tests/test_sync.py index 7aa2620..bc4bbfc 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -1,8 +1,9 @@ -import helper -import pytest import json import os +import helper +import pytest + import peeringdb from peeringdb.client import Client from peeringdb.resource import Network, Organization, all_resources