aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/serializers.py
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2019-09-24 17:32:03 -0400
committerGravatar GitHub <[email protected]>2019-09-24 17:32:03 -0400
commit37d989d0b74a1d0f8b0ee60749c79ea4a55ffba5 (patch)
treef1541776183c3d3850693ad20d81fb530bed3a1d /pydis_site/apps/api/serializers.py
parentSwap out old discord shield for new one. (diff)
parentMerge branch 'master' into update-linting (diff)
Merge pull request #251 from python-discord/update-linting
Update linting dependencies & relint
Diffstat (limited to 'pydis_site/apps/api/serializers.py')
-rw-r--r--pydis_site/apps/api/serializers.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py
index 442f6209..5466b06b 100644
--- a/pydis_site/apps/api/serializers.py
+++ b/pydis_site/apps/api/serializers.py
@@ -66,7 +66,7 @@ class MessageDeletionContextSerializer(ModelSerializer):
fields = ('actor', 'creation', 'id', 'deletedmessage_set')
depth = 1
- def create(self, validated_data):
+ def create(self, validated_data: dict) -> MessageDeletionContext:
"""
Return a `MessageDeletionContext` based on the given data.
@@ -106,7 +106,7 @@ class InfractionSerializer(ModelSerializer):
'id', 'inserted_at', 'expires_at', 'active', 'user', 'actor', 'type', 'reason', 'hidden'
)
- def validate(self, attrs):
+ def validate(self, attrs: dict) -> dict:
"""Validate data constraints for the given data and abort if it is invalid."""
infr_type = attrs.get('type')
@@ -129,7 +129,7 @@ class ExpandedInfractionSerializer(InfractionSerializer):
serializer also attaches the `user` and `actor` fields when serializing.
"""
- def to_representation(self, instance):
+ def to_representation(self, instance: Infraction) -> dict:
"""Return the dictionary representation of this infraction."""
ret = super().to_representation(instance)
@@ -166,7 +166,7 @@ class OffTopicChannelNameSerializer(ModelSerializer):
model = OffTopicChannelName
fields = ('name',)
- def to_representation(self, obj):
+ def to_representation(self, obj: OffTopicChannelName) -> str:
"""
Return the representation of this `OffTopicChannelName`.