Skip to content

Commit

Permalink
Run pre commit over entire repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin5605 committed Mar 4, 2024
1 parent d8d74bb commit 920633c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
8 changes: 2 additions & 6 deletions src/reporter/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 1 addition & 3 deletions src/reporter/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 3 additions & 9 deletions src/reporter/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 1 addition & 3 deletions src/reporter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions src/reporter/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 920633c

Please sign in to comment.