from typing import Union, Optional, Literal, Callable
from collections.abc import Iterable, Mapping
import collections
i: Union[int, str] = 1 j: Union[int, str] = "aa" k: Union[list[int], str] = 1 l: Union[list[int], str] = [1] o: Optional[int] = None p: Optional[int] = "a" weekdays: Literal[1, 2, 3, 4, 5, 6, 7] = 1 weekdays: Literal[1, 2, 3, 4, 5, 6, 7] = 8 _: tuple[int, ...] = (1, 2, 3)
_: tuple[int, str] = (1, "a", 1) _: list[tuple[int, ...]] = [(1, 2, 3)]
_: dict[str, dict[str, Union[int, str]]] = {"a": {"b": 1}}
_: dict[str, dict[str, list[int]]] = {"a": {"b": [1]}}
_: dict[str, dict[str, dict[str, int]]] = {"a": {"b": {"c": 1}}}
_: dict[str, dict[str, Optional[int]]] = {"a": {"b": 1}}
_: dict[str, dict[str, Literal[1, 2]]] = {"a": {"b": 1}}
_: dict[str, dict[str, Callable[[int], int]]] = {"a": {"b": abs}}
_: dict[str, dict[str, Callable[[int], None]]] = {"a": {"b": print}}
_: dict[str, dict[str, Opional[int]]] = {"a": {"b": 1}} _: dict[str, dict[str, Union[int, str]]] = {"a": {"b": None}} _: dict[str, dict[str, list[int]]] = {"a": {"b": ["c"]}} _: dict[str, dict[str, Callable[[int], int]]] = {"a": {"b": print}} _: dict[str, dict[str, Optional[int]]] = {"a": {"b": "c"}} _: dict[str, dict[str, Literal[1, 2]]] = {"a": {"b": 3}} _: list[tuple[int, ...]] = [(1, "a", 3)]
def f(x: Union[int, str]) -> None:
pass
f(1) f(None)
def g(x: int) -> int:
return x
_: Callable[[Union[int, str]], None] = f _: Callable[[Union[int, str]], None] = g
_: Iterable[int] = [1] _: Iterable[int] = {1} _: Iterable[int] = (1, 2) _: Iterable[int] = ["a"]
_: Mapping[str, int] = {"a": 1, "c": 2} _: Mapping[str, int] = {1: "a", 2: "b"}
def f(x: Union[int, str, None]):
pass
f(1)
f("a")
f(None)
i1 = 1 i2 = 1 i3 = 1 i3 + "a"
def f(it: Iterable):
for i in it:
print(i)
def f2(it: collections.abc.Iterable):
for i in it:
print(i)
def g(it: Iterable):
for i in it:
print(i + "a")