KotlinIsland / KotlinIsland/basedtyping

form/forminfo can include _UnionGenericAlias

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
todo
Dominant language
Python
Stars
12
Forks
2
PR merge metrics
No merged PRs in 30d

Description

https://github.com/KotlinIsland/basedtyping/blob/da376313c7bf7957416cc00bb57849c3ae45de13/basedtyping/__init__.py#L347

```python

super().__init_subclass__()

if sys.version_info >= (3, 10):
from types import UnionType

_UnionTypes = (UnionType, OldUnionType)
_Forms: TypeAlias = type | UnionType | _SpecialForm # type: ignore[unused-ignore, no-any-expr]
else:
_UnionTypes = (OldUnionType,)
_Forms: TypeAlias = Union[type, _SpecialForm]

# TODO: make this work with any "form", not just unions
# should be (form: TypeForm, forminfo: TypeForm)
# TODO: form/forminfo can include _UnionGenericAlias
def issubform(form: _Forms, forminfo: _Forms) -> bool:
"""EXPERIMENTAL: Warning, this function currently only supports unions and ``Never``.

Returns ``True`` if ``form`` is a subform (specialform or subclass) of ``forminfo``.

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read basedtyping/__init__.py around line 347 and inspect the issubform entry point, including its current _Forms and _UnionTypes definitions. The issue provides no tests or acceptance criteria; done would require defining and implementing how form and forminfo support _UnionGenericAlias, then adding or updating validation for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.