Skip to content

Python type hints: support constrained TypeVars #20388

@damccorm

Description

@damccorm

Support the following syntax when converting to internal Beam types,
and raise a TypeCheckError when trying to bind anything that isn't Any, one of the listed types, or a subtype of the listed types.


AnyStr = TypeVar('AnyStr', Text, bytes)

See: https://www.python.org/dev/peps/pep-0484/#generics (lots of cases to check)

Imported from Jira BEAM-10690. Original Jira may contain additional context.
Reported by: udim.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions