refactor: remove unnecessary 'closing' usage for boto3 client (#9343)
This commit is contained in:
parent
5eb00502ec
commit
6d2c6caa23
4 changed files with 24 additions and 36 deletions
|
|
@ -2,7 +2,6 @@ import base64
|
|||
import io
|
||||
import json
|
||||
from collections.abc import Generator
|
||||
from contextlib import closing
|
||||
|
||||
from flask import Flask
|
||||
from google.cloud import storage as google_cloud_storage
|
||||
|
|
@ -43,7 +42,7 @@ class GoogleCloudStorage(BaseStorage):
|
|||
def generate(filename: str = filename) -> Generator:
|
||||
bucket = self.client.get_bucket(self.bucket_name)
|
||||
blob = bucket.get_blob(filename)
|
||||
with closing(blob.open(mode="rb")) as blob_stream:
|
||||
with blob.open(mode="rb") as blob_stream:
|
||||
while chunk := blob_stream.read(4096):
|
||||
yield chunk
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue