Skip to content

Commit 40a41b7

Browse files
style: run autofix
1 parent a0e1c9c commit 40a41b7

File tree

150 files changed

+1579
-1755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+1579
-1755
lines changed

disnake/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import platform
66
import sys
77
from pathlib import Path
8-
from typing import List, Tuple, Union
8+
from typing import Union
99

1010
import aiohttp
1111

1212
import disnake
1313

1414

1515
def show_version() -> None:
16-
entries: List[str] = []
16+
entries: list[str] = []
1717

1818
sys_ver = sys.version_info
1919
entries.append(
@@ -399,7 +399,7 @@ def add_newcog_args(subparser) -> None:
399399
parser.add_argument("--full", help="add all special methods as well", action="store_true")
400400

401401

402-
def parse_args() -> Tuple[argparse.ArgumentParser, argparse.Namespace]:
402+
def parse_args() -> tuple[argparse.ArgumentParser, argparse.Namespace]:
403403
parser = argparse.ArgumentParser(prog="disnake", description="Tools for helping with disnake")
404404
parser.add_argument("-v", "--version", action="store_true", help="shows the library version")
405405
parser.set_defaults(func=core)

disnake/abc.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
import asyncio
66
import copy
77
from abc import ABC
8+
from collections.abc import Mapping, Sequence
89
from typing import (
910
TYPE_CHECKING,
1011
Any,
1112
Callable,
12-
Dict,
13-
List,
14-
Mapping,
1513
Optional,
1614
Protocol,
17-
Sequence,
18-
Tuple,
1915
TypeVar,
2016
Union,
2117
cast,
@@ -264,7 +260,7 @@ class GuildChannel(ABC):
264260
category_id: Optional[int]
265261
_flags: int
266262
_state: ConnectionState
267-
_overwrites: List[_Overwrites]
263+
_overwrites: list[_Overwrites]
268264

269265
if TYPE_CHECKING:
270266

@@ -279,7 +275,7 @@ def __str__(self) -> str:
279275
def _sorting_bucket(self) -> int:
280276
raise NotImplementedError
281277

282-
def _update(self, guild: Guild, data: Dict[str, Any]) -> None:
278+
def _update(self, guild: Guild, data: dict[str, Any]) -> None:
283279
raise NotImplementedError
284280

285281
async def _move(
@@ -296,7 +292,7 @@ async def _move(
296292
http = self._state.http
297293
bucket = self._sorting_bucket
298294
channels = [c for c in self.guild.channels if c._sorting_bucket == bucket]
299-
channels = cast("List[GuildChannel]", channels)
295+
channels = cast("list[GuildChannel]", channels)
300296

301297
channels.sort(key=lambda c: c.position)
302298

@@ -313,7 +309,7 @@ async def _move(
313309
# add ourselves at our designated position
314310
channels.insert(index, self)
315311

316-
payload: List[ChannelPositionUpdatePayload] = []
312+
payload: list[ChannelPositionUpdatePayload] = []
317313
for index, c in enumerate(channels):
318314
d: ChannelPositionUpdatePayload = {"id": c.id, "position": index}
319315
if parent_id is not MISSING and c.id == self.id:
@@ -379,7 +375,7 @@ async def _edit(
379375

380376
lock_permissions: bool = bool(sync_permissions)
381377

382-
overwrites_payload: List[PermissionOverwritePayload] = MISSING
378+
overwrites_payload: list[PermissionOverwritePayload] = MISSING
383379

384380
if position is not MISSING:
385381
await self._move(
@@ -428,7 +424,7 @@ async def _edit(
428424
else:
429425
flags_payload = MISSING
430426

431-
available_tags_payload: List[PartialForumTagPayload] = MISSING
427+
available_tags_payload: list[PartialForumTagPayload] = MISSING
432428
if available_tags is not MISSING:
433429
available_tags_payload = [tag.to_dict() for tag in available_tags]
434430

@@ -453,7 +449,7 @@ async def _edit(
453449
if default_layout is not MISSING:
454450
default_layout_payload = try_enum_to_int(default_layout)
455451

456-
options: Dict[str, Any] = {
452+
options: dict[str, Any] = {
457453
"name": name,
458454
"parent_id": parent_id,
459455
"topic": topic,
@@ -505,11 +501,11 @@ def _fill_overwrites(self, data: GuildChannelPayload) -> None:
505501
tmp[everyone_index], tmp[0] = tmp[0], tmp[everyone_index]
506502

507503
@property
508-
def changed_roles(self) -> List[Role]:
504+
def changed_roles(self) -> list[Role]:
509505
"""List[:class:`.Role`]: Returns a list of roles that have been overridden from
510506
their default values in the :attr:`.Guild.roles` attribute.
511507
"""
512-
ret: List[Role] = []
508+
ret: list[Role] = []
513509
g = self.guild
514510
for overwrite in filter(lambda o: o.is_role(), self._overwrites):
515511
role = g.get_role(overwrite.id)
@@ -562,7 +558,7 @@ def overwrites_for(self, obj: Union[Role, User]) -> PermissionOverwrite:
562558
return PermissionOverwrite()
563559

564560
@property
565-
def overwrites(self) -> Dict[Union[Role, Member], PermissionOverwrite]:
561+
def overwrites(self) -> dict[Union[Role, Member], PermissionOverwrite]:
566562
"""Returns all of the channel's overwrites.
567563
568564
This is returned as a dictionary where the key contains the target which
@@ -1035,7 +1031,7 @@ async def set_permissions(
10351031

10361032
async def _clone_impl(
10371033
self,
1038-
base_attrs: Dict[str, Any],
1034+
base_attrs: dict[str, Any],
10391035
*,
10401036
name: Optional[str] = None,
10411037
category: Optional[Snowflake] = MISSING,
@@ -1044,7 +1040,7 @@ async def _clone_impl(
10441040
) -> Self:
10451041
# if the overwrites are MISSING, defaults to the
10461042
# original permissions of the channel
1047-
overwrites_payload: List[PermissionOverwritePayload]
1043+
overwrites_payload: list[PermissionOverwritePayload]
10481044
if overwrites is not MISSING:
10491045
if not isinstance(overwrites, dict):
10501046
raise TypeError("overwrites parameter expects a dict.")
@@ -1250,7 +1246,7 @@ async def move(self, **kwargs: Any) -> None:
12501246
]
12511247

12521248
channels.sort(key=lambda c: (c.position, c.id))
1253-
channels = cast("List[GuildChannel]", channels)
1249+
channels = cast("list[GuildChannel]", channels)
12541250

12551251
try:
12561252
# Try to remove ourselves from the channel list
@@ -1273,7 +1269,7 @@ async def move(self, **kwargs: Any) -> None:
12731269
raise ValueError("Could not resolve appropriate move position")
12741270

12751271
channels.insert(max((index + offset), 0), self)
1276-
payload: List[ChannelPositionUpdatePayload] = []
1272+
payload: list[ChannelPositionUpdatePayload] = []
12771273
lock_permissions = kwargs.get("sync_permissions", False)
12781274
reason = kwargs.get("reason")
12791275
for index, channel in enumerate(channels):
@@ -1379,7 +1375,7 @@ async def create_invite(
13791375
invite.guild_scheduled_event = guild_scheduled_event
13801376
return invite
13811377

1382-
async def invites(self) -> List[Invite]:
1378+
async def invites(self) -> list[Invite]:
13831379
"""|coro|
13841380
13851381
Returns a list of all active instant invites from this channel.
@@ -1455,7 +1451,7 @@ async def send(
14551451
*,
14561452
tts: bool = ...,
14571453
embed: Embed = ...,
1458-
files: List[File] = ...,
1454+
files: list[File] = ...,
14591455
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
14601456
delete_after: float = ...,
14611457
nonce: Union[str, int] = ...,
@@ -1475,7 +1471,7 @@ async def send(
14751471
content: Optional[str] = ...,
14761472
*,
14771473
tts: bool = ...,
1478-
embeds: List[Embed] = ...,
1474+
embeds: list[Embed] = ...,
14791475
file: File = ...,
14801476
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
14811477
delete_after: float = ...,
@@ -1496,8 +1492,8 @@ async def send(
14961492
content: Optional[str] = ...,
14971493
*,
14981494
tts: bool = ...,
1499-
embeds: List[Embed] = ...,
1500-
files: List[File] = ...,
1495+
embeds: list[Embed] = ...,
1496+
files: list[File] = ...,
15011497
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
15021498
delete_after: float = ...,
15031499
nonce: Union[str, int] = ...,
@@ -1517,9 +1513,9 @@ async def send(
15171513
*,
15181514
tts: bool = False,
15191515
embed: Optional[Embed] = None,
1520-
embeds: Optional[List[Embed]] = None,
1516+
embeds: Optional[list[Embed]] = None,
15211517
file: Optional[File] = None,
1522-
files: Optional[List[File]] = None,
1518+
files: Optional[list[File]] = None,
15231519
stickers: Optional[Sequence[Union[GuildSticker, StandardSticker, StickerItem]]] = None,
15241520
delete_after: Optional[float] = None,
15251521
nonce: Optional[Union[str, int]] = None,
@@ -2015,10 +2011,10 @@ class Connectable(Protocol):
20152011
guild: Guild
20162012
id: int
20172013

2018-
def _get_voice_client_key(self) -> Tuple[int, str]:
2014+
def _get_voice_client_key(self) -> tuple[int, str]:
20192015
raise NotImplementedError
20202016

2021-
def _get_voice_state_pair(self) -> Tuple[int, int]:
2017+
def _get_voice_state_pair(self) -> tuple[int, int]:
20222018
raise NotImplementedError
20232019

20242020
async def connect(

disnake/activity.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import datetime
6-
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union, overload
6+
from typing import TYPE_CHECKING, Any, Literal, Optional, Union, overload
77

88
from .asset import Asset
99
from .colour import Colour
@@ -339,7 +339,7 @@ def __init__(
339339
party: Optional[ActivityParty] = None,
340340
application_id: Optional[Union[str, int]] = None,
341341
flags: Optional[int] = None,
342-
buttons: Optional[List[str]] = None,
342+
buttons: Optional[list[str]] = None,
343343
emoji: Optional[Union[PartialEmojiPayload, ActivityEmojiPayload]] = None,
344344
id: Optional[str] = None,
345345
platform: Optional[str] = None,
@@ -360,7 +360,7 @@ def __init__(
360360
self.name: Optional[str] = name
361361
self.url: Optional[str] = url
362362
self.flags: int = flags or 0
363-
self.buttons: List[str] = buttons or []
363+
self.buttons: list[str] = buttons or []
364364

365365
# undocumented fields:
366366
self.id: Optional[str] = id
@@ -398,8 +398,8 @@ def __repr__(self) -> str:
398398
inner = " ".join(f"{k!s}={v!r}" for k, v in attrs)
399399
return f"<Activity {inner}>"
400400

401-
def to_dict(self) -> Dict[str, Any]:
402-
ret: Dict[str, Any] = {}
401+
def to_dict(self) -> dict[str, Any]:
402+
ret: dict[str, Any] = {}
403403
for attr in self.__slots__:
404404
value = getattr(self, attr, None)
405405
if value is None:
@@ -608,8 +608,8 @@ def twitch_name(self) -> Optional[str]:
608608
name = self.assets["large_image"]
609609
return name[7:] if name[:7] == "twitch:" else None
610610

611-
def to_dict(self) -> Dict[str, Any]:
612-
ret: Dict[str, Any] = {
611+
def to_dict(self) -> dict[str, Any]:
612+
ret: dict[str, Any] = {
613613
"type": ActivityType.streaming.value,
614614
"name": str(self.name),
615615
"url": str(self.url),
@@ -700,7 +700,7 @@ def color(self) -> Colour:
700700
"""
701701
return self.colour
702702

703-
def to_dict(self) -> Dict[str, Any]:
703+
def to_dict(self) -> dict[str, Any]:
704704
return {
705705
"flags": 48, # SYNC | PLAY
706706
"name": "Spotify",
@@ -744,7 +744,7 @@ def title(self) -> str:
744744
return self._details
745745

746746
@property
747-
def artists(self) -> List[str]:
747+
def artists(self) -> list[str]:
748748
"""List[:class:`str`]: The artists of the song being played."""
749749
return self._state.split("; ")
750750

0 commit comments

Comments
 (0)