-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,540 additions
and
717 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from typing import Literal, TypeVar, Union | ||
|
||
from typing_extensions import override | ||
|
||
HexResolution = Union[ | ||
Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], int | ||
] | ||
|
||
_T = TypeVar("_T") | ||
|
||
|
||
# Sentinel class used until PEP 0661 is accepted | ||
class NotGiven: | ||
""" | ||
A sentinel singleton class used to distinguish omitted keyword arguments | ||
from those passed in with the value None (which may have different behavior). | ||
For example: | ||
```py | ||
def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: | ||
... | ||
get(timeout=1) # 1s timeout | ||
get(timeout=None) # No timeout | ||
get() # Default timeout behavior, which may not be statically known at the method definition. | ||
``` | ||
""" | ||
|
||
def __bool__(self) -> Literal[False]: | ||
return False | ||
|
||
@override | ||
def __repr__(self) -> str: | ||
return "NOT_GIVEN" | ||
|
||
|
||
NotGivenOr = Union[_T, NotGiven] | ||
NOT_GIVEN = NotGiven() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.