Skip to content

Commit 5bc8894

Browse files
committed
Fix a bunch of failing style/lint/spellcheck checks
1 parent ccdd224 commit 5bc8894

File tree

8 files changed

+28
-34
lines changed

8 files changed

+28
-34
lines changed

exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/trace_exporter/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(
6969
self.host_name = host_name
7070
self.node = utils.get_node(service_name, host_name)
7171

72+
# pylint: disable=arguments-differ
7273
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
7374
# Populate service_name from first span
7475
# We restrict any SpanProcessor to be only associated with a single

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
from opentelemetry.sdk.trace import ReadableSpan
7373
from opentelemetry.util.re import parse_env_headers
7474

75-
json_config = json.dumps(
75+
_JSON_CONFIG = json.dumps(
7676
{
7777
"methodConfig": [
7878
{
@@ -269,7 +269,7 @@ def __init__(
269269
self._endpoint,
270270
compression=compression,
271271
options=[
272-
("grpc.service_config", json_config),
272+
("grpc.service_config", _JSON_CONFIG),
273273
],
274274
)
275275
else:
@@ -284,7 +284,7 @@ def __init__(
284284
credentials,
285285
compression=compression,
286286
options=[
287-
("grpc.service_config", json_config),
287+
("grpc.service_config", _JSON_CONFIG),
288288
],
289289
)
290290
self._client = self._stub(self._channel)

exporter/opentelemetry-exporter-otlp-proto-grpc/tests/test_otlp_exporter_mixin.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
from unittest import TestCase
2121
from unittest.mock import ANY, Mock, patch
2222

23-
from google.rpc import code_pb2, status_pb2
23+
from google.rpc.code_pb2 import ( # pylint: disable=no-name-in-module
24+
ALREADY_EXISTS,
25+
OK,
26+
UNAVAILABLE,
27+
)
28+
from google.rpc.status_pb2 import Status # pylint: disable=no-name-in-module
2429
from grpc import Compression, server
2530
from grpc_status import rpc_status
2631

@@ -91,21 +96,21 @@ def shutdown(self, timeout_millis=30_000):
9196
class TraceServiceServicerWithExportParams(TraceServiceServicer):
9297
def __init__(
9398
self,
94-
export_result: code_pb2,
99+
export_result: int,
95100
optional_export_sleep: Optional[float] = None,
96101
):
97102
self.export_result = export_result
98103
self.optional_export_sleep = optional_export_sleep
99104

100105
# pylint: disable=invalid-name,unused-argument
101106
def Export(self, request, context):
102-
logger.warning("Export Request Recieved")
107+
logger.warning("Export Request Received")
103108
if self.optional_export_sleep:
104109
time.sleep(self.optional_export_sleep)
105-
if self.export_result != code_pb2.OK:
110+
if self.export_result != OK:
106111
context.abort_with_status(
107112
rpc_status.to_status(
108-
status_pb2.Status(
113+
Status(
109114
code=self.export_result,
110115
)
111116
)
@@ -288,7 +293,7 @@ def test_otlp_exporter_otlp_compression_envvar(
288293

289294
def test_shutdown(self):
290295
add_TraceServiceServicer_to_server(
291-
TraceServiceServicerWithExportParams(code_pb2.OK),
296+
TraceServiceServicerWithExportParams(OK),
292297
self.server,
293298
)
294299
self.assertEqual(
@@ -306,9 +311,7 @@ def test_shutdown(self):
306311

307312
def test_shutdown_wait_last_export(self):
308313
add_TraceServiceServicer_to_server(
309-
TraceServiceServicerWithExportParams(
310-
code_pb2.OK, optional_export_sleep=1
311-
),
314+
TraceServiceServicerWithExportParams(OK, optional_export_sleep=1),
312315
self.server,
313316
)
314317

@@ -327,9 +330,7 @@ def test_shutdown_wait_last_export(self):
327330

328331
def test_shutdown_doesnot_wait_last_export(self):
329332
add_TraceServiceServicer_to_server(
330-
TraceServiceServicerWithExportParams(
331-
code_pb2.OK, optional_export_sleep=3
332-
),
333+
TraceServiceServicerWithExportParams(OK, optional_export_sleep=3),
333334
self.server,
334335
)
335336

@@ -351,7 +352,7 @@ def test_export_over_closed_grpc_channel(self):
351352
# pylint: disable=protected-access
352353

353354
add_TraceServiceServicer_to_server(
354-
TraceServiceServicerWithExportParams(code_pb2.OK),
355+
TraceServiceServicerWithExportParams(OK),
355356
self.server,
356357
)
357358
self.exporter.export([self.span])
@@ -365,7 +366,7 @@ def test_export_over_closed_grpc_channel(self):
365366

366367
def test_retry_timeout(self):
367368
add_TraceServiceServicer_to_server(
368-
TraceServiceServicerWithExportParams(code_pb2.UNAVAILABLE),
369+
TraceServiceServicerWithExportParams(UNAVAILABLE),
369370
self.server,
370371
)
371372
with self.assertLogs(level=WARNING) as warning:
@@ -381,7 +382,7 @@ def test_retry_timeout(self):
381382
for idx, log in enumerate(warning.records):
382383
if idx != 2:
383384
self.assertEqual(
384-
"Export Request Recieved",
385+
"Export Request Received",
385386
log.message,
386387
)
387388
else:
@@ -405,7 +406,7 @@ def test_retry_timeout(self):
405406
for idx, log in enumerate(warning.records):
406407
if idx != 3:
407408
self.assertEqual(
408-
"Export Request Recieved",
409+
"Export Request Received",
409410
log.message,
410411
)
411412
else:
@@ -417,7 +418,7 @@ def test_retry_timeout(self):
417418
def test_timeout_set_correctly(self):
418419
add_TraceServiceServicer_to_server(
419420
TraceServiceServicerWithExportParams(
420-
code_pb2.OK, optional_export_sleep=0.5
421+
OK, optional_export_sleep=0.5
421422
),
422423
self.server,
423424
)
@@ -449,7 +450,7 @@ def test_otlp_headers_from_env(self):
449450
def test_permanent_failure(self):
450451
with self.assertLogs(level=WARNING) as warning:
451452
add_TraceServiceServicer_to_server(
452-
TraceServiceServicerWithExportParams(code_pb2.ALREADY_EXISTS),
453+
TraceServiceServicerWithExportParams(ALREADY_EXISTS),
453454
self.server,
454455
)
455456
self.assertEqual(

exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def __init__(
149149
environ.get(OTEL_EXPORTER_ZIPKIN_TIMEOUT, 10)
150150
)
151151

152+
# pylint: disable=arguments-differ
152153
def export(self, spans: Sequence[Span]) -> SpanExportResult:
153154
# After the call to Shutdown subsequent calls to Export are
154155
# not allowed and should return a Failure result

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def export(
7979
8080
Args:
8181
batch: The list of `LogData` objects to be exported.
82-
timeout_millis: Optional milliseconds until Export should timeout if it hasn't succeded.
82+
timeout_millis: Optional milliseconds until Export should timeout if it hasn't succeeded.
8383
8484
Returns:
8585
The result of the export
@@ -120,6 +120,7 @@ def export(self, batch: Sequence[LogData]):
120120
def shutdown(self):
121121
pass
122122

123+
123124
class SimpleLogRecordProcessor(LogRecordProcessor):
124125
"""This is an implementation of LogRecordProcessor which passes
125126
received logs in the export-friendly LogData representation to the

opentelemetry-sdk/src/opentelemetry/sdk/trace/export/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,12 @@ def export(
7777
7878
Args:
7979
spans: The list of `opentelemetry.trace.Span` objects to be exported
80-
timeout_millis: Optional milliseconds until Export should timeout if it hasn't succeded.
80+
timeout_millis: Optional milliseconds until Export should timeout if it hasn't succeeded.
8181
8282
Returns:
8383
The result of the export
8484
"""
8585

86-
@abc.abstractmethod
8786
def shutdown(self) -> None:
8887
"""Shuts down the exporter.
8988
@@ -522,8 +521,5 @@ def export(self, spans: typing.Sequence[ReadableSpan]) -> SpanExportResult:
522521
self.out.flush()
523522
return SpanExportResult.SUCCESS
524523

525-
def force_flush(self, timeout_millis: int = 30000):
524+
def force_flush(self, timeout_millis: int = 30000) -> bool:
526525
return True
527-
528-
def shutdown(self):
529-
pass

opentelemetry-sdk/src/opentelemetry/sdk/trace/export/in_memory_span_exporter.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,3 @@ def shutdown(self) -> None:
5757
Calls to export after the exporter has been shut down will fail.
5858
"""
5959
self._stopped = True
60-
61-
def force_flush(self, timeout_millis: int = 30000) -> bool:
62-
return True

opentelemetry-sdk/tests/trace/export/test_export.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ def export(self, spans: trace.Span) -> export.SpanExportResult:
7676
def shutdown(self):
7777
self.is_shutdown = True
7878

79-
def force_flush(self, timeout_millis: int = 30000) -> bool:
80-
return True
81-
8279

8380
class TestSimpleSpanProcessor(unittest.TestCase):
8481
def test_simple_span_processor(self):

0 commit comments

Comments
 (0)