Skip to content

Commit 3b53fa4

Browse files
committed
ref(boto3): renaming vars
1 parent ec2a236 commit 3b53fa4

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎sentry_sdk/integrations/boto3/_instrumentation.py‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _instrument_streaming_body(
213213
orig_raw_close = raw_stream.close
214214
finished = False
215215

216-
def finish(error: "Optional[BaseException]" = None) -> None:
216+
def finish_span(error: "Optional[BaseException]" = None) -> None:
217217
nonlocal finished
218218
if finished:
219219
return
@@ -232,35 +232,35 @@ def content_length_reached() -> bool:
232232

233233
def sentry_streaming_body_read(*args: "Any", **kwargs: "Any") -> bytes:
234234
try:
235-
ret = orig_read(*args, **kwargs)
235+
read_return_value = orig_read(*args, **kwargs)
236236
with capture_internal_exceptions():
237-
amount = args[0] if args else kwargs.get("amt")
237+
amount_of_bytes_requested = args[0] if args else kwargs.get("amt")
238238
if (
239-
amount is None
240-
or amount < 0
241-
or (amount > 0 and not ret)
239+
amount_of_bytes_requested is None
240+
or amount_of_bytes_requested < 0
241+
or (amount_of_bytes_requested > 0 and not read_return_value)
242242
or content_length_reached()
243243
):
244-
finish()
245-
return ret
244+
finish_span()
245+
return read_return_value
246246
except BaseException as error:
247-
finish(error)
247+
finish_span(error)
248248
raise
249249

250250
def sentry_streaming_body_close(*args: "Any", **kwargs: "Any") -> None:
251251
try:
252252
orig_close(*args, **kwargs)
253-
finish()
253+
finish_span()
254254
except BaseException as error:
255-
finish(error)
255+
finish_span(error)
256256
raise
257257

258258
def sentry_raw_stream_close(*args: "Any", **kwargs: "Any") -> None:
259259
try:
260260
orig_raw_close(*args, **kwargs)
261-
finish()
261+
finish_span()
262262
except BaseException as error:
263-
finish(error)
263+
finish_span(error)
264264
raise
265265

266266
try:
@@ -270,7 +270,7 @@ def sentry_raw_stream_close(*args: "Any", **kwargs: "Any") -> None:
270270
body.read = sentry_streaming_body_read # type: ignore
271271
body.close = sentry_streaming_body_close # type: ignore
272272
except Exception:
273-
finish()
273+
finish_span()
274274
raise
275275

276276
return True

0 commit comments

Comments
 (0)