Skip to content

Commit

Permalink
lint: Fix flake8 linting
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRA009 committed Nov 13, 2024
1 parent 99ea0f3 commit 4a5b80e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion admin/recording_uploader/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def main(region_name: str = "us-east-1", destroy: bool = False) -> None:
logger.info("Lambda function deleted successfully.")
else:
stdout = ret.stdout.decode("utf-8") if ret.stdout else ""
# find the url, which is in the format https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/upload/
# find the url, which is in the format
# https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/upload/
url_match = re.search(
r"https://([^\.]+)\.execute-api\.([^\.]+)\.amazonaws\.com/Prod/upload/",
stdout,
Expand Down
3 changes: 1 addition & 2 deletions admin/recording_uploader/uploader/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Lambda function for generating a presigned URL for uploading a recording to S3."""

from typing import Any
from uuid import uuid4
import json

from botocore.client import Config
Expand Down Expand Up @@ -70,7 +69,7 @@ def get_presigned_url(data: dict) -> dict:


def delete_object(data: dict) -> dict:
"""Delete an object from the s3 bucket
"""Delete an object from the s3 bucket.
Args:
data (dict): The data from the request.
Expand Down
2 changes: 1 addition & 1 deletion openadapt/app/dashboard/api/recordings.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def view_recording_on_cloud(recording_id: int) -> Response:

@staticmethod
def delete_recording_on_cloud(recording_id: int) -> dict[str, bool]:
"""Delete a recording from cloud"""
"""Delete a recording from cloud."""
session = crud.get_new_session(read_only=True)
recording = crud.get_recording_by_id(session, recording_id)
if recording.upload_status == Recording.UploadStatus.NOT_UPLOADED:
Expand Down
2 changes: 2 additions & 0 deletions openadapt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class Recording(db.Base):
)

class UploadStatus(enum.Enum):
"""Enum representing the upload status of a recording."""

NOT_UPLOADED = "not_uploaded"
UPLOADING = "uploading"
UPLOADED = "uploaded"
Expand Down
5 changes: 4 additions & 1 deletion openadapt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,10 @@ def get_recording_url(uploaded_key: str, uploaded_to_custom_bucket: bool) -> str
def delete_uploaded_recording(
recording_id: int, uploaded_key: str, uploaded_to_custom_bucket: bool
) -> str:
def inner():
"""Delete a recording from cloud."""

def inner() -> None:
"""Delete a recording from cloud."""
if uploaded_to_custom_bucket:
s3 = boto3.client(
"s3",
Expand Down

0 comments on commit 4a5b80e

Please sign in to comment.