Created
December 18, 2018 22:06
-
-
Save reillysiemens/8893cc59ea05898b71d9f3a4128d25a1 to your computer and use it in GitHub Desktop.
Python Callback Type Annotation
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 fn( | |
url: str, | |
state: State, | |
payload_type: PayloadType, | |
verify: bool = True, | |
method: Callable[..., Response] = requests.post, | |
) -> None: | |
""" | |
Given a function with the above signature, how can the type of | |
``method`` be made more specific? | |
""" | |
# stuff... | |
response = method( | |
url, | |
verify=verify, | |
**{payload_type.name.lower(): {'state': state.name.upper()}} | |
) | |
# more stuff... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment