Skip to content

Commit

Permalink
Forgotten pre-commit fixes from version updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrxyz committed Sep 8, 2024
1 parent b1a0b04 commit d447283
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def from_ical_event(cls, event: icalendar.Event, team: Team):
title=title,
start=event.get("dtstart").dt,
end=event.get("dtend").dt,
location=event.get("location").to_ical().decode("utf-8")
if event.get("location")
else "",
location=(
event.get("location").to_ical().decode("utf-8")
if event.get("location")
else ""
),
type=type,
team=team,
)
Expand Down
9 changes: 3 additions & 6 deletions src/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@


@overload
def ensure_string(name: str, optional: Literal[False] = False) -> str:
...
def ensure_string(name: str, optional: Literal[False] = False) -> str: ...


@overload
def ensure_string(name: str, optional: Literal[True] = True) -> str | None:
...
def ensure_string(name: str, optional: Literal[True] = True) -> str | None: ...


@overload
def ensure_string(name: str, optional: bool) -> str | None:
...
def ensure_string(name: str, optional: bool) -> str | None: ...


def ensure_string(name: str, optional: bool = False) -> str | None:
Expand Down
10 changes: 6 additions & 4 deletions src/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def on_submit(self, interaction: discord.Interaction):
)
if e.status == 422:
await interaction.response.send_message(
"Validaton failed, the user might already be in the organization.",
"Validation failed, the user might already be in the organization.",
ephemeral=True,
)
return
Expand Down Expand Up @@ -754,9 +754,11 @@ def get_issue_or_pull(self, issue: Issue):
)
res.add_field(
name="Milestone",
value=f"[`{issue['milestone']['title']}`]({issue['milestone']['html_url']})"
if issue["milestone"]
else "None",
value=(
f"[`{issue['milestone']['title']}`]({issue['milestone']['html_url']})"
if issue["milestone"]
else "None"
),
inline=True,
)
return res
Expand Down
1 change: 1 addition & 0 deletions src/leaders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provides functionality related to leadership of MIL.
"""

from __future__ import annotations

import asyncio
Expand Down
4 changes: 1 addition & 3 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ def capped_str(parts: list[str], cap: int = 1024) -> str:
If the parts are capped, "_... (X after)_" is appended to the end.
"""
result = ""
made_it = 0
for part in parts:
for made_it, part in enumerate(parts):
if len(result) + len(part) + len("\n_... (99 after)_") > cap:
result += f"_... ({len(parts) - made_it} after)_"
break
result += part + "\n"
made_it += 1
return result.strip()


Expand Down
1 change: 1 addition & 0 deletions src/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ async def projects_v2_created(self, payload: ClientPayload):
# [User A](link) created a project [project_name](link)
name = f"[{await self.real_name(gh['sender']['login'])}]({self.url(gh['sender'], html=True)})"
url = f"https://github.com/orgs/{gh['projects_v2']['owner']['login']}/projects/{gh['projects_v2']['number']}"

# All projects_v2_created webhooks have the project title listed as
# @user's untitled project, so we should wait a little bit of time
# and then fetch the title later
Expand Down

0 comments on commit d447283

Please sign in to comment.