Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions webhook_server_container/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from typing import Any, Dict
import os
import sys
from typing import Any, Dict
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Type annotation should use lowercase types for consistency.

The type annotation still uses Dict instead of the lowercase dict. According to the PR summary, one of the goals is to modernize type annotations by replacing capitalized types with their lowercase equivalents.

-from typing import Any, Dict
+from typing import Any
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from typing import Any, Dict
from typing import Any


from fastapi import Request
import requests
import urllib3

from fastapi import FastAPI
from fastapi import FastAPI, Request

from webhook_server_container.libs.github_api import ProcessGithubWehook
from webhook_server_container.utils.helpers import get_logger_with_params
Expand Down Expand Up @@ -46,12 +44,13 @@ async def process_webhook(request: Request) -> Dict[str, Any]:

except Exception as exp:
logger.error(f"Error: {exp}")
exc_type, exc_obj, exc_tb = sys.exc_info() # noqa: F841
exc_type, _, exc_tb = sys.exc_info() # noqa: F841
msg = f"Error: {exc_type}"

if exc_tb is not None:
file_name = os.path.split(exc_tb.tb_frame.f_code.co_filename)
msg = f"Error: {exc_type}, File: {file_name}, Line: {exc_tb.tb_lineno}"
logger.error(msg)

return {
"status": requests.codes.server_error,
Expand Down
Loading