Skip to content

fix(typing): swap NoReturn with None for methods with no return value #2004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions aws_lambda_powertools/tracing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numbers
import traceback
from contextlib import contextmanager
from typing import Any, Generator, List, NoReturn, Optional, Sequence, Union
from typing import Any, Generator, List, Optional, Sequence, Union


class BaseSegment(abc.ABC):
Expand All @@ -28,7 +28,7 @@ def remove_subsegment(self, subsegment: Any):
"""Remove input subsegment from child subsegments."""

@abc.abstractmethod
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:
"""Annotate segment or subsegment with a key-value pair.

Note: Annotations will be indexed for later search query.
Expand All @@ -42,7 +42,7 @@ def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> N
"""

@abc.abstractmethod
def put_metadata(self, key: str, value: Any, namespace: str = "default") -> NoReturn:
def put_metadata(self, key: str, value: Any, namespace: str = "default") -> None:
"""Add metadata to segment or subsegment. Metadata is not indexed
but can be later retrieved by BatchGetTraces API.

Expand Down Expand Up @@ -101,7 +101,7 @@ def in_subsegment_async(self, name=None, **kwargs) -> Generator[BaseSegment, Non
"""

@abc.abstractmethod
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:
def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:
"""Annotate current active trace entity with a key-value pair.

Note: Annotations will be indexed for later search query.
Expand All @@ -115,7 +115,7 @@ def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> N
"""

@abc.abstractmethod
def put_metadata(self, key: str, value: Any, namespace: str = "default") -> NoReturn:
def put_metadata(self, key: str, value: Any, namespace: str = "default") -> None:
"""Add metadata to the current active trace entity.

Note: Metadata is not indexed but can be later retrieved by BatchGetTraces API.
Expand All @@ -131,7 +131,7 @@ def put_metadata(self, key: str, value: Any, namespace: str = "default") -> NoRe
"""

@abc.abstractmethod
def patch(self, modules: Sequence[str]) -> NoReturn:
def patch(self, modules: Sequence[str]) -> None:
"""Instrument a set of supported libraries

Parameters
Expand All @@ -141,5 +141,5 @@ def patch(self, modules: Sequence[str]) -> NoReturn:
"""

@abc.abstractmethod
def patch_all(self) -> NoReturn:
def patch_all(self) -> None:
"""Instrument all supported libraries"""