Skip to content

Commit 0bfc566

Browse files
committed
cleanup imports
1 parent ec36dca commit 0bfc566

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

sentry_sdk/_batcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
import random
33
import threading
44
from datetime import datetime, timezone
5-
from typing import Optional, List, Callable, TYPE_CHECKING, Any
5+
from typing import TYPE_CHECKING, TypeVar, Generic
66

77
from sentry_sdk.utils import format_timestamp, safe_repr, serialize_attribute
88
from sentry_sdk.envelope import Envelope, Item, PayloadRef
99

1010
if TYPE_CHECKING:
11-
from typing import TypeVar
11+
from typing import Optional, Callable, Any
1212

13-
T = TypeVar("T")
13+
T = TypeVar("T")
1414

1515

16-
class Batcher:
16+
class Batcher(Generic[T]):
1717
MAX_BEFORE_FLUSH = 100
1818
MAX_BEFORE_DROP = 1_000
1919
FLUSH_WAIT_TIME = 5.0
@@ -26,7 +26,7 @@ def __init__(
2626
capture_func: "Callable[[Envelope], None]",
2727
record_lost_func: "Callable[..., None]",
2828
) -> None:
29-
self._buffer: "List[T]" = []
29+
self._buffer: "list[T]" = []
3030
self._capture_func = capture_func
3131
self._record_lost_func = record_lost_func
3232
self._running = True

sentry_sdk/_log_batcher.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import os
2-
import random
3-
import threading
4-
from datetime import datetime, timezone
5-
from typing import Optional, List, Callable, TYPE_CHECKING, Any
1+
from typing import TYPE_CHECKING
62

73
from sentry_sdk._batcher import Batcher
8-
from sentry_sdk.utils import format_timestamp, safe_repr, serialize_attribute
4+
from sentry_sdk.utils import serialize_attribute
95
from sentry_sdk.envelope import Envelope, Item, PayloadRef
106

117
if TYPE_CHECKING:
8+
from typing import Any
129
from sentry_sdk._types import Log
1310

1411

sentry_sdk/_metrics_batcher.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import os
2-
import random
3-
import threading
4-
from datetime import datetime, timezone
5-
from typing import Optional, List, Callable, TYPE_CHECKING, Any, Union
1+
from typing import TYPE_CHECKING
62

73
from sentry_sdk._batcher import Batcher
8-
from sentry_sdk.utils import format_timestamp, safe_repr, serialize_attribute
9-
from sentry_sdk.envelope import Envelope, Item, PayloadRef
4+
from sentry_sdk.utils import serialize_attribute
5+
from sentry_sdk.envelope import Item
106

117
if TYPE_CHECKING:
8+
from typing import Any
129
from sentry_sdk._types import Metric
1310

1411

0 commit comments

Comments
 (0)