Skip to content

Commit 387ef49

Browse files
committed
style: fix error [SIM910] - Use headers.get(<index>) instead of headers.get(<index>, None).
Used Ruff (vscode and pre-commit) to: - Black-compatible code formatting. - fix all auto-fixable violations. - isort-compatible import sorting. - flake8-simplify manual fixes. Signed-off-by: Paulo Vital <paulo.vital@ibm.com>
1 parent bec8c70 commit 387ef49

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/instana/instrumentation/celery.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _get_task_id(
3030
"""
3131
Across Celery versions, the task id can exist in a couple of places.
3232
"""
33-
id = headers.get("id", None)
33+
id = headers.get("id")
3434
if id is None:
3535
id = body.get("id", None)
3636
return id
@@ -70,8 +70,8 @@ def task_prerun(
7070
ctx = None
7171
tracer = get_tracer()
7272

73-
task = kwargs.get("sender", None)
74-
task_id = kwargs.get("task_id", None)
73+
task = kwargs.get("sender")
74+
task_id = kwargs.get("task_id")
7575
task = registry.tasks.get(task.name)
7676

7777
headers = task.request.get("headers", {})
@@ -117,7 +117,7 @@ def task_failure(
117117
span = worker_span.get()
118118
if span.is_recording():
119119
span.set_attribute("success", False)
120-
exc = kwargs.get("exception", None)
120+
exc = kwargs.get("exception")
121121
if exc:
122122
span.record_exception(exc)
123123
else:
@@ -133,7 +133,7 @@ def task_retry(
133133
try:
134134
span = worker_span.get()
135135
if span.is_recording():
136-
reason = kwargs.get("reason", None)
136+
reason = kwargs.get("reason")
137137
if reason:
138138
span.set_attribute("retry-reason", reason)
139139
except Exception:

src/instana/instrumentation/pyramid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def init_with_instana(
115115
settings["pyramid.tweens"] = "\n".join(tweens)
116116
kwargs["settings"] = settings
117117

118-
if not kwargs.get("package", None):
118+
if not kwargs.get("package"):
119119
kwargs["package"] = caller_package()
120120

121121
wrapped(*args, **kwargs)

0 commit comments

Comments
 (0)