Skip to content

Commit 0066faa

Browse files
committed
Fix typing
1 parent d1b6dd9 commit 0066faa

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ ignore_missing_imports = True
7474
ignore_missing_imports = True
7575
[mypy-openai.*]
7676
ignore_missing_imports = True
77+
[mypy-openfeature.*]
78+
ignore_missing_imports = True
7779
[mypy-huggingface_hub.*]
7880
ignore_missing_imports = True
7981
[mypy-arq.*]

sentry_sdk/flag_utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
from copy import copy
2+
from typing import TYPE_CHECKING
23

34
import itertools
45

6+
if TYPE_CHECKING:
7+
from typing import TypedDict
8+
9+
FlagData = TypedDict("FlagData", {"flag": str, "result": bool})
10+
511

612
class FlagBuffer:
713

@@ -13,9 +19,11 @@ def __init__(self, capacity):
1319

1420
@property
1521
def index(self):
22+
# type: () -> int
1623
return self.ip % self.capacity
1724

1825
def clear(self):
26+
# type: () -> None
1927
self.buffer = []
2028
self.ip = 0
2129

@@ -27,7 +35,7 @@ def copy(self):
2735
return buffer
2836

2937
def get(self):
30-
# type: () -> list[dict]
38+
# type: () -> list[FlagData]
3139
if self.ip >= self.capacity:
3240
iterator = itertools.chain(
3341
range(self.index, self.capacity), range(0, self.index)
@@ -58,5 +66,5 @@ def __init__(self, flag, result):
5866

5967
@property
6068
def asdict(self):
61-
# type: () -> dict
69+
# type: () -> FlagData
6270
return {"flag": self.flag, "result": self.result}

sentry_sdk/scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def clear(self):
689689

690690
# self._last_event_id is only applicable to isolation scopes
691691
self._last_event_id = None # type: Optional[str]
692-
self._flags = None
692+
self._flags = None # type: Optional[FlagBuffer]
693693

694694
@_attr_setter
695695
def level(self, value):

0 commit comments

Comments
 (0)