Skip to content

Commit ce4c3a7

Browse files
suppress specific warnings
1 parent 825c727 commit ce4c3a7

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _handle(self, error: Exception, *args, **kwargs):
7070

7171
class ErrorHandler(ABC):
7272
@abstractmethod
73-
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore
73+
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore[misc, no-untyped-def]
7474
"""
7575
Handle an exception
7676
"""
@@ -84,7 +84,7 @@ class _DefaultErrorHandler(ErrorHandler):
8484
"""
8585

8686
# pylint: disable=useless-return
87-
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore
87+
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
8888
logger.exception("Error handled by default error handler: ")
8989
return None
9090

@@ -110,22 +110,22 @@ def __enter__(self) -> None:
110110
pass
111111

112112
# pylint: disable=no-self-use
113-
def __exit__(self, exc_type, exc_value, traceback) -> Optional[bool]: # type: ignore
113+
def __exit__(self, exc_type, exc_value, traceback) -> Optional[bool]: # type: ignore[no-untyped-def]
114114
if exc_value is None: # type: ignore
115115
return None
116116

117117
plugin_handled = False
118118

119-
error_handler_entry_points = entry_points( # type: ignore
119+
error_handler_entry_points = entry_points( # type: ignore[misc]
120120
group="opentelemetry_error_handler"
121121
)
122122

123-
for error_handler_entry_point in error_handler_entry_points:
124-
error_handler_class = error_handler_entry_point.load() # type: ignore
123+
for error_handler_entry_point in error_handler_entry_points: # type: ignore[misc]
124+
error_handler_class = error_handler_entry_point.load() # type: ignore[misc]
125125

126-
if issubclass(error_handler_class, exc_value.__class__): # type: ignore
126+
if issubclass(error_handler_class, exc_value.__class__): # type: ignore[misc]
127127
try:
128-
error_handler_class()._handle(exc_value) # type: ignore
128+
error_handler_class()._handle(exc_value) # type: ignore[misc]
129129
plugin_handled = True
130130

131131
# pylint: disable=broad-exception-caught
@@ -134,11 +134,11 @@ def __exit__(self, exc_type, exc_value, traceback) -> Optional[bool]: # type: i
134134
"%s error while handling error"
135135
" %s by error handler %s",
136136
error_handling_error.__class__.__name__,
137-
exc_value.__class__.__name__, # type: ignore
138-
error_handler_class.__name__, # type: ignore
137+
exc_value.__class__.__name__, # type: ignore[misc]
138+
error_handler_class.__name__, # type: ignore[misc]
139139
)
140140

141141
if not plugin_handled:
142-
_DefaultErrorHandler()._handle(exc_value) # type: ignore
142+
_DefaultErrorHandler()._handle(exc_value) # type: ignore[misc]
143143

144144
return True

opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exemplar/exemplar_reservoir.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def collect(self, point_attributes: Attributes) -> Optional[Exemplar]:
129129
{
130130
k: v
131131
for k, v in self.__attributes.items()
132-
if k not in point_attributes # type: ignore
132+
if k not in point_attributes # type: ignore[operator]
133133
}
134134
if self.__attributes
135135
else None
@@ -162,8 +162,8 @@ class BucketIndexError(ValueError):
162162
class FixedSizeExemplarReservoirABC(ExemplarReservoir):
163163
"""Abstract class for a reservoir with fixed size."""
164164

165-
def __init__(self, size: int, **kwargs) -> None: # type: ignore
166-
super().__init__(**kwargs) # type: ignore
165+
def __init__(self, size: int, **kwargs) -> None: # type: ignore[no-untyped-def]
166+
super().__init__(**kwargs) # type: ignore[misc]
167167
self._size: int = size
168168
self._reservoir_storage: Mapping[int, ExemplarBucket] = defaultdict(
169169
ExemplarBucket
@@ -257,8 +257,8 @@ class SimpleFixedSizeExemplarReservoir(FixedSizeExemplarReservoirABC):
257257
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#simplefixedsizeexemplarreservoir
258258
"""
259259

260-
def __init__(self, size: int = 1, **kwargs) -> None: # type: ignore
261-
super().__init__(size, **kwargs) # type: ignore
260+
def __init__(self, size: int = 1, **kwargs) -> None: # type: ignore[no-untyped-def]
261+
super().__init__(size, **kwargs) # type: ignore[misc]
262262
self._measurements_seen: int = 0
263263

264264
def _reset(self) -> None:
@@ -292,8 +292,8 @@ class AlignedHistogramBucketExemplarReservoir(FixedSizeExemplarReservoirABC):
292292
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#alignedhistogrambucketexemplarreservoir
293293
"""
294294

295-
def __init__(self, boundaries: Sequence[float], **kwargs) -> None: # type: ignore
296-
super().__init__(len(boundaries) + 1, **kwargs) # type: ignore
295+
def __init__(self, boundaries: Sequence[float], **kwargs) -> None: # type: ignore[no-untyped-def]
296+
super().__init__(len(boundaries) + 1, **kwargs) # type: ignore[misc]
297297
self._boundaries: Sequence[float] = boundaries
298298

299299
def offer(

0 commit comments

Comments
 (0)