Skip to content

Instantly share code, notes, and snippets.

@koi8-r
Created May 3, 2020 18:19
Show Gist options
  • Save koi8-r/0233b936d09fce4497d20db87ff16bd4 to your computer and use it in GitHub Desktop.
Save koi8-r/0233b936d09fce4497d20db87ff16bd4 to your computer and use it in GitHub Desktop.
Python MyPy cheats
from typing import Any, TypeVar, Callable, IO, Match
import re, sys
F = TypeVar('F', bound=Callable[..., Any])
def decorator(fn: F) -> F:
...
def stdout() -> IO[str]:
return sys.stdout
match: Match[str] = re.match(r'.*', '1234')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment