-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
c apiThis has to do with the C API (_view)This has to do with the C API (_view)complexThis should only be looked at by someone who knows what they're doingThis should only be looked at by someone who knows what they're doingimprovementImprovement to an existing featureImprovement to an existing feature
Milestone
Description
Improvement Description
As of now, typing.Literal
nor enum.Enum
are supported when using the type validation API. This is an important feature that should be ready before #10 is complete.
Improvement Request Example API
from view import compile_type
from enum import Enum
class MyEnum(Enum):
A = 1
B = 2
tp = compile_type(MyEnum)
tp.cast("1") # MyEnum.A
tp.cast("A") # MyEnum.A
And with literals:
from view import compile_type
from typing import Literal
tp = compile_type(Literal["a", "b", "c"])
tp.is_compatible("1") # False
tp.is_compatible("a") # True
tp.is_compatible("A") # False
Anything else?
No response
Metadata
Metadata
Assignees
Labels
c apiThis has to do with the C API (_view)This has to do with the C API (_view)complexThis should only be looked at by someone who knows what they're doingThis should only be looked at by someone who knows what they're doingimprovementImprovement to an existing featureImprovement to an existing feature