Skip to content

Commit 03b2c2d

Browse files
committed
moar type fun
1 parent 838c5ea commit 03b2c2d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sentry_sdk/transport.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from urllib.request import getproxies
1212

1313
try:
14-
import brotli
14+
import brotli # type: ignore
1515
except ImportError:
1616
brotli = None
1717

@@ -24,7 +24,7 @@
2424
from sentry_sdk.worker import BackgroundWorker
2525
from sentry_sdk.envelope import Envelope, Item, PayloadRef
2626

27-
from typing import TYPE_CHECKING
27+
from typing import TYPE_CHECKING, cast
2828

2929
if TYPE_CHECKING:
3030
from typing import Any
@@ -176,10 +176,11 @@ def _parse_rate_limits(header, now=None):
176176
for limit in header.split(","):
177177
try:
178178
parameters = limit.strip().split(":")
179-
retry_after, categories = parameters[:2]
179+
retry_after_val, categories = parameters[:2]
180180

181-
retry_after = now + timedelta(seconds=int(retry_after))
181+
retry_after = now + timedelta(seconds=int(retry_after_val))
182182
for category in categories and categories.split(";") or (None,):
183+
category = cast(EventDataCategory, category)
183184
if category == "metric_bucket":
184185
try:
185186
namespaces = parameters[4].split(";")
@@ -580,7 +581,7 @@ def flush(
580581
timeout,
581582
callback=None,
582583
):
583-
# type: (Self, float, Optional[Callable]) -> None
584+
# type: (Self, float, Optional[Callable[[int, float], None]]) -> None
584585
logger.debug("Flushing HTTP transport")
585586

586587
if timeout > 0:

0 commit comments

Comments
 (0)