Skip to content

feat: implement AdjustLink type operator#32

Open
AliiiBenn wants to merge 6 commits intomainfrom
feat/adjust-link
Open

feat: implement AdjustLink type operator#32
AliiiBenn wants to merge 6 commits intomainfrom
feat/adjust-link

Conversation

@AliiiBenn
Copy link
Member

Summary

Implements the AdjustLink helper type as mentioned in PEP 827 for handling ORM-style relations.

AdjustLink[Tgt, LinkTy] wraps the type in list if LinkTy is a MultiLink (one-to-many relationship), otherwise returns the type directly.

Changes

  • Add AdjustLink class to typing.py
  • Add evaluator in _eval_operators.py with MultiLink detection via origin name and MRO
  • Add comprehensive tests

Test plan

  • All AdjustLink tests pass
  • Existing tests still pass

Related: #31

🤖 Generated with Claude Code

AliiiBenn and others added 6 commits March 9, 2026 10:48
Add AdjustLink[Tgt, LinkTy] operator that wraps type in list
if LinkTy is MultiLink (one-to-many), otherwise returns type directly.

Used for ORM-style relations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add evaluator for AdjustLink that detects MultiLink types
via origin name and MRO inspection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests for:
- AdjustLink with MultiLink (returns list)
- AdjustLink with Link (returns type directly)
- AdjustLink with Property (returns type directly)
- AdjustLink with subclass of MultiLink
- AdjustLink with SingleLink (not MultiLink)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AliiiBenn AliiiBenn linked an issue Mar 9, 2026 that may be closed by this pull request
9 tasks
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.

[FEATURE] Implement AdjustLink helper type

1 participant