Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/sentry/api/fields/empty_decimal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from decimal import Decimal
from typing import cast

from rest_framework import serializers
from rest_framework.fields import empty
Expand All @@ -12,11 +11,6 @@ class EmptyDecimalField(serializers.DecimalField):
cases, so this restores it.
"""

def to_internal_value(self, data: int | float | str | Decimal) -> Decimal:
if data == "":
return cast(Decimal, None)
return super().to_internal_value(data)

def run_validation(self, data: object = empty) -> Decimal | None:
if data == "":
return None
Expand Down
7 changes: 0 additions & 7 deletions src/sentry/api/fields/empty_integer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import cast

from rest_framework import serializers
from rest_framework.fields import empty

Expand All @@ -11,11 +9,6 @@ class EmptyIntegerField(serializers.IntegerField):
cases, so this restores it.
"""

def to_internal_value(self, data: int | float | str) -> int:
if data == "":
return cast(int, None)
return super().to_internal_value(data)

def run_validation(self, data: object = empty) -> int | None:
if data == "":
return None
Expand Down
4 changes: 2 additions & 2 deletions src/sentry/monitors/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def get_value(self, dictionary: Any) -> Any:


class MissedMarginField(EmptyIntegerField):
def to_internal_value(self, value: Any) -> Any:
value = super().to_internal_value(value)
def to_internal_value(self, data: float | int | str) -> int:
value = super().to_internal_value(data)

# XXX(epurkhiser): As part of GH-56526 we changed the minimum value
# allowed for the checkin_margin to 1 from 0. Some monitors may still
Expand Down
Loading