Skip to content

Commit 301c5ee

Browse files
author
AntonioMrtz
committed
style : run ruff lint and format all codebase
1 parent 5d7a05d commit 301c5ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+95
-136
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Commit type
66

7-
<!--
7+
<!--
88
99
!!CHECK ONE!!
1010
@@ -58,4 +58,3 @@
5858
<!-- Mention the team members assigned to review and merge this pull request. -->
5959

6060
@AntonioMrtz <!-- Default -->
61-

.github/workflows/backend-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ jobs:
5050
- name: Fail workflow on test failure
5151
if: ${{ failure() }}
5252
run: exit 1
53-

.github/workflows/generate-docs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ jobs:
5050
with:
5151
token: ${{ secrets.PAT }}
5252
branch: ${{ github.base_ref }}
53-

AWS-Lambda-API/lambda_function.py

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import json
22
import boto3
33
import os
4-
import io
54
import base64
65

7-
s3 = boto3.resource('s3')
8-
s3_client = boto3.client('s3')
9-
song_bucket = s3.Bucket('canciones-spotify-electron')
6+
s3 = boto3.resource("s3")
7+
s3_client = boto3.client("s3")
8+
song_bucket = s3.Bucket("canciones-spotify-electron")
109
bucket_base_path = "canciones/"
1110
distribution_id = os.getenv("DISTRIBUTION_ID")
1211

1312

1413
def get_cloudfront_url(resource_path: str):
15-
16-
cloudfront_client = boto3.client('cloudfront')
14+
cloudfront_client = boto3.client("cloudfront")
1715
response = cloudfront_client.get_distribution(Id=distribution_id)
18-
domain_name = response['Distribution']['DomainName']
16+
domain_name = response["Distribution"]["DomainName"]
1917

2018
# Construct the CloudFront URL
2119
cloudfront_url = f"https://{domain_name}/{bucket_base_path}{resource_path}.mp3"
@@ -24,59 +22,51 @@ def get_cloudfront_url(resource_path: str):
2422

2523

2624
def lambda_handler(event, context):
27-
2825
try:
29-
3026
method = event["httpMethod"]
3127
song_name = event["queryStringParameters"]["nombre"]
3228

33-
if (method == 'GET'):
29+
if method == "GET":
3430
return {
3531
"statusCode": 200,
36-
"body": json.dumps({"url": str(get_cloudfront_url(song_name))})
32+
"body": json.dumps({"url": str(get_cloudfront_url(song_name))}),
3733
}
3834

39-
elif (method == 'DELETE'):
35+
elif method == "DELETE":
4036
s3_client.delete_object(
41-
Bucket=song_bucket.name, Key=f"{bucket_base_path}{song_name}.mp3")
37+
Bucket=song_bucket.name, Key=f"{bucket_base_path}{song_name}.mp3"
38+
)
4239
return {
4340
"statusCode": 202,
44-
"body": json.dumps({"details": "Canción borrada correctamente"})
41+
"body": json.dumps({"details": "Canción borrada correctamente"}),
4542
}
4643

47-
elif (method == 'POST'):
48-
44+
elif method == "POST":
4945
song_key = f"{bucket_base_path}{song_name}.mp3"
5046

5147
try:
52-
5348
body_str = event["body"]
5449
body_dict = json.loads(body_str)
5550
song_data = body_dict.get("file")
5651
encoded_data = song_data.split("'")[1]
5752

5853
decoded_bytes = base64.b64decode(encoded_data)
5954

60-
s3_client.put_object(Body=decoded_bytes,
61-
Bucket=song_bucket.name, Key=song_key)
55+
s3_client.put_object(
56+
Body=decoded_bytes, Bucket=song_bucket.name, Key=song_key
57+
)
6258
return {
6359
"statusCode": 201,
64-
"body": json.dumps({"details": "Canción borrada correctamente"})
60+
"body": json.dumps({"details": "Canción borrada correctamente"}),
6561
}
6662

6763
except Exception as e:
68-
return {
69-
"statusCode": 500,
70-
"body": json.dumps({"details": str(e)})
71-
}
64+
return {"statusCode": 500, "body": json.dumps({"details": str(e)})}
7265

7366
return {
7467
"statusCode": 201,
75-
"body": json.dumps({"details": "Canción creada correctamente"})
68+
"body": json.dumps({"details": "Canción creada correctamente"}),
7669
}
7770

7871
except Exception as e:
79-
return {
80-
"statusCode": 500,
81-
"body": json.dumps({"error": str(e)})
82-
}
72+
return {"statusCode": 500, "body": json.dumps({"error": str(e)})}

Backend/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ LAMBDA_URL=https://lambda-url.us-east-1.on.aws/path/
44
# PROD,TEST
55
ENV_VALUE=PROD
66
# STREAMING_LAMBDA,STREAMING_SDK,DB_BLOB
7-
ARCH=STREAMING_LAMBDA
7+
ARCH=STREAMING_LAMBDA

Backend/api-docs-spotify-electron.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@
2323
</script>
2424
</body>
2525
</html>
26-

Backend/app/model/SongBlob.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
@dataclass
99
class SongBlob(SpotifyElectronModel):
10-
1110
name: str
1211
artist: str
1312
photo: str

Backend/app/resources/config.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ port=8000
88
log_file =
99
; DEBUG,INFO
1010
log_level = INFO
11-

Backend/app/routers/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
@router.post("/", tags=["login"])
2020
def login_usuario(
21-
form_data: Annotated[OAuth2PasswordRequestForm, Depends()]
21+
form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
2222
) -> Response:
2323
"""Devuelve la playlist con nombre "nombre"
2424

Backend/app/routers/usuarios.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
from typing import Annotated, List, Union
32

43
import app.services.all_users_service as all_users_service

0 commit comments

Comments
 (0)