Browse Source

ref: fix typing for templatetags.sentry_helpers (#78635)

<!-- Describe your PR here. -->
anthony sottile 5 months ago
parent
commit
779d6a288e
2 changed files with 2 additions and 4 deletions
  1. 0 1
      pyproject.toml
  2. 2 3
      src/sentry/templatetags/sentry_helpers.py

+ 0 - 1
pyproject.toml

@@ -341,7 +341,6 @@ module = [
     "sentry.tasks.auth",
     "sentry.tasks.base",
     "sentry.tasks.process_buffer",
-    "sentry.templatetags.sentry_helpers",
     "sentry.testutils.cases",
     "sentry.testutils.fixtures",
     "sentry.testutils.helpers.notifications",

+ 2 - 3
src/sentry/templatetags/sentry_helpers.py

@@ -22,8 +22,7 @@ SentryVersion = namedtuple("SentryVersion", ["current", "latest", "update_availa
 
 register = template.Library()
 
-truncatechars = register.filter(stringfilter(truncatechars))
-truncatechars.is_safe = True
+truncatechars = register.filter(stringfilter(truncatechars), is_safe=True)
 
 
 @register.filter
@@ -254,7 +253,7 @@ def date(dt, arg=None):
 @register.simple_tag
 def percent(value, total, format=None):
     if not (value and total):
-        result = 0
+        result = 0.0
     else:
         result = int(value) / float(total) * 100