Created
October 15, 2021 04:59
-
-
Save andgineer/0908a17259fd89a9ef568d475821dece to your computer and use it in GitHub Desktop.
async version of nullcontext
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
session = get_session() if s3 is None else None | |
async with session.create_client( | |
"s3" | |
) if s3 is None else contextlib.AsyncExitStack() as s3_temp: | |
s3_object = await (s3 or s3_temp).get_object(Bucket=bucket, Key=key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment