Skip to content

Commit

Permalink
Adopt Ruff (python#1372)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
AA-Turner and hugovk authored Aug 15, 2024
1 parent cedcb49 commit 8e00ff2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

38 changes: 9 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
args: [--skip-string-normalization]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
[flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
name: Run Ruff (lint)
args: [--exit-non-zero-on-fix]
- id: ruff-format
name: Run Ruff (format)
args: [--check]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
35 changes: 35 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
target-version = "py311"
fix = true
output-format = "full"
line-length = 88

[lint]
preview = true
select = [
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"E", # pycodestyle
"F", # pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PERF", # perflint
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"TCH", # flake8-type-checking
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
ignore = [
"E501", # Ignore line length errors (we use auto-formatting)
]

[format]
preview = true
quote-style = "preserve"
docstring-code-format = true
7 changes: 2 additions & 5 deletions _tools/generate_release_cycle.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Read in a JSON and generate two CSVs and an SVG file."""

from __future__ import annotations

import argparse
import csv
import datetime as dt
import json
import sys

import jinja2

Expand Down Expand Up @@ -45,10 +45,7 @@ def __init__(self) -> None:

def write_csv(self) -> None:
"""Output CSV files."""
if sys.version_info >= (3, 11):
now_str = str(dt.datetime.now(dt.UTC))
else:
now_str = str(dt.datetime.utcnow())
now_str = str(dt.datetime.now(dt.UTC))

versions_by_category = {"branches": {}, "end-of-life": {}}
headers = None
Expand Down

0 comments on commit 8e00ff2

Please sign in to comment.