🚨 Fixed DeepSource issues
This commit is contained in:
@@ -27,9 +27,10 @@ class LocalStorage:
|
||||
except FileNotFoundError:
|
||||
yield None
|
||||
|
||||
async def upload(self, file_name: str, data: BinaryIO, mime_type: str | None = None) -> None:
|
||||
# skipcq: PYL-W0613
|
||||
async def upload(self, file_name: str, file: BinaryIO, mime_type: str | None = None) -> None:
|
||||
async with aiofiles.open(file=os.path.join(self.base_path, file_name), mode="wb") as f:
|
||||
await aioshutil_copyfileobj(data, f)
|
||||
await aioshutil_copyfileobj(file, f)
|
||||
|
||||
async def delete(self, file_names: [str]) -> None:
|
||||
for i in file_names:
|
||||
|
||||
@@ -103,15 +103,13 @@ class S3Storage:
|
||||
+ "Signature="
|
||||
+ signature
|
||||
)
|
||||
# if expiry is not None:
|
||||
# authorization_header += f", Expires={expiry}"
|
||||
|
||||
# Send the request with the authorization header
|
||||
headers = {"x-amz-date": amz_date, "Authorization": authorization_header}
|
||||
request_url = self.base_url + path + "?" + canonical_querystring
|
||||
|
||||
return headers, request_url
|
||||
|
||||
# skipcq: PYL-W0613
|
||||
async def upload(self, file: BinaryIO, file_name: str, mime_type: str | None = "application/octet-stream") -> None:
|
||||
headers, url = self._generate_aws_signature_v4(method="PUT", path=f"/{file_name}")
|
||||
async with ClientSession() as session, session.put(url, headers=headers, data=file) as resp:
|
||||
|
||||
Reference in New Issue
Block a user