Skip to content

Commit e6712f3

Browse files
committed
Fix lint
1 parent 703ad62 commit e6712f3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

opentelemetry-api/src/opentelemetry/context/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
# limitations under the License.
1414

1515
import logging
16-
import threading
1716
import typing
18-
from functools import wraps
1917
from os import environ
2018
from uuid import uuid4
2119

@@ -26,6 +24,7 @@
2624

2725
logger = logging.getLogger(__name__)
2826

27+
2928
def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
3029
"""Initialize the RuntimeContext
3130
@@ -51,8 +50,10 @@ def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
5150
)
5251
).load()()
5352

53+
5454
_RUNTIME_CONTEXT = _load_runtime_context()
5555

56+
5657
def create_key(keyname: str) -> str:
5758
"""To allow cross-cutting concern to control access to their local state,
5859
the RuntimeContext API provides a function which takes a keyname as input,

opentelemetry-api/tests/context/test_context.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
# limitations under the License.
1414

1515
import unittest
16+
from os import environ
1617

1718
from opentelemetry import context
1819
from opentelemetry.context.context import Context
20+
from opentelemetry.context.contextvars_context import ContextVarsRuntimeContext
21+
from opentelemetry.environment_variables import OTEL_PYTHON_CONTEXT
1922

2023

2124
def _do_work() -> str:
@@ -75,16 +78,13 @@ def test_set_current(self):
7578
context.detach(token)
7679
self.assertEqual("yyy", context.get_value("a"))
7780

81+
7882
class TestInitContext(unittest.TestCase):
7983
def test_load_runtime_context(self):
80-
from os import environ
81-
from opentelemetry.environment_variables import OTEL_PYTHON_CONTEXT
82-
from opentelemetry.context.contextvars_context import ContextVarsRuntimeContext
83-
8484
environ[OTEL_PYTHON_CONTEXT] = "contextvars_context"
85-
ctx = context._load_runtime_context()
85+
ctx = context._load_runtime_context() # pylint: disable=W0212
8686
self.assertIsInstance(ctx, ContextVarsRuntimeContext)
8787

8888
environ.pop(OTEL_PYTHON_CONTEXT)
89-
ctx = context._load_runtime_context()
89+
ctx = context._load_runtime_context() # pylint: disable=W0212
9090
self.assertIsInstance(ctx, ContextVarsRuntimeContext)

0 commit comments

Comments
 (0)