|
1 | | -from typing import TYPE_CHECKING, Deque, TypeVar, Union |
| 1 | +from typing import TYPE_CHECKING, TypeVar, Union |
2 | 2 |
|
3 | 3 |
|
4 | 4 | # Re-exported for compat, since code out there in the wild might use this variable. |
@@ -34,7 +34,7 @@ def __str__(self): |
34 | 34 | return str({"value": str(self.value), "metadata": str(self.metadata)}) |
35 | 35 |
|
36 | 36 | def __repr__(self): |
37 | | - return str(self) |
| 37 | + return self |
38 | 38 |
|
39 | 39 | def __len__(self): |
40 | 40 | return len(self.value) |
@@ -95,52 +95,6 @@ def substituted_because_contains_sensitive_data(cls): |
95 | 95 | Annotated = Union[AnnotatedValue, T] |
96 | 96 |
|
97 | 97 |
|
98 | | -class AnnotatedDeque(AnnotatedValue): |
99 | | - """ |
100 | | - Meta information for a data field in the event payload. |
101 | | - This is to tell Relay that we have tampered with the fields value. |
102 | | - See: |
103 | | - https://github.com/getsentry/relay/blob/be12cd49a0f06ea932ed9b9f93a655de5d6ad6d1/relay-general/src/types/meta.rs#L407-L423 |
104 | | - """ |
105 | | - |
106 | | - __slots__ = ("value", "metadata") |
107 | | - |
108 | | - def __init__(self, value, metadata): |
109 | | - # type: (Deque[Any], Dict[str, Any]) -> None |
110 | | - self.value = value |
111 | | - self.metadata = metadata |
112 | | - |
113 | | - def __eq__(self, other): |
114 | | - # type: (Any) -> bool |
115 | | - if not isinstance(other, AnnotatedValue): |
116 | | - return False |
117 | | - |
118 | | - return self.value == other.value and self.metadata == other.metadata |
119 | | - |
120 | | - def append(self, other): |
121 | | - # type: (Any) -> None |
122 | | - self.value.append(other) |
123 | | - |
124 | | - def extend(self, other): |
125 | | - # type: (Any) -> None |
126 | | - self.value.extend(other) |
127 | | - |
128 | | - def popleft(self): |
129 | | - self.value.popleft() |
130 | | - |
131 | | - def __len__(self): |
132 | | - return len(self.value) |
133 | | - |
134 | | - @classmethod |
135 | | - def truncated(cls, value, n_truncated): |
136 | | - # type: (Deque[Any], int) -> AnnotatedValue |
137 | | - """Data was removed because the number of elements exceeded the maximum limit.""" |
138 | | - return AnnotatedDeque( |
139 | | - value=value, |
140 | | - metadata={"len": [n_truncated]}, # Remark |
141 | | - ) |
142 | | - |
143 | | - |
144 | 98 | if TYPE_CHECKING: |
145 | 99 | from collections.abc import Container, MutableMapping, Sequence |
146 | 100 |
|
|
0 commit comments