diff --git a/dev-requirements.txt b/dev-requirements.txt index fe54373e7..5b53cd381 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -pylint<2.10 +pylint==2.12.2 flake8~=3.7 isort~=5.6 black>=22.1.0 diff --git a/exporter/opentelemetry-exporter-richconsole/setup.py b/exporter/opentelemetry-exporter-richconsole/setup.py index 4237e6f2f..db3c1ce7a 100644 --- a/exporter/opentelemetry-exporter-richconsole/setup.py +++ b/exporter/opentelemetry-exporter-richconsole/setup.py @@ -21,7 +21,7 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "exporter", "richconsole", "version.py" ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup(version=PACKAGE_INFO["__version__"]) diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py index 155c9948a..3917d277f 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py @@ -507,6 +507,7 @@ class MockPool: self.server_host = server_host self.user = user + # pylint: disable=no-self-use async def release(self, conn): return conn @@ -542,11 +543,11 @@ class MockConnection: database, server_port, server_host, user ) - # pylint: disable=no-self-use def cursor(self): coro = self._cursor() return _ContextManager(coro) # pylint: disable=no-value-for-parameter + # pylint: disable=no-self-use async def _cursor(self): return MockCursor() @@ -585,6 +586,7 @@ class AiopgConnectionMock: class AiopgPoolMock: + # pylint: disable=no-self-use async def release(self, conn): return conn @@ -592,6 +594,7 @@ class AiopgPoolMock: coro = self._acquire() return _PoolAcquireContextManager(coro, self) + # pylint: disable=no-self-use async def _acquire(self): return AiopgConnectionMock() diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py index f1128b8cb..4396dd224 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py @@ -310,10 +310,10 @@ class TestAsgiApplication(AsgiTestBase): self.assertEqual(response_body["body"], b"*") self.assertEqual(response_start["status"], 200) - traceresponse = "00-{0}-{1}-01".format( - format_trace_id(span.get_span_context().trace_id), - format_span_id(span.get_span_context().span_id), - ) + trace_id = format_trace_id(span.get_span_context().trace_id) + span_id = format_span_id(span.get_span_context().span_id) + traceresponse = f"00-{trace_id}-{span_id}-01" + self.assertListEqual( response_start["headers"], [ @@ -423,10 +423,10 @@ class TestAsgiApplication(AsgiTestBase): span = self.memory_exporter.get_finished_spans()[-1] self.assertEqual(trace_api.SpanKind.SERVER, span.kind) - traceresponse = "00-{0}-{1}-01".format( - format_trace_id(span.get_span_context().trace_id), - format_span_id(span.get_span_context().span_id), - ) + trace_id = format_trace_id(span.get_span_context().trace_id) + span_id = format_span_id(span.get_span_context().span_id) + traceresponse = f"00-{trace_id}-{span_id}-01" + self.assertListEqual( socket_send["headers"], [ diff --git a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py index ecc3172e8..baf1a9289 100644 --- a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py +++ b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py @@ -368,12 +368,11 @@ class TestMiddlewareAsgi(SimpleTestCase, TestBase): response["Access-Control-Expose-Headers"], "traceresponse", ) + trace_id = format_trace_id(span.get_span_context().trace_id) + span_id = format_span_id(span.get_span_context().span_id) self.assertEqual( response["traceresponse"], - "00-{}-{}-01".format( - format_trace_id(span.get_span_context().trace_id), - format_span_id(span.get_span_context().span_id), - ), + f"00-{trace_id}-{span_id}-01", ) self.memory_exporter.clear() diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py b/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py index bb9a22546..4756b5189 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/tests/test_pymemcache.py @@ -106,7 +106,7 @@ class PymemcacheClientTestCase( def test_get_many_none_found(self): client = self.make_client([b"END\r\n"]) result = client.get_many([b"key1", b"key2"]) - assert result == {} + assert not result spans = self.memory_exporter.get_finished_spans() @@ -116,7 +116,7 @@ class PymemcacheClientTestCase( client = self.make_client([b"END\r\n"]) # alias for get_many result = client.get_multi([b"key1", b"key2"]) - assert result == {} + assert not result spans = self.memory_exporter.get_finished_spans() diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py index b53b4f230..ef21fccbf 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/utils.py @@ -131,6 +131,7 @@ def _generate_sql_comment(**meta): # Sort the keywords to ensure that caching works and that testing is # deterministic. It eases visual inspection as well. + # pylint: disable=consider-using-f-string return ( " /*" + _KEY_VALUE_DELIMITER.join(