Enhance project member management and update documentation#755
Conversation
TitleEnhance project member management and update documentation Description• プロジェクトメンバリポジトリを追加実装 Changes walkthrough 📝
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
There was a problem hiding this comment.
Pull request overview
This PR centralizes “English name” extraction for annotation specs into shared utility helpers, introduces a cached repository for project member lookup, and updates the Sphinx API reference to document the new module.
Changes:
- Added
get_label_name_en/get_attribute_name_en/get_choice_name_enhelpers (and correspondingTypedDictholders) and updated related lookup logic/tests to use them. - Added
ProjectMemberRepositorywith per-project member caching plus unit tests for account_id/user_id lookups. - Updated
docs/api_reference/index.rstto includeproject_member_repositoryin the API reference toctree.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/util/test_annotation_specs.py |
Adds tests for the new *_name_en helpers and updates existing tests to use them. |
tests/test_project_member_repository.py |
New unit tests covering ProjectMemberRepository lookup behavior and error cases. |
docs/api_reference/index.rst |
Adds project_member_repository to the Sphinx toctree (currently missing the referenced .rst). |
annofabapi/wrapper.py |
Replaces local “English name” extraction helpers with shared util functions. |
annofabapi/util/annotation_specs.py |
Introduces LabelNameHolder / NameHolder and the new *_name_en helper functions; updates existing lookup functions to use them. |
annofabapi/project_member_repository.py |
New repository providing cached project member retrieval and ID mapping helpers. |
| exceptions | ||
| segmentation | ||
| plugin | ||
| project_member_repository |
This pull request introduces a new
ProjectMemberRepositoryutility for managing project member information and refactors the annotation specs utility functions to improve code clarity and reuse. Additionally, it updates the codebase and tests to leverage these new utilities, replacing ad-hoc implementations with standardized functions.Key changes include:
New features:
ProjectMemberRepositoryclass inannofabapi/project_member_repository.pyto provide efficient access to project member information, including methods for retrieving members by account or user ID and converting between account and user IDs.ProjectMemberRepositoryintests/test_project_member_repository.py.project_member_repository.Refactoring and utility improvements:
LabelNameHolder,NameHolder) and utility functions (get_label_name_en,get_attribute_name_en,get_choice_name_en) inannofabapi/util/annotation_specs.pyfor extracting English names from annotation specs. Updated related functions to use these utilities for improved consistency and error handling. [1] [2] [3] [4] [5]annofabapi/wrapper.pyto use the new utility functions and TypedDicts for label, attribute, and choice name extraction, removing redundant internal methods and improving type safety withcast. [1] [2] [3] [4] [5] [6] [7] [8] [9]Testing improvements:
tests/util/test_annotation_specs.pyto cover the new utility functions and updated existing tests to use them. [1] [2] [3]These changes improve maintainability, consistency, and test coverage for project member and annotation spec handling.