Skip to content

Commit 9b3d03a

Browse files
authored
Update blacken-docs and black to latest versions (#9802)
* Update blacken-docs and black to latest versions * Include docs folder for blackend-docs * Run blacken docs on docs folder * Fix broken link on authentication page
1 parent 5a6f2ae commit 9b3d03a

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ repos:
1919
additional_dependencies:
2020
- flake8-tidy-imports
2121
- repo: https://github.com/adamchainz/blacken-docs
22-
rev: 1.16.0
22+
rev: 1.20.0
2323
hooks:
2424
- id: blacken-docs
25-
exclude: ^(?!docs).*$
2625
additional_dependencies:
27-
- black==23.1.0
26+
- black==25.9.0
2827
- repo: https://github.com/codespell-project/codespell
2928
# Configuration for codespell is in .codespellrc
3029
rev: v2.2.6

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ Install using `pip`...
6767
pip install djangorestframework
6868

6969
Add `'rest_framework'` to your `INSTALLED_APPS` setting.
70+
7071
```python
7172
INSTALLED_APPS = [
72-
...
73-
'rest_framework',
73+
# ...
74+
"rest_framework",
7475
]
7576
```
7677

@@ -99,7 +100,7 @@ from rest_framework import routers, serializers, viewsets
99100
class UserSerializer(serializers.HyperlinkedModelSerializer):
100101
class Meta:
101102
model = User
102-
fields = ['url', 'username', 'email', 'is_staff']
103+
fields = ["url", "username", "email", "is_staff"]
103104

104105

105106
# ViewSets define the view behavior.
@@ -110,13 +111,13 @@ class UserViewSet(viewsets.ModelViewSet):
110111

111112
# Routers provide a way of automatically determining the URL conf.
112113
router = routers.DefaultRouter()
113-
router.register(r'users', UserViewSet)
114+
router.register(r"users", UserViewSet)
114115

115116
# Wire up our API using automatic URL routing.
116117
# Additionally, we include login URLs for the browsable API.
117118
urlpatterns = [
118-
path('', include(router.urls)),
119-
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
119+
path("", include(router.urls)),
120+
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
120121
]
121122
```
122123

@@ -126,15 +127,15 @@ Add the following to your `settings.py` module:
126127

127128
```python
128129
INSTALLED_APPS = [
129-
... # Make sure to include the default installed apps here.
130-
'rest_framework',
130+
# ... make sure to include the default installed apps here.
131+
"rest_framework",
131132
]
132133

133134
REST_FRAMEWORK = {
134135
# Use Django's standard `django.contrib.auth` permissions,
135136
# or allow read-only access for unauthenticated users.
136-
'DEFAULT_PERMISSION_CLASSES': [
137-
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
137+
"DEFAULT_PERMISSION_CLASSES": [
138+
"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
138139
]
139140
}
140141
```

docs/api-guide/authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ There are currently two forks of this project.
454454

455455
More information can be found in the [Documentation](https://django-rest-durin.readthedocs.io/en/latest/index.html).
456456

457-
## django-pyoidc
457+
## django-pyoidc
458458

459459
[dango-pyoidc][django_pyoidc] adds support for OpenID Connect (OIDC) authentication. This allows you to delegate user management to an Identity Provider, which can be used to implement Single-Sign-On (SSO). It provides support for most uses-cases, such as customizing how token info are mapped to user models, using OIDC audiences for access control, etc.
460460

@@ -497,4 +497,4 @@ More information can be found in the [Documentation](https://django-pyoidc.readt
497497
[django-rest-authemail]: https://github.com/celiao/django-rest-authemail
498498
[django-rest-durin]: https://github.com/eshaan7/django-rest-durin
499499
[login-required-middleware]: https://docs.djangoproject.com/en/stable/ref/middleware/#django.contrib.auth.middleware.LoginRequiredMiddleware
500-
[django-pyoidc] : https://github.com/makinacorpus/django_pyoidc
500+
[django-pyoidc]: https://github.com/makinacorpus/django_pyoidc

docs/api-guide/viewsets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Using the example from the previous section:
231231
Alternatively, you can use the `url_name` attribute set by the `@action` decorator.
232232

233233
```pycon
234-
>>> view.reverse_action(view.set_password.url_name, args=['1'])
234+
>>> view.reverse_action(view.set_password.url_name, args=["1"])
235235
'http://localhost:8000/api/users/1/set_password'
236236
```
237237

docs/community/3.11-announcement.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ class DocStringExampleListView(APIView):
5050

5151
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
5252

53-
def get(self, request, *args, **kwargs):
54-
...
53+
def get(self, request, *args, **kwargs): ...
5554

56-
def post(self, request, *args, **kwargs):
57-
...
55+
def post(self, request, *args, **kwargs): ...
5856
```
5957

6058
## Validator / Default Context
@@ -76,8 +74,7 @@ Validator implementations will look like this:
7674
class CustomValidator:
7775
requires_context = True
7876

79-
def __call__(self, value, serializer_field):
80-
...
77+
def __call__(self, value, serializer_field): ...
8178
```
8279

8380
Default implementations will look like this:
@@ -86,8 +83,7 @@ Default implementations will look like this:
8683
class CustomDefault:
8784
requires_context = True
8885

89-
def __call__(self, serializer_field):
90-
...
86+
def __call__(self, serializer_field): ...
9187
```
9288

9389
---

0 commit comments

Comments
 (0)