refactor(requests): Make all the type hints dynamic
Made the code shorter by about ~500 lines and easier to maintain in return for making the arguments autocompletion bad for shells that don't check for dynamic type hints like IPython.
This commit is contained in:
@@ -4,6 +4,8 @@ Type definitions for type checking purposes.
|
||||
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
TypedDict,
|
||||
TypeAlias,
|
||||
cast,
|
||||
overload,
|
||||
Any,
|
||||
@@ -34,6 +36,17 @@ PageLoadStates = Literal["commit", "domcontentloaded", "load", "networkidle"]
|
||||
extraction_types = Literal["text", "html", "markdown"]
|
||||
StrOrBytes = Union[str, bytes]
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from typing_extensions import Unpack
|
||||
else: # pragma: no cover
|
||||
|
||||
class _Unpack:
|
||||
@staticmethod
|
||||
def __getitem__(*args, **kwargs):
|
||||
pass
|
||||
|
||||
Unpack = _Unpack()
|
||||
|
||||
|
||||
try:
|
||||
# Python 3.11+
|
||||
|
||||
Reference in New Issue
Block a user