Skip to content

Conversation

yuji38kwmt
Copy link
Collaborator

@yuji38kwmt yuji38kwmt commented May 9, 2025

背景

ラベルcarとラベルbikeには、それぞれtypeという属性が存在するが、属性の定義自体が異なるケースはあります。
このように属性名が重複しているケースは多々あります。
その場合でも、属性情報を取得できるようにするため、「指定したラベルが参照している属性」という条件で絞り込めるようにしました。

@yuji38kwmt yuji38kwmt changed the title 引数を追加 annofab.util.annotation_specs.AnnotationSpecsAccessorget_attribute関数にlabel引数を追加して、指定したラベルに含まれる属性情報を取得できるようにしました。 May 9, 2025
@yuji38kwmt yuji38kwmt requested a review from Copilot May 9, 2025 14:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the attribute retrieval logic in AnnotationSpecsAccessor by adding an optional label parameter to filter attribute information based on the label’s associated additional data definitions. Key changes include:

  • Updating the signature of get_attribute (both as a standalone function and as a method) to accept a new label parameter.
  • Enhancing error messages to include label details when attribute lookup issues occur.
  • Adding tests to cover the new label-filtering logic.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/util/test_annotation_specs.py Added tests for get_attribute filtering by label and not found cases.
annofabapi/util/annotation_specs.py Modified get_attribute to support an optional label argument and updated error messages with label info.

@yuji38kwmt yuji38kwmt merged commit 7f829ad into main May 9, 2025
8 checks passed
@yuji38kwmt yuji38kwmt deleted the update-specs-attributes2 branch May 9, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant