Skip to content

Instantly share code, notes, and snippets.


studio3104/ Secret

Created Feb 10, 2018
What would you like to do?
pyannotate example py3
from typing import Any, Dict, Optional, Union
import requests
from requests.models import Response
def add(a: int, b: int) -> int:
return a + b
def str_or_none(c: Union[int, str]) -> Optional[str]:
return c if isinstance(c, str) else None
def call_address_api(zipcode: str) -> Response:
return requests.get(f'{zipcode}')
def parse_response_json(response: Response) -> Dict[str, Any]:
return response.json()
class Hoge:
def __init__(self) -> None:
def sub(self, d: int, e: int) -> int:
return d - e
def create_hoge_instance() -> Hoge:
return Hoge()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment