Skip to content

Commit

Permalink
suppress specific warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhakarjuzgar committed Dec 24, 2024
1 parent 825c727 commit ce4c3a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions opentelemetry-sdk/src/opentelemetry/sdk/error_handler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _handle(self, error: Exception, *args, **kwargs):

class ErrorHandler(ABC):
@abstractmethod
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore
def _handle(self, error: Exception, *args, **kwargs) -> None: # type: ignore[misc, no-untyped-def]
"""
Handle an exception
"""
Expand All @@ -84,7 +84,7 @@ class _DefaultErrorHandler(ErrorHandler):
"""

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

Expand All @@ -110,22 +110,22 @@ def __enter__(self) -> None:
pass

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

plugin_handled = False

error_handler_entry_points = entry_points( # type: ignore
error_handler_entry_points = entry_points( # type: ignore[misc]
group="opentelemetry_error_handler"
)

for error_handler_entry_point in error_handler_entry_points:
error_handler_class = error_handler_entry_point.load() # type: ignore
for error_handler_entry_point in error_handler_entry_points: # type: ignore[misc]
error_handler_class = error_handler_entry_point.load() # type: ignore[misc]

if issubclass(error_handler_class, exc_value.__class__): # type: ignore
if issubclass(error_handler_class, exc_value.__class__): # type: ignore[misc]
try:
error_handler_class()._handle(exc_value) # type: ignore
error_handler_class()._handle(exc_value) # type: ignore[misc]
plugin_handled = True

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

if not plugin_handled:
_DefaultErrorHandler()._handle(exc_value) # type: ignore
_DefaultErrorHandler()._handle(exc_value) # type: ignore[misc]

return True
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def collect(self, point_attributes: Attributes) -> Optional[Exemplar]:
{
k: v
for k, v in self.__attributes.items()
if k not in point_attributes # type: ignore
if k not in point_attributes # type: ignore[operator]
}
if self.__attributes
else None
Expand Down Expand Up @@ -162,8 +162,8 @@ class BucketIndexError(ValueError):
class FixedSizeExemplarReservoirABC(ExemplarReservoir):
"""Abstract class for a reservoir with fixed size."""

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

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

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

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

def offer(
Expand Down

0 comments on commit ce4c3a7

Please sign in to comment.