We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`BaseSegment` defines `put_annotation` as having return type `NoReturn`
### Expected Behaviour

The return type should be `None`. `NoReturn` means that the function never returns (e.g. it always throws an exception) and makes type checkers (e.g. mypy) mark all code following `put_annotation` as unreachable.

Also applies to `put_metadata`, `patch`, and `patch_all`.


### Current Behaviour

These methods breaks type checking in any modules they're used because all code following a call to e.g. `put_annotation` is marked as unreachable.

### Code snippet

```python
with Tracer().provider.in_subsegment('test') as subsegment:
    subsegment.put_metadata('x', 1)
    print("hi")  # marked as unreachable
```


### Possible Solution

Change the return type to `None`.

### Steps to Reproduce

Use the code snippet above and run `mypy` on the file.

### AWS Lambda Powertools for Python version

latest

### AWS Lambda function runtime

3.9

### Packaging format used

PyPi

### Debugging logs

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `aws_lambda_powertools/tracing/base.py`
Content:
```
1 import abc
2 import numbers
3 import traceback
4 from contextlib import contextmanager
5 from typing import Any, Generator, List, NoReturn, Optional, Sequence, Union
6 
7 
8 class BaseSegment(abc.ABC):
9     """Holds common properties and methods on segment and subsegment."""
10 
11     @abc.abstractmethod
12     def close(self, end_time: Optional[int] = None):
13         """Close the trace entity by setting `end_time`
14         and flip the in progress flag to False.
15 
16         Parameters
17         ----------
18         end_time: int
19             Time in epoch seconds, by default current time will be used.
20         """
21 
22     @abc.abstractmethod
23     def add_subsegment(self, subsegment: Any):
24         """Add input subsegment as a child subsegment."""
25 
26     @abc.abstractmethod
27     def remove_subsegment(self, subsegment: Any):
28         """Remove input subsegment from child subsegments."""
29 
30     @abc.abstractmethod
31     def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:
32         """Annotate segment or subsegment with a key-value pair.
33 
34         Note: Annotations will be indexed for later search query.
35 
36         Parameters
37         ----------
38         key: str
39             Metadata key
40         value: Union[str, numbers.Number, bool]
41             Annotation value
42         """
43 
44     @abc.abstractmethod
45     def put_metadata(self, key: str, value: Any, namespace: str = "default") -> NoReturn:
46         """Add metadata to segment or subsegment. Metadata is not indexed
47         but can be later retrieved by BatchGetTraces API.
48 
49         Parameters
50         ----------
51         key: str
52             Metadata key
53         value: Any
54             Any object that can be serialized into a JSON string
55         namespace: Set[str]
56             Metadata namespace, by default 'default'
57         """
58 
59     @abc.abstractmethod
60     def add_exception(self, exception: BaseException, stack: List[traceback.StackSummary], remote: bool = False):
61         """Add an exception to trace entities.
62 
63         Parameters
64         ----------
65         exception: Exception
66             Caught exception
67         stack: List[traceback.StackSummary]
68             List of traceback summaries
69 
70             Output from `traceback.extract_stack()`.
71         remote: bool
72             Whether it's a client error (False) or downstream service error (True), by default False
73         """
74 
75 
76 class BaseProvider(abc.ABC):
77     @abc.abstractmethod
78     @contextmanager
79     def in_subsegment(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:
80         """Return a subsegment context manger.
81 
82         Parameters
83         ----------
84         name: str
85             Subsegment name
86         kwargs: Optional[dict]
87             Optional parameters to be propagated to segment
88         """
89 
90     @abc.abstractmethod
91     @contextmanager
92     def in_subsegment_async(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:
93         """Return a subsegment async context manger.
94 
95         Parameters
96         ----------
97         name: str
98             Subsegment name
99         kwargs: Optional[dict]
100             Optional parameters to be propagated to segment
101         """
102 
103     @abc.abstractmethod
104     def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:
105         """Annotate current active trace entity with a key-value pair.
106 
107         Note: Annotations will be indexed for later search query.
108 
109         Parameters
110         ----------
111         key: str
112             Metadata key
113         value: Union[str, numbers.Number, bool]
114             Annotation value
115         """
116 
117     @abc.abstractmethod
118     def put_metadata(self, key: str, value: Any, namespace: str = "default") -> NoReturn:
119         """Add metadata to the current active trace entity.
120 
121         Note: Metadata is not indexed but can be later retrieved by BatchGetTraces API.
122 
123         Parameters
124         ----------
125         key: str
126             Metadata key
127         value: Any
128             Any object that can be serialized into a JSON string
129         namespace: Set[str]
130             Metadata namespace, by default 'default'
131         """
132 
133     @abc.abstractmethod
134     def patch(self, modules: Sequence[str]) -> NoReturn:
135         """Instrument a set of supported libraries
136 
137         Parameters
138         ----------
139         modules: Set[str]
140             Set of modules to be patched
141         """
142 
143     @abc.abstractmethod
144     def patch_all(self) -> NoReturn:
145         """Instrument all supported libraries"""
146
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/aws_lambda_powertools/tracing/base.py b/aws_lambda_powertools/tracing/base.py
--- a/aws_lambda_powertools/tracing/base.py
+++ b/aws_lambda_powertools/tracing/base.py
@@ -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):
@@ -28,7 +28,7 @@
         """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.
@@ -42,7 +42,7 @@
         """
 
     @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.
 
@@ -101,7 +101,7 @@
         """
 
     @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.
@@ -115,7 +115,7 @@
         """
 
     @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.
@@ -131,7 +131,7 @@
         """
 
     @abc.abstractmethod
-    def patch(self, modules: Sequence[str]) -> NoReturn:
+    def patch(self, modules: Sequence[str]) -> None:
         """Instrument a set of supported libraries
 
         Parameters
@@ -141,5 +141,5 @@
         """
 
     @abc.abstractmethod
-    def patch_all(self) -> NoReturn:
+    def patch_all(self) -> None:
         """Instrument all supported libraries"""

{"golden_diff": "diff --git a/aws_lambda_powertools/tracing/base.py b/aws_lambda_powertools/tracing/base.py\n--- a/aws_lambda_powertools/tracing/base.py\n+++ b/aws_lambda_powertools/tracing/base.py\n@@ -2,7 +2,7 @@\n import numbers\n import traceback\n from contextlib import contextmanager\n-from typing import Any, Generator, List, NoReturn, Optional, Sequence, Union\n+from typing import Any, Generator, List, Optional, Sequence, Union\n \n \n class BaseSegment(abc.ABC):\n@@ -28,7 +28,7 @@\n         \"\"\"Remove input subsegment from child subsegments.\"\"\"\n \n     @abc.abstractmethod\n-    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:\n+    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:\n         \"\"\"Annotate segment or subsegment with a key-value pair.\n \n         Note: Annotations will be indexed for later search query.\n@@ -42,7 +42,7 @@\n         \"\"\"\n \n     @abc.abstractmethod\n-    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> NoReturn:\n+    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> None:\n         \"\"\"Add metadata to segment or subsegment. Metadata is not indexed\n         but can be later retrieved by BatchGetTraces API.\n \n@@ -101,7 +101,7 @@\n         \"\"\"\n \n     @abc.abstractmethod\n-    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:\n+    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:\n         \"\"\"Annotate current active trace entity with a key-value pair.\n \n         Note: Annotations will be indexed for later search query.\n@@ -115,7 +115,7 @@\n         \"\"\"\n \n     @abc.abstractmethod\n-    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> NoReturn:\n+    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> None:\n         \"\"\"Add metadata to the current active trace entity.\n \n         Note: Metadata is not indexed but can be later retrieved by BatchGetTraces API.\n@@ -131,7 +131,7 @@\n         \"\"\"\n \n     @abc.abstractmethod\n-    def patch(self, modules: Sequence[str]) -> NoReturn:\n+    def patch(self, modules: Sequence[str]) -> None:\n         \"\"\"Instrument a set of supported libraries\n \n         Parameters\n@@ -141,5 +141,5 @@\n         \"\"\"\n \n     @abc.abstractmethod\n-    def patch_all(self) -> NoReturn:\n+    def patch_all(self) -> None:\n         \"\"\"Instrument all supported libraries\"\"\"\n", "issue": "`BaseSegment` defines `put_annotation` as having return type `NoReturn`\n### Expected Behaviour\r\n\r\nThe return type should be `None`. `NoReturn` means that the function never returns (e.g. it always throws an exception) and makes type checkers (e.g. mypy) mark all code following `put_annotation` as unreachable.\r\n\r\nAlso applies to `put_metadata`, `patch`, and `patch_all`.\r\n\r\n\r\n### Current Behaviour\r\n\r\nThese methods breaks type checking in any modules they're used because all code following a call to e.g. `put_annotation` is marked as unreachable.\r\n\r\n### Code snippet\r\n\r\n```python\r\nwith Tracer().provider.in_subsegment('test') as subsegment:\r\n    subsegment.put_metadata('x', 1)\r\n    print(\"hi\")  # marked as unreachable\r\n```\r\n\r\n\r\n### Possible Solution\r\n\r\nChange the return type to `None`.\r\n\r\n### Steps to Reproduce\r\n\r\nUse the code snippet above and run `mypy` on the file.\r\n\r\n### AWS Lambda Powertools for Python version\r\n\r\nlatest\r\n\r\n### AWS Lambda function runtime\r\n\r\n3.9\r\n\r\n### Packaging format used\r\n\r\nPyPi\r\n\r\n### Debugging logs\r\n\r\n_No response_\n", "before_files": [{"content": "import abc\nimport numbers\nimport traceback\nfrom contextlib import contextmanager\nfrom typing import Any, Generator, List, NoReturn, Optional, Sequence, Union\n\n\nclass BaseSegment(abc.ABC):\n    \"\"\"Holds common properties and methods on segment and subsegment.\"\"\"\n\n    @abc.abstractmethod\n    def close(self, end_time: Optional[int] = None):\n        \"\"\"Close the trace entity by setting `end_time`\n        and flip the in progress flag to False.\n\n        Parameters\n        ----------\n        end_time: int\n            Time in epoch seconds, by default current time will be used.\n        \"\"\"\n\n    @abc.abstractmethod\n    def add_subsegment(self, subsegment: Any):\n        \"\"\"Add input subsegment as a child subsegment.\"\"\"\n\n    @abc.abstractmethod\n    def remove_subsegment(self, subsegment: Any):\n        \"\"\"Remove input subsegment from child subsegments.\"\"\"\n\n    @abc.abstractmethod\n    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:\n        \"\"\"Annotate segment or subsegment with a key-value pair.\n\n        Note: Annotations will be indexed for later search query.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Union[str, numbers.Number, bool]\n            Annotation value\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> NoReturn:\n        \"\"\"Add metadata to segment or subsegment. Metadata is not indexed\n        but can be later retrieved by BatchGetTraces API.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Any\n            Any object that can be serialized into a JSON string\n        namespace: Set[str]\n            Metadata namespace, by default 'default'\n        \"\"\"\n\n    @abc.abstractmethod\n    def add_exception(self, exception: BaseException, stack: List[traceback.StackSummary], remote: bool = False):\n        \"\"\"Add an exception to trace entities.\n\n        Parameters\n        ----------\n        exception: Exception\n            Caught exception\n        stack: List[traceback.StackSummary]\n            List of traceback summaries\n\n            Output from `traceback.extract_stack()`.\n        remote: bool\n            Whether it's a client error (False) or downstream service error (True), by default False\n        \"\"\"\n\n\nclass BaseProvider(abc.ABC):\n    @abc.abstractmethod\n    @contextmanager\n    def in_subsegment(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:\n        \"\"\"Return a subsegment context manger.\n\n        Parameters\n        ----------\n        name: str\n            Subsegment name\n        kwargs: Optional[dict]\n            Optional parameters to be propagated to segment\n        \"\"\"\n\n    @abc.abstractmethod\n    @contextmanager\n    def in_subsegment_async(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:\n        \"\"\"Return a subsegment async context manger.\n\n        Parameters\n        ----------\n        name: str\n            Subsegment name\n        kwargs: Optional[dict]\n            Optional parameters to be propagated to segment\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> NoReturn:\n        \"\"\"Annotate current active trace entity with a key-value pair.\n\n        Note: Annotations will be indexed for later search query.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Union[str, numbers.Number, bool]\n            Annotation value\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> NoReturn:\n        \"\"\"Add metadata to the current active trace entity.\n\n        Note: Metadata is not indexed but can be later retrieved by BatchGetTraces API.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Any\n            Any object that can be serialized into a JSON string\n        namespace: Set[str]\n            Metadata namespace, by default 'default'\n        \"\"\"\n\n    @abc.abstractmethod\n    def patch(self, modules: Sequence[str]) -> NoReturn:\n        \"\"\"Instrument a set of supported libraries\n\n        Parameters\n        ----------\n        modules: Set[str]\n            Set of modules to be patched\n        \"\"\"\n\n    @abc.abstractmethod\n    def patch_all(self) -> NoReturn:\n        \"\"\"Instrument all supported libraries\"\"\"\n", "path": "aws_lambda_powertools/tracing/base.py"}], "after_files": [{"content": "import abc\nimport numbers\nimport traceback\nfrom contextlib import contextmanager\nfrom typing import Any, Generator, List, Optional, Sequence, Union\n\n\nclass BaseSegment(abc.ABC):\n    \"\"\"Holds common properties and methods on segment and subsegment.\"\"\"\n\n    @abc.abstractmethod\n    def close(self, end_time: Optional[int] = None):\n        \"\"\"Close the trace entity by setting `end_time`\n        and flip the in progress flag to False.\n\n        Parameters\n        ----------\n        end_time: int\n            Time in epoch seconds, by default current time will be used.\n        \"\"\"\n\n    @abc.abstractmethod\n    def add_subsegment(self, subsegment: Any):\n        \"\"\"Add input subsegment as a child subsegment.\"\"\"\n\n    @abc.abstractmethod\n    def remove_subsegment(self, subsegment: Any):\n        \"\"\"Remove input subsegment from child subsegments.\"\"\"\n\n    @abc.abstractmethod\n    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:\n        \"\"\"Annotate segment or subsegment with a key-value pair.\n\n        Note: Annotations will be indexed for later search query.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Union[str, numbers.Number, bool]\n            Annotation value\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> None:\n        \"\"\"Add metadata to segment or subsegment. Metadata is not indexed\n        but can be later retrieved by BatchGetTraces API.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Any\n            Any object that can be serialized into a JSON string\n        namespace: Set[str]\n            Metadata namespace, by default 'default'\n        \"\"\"\n\n    @abc.abstractmethod\n    def add_exception(self, exception: BaseException, stack: List[traceback.StackSummary], remote: bool = False):\n        \"\"\"Add an exception to trace entities.\n\n        Parameters\n        ----------\n        exception: Exception\n            Caught exception\n        stack: List[traceback.StackSummary]\n            List of traceback summaries\n\n            Output from `traceback.extract_stack()`.\n        remote: bool\n            Whether it's a client error (False) or downstream service error (True), by default False\n        \"\"\"\n\n\nclass BaseProvider(abc.ABC):\n    @abc.abstractmethod\n    @contextmanager\n    def in_subsegment(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:\n        \"\"\"Return a subsegment context manger.\n\n        Parameters\n        ----------\n        name: str\n            Subsegment name\n        kwargs: Optional[dict]\n            Optional parameters to be propagated to segment\n        \"\"\"\n\n    @abc.abstractmethod\n    @contextmanager\n    def in_subsegment_async(self, name=None, **kwargs) -> Generator[BaseSegment, None, None]:\n        \"\"\"Return a subsegment async context manger.\n\n        Parameters\n        ----------\n        name: str\n            Subsegment name\n        kwargs: Optional[dict]\n            Optional parameters to be propagated to segment\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_annotation(self, key: str, value: Union[str, numbers.Number, bool]) -> None:\n        \"\"\"Annotate current active trace entity with a key-value pair.\n\n        Note: Annotations will be indexed for later search query.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Union[str, numbers.Number, bool]\n            Annotation value\n        \"\"\"\n\n    @abc.abstractmethod\n    def put_metadata(self, key: str, value: Any, namespace: str = \"default\") -> None:\n        \"\"\"Add metadata to the current active trace entity.\n\n        Note: Metadata is not indexed but can be later retrieved by BatchGetTraces API.\n\n        Parameters\n        ----------\n        key: str\n            Metadata key\n        value: Any\n            Any object that can be serialized into a JSON string\n        namespace: Set[str]\n            Metadata namespace, by default 'default'\n        \"\"\"\n\n    @abc.abstractmethod\n    def patch(self, modules: Sequence[str]) -> None:\n        \"\"\"Instrument a set of supported libraries\n\n        Parameters\n        ----------\n        modules: Set[str]\n            Set of modules to be patched\n        \"\"\"\n\n    @abc.abstractmethod\n    def patch_all(self) -> None:\n        \"\"\"Instrument all supported libraries\"\"\"\n", "path": "aws_lambda_powertools/tracing/base.py"}]}