-
-
Save studio3104/128ab66f76e1bb32fbbe228f67634721 to your computer and use it in GitHub Desktop.
pyannotate example py3
This file contains 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 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'http://api.zipaddress.net/?zipcode={zipcode}') | |
def parse_response_json(response: Response) -> Dict[str, Any]: | |
return response.json() | |
class Hoge: | |
def __init__(self) -> None: | |
pass | |
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