Skip to content

Commit 41ec1fd

Browse files
committed
Eliminate usage of typing module and update docstrings.
1 parent 876daaf commit 41ec1fd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pydis_site/apps/api/serializers.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""Converters from Django models to data interchange formats and back."""
2-
from typing import List
3-
42
from django.db.models.query import QuerySet
53
from django.db.utils import IntegrityError
64
from rest_framework.exceptions import NotFound
@@ -205,12 +203,12 @@ def to_representation(self, instance: Infraction) -> dict:
205203
class OffTopicChannelNameListSerializer(ListSerializer):
206204
"""Custom ListSerializer to override to_representation() when list views are triggered."""
207205

208-
def to_representation(self, objects: List[OffTopicChannelName]) -> List[str]:
206+
def to_representation(self, objects: list[OffTopicChannelName]) -> list[str]:
209207
"""
210-
Return a list representing a list of `OffTopicChannelName`.
208+
Return a list with all `OffTopicChannelName`s in the database.
211209
212-
This only returns the name of the off topic channel name. As the model
213-
only has a single attribute, it is unnecessary to create a nested dictionary.
210+
This returns the list of off topic channel names. We want to only return
211+
the name attribute, hence it is unnecessary to create a nested dictionary.
214212
Additionally, this allows off topic channel name routes to simply return an
215213
array of names instead of objects, saving on bandwidth.
216214
"""

0 commit comments

Comments
 (0)