Skip to content

Commit

Permalink
Black dropped us 5 years ago
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Sep 5, 2024
1 parent 62fb657 commit 2f1014a
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ You will find the built documentation in `docs/_build/html`.

## Code

- We follow [PEP 8](https://peps.python.org/pep-0008/) as enforced by [Ruff](https://ruff.rs/) and [Black](https://github.com/psf/black) with a line length of 79 characters.
- We follow [PEP 8](https://peps.python.org/pep-0008/) as enforced by [Ruff](https://ruff.rs/) with a line length of 79 characters.

- As long as you run our full *tox* suite before committing, or install our [*pre-commit*](https://pre-commit.com/) hooks, you won't have to spend any time on formatting your code at all.
If you don't, CI will catch it for you -- but that seems like a waste of your time!
Expand Down
6 changes: 1 addition & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ ci:
autoupdate_schedule: monthly

repos:
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
hooks:
- id: ruff-format
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

Expand Down
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ exclude_lines = [
]


[tool.black]
line-length = 79


[tool.interrogate]
omit-covered-files = true
verbose = 2
Expand All @@ -190,6 +186,7 @@ toplevel = ["attr", "attrs"]

[tool.ruff]
src = ["src", "tests", "conftest.py", "docs"]
line-length = 79

[tool.ruff.lint]
select = ["ALL"]
Expand All @@ -200,12 +197,13 @@ ignore = [
"ANN", # Mypy is better at this
"ARG", # unused arguments are normal when implementing interfaces
"C901", # we're complex software
"COM", # Black takes care of our commas
"COM", # ruff format takes care of our commas
"D", # We prefer our own docstring style.
"E501", # leave line-length enforcement to Black
"E501", # leave line-length enforcement to ruff format
"ERA001", # we need to keep around some notes
"FBT", # we don't hate bool args around here
"FIX", # Yes, we want XXX as a marker.
"ISC001", # conflicts with ruff format
"N", # we need more naming freedom
"PD", # we're not pandas
"PLR0912", # we're complex software
Expand Down
1 change: 0 additions & 1 deletion src/attr/_next_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
default values.
"""


from functools import partial

from . import setters
Expand Down
1 change: 0 additions & 1 deletion src/attr/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Commonly useful converters.
"""


import typing

from ._compat import _AnnotationExtractor
Expand Down
1 change: 0 additions & 1 deletion src/attr/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Commonly useful validators.
"""


import operator
import re

Expand Down
4 changes: 2 additions & 2 deletions src/attr/validators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def instance_of(type: type[_T]) -> _ValidatorType[_T]: ...
def instance_of(type: tuple[type[_T]]) -> _ValidatorType[_T]: ...
@overload
def instance_of(
type: tuple[type[_T1], type[_T2]]
type: tuple[type[_T1], type[_T2]],
) -> _ValidatorType[_T1 | _T2]: ...
@overload
def instance_of(
type: tuple[type[_T1], type[_T2], type[_T3]]
type: tuple[type[_T1], type[_T2], type[_T3]],
) -> _ValidatorType[_T1 | _T2 | _T3]: ...
@overload
def instance_of(type: tuple[type, ...]) -> _ValidatorType[Any]: ...
Expand Down
1 change: 1 addition & 0 deletions tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Testing strategies for Hypothesis-based tests.
"""

import functools
import keyword
import string
Expand Down
1 change: 0 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tests for `attr._config`.
"""


import pytest

from attr import _config
Expand Down
5 changes: 2 additions & 3 deletions tests/test_dunders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tests for dunder methods from `attrib._make`.
"""


import copy
import inspect
import pickle
Expand Down Expand Up @@ -481,12 +480,12 @@ def test_enforces_type(self):
exc_args = ("Invalid value for hash. Must be True, False, or None.",)

with pytest.raises(TypeError) as e:
make_class("C", {}, unsafe_hash=1),
make_class("C", {}, unsafe_hash=1)

assert exc_args == e.value.args

with pytest.raises(TypeError) as e:
make_class("C", {"a": attr.ib(hash=1)}),
make_class("C", {"a": attr.ib(hash=1)})

assert exc_args == e.value.args

Expand Down
1 change: 0 additions & 1 deletion tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tests for `attr.filters`.
"""


import pytest

import attr
Expand Down
1 change: 1 addition & 0 deletions tests/test_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Tests for `attr._make`.
"""

import copy
import functools
import gc
Expand Down
1 change: 0 additions & 1 deletion tests/test_pattern_matching.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: MIT

# Keep this file SHORT, until Black can handle it.
import pytest

import attr
Expand Down
1 change: 0 additions & 1 deletion tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tests for `attr.validators`.
"""


import re

import pytest
Expand Down
1 change: 0 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Common helper functions for tests.
"""


from attr import Attribute
from attr._make import NOTHING, _default_init_alias_for, make_class

Expand Down

0 comments on commit 2f1014a

Please sign in to comment.