Skip to content

Commit 4ffed39

Browse files
committed
chore: add docformatter pre-commit
1 parent d7959c8 commit 4ffed39

File tree

2 files changed

+30
-35
lines changed

2 files changed

+30
-35
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v4.5.0
55
hooks:
66
- id: fix-byte-order-marker
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-toml
10-
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: 'v0.0.284'
10+
- repo: https://github.com/asottile/pyupgrade
11+
rev: v3.15.0
1212
hooks:
13-
- id: ruff
14-
args: [--fix, --exit-non-zero-on-fix]
13+
- id: pyupgrade
14+
args: ["--py38-plus"]
1515
- repo: https://github.com/asottile/reorder_python_imports
16-
rev: v3.10.0
16+
rev: v3.12.0
1717
hooks:
1818
- id: reorder-python-imports
1919
args: ["--application-directories", "canaille"]
20-
- repo: https://github.com/asottile/pyupgrade
21-
rev: v3.10.1
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: 'v0.1.9'
2222
hooks:
23-
- id: pyupgrade
24-
args: ["--py38-plus"]
25-
- repo: https://github.com/psf/black
26-
rev: 23.7.0
23+
- id: ruff
24+
args: [--fix, --exit-non-zero-on-fix]
25+
- id: ruff-format
26+
- repo: https://github.com/PyCQA/docformatter
27+
rev: v1.7.5
2728
hooks:
28-
- id: black
29+
- id: docformatter
2930
- repo: https://github.com/rtts/djhtml
3031
rev: 3.0.6
3132
hooks:

pytest_iam/__init__.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424

2525
class Server:
26-
"""
27-
A proxy object that is returned by the pytest fixture.
28-
"""
26+
"""A proxy object that is returned by the pytest fixture."""
2927

3028
#: The port on which the local http server listens
3129
port: int
@@ -50,14 +48,12 @@ def logged_user():
5048

5149
@property
5250
def url(self) -> str:
53-
"""
54-
The URL at which the IAM server is accessible.
55-
"""
51+
"""The URL at which the IAM server is accessible."""
5652
return f"http://localhost:{self.port}/"
5753

5854
def random_user(self, **kwargs) -> User:
59-
"""
60-
Generates a :class:`~canaille.core.models.User` with random values.
55+
"""Generates a :class:`~canaille.core.models.User` with random values.
56+
6157
Any parameter will be used instead of a random value.
6258
"""
6359
with self.app.app_context():
@@ -68,8 +64,8 @@ def random_user(self, **kwargs) -> User:
6864
return user
6965

7066
def random_group(self, **kwargs) -> Group:
71-
"""
72-
Generates a :class:`~canaille.core.models.Group` with random values.
67+
"""Generates a :class:`~canaille.core.models.Group` with random values.
68+
7369
Any parameter will be used instead of a random value.
7470
"""
7571
with self.app.app_context():
@@ -80,8 +76,9 @@ def random_group(self, **kwargs) -> Group:
8076
return group
8177

8278
def random_token(self, subject, client, **kwargs) -> Token:
83-
"""
84-
Generates a test :class:`~canaille.oidc.basemodels.Token` with random values.
79+
"""Generates a test :class:`~canaille.oidc.basemodels.Token` with
80+
random values.
81+
8582
Any parameter will be used instead of a random value.
8683
"""
8784
with self.app.app_context():
@@ -104,15 +101,14 @@ def random_token(self, subject, client, **kwargs) -> Token:
104101
return token
105102

106103
def login(self, user):
107-
"""
108-
Opens a session for the user in the IAM session.
104+
"""Opens a session for the user in the IAM session.
105+
109106
This allows to skip the connection screen.
110107
"""
111108
self.logged_user = user
112109

113110
def consent(self, user, client=None) -> Consent | List[Consent]:
114-
"""
115-
Make a user consent to share data with OIDC clients.
111+
"""Make a user consent to share data with OIDC clients.
116112
117113
:param client: If :const:`None`, all existing clients are consented.
118114
"""
@@ -143,9 +139,8 @@ def consent(self, user, client=None) -> Consent | List[Consent]:
143139

144140
@pytest.fixture(scope="session")
145141
def iam_configuration() -> Dict[str, Any]:
146-
"""
147-
Fixture for editing the configuration of :meth:`~pytest_iam.iam_server`.
148-
"""
142+
"""Fixture for editing the configuration of
143+
:meth:`~pytest_iam.iam_server`."""
149144

150145
private_key, public_key = generate_keypair()
151146
return {
@@ -170,9 +165,8 @@ def iam_configuration() -> Dict[str, Any]:
170165

171166
@pytest.fixture(scope="session")
172167
def iam_server(iam_configuration) -> Server:
173-
"""
174-
Fixture that creates a Canaille server listening a random port in a thread.
175-
"""
168+
"""Fixture that creates a Canaille server listening a random port in a
169+
thread."""
176170

177171
port = portpicker.pick_unused_port()
178172
app = create_app(config=iam_configuration)

0 commit comments

Comments
 (0)