diff --git a/src/reporter/app.py b/src/reporter/app.py index 89e00bf..6455ab8 100644 --- a/src/reporter/app.py +++ b/src/reporter/app.py @@ -15,9 +15,5 @@ async def echo(http_client: HTTPClientDependency) -> str: @app.post("/report/{project_name}") -async def report_endpoint( - project_name: str, observation: Observation, http_client: HTTPClientDependency -): - await send_observation( - project_name=project_name, observation=observation, http_client=http_client - ) +async def report_endpoint(project_name: str, observation: Observation, http_client: HTTPClientDependency): + await send_observation(project_name=project_name, observation=observation, http_client=http_client) diff --git a/src/reporter/http_client.py b/src/reporter/http_client.py index 591dd45..5e2d118 100644 --- a/src/reporter/http_client.py +++ b/src/reporter/http_client.py @@ -12,9 +12,7 @@ class BearerAuthentication(httpx.Auth): def __init__(self, *, token: str) -> None: self.token = token - def auth_flow( - self, request: httpx.Request - ) -> Generator[httpx.Request, httpx.Response, None]: + def auth_flow(self, request: httpx.Request) -> Generator[httpx.Request, httpx.Response, None]: request.headers["Authorization"] = f"Bearer {self.token}" yield request diff --git a/src/reporter/mailer.py b/src/reporter/mailer.py index b716eca..41cc76c 100644 --- a/src/reporter/mailer.py +++ b/src/reporter/mailer.py @@ -30,15 +30,9 @@ async def send_mail( reply_to_recipient = Recipient(email_address=EmailAddress(address=Mail.reply_to)) from_recipient = Recipient(email_address=EmailAddress(address=Mail.sender)) - to_recipients = [ - Recipient(email_address=EmailAddress(address=to_address)) - for to_address in to_addresses - ] - - bcc_recipients = [ - Recipient(email_address=EmailAddress(address=bcc_address)) - for bcc_address in bcc_addresses - ] + to_recipients = [Recipient(email_address=EmailAddress(address=to_address)) for to_address in to_addresses] + + bcc_recipients = [Recipient(email_address=EmailAddress(address=bcc_address)) for bcc_address in bcc_addresses] email_body = ItemBody(content=content, content_type=BodyType.Html) diff --git a/src/reporter/models.py b/src/reporter/models.py index 74604f1..52fff0b 100644 --- a/src/reporter/models.py +++ b/src/reporter/models.py @@ -24,8 +24,6 @@ class Observation(BaseModel): @model_validator(mode="after") def model_validator(self: Observation) -> Observation: if self.kind == ObservationKind.Malware: - assert ( - self.inspector_url is not None - ), "inspector_url is required when kind is malware" + assert self.inspector_url is not None, "inspector_url is required when kind is malware" return self diff --git a/src/reporter/observations.py b/src/reporter/observations.py index 42a18a8..517129b 100644 --- a/src/reporter/observations.py +++ b/src/reporter/observations.py @@ -6,9 +6,7 @@ from reporter.models import Observation -async def send_observation( - project_name: str, observation: Observation, *, http_client: httpx.AsyncClient -): +async def send_observation(project_name: str, observation: Observation, *, http_client: httpx.AsyncClient): path = f"/danger-api/projects/{project_name}/observations" json = jsonable_encoder(observation)