Skip to content

Commit 05b077a

Browse files
committed
Auto-fixes from ruff
1 parent 31089b1 commit 05b077a

File tree

13 files changed

+17
-15
lines changed

13 files changed

+17
-15
lines changed

CHANGELOG-V3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
These changes are part of `pycord-test/pycord`, and are candidates for the next major
44
release.
5+
**⚠️ This version removes support for Python 3.9. ⚠️**
56

67
### Added
78

@@ -12,3 +13,4 @@ release.
1213
### Deprecated
1314

1415
### Removed
16+
- **⚠️ Removed support for Python 3.9.**

discord/commands/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def __init__(self, input_type: InputType = str, /, description: str | None = Non
273273
minmax_typehint = Optional[int]
274274
elif self.input_type == SlashCommandOptionType.number:
275275
minmax_types = (int, float, type(None))
276-
minmax_typehint = Optional[Union[int, float]]
276+
minmax_typehint = Optional[int | float]
277277
else:
278278
minmax_types = (type(None),)
279279
minmax_typehint = type(None)

discord/ext/commands/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555

5656
T = TypeVar("T")
57-
BotT = TypeVar("BotT", bound="Union[Bot, AutoShardedBot]")
57+
BotT = TypeVar("BotT", bound="Bot | AutoShardedBot")
5858
CogT = TypeVar("CogT", bound="Cog")
5959

6060
if TYPE_CHECKING:

discord/guild.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
VocalGuildChannel = Union[VoiceChannel, StageChannel]
119119
GuildChannel = Union[VoiceChannel, StageChannel, TextChannel, ForumChannel, CategoryChannel]
120-
ByCategoryItem = Tuple[Optional[CategoryChannel], List[GuildChannel]]
120+
ByCategoryItem = Tuple[CategoryChannel | None, List[GuildChannel]]
121121

122122

123123
class BanEntry(NamedTuple):

discord/iterators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
T = TypeVar("T")
7575
OT = TypeVar("OT")
76-
_Func = Callable[[T], Union[OT, Awaitable[OT]]]
76+
_Func = Callable[[T], OT | Awaitable[OT]]
7777

7878
OLDEST_OBJECT = Object(id=0)
7979

discord/role.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ async def _move(self, position: int, reason: str | None) -> None:
427427
else:
428428
roles.append(self.id)
429429

430-
payload: list[RolePositionUpdate] = [{"id": z[0], "position": z[1]} for z in zip(roles, change_range)]
430+
payload: list[RolePositionUpdate] = [{"id": z[0], "position": z[1]} for z in zip(roles, change_range, strict=False)]
431431
await http.move_role_position(self.guild.id, payload, reason=reason)
432432

433433
async def edit(

discord/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,7 @@ async def _delay_ready(self) -> None:
19531953

19541954
guilds = sorted(processed, key=lambda g: g[0].shard_id)
19551955
for shard_id, info in itertools.groupby(guilds, key=lambda g: g[0].shard_id):
1956-
children, futures = zip(*info)
1956+
children, futures = zip(*info, strict=False)
19571957
# 110 reqs/minute w/ 1 req/guild plus some buffer
19581958
timeout = 61 * (len(children) / 110)
19591959
try:

discord/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,9 @@ def generate_snowflake(dt: datetime.datetime | None = None) -> int:
12801280

12811281
V = Union[Iterable[OptionChoice], Iterable[str], Iterable[int], Iterable[float]]
12821282
AV = Awaitable[V]
1283-
Values = Union[V, Callable[[AutocompleteContext], Union[V, AV]], AV]
1283+
Values = Union[V, Callable[[AutocompleteContext], V | AV], AV]
12841284
AutocompleteFunc = Callable[[AutocompleteContext], AV]
1285-
FilterFunc = Callable[[AutocompleteContext, Any], Union[bool, Awaitable[bool]]]
1285+
FilterFunc = Callable[[AutocompleteContext, Any], bool | Awaitable[bool]]
12861286

12871287

12881288
def basic_autocomplete(values: Values, *, filter: FilterFunc | None = None) -> AutocompleteFunc:

docs/extensions/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def write_genindex(self) -> None:
4040
if self.config.html_split_index:
4141
self.handle_page("genindex", genindexcontext, "genindex-split.html")
4242
self.handle_page("genindex-all", genindexcontext, "genindex.html")
43-
for (key, entries), count in zip(genindex, indexcounts):
43+
for (key, entries), count in zip(genindex, indexcounts, strict=False):
4444
ctx = {
4545
"key": key,
4646
"entries": entries,

examples/app_commands/slash_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def hello(
4141
)
4242
async def select_channel(
4343
ctx: discord.ApplicationContext,
44-
channel: Union[discord.TextChannel, discord.VoiceChannel],
44+
channel: discord.TextChannel | discord.VoiceChannel,
4545
):
4646
await ctx.respond(f"Hi! You selected {channel.mention} channel.")
4747

0 commit comments

Comments
 (0)