Restriction.to_human_readable()にIDを出力するオプションを追加しました。 - #760
Merged
Conversation
TitleRefactor code structure for improved readability and maintainability 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. |
Restriction.to_human_readable()にIDを出力するオプションを追加しました。
There was a problem hiding this comment.
Pull request overview
属性英語名が重複しているケースでも制約内容を特定できるように、Restriction.to_human_readable() の出力へ属性ID/選択肢ID/ラベルIDを付与できるオプション(include_ids)を追加するPRです。CLI等での制約表示のトラブルシュート性を高める変更になっています。
Changes:
Restriction.to_human_readable(..., include_ids: bool = False)を追加し、必要に応じてID付き表現へ切り替え可能に変更- ID付きの人間向け文字列表現を生成する内部関数
_restriction_to_human_readable_with_ids()を追加 include_ids=Trueの挙動(属性ID/選択肢ID/ラベルIDの出力)をテストで追加- Python 3.13向けの lint 依存として
mypy>=2へ更新
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| annofabapi/util/attribute_restrictions.py | to_human_readable() に include_ids を追加し、ID付き人間向け文字列表現の生成ロジックを実装 |
| tests/util/test_attribute_restrictions.py | include_ids=True 時に属性ID/選択肢ID/ラベルIDが出力されることを検証するテストを追加 |
| pyproject.toml | Python 3.13 条件付きで linter 依存の mypy 制約を mypy>=2 に更新 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
属性英語名が重複している場合は、属性IDを出力しないと特定できないので、IDを出力するオプションを追加しました。