Skip to content

Commit 8bc4cb0

Browse files
committed
More fixes
1 parent 062a9e6 commit 8bc4cb0

File tree

10 files changed

+31
-39
lines changed

10 files changed

+31
-39
lines changed

dev-requirements.txt

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
pylint==3.0.2
2-
flake8~=3.7
3-
isort~=5.8
4-
black~=22.3.0
5-
httpretty~=1.0
2+
flake8==6.1.0
3+
isort==5.12.0
4+
black==22.3.0
5+
httpretty==1.1.4
66
mypy==0.931
7-
sphinx~=7.1
7+
sphinx==7.1.2
88
sphinx-rtd-theme==2.0.0rc4
9-
sphinx-autodoc-typehints~=1.25
9+
sphinx-autodoc-typehints==1.25.2
1010
pytest==7.1.3
11-
pytest-cov~=4.1
12-
readme-renderer~=24.0
11+
pytest-cov==4.1.0
12+
readme-renderer==42.0
1313
bleach==4.1.0 # transient dependency for readme-renderer
1414
protobuf~=3.13
1515
markupsafe>=2.0.1
1616
codespell==2.1.0
1717
requests==2.31.0
1818
ruamel.yaml==0.17.21
19+
flaky==3.7.0

docs-requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
sphinx~=7.1
1+
sphinx==7.1.2
22
sphinx-rtd-theme==2.0.0rc4
3-
sphinx-autodoc-typehints~=1.25
3+
sphinx-autodoc-typehints==1.25.2
44

55
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
66
# doesn't work for pkg_resources.

instrumentation/opentelemetry-instrumentation-aws-lambda/tests/__init__.py

Whitespace-only changes.

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/lmbd.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ def _inject_current_span(cls, call_context: _AwsSdkCallContext):
9999
# Lambda extension
100100
################################################################################
101101

102-
_OPERATION_MAPPING = {
102+
_OPERATION_MAPPING: Dict[str, _LambdaOperation] = {
103103
op.operation_name(): op
104104
for op in globals().values()
105105
if inspect.isclass(op)
106106
and issubclass(op, _LambdaOperation)
107107
and not inspect.isabstract(op)
108-
} # type: Dict[str, _LambdaOperation]
108+
}
109109

110110

111111
class _LambdaExtension(_AwsSdkExtension):

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/sns.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ def before_service_call(cls, call_context: _AwsSdkCallContext, span: Span):
143143
# SNS extension
144144
################################################################################
145145

146-
_OPERATION_MAPPING = {
146+
_OPERATION_MAPPING: Dict[str, _SnsOperation] = {
147147
op.operation_name(): op
148148
for op in globals().values()
149149
if inspect.isclass(op)
150150
and issubclass(op, _SnsOperation)
151151
and not inspect.isabstract(op)
152-
} # type: Dict[str, _SnsOperation]
152+
}
153153

154154

155155
class _SnsExtension(_AwsSdkExtension):

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/types.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,21 @@ def __init__(self, client: _BotoClientT, args: Tuple[str, Dict[str, Any]]):
5757
boto_meta = client.meta
5858
service_model = boto_meta.service_model
5959

60-
self.service = service_model.service_name.lower() # type: str
61-
self.operation = operation # type: str
62-
self.params = params # type: Dict[str, Any]
60+
self.service = service_model.service_name.lower()
61+
self.operation = operation
62+
self.params = params
6363

6464
# 'operation' and 'service' are essential for instrumentation.
6565
# for all other attributes we extract them defensively. All of them should
6666
# usually exist unless some future botocore version moved things.
67-
self.region = self._get_attr(
68-
boto_meta, "region_name"
69-
) # type: Optional[str]
70-
self.endpoint_url = self._get_attr(
67+
self.region: Optional[str] = self._get_attr(boto_meta, "region_name")
68+
self.endpoint_url: Optional[str] = self._get_attr(
7169
boto_meta, "endpoint_url"
72-
) # type: Optional[str]
70+
)
7371

74-
self.api_version = self._get_attr(
72+
self.api_version: Optional[str] = self._get_attr(
7573
service_model, "api_version"
76-
) # type: Optional[str]
74+
)
7775
# name of the service in proper casing
7876
self.service_id = str(
7977
self._get_attr(service_model, "service_id", self.service)

instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_aio_server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def _unary_interceptor(request_or_iterator, context):
7777
# we handle in our context wrapper.
7878
# Here, we're interested in uncaught exceptions.
7979
# pylint:disable=unidiomatic-typecheck
80-
if type(error) != Exception:
80+
if type(error) != Exception: # noqa: E721
8181
span.record_exception(error)
8282
raise error
8383

@@ -101,7 +101,7 @@ async def _stream_interceptor(request_or_iterator, context):
101101

102102
except Exception as error:
103103
# pylint:disable=unidiomatic-typecheck
104-
if type(error) != Exception:
104+
if type(error) != Exception: # noqa: E721
105105
span.record_exception(error)
106106
raise error
107107

instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def telemetry_interceptor(request_or_iterator, context):
315315
# we handle in our context wrapper.
316316
# Here, we're interested in uncaught exceptions.
317317
# pylint:disable=unidiomatic-typecheck
318-
if type(error) != Exception:
318+
if type(error) != Exception: # noqa: E721
319319
span.record_exception(error)
320320
raise error
321321

@@ -342,6 +342,6 @@ def _intercept_server_stream(
342342

343343
except Exception as error:
344344
# pylint:disable=unidiomatic-typecheck
345-
if type(error) != Exception:
345+
if type(error) != Exception: # noqa: E721
346346
span.record_exception(error)
347347
raise error

tox.ini

+1-8
Original file line numberDiff line numberDiff line change
@@ -519,14 +519,7 @@ commands =
519519
basepython: python3
520520
recreate = True
521521
deps =
522-
-c dev-requirements.txt
523-
flaky
524-
pylint
525-
flake8
526-
isort
527-
black
528-
readme_renderer
529-
httpretty
522+
-r dev-requirements.txt
530523

531524
commands_pre =
532525
python -m pip install "{env:CORE_REPO}#egg=opentelemetry-api&subdirectory=opentelemetry-api"

util/opentelemetry-util-http/src/opentelemetry/util/http/httplib.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def trysetip(conn: http.client.HTTPConnection, loglevel=logging.DEBUG) -> bool:
7878
state = _getstate()
7979
if not state:
8080
return True
81-
spanlist = state.get("need_ip") # type: typing.List[Span]
81+
spanlist: typing.List[Span] = state.get("need_ip")
8282
if not spanlist:
8383
return True
8484

@@ -88,7 +88,7 @@ def trysetip(conn: http.client.HTTPConnection, loglevel=logging.DEBUG) -> bool:
8888

8989
sock = "<property not accessed>"
9090
try:
91-
sock = conn.sock # type: typing.Optional[socket.socket]
91+
sock: typing.Optional[socket.socket] = conn.sock
9292
logger.debug("Got socket: %s", sock)
9393
if sock is None:
9494
return False
@@ -163,7 +163,7 @@ def set_ip_on_next_http_connection(span: Span):
163163
finally:
164164
context.detach(token)
165165
else:
166-
spans = state["need_ip"] # type: typing.List[Span]
166+
spans: typing.List[Span] = state["need_ip"]
167167
spans.append(span)
168168
try:
169169
yield

0 commit comments

Comments
 (0)