[PR #126] [CLOSED] 🔧 refactor: Add get_optional_attr helper function for consistent attribute access #179

Closed
opened 2026-10-18 21:12:28 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/mcpo/pull/126
Author: @MartinPSDev
Created: 5/9/2025
Status: ❌ Closed

Base: dev ← Head: refactor/middleware-and-helpers


📝 Commits (1)

  • e570511 refactor: Add get_optional_attr helper function

📊 Changes

2 files changed (+11 additions, -9 deletions)

View changed files

📝 CHANGELOG.md (+4 -6)
📝 src/mcpo/main.py (+7 -3)

📄 Description

Description

Introduces a new helper function get_optional_attr to standardize the way we handle optional attribute access throughout the codebase. This change improves code consistency and maintainability.

Changes Made

  • Added get_optional_attr helper function in main.py
  • Updated existing getattr calls to use the new helper
  • Added test cases to verify helper function behavior
  • Updated CHANGELOG.md with the changes

N/A

Checklist

  • Tests are passing
  • CHANGELOG.md has been updated
  • Code follows project style guidelines
  • Documentation has been updated (if applicable)

Additional Notes

This refactoring aims to make the codebase more maintainable by providing a consistent way to handle optional attribute access, reducing potential bugs and improving readability.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/mcpo/pull/126 **Author:** [@MartinPSDev](https://github.com/MartinPSDev) **Created:** 5/9/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `refactor/middleware-and-helpers` --- ### 📝 Commits (1) - [`e570511`](https://github.com/open-webui/mcpo/commit/e5705119bf84d3c765b37a63b88e0d1056658792) refactor: Add get_optional_attr helper function ### 📊 Changes **2 files changed** (+11 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -6) 📝 `src/mcpo/main.py` (+7 -3) </details> ### 📄 Description ### Description Introduces a new helper function `get_optional_attr` to standardize the way we handle optional attribute access throughout the codebase. This change improves code consistency and maintainability. ### Changes Made - Added `get_optional_attr` helper function in `main.py` - Updated existing `getattr` calls to use the new helper - Added test cases to verify helper function behavior - Updated CHANGELOG.md with the changes ### Related Issues N/A ### Checklist - [x] Tests are passing - [x] CHANGELOG.md has been updated - [x] Code follows project style guidelines - [x] Documentation has been updated (if applicable) ### Additional Notes This refactoring aims to make the codebase more maintainable by providing a consistent way to handle optional attribute access, reducing potential bugs and improving readability. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:12:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/mcpo#179
No description provided.