Skip to content

Commit

Permalink
misc: Run ruff format.
Browse files Browse the repository at this point in the history
  • Loading branch information
elenakrittik committed Mar 29, 2024
1 parent c2f9e2c commit fe1372d
Show file tree
Hide file tree
Showing 62 changed files with 410 additions and 669 deletions.
33 changes: 11 additions & 22 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ class GuildChannel(ABC):

def __init__(
self, *, state: ConnectionState, guild: Guild, data: Mapping[str, Any]
) -> None:
...
) -> None: ...

def __str__(self) -> str:
return self.name
Expand Down Expand Up @@ -838,8 +837,7 @@ async def set_permissions(
*,
overwrite: Optional[PermissionOverwrite] = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
@_overload_with_permissions
Expand Down Expand Up @@ -904,8 +902,7 @@ async def set_permissions(
view_channel: Optional[bool] = ...,
view_creator_monetization_analytics: Optional[bool] = ...,
view_guild_insights: Optional[bool] = ...,
) -> None:
...
) -> None: ...

async def set_permissions(
self,
Expand Down Expand Up @@ -1111,8 +1108,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1123,8 +1119,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1135,8 +1130,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
async def move(
Expand All @@ -1147,8 +1141,7 @@ async def move(
category: Optional[Snowflake] = ...,
sync_permissions: bool = ...,
reason: Optional[str] = ...,
) -> None:
...
) -> None: ...

async def move(self, **kwargs: Any) -> None:
"""|coro|
Expand Down Expand Up @@ -1434,8 +1427,7 @@ async def send(
mention_author: bool = ...,
view: View = ...,
components: Components[MessageUIComponent] = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1455,8 +1447,7 @@ async def send(
mention_author: bool = ...,
view: View = ...,
components: Components[MessageUIComponent] = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1476,8 +1467,7 @@ async def send(
mention_author: bool = ...,
view: View = ...,
components: Components[MessageUIComponent] = ...,
) -> Message:
...
) -> Message: ...

@overload
async def send(
Expand All @@ -1497,8 +1487,7 @@ async def send(
mention_author: bool = ...,
view: View = ...,
components: Components[MessageUIComponent] = ...,
) -> Message:
...
) -> Message: ...

async def send(
self,
Expand Down
6 changes: 2 additions & 4 deletions disnake/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,11 @@ def __repr__(self) -> str:
@overload
def create_activity(
data: Union[ActivityPayload, WidgetActivityPayload], *, state: Optional[ConnectionState] = None
) -> ActivityTypes:
...
) -> ActivityTypes: ...


@overload
def create_activity(data: None, *, state: Optional[ConnectionState] = None) -> None:
...
def create_activity(data: None, *, state: Optional[ConnectionState] = None) -> None: ...


def create_activity(
Expand Down
12 changes: 6 additions & 6 deletions disnake/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _transform(entry: AuditLogEntry, data: Optional[int]) -> Optional[FlagsT]:


def _list_transformer(
func: Callable[[AuditLogEntry, Any], T]
func: Callable[[AuditLogEntry, Any], T],
) -> Callable[[AuditLogEntry, Any], List[T]]:
def _transform(entry: AuditLogEntry, data: Any) -> List[T]:
if not data:
Expand Down Expand Up @@ -302,11 +302,9 @@ def __repr__(self) -> str:

if TYPE_CHECKING:

def __getattr__(self, item: str) -> Any:
...
def __getattr__(self, item: str) -> Any: ...

def __setattr__(self, key: str, value: Any) -> Any:
...
def __setattr__(self, key: str, value: Any) -> Any: ...


Transformer = Callable[["AuditLogEntry", Any], Any]
Expand Down Expand Up @@ -807,7 +805,9 @@ def _convert_target_invite(self, target_id: int) -> Invite:
"uses": changeset.uses,
}

obj = Invite(state=self._state, data=fake_payload, guild=self.guild, channel=changeset.channel) # type: ignore
obj = Invite(
state=self._state, data=fake_payload, guild=self.guild, channel=changeset.channel

Check failure on line 809 in disnake/audit_logs.py

View workflow job for this annotation

GitHub Actions / pyright (3.8, false)

Argument of type "dict[str, Any]" cannot be assigned to parameter "data" of type "GatewayInvitePayload | Invite" in function "__init__"   Type "dict[str, Any]" cannot be assigned to type "GatewayInvitePayload | Invite"     "dict[str, Any]" is incompatible with "Invite"     "dict[str, Any]" is incompatible with "InviteCreateEvent"     "dict[str, Any]" is incompatible with "InviteDeleteEvent" (reportGeneralTypeIssues)
) # type: ignore

Check failure on line 810 in disnake/audit_logs.py

View workflow job for this annotation

GitHub Actions / pyright (3.8, false)

Unnecessary "# type: ignore" comment
try:
obj.inviter = changeset.inviter
except AttributeError:
Expand Down
12 changes: 4 additions & 8 deletions disnake/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ def __init__(
keyword_filter: Optional[Sequence[str]],
regex_patterns: Optional[Sequence[str]] = None,
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
Expand All @@ -306,23 +305,20 @@ def __init__(
keyword_filter: Optional[Sequence[str]] = None,
regex_patterns: Optional[Sequence[str]],
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
self,
*,
presets: AutoModKeywordPresets,
allow_list: Optional[Sequence[str]] = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
self, *, mention_total_limit: int, mention_raid_protection_enabled: bool = False
) -> None:
...
) -> None: ...

def __init__(
self,
Expand Down
9 changes: 3 additions & 6 deletions disnake/backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,13 @@ def __init__(self, base: int = 1, *, integral: T = False) -> None:
)

@overload
def delay(self: ExponentialBackoff[Literal[False]]) -> float:
...
def delay(self: ExponentialBackoff[Literal[False]]) -> float: ...

@overload
def delay(self: ExponentialBackoff[Literal[True]]) -> int:
...
def delay(self: ExponentialBackoff[Literal[True]]) -> int: ...

@overload
def delay(self: ExponentialBackoff[bool]) -> Union[int, float]:
...
def delay(self: ExponentialBackoff[bool]) -> Union[int, float]: ...

def delay(self) -> Union[int, float]:
"""Compute the next delay
Expand Down
Loading

0 comments on commit fe1372d

Please sign in to comment.