This file contains hidden or 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
| def ft_harvest_total(): | |
| x = int(input("Day 1 harvest: ")) | |
| y = int(input("Day 2 harvest: ")) | |
| z = int(input("Day 3 harvest: ")) | |
| print("Total harvest:", x + y + z) |
This file contains hidden or 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
| class C: | |
| pass | |
| def foo(self) -> int: | |
| return 10 | |
| C.foo = foo |
This file contains hidden or 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
| from typing import Iterator | |
| def fib(n: int) -> Iterator[int]: | |
| a, b = 0, 1 | |
| while a < n: | |
| yield a | |
| a, b = b, a + b |
This file contains hidden or 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
| from collections.abc import Callable, Hashable, Mapping | |
| from typing import Concatenate, Any | |
| class NDArray: ... | |
| def mean(_: NDArray, *args: Any, **kwargs: Any) -> Any: | |
| pass | |
| def f(_: Mapping[Hashable, list[Callable[Concatenate[NDArray, ...], Any]]]) -> None: | |
| pass |
This file contains hidden or 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
| from typing import Protocol, TypeVar, ClassVar, Any | |
| from collections.abc import Iterator | |
| _T_co = TypeVar("_T_co", covariant=True) | |
| class CovariantList(Protocol[_T_co]): | |
| __hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride] | |
| @property # type: ignore[override] | |
| def __class__(self) -> type[list[Any]]: ... # pyrefly: ignore[bad-override] | |
| @__class__.setter |
This file contains hidden or 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
| import typing | |
| from typing import Any | |
| class RunnerSnapshot: | |
| pass | |
| @typing.overload | |
| def _normalize_runner(runner: dict) -> RunnerSnapshot: |
This file contains hidden or 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
| from dataclasses import dataclass | |
| from typing import Any, NotRequired, Self, TypedDict | |
| @dataclass | |
| class BaseQueryParameters: | |
| type: str | |
| query: str | |
| from_: int | |
| size: int |
This file contains hidden or 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
| from typing_extensions import TypeForm | |
| def foo[T](x: TypeForm[T]) -> None: | |
| pass | |
| foo("Unresolvable") |
This file contains hidden or 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
| import typing as tp | |
| from typing import reveal_type | |
| class MyIntList: | |
| def __init__(self, lst: list[int]) -> None: | |
| self.lst = lst | |
| @tp.overload |
This file contains hidden or 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
| from __future__ import annotations | |
| from typing import overload | |
| class Widget: | |
| @overload | |
| def __init__(self, name: str, /, major: int, minor: int, *, extra: object = None, config: str | None = None) -> None: ... | |
| @overload | |
| def __init__(self, *, name: str, major: int, minor: int, extra: object = None, config: str | None = None) -> None: ... | |
| @overload |
NewerOlder