Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pre-pep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ grabs the argument to a ``Pointer``).

::

type PointerArg[T: Pointer] = GetArg[T, Pointer, 0]
type PointerArg[T: Pointer] = GetArg[T, Pointer, Literal[0]]

``AdjustLink`` sticks a ``list`` around ``MultiLink``, using features
we've discussed already.
Expand Down Expand Up @@ -559,8 +559,6 @@ to be imported, and it could also be used qualified as
# *[... for t in ...] arguments
| <ident>[<variadic-type-arg> +]

| <string-or-int-literal> # Only accepted in arguments to new functions?

# Type conditional checks are boolean compositions of
# "subtype checking" and boolean Literal type checking.
<type-bool> =
Expand Down
4 changes: 3 additions & 1 deletion tests/test_fastapilike_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class Field[T: FieldArgs](InitField[T]):
####

# TODO: Should this go into the stdlib?
type GetFieldItem[T: InitField, K] = GetAttr[GetArg[T, InitField, 0], K]
type GetFieldItem[T: InitField, K] = GetAttr[
GetArg[T, InitField, Literal[0]], K
]


##
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qblike.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Link[T]:

# Conditional type alias!
type FilterLinks[T] = (
Link[PropsOnly[GetArg[T, Link, 0]]] if IsSub[T, Link] else T
Link[PropsOnly[GetArg[T, Link, Literal[0]]]] if IsSub[T, Link] else T
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_qblike_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def select[ModelT, K: BaseTypedDict](
grabs the argument to a ``Pointer``).

"""
type PointerArg[T: Pointer] = GetArg[T, Pointer, 0]
type PointerArg[T: Pointer] = GetArg[T, Pointer, Literal[0]]

"""
``AdjustLink`` sticks a ``list`` around ``MultiLink``, using features
Expand Down
2 changes: 1 addition & 1 deletion tests/test_type_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Final(Mine, Ordinary, Wrapper[float], AnotherBase[float], Last[int]):
pass


type BaseArg[T] = GetArg[T, Base, 0] if IsSub[T, Base] else Never
type BaseArg[T] = GetArg[T, Base, Literal[0]] if IsSub[T, Base] else Never


type AllOptional[T] = NewProtocol[
Expand Down
Loading