mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-29 13:12:39 +08:00
[build] bump pylint (#923)
* [build] bump pylint Fixes #632 * apply lint suggestions * specify encoding
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
pylint<2.10
|
||||
pylint==2.12.2
|
||||
flake8~=3.7
|
||||
isort~=5.6
|
||||
black>=22.1.0
|
||||
|
@ -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__"])
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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"],
|
||||
[
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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(
|
||||
|
Reference in New Issue
Block a user