We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
update pylint to 2.11.0
The version of pylint in this repo is falling behind. I tried running it w/ pylint 2.11.0 and came across a bunch of warnings in the following categories:

- [x] #2130
- [x] #2125
- [x] #2126
- [x] #2132
- [x] #2134

I will submit separate PRs for each of those, before submitting a PR to bump pylint to 2.11.0.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `opentelemetry-api/src/opentelemetry/util/_time.py`
Content:
```
1 # Copyright The OpenTelemetry Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 from logging import getLogger
16 from sys import version_info
17 
18 if version_info.minor < 7:
19     getLogger(__name__).warning(  # pylint: disable=logging-not-lazy
20         "You are using Python 3.%s. This version does not support timestamps "
21         "with nanosecond precision and the OpenTelemetry SDK will use "
22         "millisecond precision instead. Please refer to PEP 564 for more "
23         "information. Please upgrade to Python 3.7 or newer to use nanosecond "
24         "precision." % version_info.minor
25     )
26     from time import time
27 
28     def _time_ns() -> int:
29         return int(time() * 1e9)
30 
31 
32 else:
33     from time import time_ns
34 
35     _time_ns = time_ns
36
```

Path: `opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 # Copyright The OpenTelemetry Authors
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 import argparse
18 import logging
19 import subprocess
20 import sys
21 
22 import pkg_resources
23 
24 from opentelemetry.instrumentation.bootstrap_gen import (
25     default_instrumentations,
26     libraries,
27 )
28 
29 logger = logging.getLogger(__file__)
30 
31 
32 def _syscall(func):
33     def wrapper(package=None):
34         try:
35             if package:
36                 return func(package)
37             return func()
38         except subprocess.SubprocessError as exp:
39             cmd = getattr(exp, "cmd", None)
40             if cmd:
41                 msg = f'Error calling system command "{" ".join(cmd)}"'
42             if package:
43                 msg = f'{msg} for package "{package}"'
44             raise RuntimeError(msg)
45 
46     return wrapper
47 
48 
49 @_syscall
50 def _sys_pip_install(package):
51     # explicit upgrade strategy to override potential pip config
52     subprocess.check_call(
53         [
54             sys.executable,
55             "-m",
56             "pip",
57             "install",
58             "-U",
59             "--upgrade-strategy",
60             "only-if-needed",
61             package,
62         ]
63     )
64 
65 
66 def _pip_check():
67     """Ensures none of the instrumentations have dependency conflicts.
68     Clean check reported as:
69     'No broken requirements found.'
70     Dependency conflicts are reported as:
71     'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.'
72     To not be too restrictive, we'll only check for relevant packages.
73     """
74     check_pipe = subprocess.Popen(
75         [sys.executable, "-m", "pip", "check"], stdout=subprocess.PIPE
76     )
77     pip_check = check_pipe.communicate()[0].decode()
78     pip_check_lower = pip_check.lower()
79     for package_tup in libraries.values():
80         for package in package_tup:
81             if package.lower() in pip_check_lower:
82                 raise RuntimeError(f"Dependency conflict found: {pip_check}")
83 
84 
85 def _is_installed(req):
86     if req in sys.modules:
87         return True
88 
89     try:
90         pkg_resources.get_distribution(req)
91     except pkg_resources.DistributionNotFound:
92         return False
93     except pkg_resources.VersionConflict as exc:
94         logger.warning(
95             "instrumentation for package %s is available but version %s is installed. Skipping.",
96             exc.req,
97             exc.dist.as_requirement(),  # pylint: disable=no-member
98         )
99         return False
100     return True
101 
102 
103 def _find_installed_libraries():
104     libs = default_instrumentations[:]
105     libs.extend(
106         [
107             v["instrumentation"]
108             for _, v in libraries.items()
109             if _is_installed(v["library"])
110         ]
111     )
112     return libs
113 
114 
115 def _run_requirements():
116     logger.setLevel(logging.ERROR)
117     print("\n".join(_find_installed_libraries()), end="")
118 
119 
120 def _run_install():
121     for lib in _find_installed_libraries():
122         _sys_pip_install(lib)
123     _pip_check()
124 
125 
126 def run() -> None:
127     action_install = "install"
128     action_requirements = "requirements"
129 
130     parser = argparse.ArgumentParser(
131         description="""
132         opentelemetry-bootstrap detects installed libraries and automatically
133         installs the relevant instrumentation packages for them.
134         """
135     )
136     parser.add_argument(
137         "-a",
138         "--action",
139         choices=[action_install, action_requirements],
140         default=action_requirements,
141         help="""
142         install - uses pip to install the new requirements using to the
143                   currently active site-package.
144         requirements - prints out the new requirements to stdout. Action can
145                        be piped and appended to a requirements.txt file.
146         """,
147     )
148     args = parser.parse_args()
149 
150     cmd = {
151         action_install: _run_install,
152         action_requirements: _run_requirements,
153     }[args.action]
154     cmd()
155
```
--- 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/opentelemetry-api/src/opentelemetry/util/_time.py b/opentelemetry-api/src/opentelemetry/util/_time.py
--- a/opentelemetry-api/src/opentelemetry/util/_time.py
+++ b/opentelemetry-api/src/opentelemetry/util/_time.py
@@ -17,7 +17,7 @@
 
 if version_info.minor < 7:
     getLogger(__name__).warning(  # pylint: disable=logging-not-lazy
-        "You are using Python 3.%s. This version does not support timestamps "
+        "You are using Python 3.%s. This version does not support timestamps "  # pylint: disable=C0209
         "with nanosecond precision and the OpenTelemetry SDK will use "
         "millisecond precision instead. Please refer to PEP 564 for more "
         "information. Please upgrade to Python 3.7 or newer to use nanosecond "
diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py
--- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py
+++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py
@@ -71,11 +71,11 @@
     'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.'
     To not be too restrictive, we'll only check for relevant packages.
     """
-    check_pipe = subprocess.Popen(
+    with subprocess.Popen(
         [sys.executable, "-m", "pip", "check"], stdout=subprocess.PIPE
-    )
-    pip_check = check_pipe.communicate()[0].decode()
-    pip_check_lower = pip_check.lower()
+    ) as check_pipe:
+        pip_check = check_pipe.communicate()[0].decode()
+        pip_check_lower = pip_check.lower()
     for package_tup in libraries.values():
         for package in package_tup:
             if package.lower() in pip_check_lower:

{"golden_diff": "diff --git a/opentelemetry-api/src/opentelemetry/util/_time.py b/opentelemetry-api/src/opentelemetry/util/_time.py\n--- a/opentelemetry-api/src/opentelemetry/util/_time.py\n+++ b/opentelemetry-api/src/opentelemetry/util/_time.py\n@@ -17,7 +17,7 @@\n \n if version_info.minor < 7:\n     getLogger(__name__).warning(  # pylint: disable=logging-not-lazy\n-        \"You are using Python 3.%s. This version does not support timestamps \"\n+        \"You are using Python 3.%s. This version does not support timestamps \"  # pylint: disable=C0209\n         \"with nanosecond precision and the OpenTelemetry SDK will use \"\n         \"millisecond precision instead. Please refer to PEP 564 for more \"\n         \"information. Please upgrade to Python 3.7 or newer to use nanosecond \"\ndiff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py\n--- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py\n+++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py\n@@ -71,11 +71,11 @@\n     'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.'\n     To not be too restrictive, we'll only check for relevant packages.\n     \"\"\"\n-    check_pipe = subprocess.Popen(\n+    with subprocess.Popen(\n         [sys.executable, \"-m\", \"pip\", \"check\"], stdout=subprocess.PIPE\n-    )\n-    pip_check = check_pipe.communicate()[0].decode()\n-    pip_check_lower = pip_check.lower()\n+    ) as check_pipe:\n+        pip_check = check_pipe.communicate()[0].decode()\n+        pip_check_lower = pip_check.lower()\n     for package_tup in libraries.values():\n         for package in package_tup:\n             if package.lower() in pip_check_lower:\n", "issue": "update pylint to 2.11.0\nThe version of pylint in this repo is falling behind. I tried running it w/ pylint 2.11.0 and came across a bunch of warnings in the following categories:\r\n\r\n- [x] #2130\r\n- [x] #2125\r\n- [x] #2126\r\n- [x] #2132\r\n- [x] #2134\r\n\r\nI will submit separate PRs for each of those, before submitting a PR to bump pylint to 2.11.0.\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom logging import getLogger\nfrom sys import version_info\n\nif version_info.minor < 7:\n    getLogger(__name__).warning(  # pylint: disable=logging-not-lazy\n        \"You are using Python 3.%s. This version does not support timestamps \"\n        \"with nanosecond precision and the OpenTelemetry SDK will use \"\n        \"millisecond precision instead. Please refer to PEP 564 for more \"\n        \"information. Please upgrade to Python 3.7 or newer to use nanosecond \"\n        \"precision.\" % version_info.minor\n    )\n    from time import time\n\n    def _time_ns() -> int:\n        return int(time() * 1e9)\n\n\nelse:\n    from time import time_ns\n\n    _time_ns = time_ns\n", "path": "opentelemetry-api/src/opentelemetry/util/_time.py"}, {"content": "#!/usr/bin/env python3\n\n# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport logging\nimport subprocess\nimport sys\n\nimport pkg_resources\n\nfrom opentelemetry.instrumentation.bootstrap_gen import (\n    default_instrumentations,\n    libraries,\n)\n\nlogger = logging.getLogger(__file__)\n\n\ndef _syscall(func):\n    def wrapper(package=None):\n        try:\n            if package:\n                return func(package)\n            return func()\n        except subprocess.SubprocessError as exp:\n            cmd = getattr(exp, \"cmd\", None)\n            if cmd:\n                msg = f'Error calling system command \"{\" \".join(cmd)}\"'\n            if package:\n                msg = f'{msg} for package \"{package}\"'\n            raise RuntimeError(msg)\n\n    return wrapper\n\n\n@_syscall\ndef _sys_pip_install(package):\n    # explicit upgrade strategy to override potential pip config\n    subprocess.check_call(\n        [\n            sys.executable,\n            \"-m\",\n            \"pip\",\n            \"install\",\n            \"-U\",\n            \"--upgrade-strategy\",\n            \"only-if-needed\",\n            package,\n        ]\n    )\n\n\ndef _pip_check():\n    \"\"\"Ensures none of the instrumentations have dependency conflicts.\n    Clean check reported as:\n    'No broken requirements found.'\n    Dependency conflicts are reported as:\n    'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.'\n    To not be too restrictive, we'll only check for relevant packages.\n    \"\"\"\n    check_pipe = subprocess.Popen(\n        [sys.executable, \"-m\", \"pip\", \"check\"], stdout=subprocess.PIPE\n    )\n    pip_check = check_pipe.communicate()[0].decode()\n    pip_check_lower = pip_check.lower()\n    for package_tup in libraries.values():\n        for package in package_tup:\n            if package.lower() in pip_check_lower:\n                raise RuntimeError(f\"Dependency conflict found: {pip_check}\")\n\n\ndef _is_installed(req):\n    if req in sys.modules:\n        return True\n\n    try:\n        pkg_resources.get_distribution(req)\n    except pkg_resources.DistributionNotFound:\n        return False\n    except pkg_resources.VersionConflict as exc:\n        logger.warning(\n            \"instrumentation for package %s is available but version %s is installed. Skipping.\",\n            exc.req,\n            exc.dist.as_requirement(),  # pylint: disable=no-member\n        )\n        return False\n    return True\n\n\ndef _find_installed_libraries():\n    libs = default_instrumentations[:]\n    libs.extend(\n        [\n            v[\"instrumentation\"]\n            for _, v in libraries.items()\n            if _is_installed(v[\"library\"])\n        ]\n    )\n    return libs\n\n\ndef _run_requirements():\n    logger.setLevel(logging.ERROR)\n    print(\"\\n\".join(_find_installed_libraries()), end=\"\")\n\n\ndef _run_install():\n    for lib in _find_installed_libraries():\n        _sys_pip_install(lib)\n    _pip_check()\n\n\ndef run() -> None:\n    action_install = \"install\"\n    action_requirements = \"requirements\"\n\n    parser = argparse.ArgumentParser(\n        description=\"\"\"\n        opentelemetry-bootstrap detects installed libraries and automatically\n        installs the relevant instrumentation packages for them.\n        \"\"\"\n    )\n    parser.add_argument(\n        \"-a\",\n        \"--action\",\n        choices=[action_install, action_requirements],\n        default=action_requirements,\n        help=\"\"\"\n        install - uses pip to install the new requirements using to the\n                  currently active site-package.\n        requirements - prints out the new requirements to stdout. Action can\n                       be piped and appended to a requirements.txt file.\n        \"\"\",\n    )\n    args = parser.parse_args()\n\n    cmd = {\n        action_install: _run_install,\n        action_requirements: _run_requirements,\n    }[args.action]\n    cmd()\n", "path": "opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py"}], "after_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom logging import getLogger\nfrom sys import version_info\n\nif version_info.minor < 7:\n    getLogger(__name__).warning(  # pylint: disable=logging-not-lazy\n        \"You are using Python 3.%s. This version does not support timestamps \"  # pylint: disable=C0209\n        \"with nanosecond precision and the OpenTelemetry SDK will use \"\n        \"millisecond precision instead. Please refer to PEP 564 for more \"\n        \"information. Please upgrade to Python 3.7 or newer to use nanosecond \"\n        \"precision.\" % version_info.minor\n    )\n    from time import time\n\n    def _time_ns() -> int:\n        return int(time() * 1e9)\n\n\nelse:\n    from time import time_ns\n\n    _time_ns = time_ns\n", "path": "opentelemetry-api/src/opentelemetry/util/_time.py"}, {"content": "#!/usr/bin/env python3\n\n# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport logging\nimport subprocess\nimport sys\n\nimport pkg_resources\n\nfrom opentelemetry.instrumentation.bootstrap_gen import (\n    default_instrumentations,\n    libraries,\n)\n\nlogger = logging.getLogger(__file__)\n\n\ndef _syscall(func):\n    def wrapper(package=None):\n        try:\n            if package:\n                return func(package)\n            return func()\n        except subprocess.SubprocessError as exp:\n            cmd = getattr(exp, \"cmd\", None)\n            if cmd:\n                msg = f'Error calling system command \"{\" \".join(cmd)}\"'\n            if package:\n                msg = f'{msg} for package \"{package}\"'\n            raise RuntimeError(msg)\n\n    return wrapper\n\n\n@_syscall\ndef _sys_pip_install(package):\n    # explicit upgrade strategy to override potential pip config\n    subprocess.check_call(\n        [\n            sys.executable,\n            \"-m\",\n            \"pip\",\n            \"install\",\n            \"-U\",\n            \"--upgrade-strategy\",\n            \"only-if-needed\",\n            package,\n        ]\n    )\n\n\ndef _pip_check():\n    \"\"\"Ensures none of the instrumentations have dependency conflicts.\n    Clean check reported as:\n    'No broken requirements found.'\n    Dependency conflicts are reported as:\n    'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.'\n    To not be too restrictive, we'll only check for relevant packages.\n    \"\"\"\n    with subprocess.Popen(\n        [sys.executable, \"-m\", \"pip\", \"check\"], stdout=subprocess.PIPE\n    ) as check_pipe:\n        pip_check = check_pipe.communicate()[0].decode()\n        pip_check_lower = pip_check.lower()\n    for package_tup in libraries.values():\n        for package in package_tup:\n            if package.lower() in pip_check_lower:\n                raise RuntimeError(f\"Dependency conflict found: {pip_check}\")\n\n\ndef _is_installed(req):\n    if req in sys.modules:\n        return True\n\n    try:\n        pkg_resources.get_distribution(req)\n    except pkg_resources.DistributionNotFound:\n        return False\n    except pkg_resources.VersionConflict as exc:\n        logger.warning(\n            \"instrumentation for package %s is available but version %s is installed. Skipping.\",\n            exc.req,\n            exc.dist.as_requirement(),  # pylint: disable=no-member\n        )\n        return False\n    return True\n\n\ndef _find_installed_libraries():\n    libs = default_instrumentations[:]\n    libs.extend(\n        [\n            v[\"instrumentation\"]\n            for _, v in libraries.items()\n            if _is_installed(v[\"library\"])\n        ]\n    )\n    return libs\n\n\ndef _run_requirements():\n    logger.setLevel(logging.ERROR)\n    print(\"\\n\".join(_find_installed_libraries()), end=\"\")\n\n\ndef _run_install():\n    for lib in _find_installed_libraries():\n        _sys_pip_install(lib)\n    _pip_check()\n\n\ndef run() -> None:\n    action_install = \"install\"\n    action_requirements = \"requirements\"\n\n    parser = argparse.ArgumentParser(\n        description=\"\"\"\n        opentelemetry-bootstrap detects installed libraries and automatically\n        installs the relevant instrumentation packages for them.\n        \"\"\"\n    )\n    parser.add_argument(\n        \"-a\",\n        \"--action\",\n        choices=[action_install, action_requirements],\n        default=action_requirements,\n        help=\"\"\"\n        install - uses pip to install the new requirements using to the\n                  currently active site-package.\n        requirements - prints out the new requirements to stdout. Action can\n                       be piped and appended to a requirements.txt file.\n        \"\"\",\n    )\n    args = parser.parse_args()\n\n    cmd = {\n        action_install: _run_install,\n        action_requirements: _run_requirements,\n    }[args.action]\n    cmd()\n", "path": "opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py"}]}