Skip to content

Conversation

@reckart
Copy link
Member

@reckart reckart commented Nov 10, 2025

What's in the PR

  • Introduced Annotation class with default begin/end 0
  • Update reference data accordingly
  • Fixed several issues with sorting/ordering annotations

How to test manually

  • No specific test procedure

Automatic testing

  • PR includes unit tests

Documentation

  • PR updates documentation

Copy link

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 introduces a concrete Annotation base class with default begin=0 and end=0 attributes to provide a stable typing foundation for annotation instances. This addresses sorting and serialization issues with runtime-generated annotation types.

  • Introduced Annotation class that all annotation types inherit from
  • Updated XMI test fixtures to include default begin="0" end="0" attributes for annotation-like types
  • Refactored sorting logic to use stable key-based comparisons instead of comparator functions

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
cassis/typesystem.py Added Annotation base class and updated type generation to inherit from it for annotation types
cassis/cas.py Updated type hints to use Annotation instead of FeatureStructure where appropriate; improved duck-typing in _sort_func
cassis/xmi.py Fixed offset conversion logic with defensive checks and improved comments
cassis/util.py Replaced comparator-based sorting with stable key functions; refactored hash computation to return deterministic string representations
tests/test_files/xmi/*.xmi Added begin="0" end="0" attributes to annotation instances in test fixtures
tests/test_ducktyping.py New test file verifying runtime-generated annotations work correctly
tests/test_cas.py Added tests for non-annotation feature structures and runtime-generated annotations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@reckart reckart force-pushed the feature/336-Introduce-Annotation-class branch 2 times, most recently from 121e10f to 9318f26 Compare November 11, 2025 06:19
@reckart reckart requested a review from Copilot November 11, 2025 06:29
Copy link

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# Should be possible to get away with not sorting here assuming that all_features returns the features always in
# the same order
parts: list[str] = []
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

Inconsistent type hint syntax. The file imports Dict and Any from typing (line 4) but uses the built-in list[str] syntax here instead of List[str] from typing. For consistency with the rest of the file and better compatibility, either add List to the imports and use List[str], or update all type hints to use PEP 585 built-in generics throughout the file.

Copilot uses AI. Check for mistakes.
cassis/util.py Outdated
return "|".join(parts)


def _normalize_feature_value(value: Any):
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

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

_normalize_feature_value returns tuple of size 1 and tuple of size 2.
_normalize_feature_value returns tuple of size 1 and tuple of size 4.
_normalize_feature_value returns tuple of size 1 and tuple of size 2.
_normalize_feature_value returns tuple of size 1 and tuple of size 2.
_normalize_feature_value returns tuple of size 2 and tuple of size 4.
_normalize_feature_value returns tuple of size 2 and tuple of size 4.
_normalize_feature_value returns tuple of size 2 and tuple of size 4.

Copilot uses AI. Check for mistakes.
- Introduced Annotation class with default begin/end 0
- Update reference data accordingly
- Fixed several issues with sorting/ordering annotations
@reckart reckart force-pushed the feature/336-Introduce-Annotation-class branch from 9318f26 to e5eb8e0 Compare November 11, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants