Skip to content

Commit 1107151

Browse files
fix: remove unnecessary hasattr checks (#146)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Follow the [`CONTRIBUTING` Guide](https://github.com/google-a2a/a2a-python/blob/main/CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - [x] Ensure the tests and linter pass (Run `nox -s format` from the repository root to format) - [x] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕 Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
1 parent 0c9df12 commit 1107151

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/a2a/server/apps/starlette_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def _generate_error_response(
151151
log_level,
152152
f'Request Error (ID: {request_id}): '
153153
f"Code={error_resp.error.code}, Message='{error_resp.error.message}'"
154-
f'{", Data=" + str(error_resp.error.data) if hasattr(error, "data") and error_resp.error.data else ""}',
154+
f'{", Data=" + str(error_resp.error.data) if error_resp.error.data else ""}',
155155
)
156156
return JSONResponse(
157157
error_resp.model_dump(mode='json', exclude_none=True),

src/a2a/utils/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def append_artifact_to_task(task: Task, event: TaskArtifactUpdateEvent) -> None:
6969

7070
# Find existing artifact by its id
7171
for i, art in enumerate(task.artifacts):
72-
if hasattr(art, 'artifactId') and art.artifactId == artifact_id:
72+
if art.artifactId == artifact_id:
7373
existing_artifact = art
7474
existing_artifact_list_index = i
7575
break

0 commit comments

Comments
 (0)