diff --git a/rest_framework-stubs/utils/encoders.pyi b/rest_framework-stubs/utils/encoders.pyi index 9d88a9b58..a6e2a87c5 100644 --- a/rest_framework-stubs/utils/encoders.pyi +++ b/rest_framework-stubs/utils/encoders.pyi @@ -1,3 +1,10 @@ +import datetime import json +from yaml import Dumper, ScalarNode + class JSONEncoder(json.JSONEncoder): ... + +class CustomScalar: + @classmethod + def represent_timedelta(cls, dumper: Dumper, data: datetime.timedelta) -> ScalarNode: ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 5ce812434..4e4e6bfdd 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -147,5 +147,4 @@ rest_framework.serializers.Field.__class_getitem__ rest_framework.serializers.ListSerializer.run_child_validation rest_framework.serializers.ModelSerializer.get_unique_together_constraints rest_framework.templatetags.rest_framework.optional_logout -rest_framework.utils.encoders.CustomScalar rest_framework.utils.field_mapping.get_unique_validators