Skip to content

Commit

Permalink
[build] bump pylint (#923)
Browse files Browse the repository at this point in the history
* [build] bump pylint

Fixes #632

* apply lint suggestions

* specify encoding
  • Loading branch information
Alex Boten committed Feb 16, 2022
1 parent d54b61e commit 22cc215
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pylint<2.10
pylint==2.12.2
flake8~=3.7
isort~=5.6
black>=22.1.0
Expand Down
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-richconsole/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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__"])
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ def __init__(self, database, server_port, server_host, user):
self.server_host = server_host
self.user = user

# pylint: disable=no-self-use
async def release(self, conn):
return conn

Expand Down Expand Up @@ -542,11 +543,11 @@ def __init__(self, database, server_port, server_host, user):
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()

Expand Down Expand Up @@ -585,13 +586,15 @@ async def __aenter__(self):


class AiopgPoolMock:
# pylint: disable=no-self-use
async def release(self, conn):
return conn

def acquire(self):
coro = self._acquire()
return _PoolAcquireContextManager(coro, self)

# pylint: disable=no-self-use
async def _acquire(self):
return AiopgConnectionMock()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ def test_traceresponse_header(self):
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"],
[
Expand Down Expand Up @@ -423,10 +423,10 @@ def test_websocket_traceresponse_header(self):
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"],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,11 @@ async def test_trace_response_headers(self):
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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_set_not_recording(self):
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()

Expand All @@ -116,7 +116,7 @@ def test_get_multi_none_found(self):
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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 22cc215

Please sign in to comment.