Broken PR build fix (#10556)

* Update run_ci.sh

* fix flake8 warning s3-lambda.py

1. Two blank lines before the function definition (E302).  
2. Four-space indentation (E111, E114).  
3. Spaces around operators (E225).  
4. Correct alignment for comments.
This commit is contained in:
Adam Djellouli 2025-03-26 21:19:33 -01:00 committed by GitHub
parent 4d5756fd2b
commit 51f7b8948f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 35 deletions

View File

@ -1,25 +1,25 @@
import boto3 import boto3
import json import json
def lambda_handler(event, context):
def lambda_handler(event, context):
# i want to know that event thing # i want to know that event thing
print(event) print(event)
# extract relevant information from the s3 event trigger # extract relevant information from the s3 event trigger
bucket_name=event['Records'][0]['s3']['bucket']['name'] bucket_name = event['Records'][0]['s3']['bucket']['name']
object_key=event['Records'][0]['s3']['object']['key'] object_key = event['Records'][0]['s3']['object']['key']
# perform desired operations with the upload file # perform desired operations with the uploaded file
print(f"File '{object_key}' was uploaded to bucket '{bucket_name}'") print(f"File '{object_key}' was uploaded to bucket '{bucket_name}'")
# example: send a notification via sns # example: send a notification via SNS
sns_client=boto3.client('sns') sns_client = boto3.client('sns')
topic_arn='arn:aws:sns:us-east-1:<account-id>:s3-lambda-sns' topic_arn = 'arn:aws:sns:us-east-1:<account-id>:s3-lambda-sns'
sns_client.publish( sns_client.publish(
TopicArn=topic_arn, TopicArn=topic_arn,
Subject='s3 object created !!', Subject='s3 object created !!',
Message=f"File '{object_key}' was uploaded to bucket '{bucket_name}" Message=f"File '{object_key}' was uploaded to bucket '{bucket_name}'"
) )
# Example: Trigger another Lambda function # Example: Trigger another Lambda function
@ -30,7 +30,7 @@ def lambda_handler(event, context):
# InvocationType='Event', # InvocationType='Event',
# Payload=json.dumps({'bucket_name': bucket_name, 'object_key': object_key}) # Payload=json.dumps({'bucket_name': bucket_name, 'object_key': object_key})
# ) # )
# in case of queuing and other objective similar to the netflix flow of triggering # in case of queuing and other objectives similar to the Netflix flow of triggering
return { return {
'statusCode': 200, 'statusCode': 200,

View File

@ -2,12 +2,16 @@
set -euo pipefail set -euo pipefail
PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/.." PROJECT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.."
MD_FILES=$(find ${PROJECT_DIR} -name "*.md" -not -path "${PROJECT_DIR}/tests/*") # Use the `-print0` option to handle spaces safely, and while-read loop:
find "${PROJECT_DIR}" \
for file in ${MD_FILES[@]}; do -name "*.md" \
python ${PROJECT_DIR}/tests/syntax_lint.py ${file} > /dev/null -not -path "${PROJECT_DIR}/tests/*" \
-print0 |
while IFS= read -r -d '' file
do
python "${PROJECT_DIR}/tests/syntax_lint.py" "${file}" > /dev/null
done done
echo "- Syntax lint tests on MD files passed successfully" echo "- Syntax lint tests on MD files passed successfully"